mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-15 09:30:20 +00:00
#642: M1677940 M1698503 M1699835 (modified)
This commit is contained in:
parent
36ee9cc9c8
commit
4f70dd5c95
@ -4030,29 +4030,41 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
||||
|
||||
gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
||||
{
|
||||
// use lazy initilization for the font group since it's rather expensive
|
||||
if (!CurrentState().fontGroup) {
|
||||
// Use lazy (re)initialization for the fontGroup since it's rather expensive.
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
gfxTextPerfMetrics* tp = nullptr;
|
||||
if (presShell && !presShell->IsDestroying()) {
|
||||
tp = presShell->GetPresContext()->GetTextPerfMetrics();
|
||||
}
|
||||
|
||||
// If we have a cached fontGroup, check that it is valid for the current
|
||||
// prescontext; if not, we need to discard and re-create it.
|
||||
RefPtr<gfxFontGroup>& fontGroup = CurrentState().fontGroup;
|
||||
if (fontGroup && fontGroup->GetTextPerfMetrics() != tp)
|
||||
fontGroup = nullptr;
|
||||
|
||||
if (!fontGroup) {
|
||||
ErrorResult err;
|
||||
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
||||
static float kDefaultFontSize = 10.0;
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
|
||||
// If the font has already been set, we're re-creating the fontGroup
|
||||
// and should re-use the existing font attribute; if not, we initialize
|
||||
// it to the canvas default.
|
||||
const nsString& currentFont = CurrentState().font;
|
||||
bool fontUpdated = SetFontInternal(
|
||||
currentFont.IsEmpty() ? kDefaultFontStyle : currentFont, err);
|
||||
if (err.Failed() || !fontUpdated) {
|
||||
err.SuppressException();
|
||||
gfxFontStyle style;
|
||||
style.size = kDefaultFontSize;
|
||||
gfxTextPerfMetrics* tp = nullptr;
|
||||
if (presShell && !presShell->IsDestroying()) {
|
||||
tp = presShell->GetPresContext()->GetTextPerfMetrics();
|
||||
}
|
||||
int32_t perDevPixel, perCSSPixel;
|
||||
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
||||
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
||||
CurrentState().fontGroup =
|
||||
gfxPlatform::GetPlatform()->CreateFontGroup(FontFamilyList(eFamily_sans_serif),
|
||||
fontGroup = gfxPlatform::GetPlatform()->CreateFontGroup(FontFamilyList(eFamily_sans_serif),
|
||||
&style, tp,
|
||||
nullptr, devToCssSize);
|
||||
if (CurrentState().fontGroup) {
|
||||
if (fontGroup) {
|
||||
CurrentState().font = kDefaultFontStyle;
|
||||
} else {
|
||||
NS_ERROR("Default canvas font is invalid");
|
||||
@ -4060,7 +4072,7 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
||||
}
|
||||
}
|
||||
|
||||
return CurrentState().fontGroup;
|
||||
return fontGroup;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -113,6 +113,7 @@ int16_t gBadPortList[] = {
|
||||
42, // name
|
||||
43, // nicname
|
||||
53, // domain
|
||||
69, // tftp
|
||||
77, // priv-rjs
|
||||
79, // finger
|
||||
87, // ttylink
|
||||
@ -130,8 +131,10 @@ int16_t gBadPortList[] = {
|
||||
119, // nntp
|
||||
123, // ntp
|
||||
135, // loc-srv / epmap
|
||||
137, // netbios
|
||||
139, // netbios
|
||||
143, // imap2
|
||||
161, // snmp
|
||||
179, // bgp
|
||||
389, // ldap
|
||||
427, // afp (alternate)
|
||||
@ -154,6 +157,7 @@ int16_t gBadPortList[] = {
|
||||
636, // ldap+ssl
|
||||
993, // imap+ssl
|
||||
995, // pop3+ssl
|
||||
1719, // h323gatestat
|
||||
1720, // h323hostcall
|
||||
1723, // pptp
|
||||
2049, // nfs
|
||||
@ -162,12 +166,14 @@ int16_t gBadPortList[] = {
|
||||
5060, // sip
|
||||
5061, // sips
|
||||
6000, // x11
|
||||
6566, // sane-port
|
||||
6665, // irc (alternate)
|
||||
6666, // irc (alternate)
|
||||
6667, // irc (default)
|
||||
6668, // irc (alternate)
|
||||
6669, // irc (alternate)
|
||||
6697, // irc+tls
|
||||
10080, // amanda
|
||||
0, // Sentinel value: This MUST be zero
|
||||
};
|
||||
|
||||
@ -1182,7 +1188,7 @@ nsIOService::AllowPort(int32_t inPort, const char *scheme, bool *_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (port == 0) {
|
||||
if (port <= 0 || port >= std::numeric_limits<uint16_t>::max()) {
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user