#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()
|
gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
|
||||||
{
|
{
|
||||||
// use lazy initilization for the font group since it's rather expensive
|
// Use lazy (re)initialization for the fontGroup since it's rather expensive.
|
||||||
if (!CurrentState().fontGroup) {
|
|
||||||
|
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;
|
ErrorResult err;
|
||||||
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
||||||
static float kDefaultFontSize = 10.0;
|
static float kDefaultFontSize = 10.0;
|
||||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
// If the font has already been set, we're re-creating the fontGroup
|
||||||
bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
|
// 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) {
|
if (err.Failed() || !fontUpdated) {
|
||||||
err.SuppressException();
|
err.SuppressException();
|
||||||
gfxFontStyle style;
|
gfxFontStyle style;
|
||||||
style.size = kDefaultFontSize;
|
style.size = kDefaultFontSize;
|
||||||
gfxTextPerfMetrics* tp = nullptr;
|
|
||||||
if (presShell && !presShell->IsDestroying()) {
|
|
||||||
tp = presShell->GetPresContext()->GetTextPerfMetrics();
|
|
||||||
}
|
|
||||||
int32_t perDevPixel, perCSSPixel;
|
int32_t perDevPixel, perCSSPixel;
|
||||||
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
||||||
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
||||||
CurrentState().fontGroup =
|
fontGroup = gfxPlatform::GetPlatform()->CreateFontGroup(FontFamilyList(eFamily_sans_serif),
|
||||||
gfxPlatform::GetPlatform()->CreateFontGroup(FontFamilyList(eFamily_sans_serif),
|
|
||||||
&style, tp,
|
&style, tp,
|
||||||
nullptr, devToCssSize);
|
nullptr, devToCssSize);
|
||||||
if (CurrentState().fontGroup) {
|
if (fontGroup) {
|
||||||
CurrentState().font = kDefaultFontStyle;
|
CurrentState().font = kDefaultFontStyle;
|
||||||
} else {
|
} else {
|
||||||
NS_ERROR("Default canvas font is invalid");
|
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
|
42, // name
|
||||||
43, // nicname
|
43, // nicname
|
||||||
53, // domain
|
53, // domain
|
||||||
|
69, // tftp
|
||||||
77, // priv-rjs
|
77, // priv-rjs
|
||||||
79, // finger
|
79, // finger
|
||||||
87, // ttylink
|
87, // ttylink
|
||||||
|
@ -130,8 +131,10 @@ int16_t gBadPortList[] = {
|
||||||
119, // nntp
|
119, // nntp
|
||||||
123, // ntp
|
123, // ntp
|
||||||
135, // loc-srv / epmap
|
135, // loc-srv / epmap
|
||||||
|
137, // netbios
|
||||||
139, // netbios
|
139, // netbios
|
||||||
143, // imap2
|
143, // imap2
|
||||||
|
161, // snmp
|
||||||
179, // bgp
|
179, // bgp
|
||||||
389, // ldap
|
389, // ldap
|
||||||
427, // afp (alternate)
|
427, // afp (alternate)
|
||||||
|
@ -154,6 +157,7 @@ int16_t gBadPortList[] = {
|
||||||
636, // ldap+ssl
|
636, // ldap+ssl
|
||||||
993, // imap+ssl
|
993, // imap+ssl
|
||||||
995, // pop3+ssl
|
995, // pop3+ssl
|
||||||
|
1719, // h323gatestat
|
||||||
1720, // h323hostcall
|
1720, // h323hostcall
|
||||||
1723, // pptp
|
1723, // pptp
|
||||||
2049, // nfs
|
2049, // nfs
|
||||||
|
@ -162,12 +166,14 @@ int16_t gBadPortList[] = {
|
||||||
5060, // sip
|
5060, // sip
|
||||||
5061, // sips
|
5061, // sips
|
||||||
6000, // x11
|
6000, // x11
|
||||||
|
6566, // sane-port
|
||||||
6665, // irc (alternate)
|
6665, // irc (alternate)
|
||||||
6666, // irc (alternate)
|
6666, // irc (alternate)
|
||||||
6667, // irc (default)
|
6667, // irc (default)
|
||||||
6668, // irc (alternate)
|
6668, // irc (alternate)
|
||||||
6669, // irc (alternate)
|
6669, // irc (alternate)
|
||||||
6697, // irc+tls
|
6697, // irc+tls
|
||||||
|
10080, // amanda
|
||||||
0, // Sentinel value: This MUST be zero
|
0, // Sentinel value: This MUST be zero
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1182,7 +1188,7 @@ nsIOService::AllowPort(int32_t inPort, const char *scheme, bool *_retval)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port == 0) {
|
if (port <= 0 || port >= std::numeric_limits<uint16_t>::max()) {
|
||||||
*_retval = false;
|
*_retval = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue