зеркало из https://github.com/mozilla/gecko-dev.git
Bug 811391 - Part 1: Ignore @page declarations involving viewport units. r=dbaron
* * * Bug 811391 followup: Fix out-of-order init list, to fix build warning (treated as error).
This commit is contained in:
Родитель
b5846cd75f
Коммит
19481d1320
|
@ -753,6 +753,9 @@ protected:
|
||||||
// True if unsafe rules should be allowed
|
// True if unsafe rules should be allowed
|
||||||
bool mUnsafeRulesEnabled : 1;
|
bool mUnsafeRulesEnabled : 1;
|
||||||
|
|
||||||
|
// True if viewport units should be allowed.
|
||||||
|
bool mViewportUnitsEnabled : 1;
|
||||||
|
|
||||||
// True for parsing media lists for HTML attributes, where we have to
|
// True for parsing media lists for HTML attributes, where we have to
|
||||||
// ignore CSS comments.
|
// ignore CSS comments.
|
||||||
bool mHTMLMediaMode : 1;
|
bool mHTMLMediaMode : 1;
|
||||||
|
@ -835,6 +838,7 @@ CSSParserImpl::CSSParserImpl()
|
||||||
mHashlessColorQuirk(false),
|
mHashlessColorQuirk(false),
|
||||||
mUnitlessLengthQuirk(false),
|
mUnitlessLengthQuirk(false),
|
||||||
mUnsafeRulesEnabled(false),
|
mUnsafeRulesEnabled(false),
|
||||||
|
mViewportUnitsEnabled(true),
|
||||||
mHTMLMediaMode(false),
|
mHTMLMediaMode(false),
|
||||||
mParsingCompoundProperty(false),
|
mParsingCompoundProperty(false),
|
||||||
mInFailingSupportsRule(false),
|
mInFailingSupportsRule(false),
|
||||||
|
@ -2399,9 +2403,16 @@ CSSParserImpl::ParsePageRule(RuleAppendFunc aAppendFunc, void* aData)
|
||||||
// TODO: There can be page selectors after @page such as ":first", ":left".
|
// TODO: There can be page selectors after @page such as ":first", ":left".
|
||||||
uint32_t parseFlags = eParseDeclaration_InBraces |
|
uint32_t parseFlags = eParseDeclaration_InBraces |
|
||||||
eParseDeclaration_AllowImportant;
|
eParseDeclaration_AllowImportant;
|
||||||
|
|
||||||
|
// Forbid viewport units in @page rules. See bug 811391.
|
||||||
|
NS_ABORT_IF_FALSE(mViewportUnitsEnabled,
|
||||||
|
"Viewport units should be enabled outside of @page rules.");
|
||||||
|
mViewportUnitsEnabled = false;
|
||||||
nsAutoPtr<css::Declaration> declaration(
|
nsAutoPtr<css::Declaration> declaration(
|
||||||
ParseDeclarationBlock(parseFlags,
|
ParseDeclarationBlock(parseFlags,
|
||||||
eCSSContext_Page));
|
eCSSContext_Page));
|
||||||
|
mViewportUnitsEnabled = true;
|
||||||
|
|
||||||
if (!declaration) {
|
if (!declaration) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4676,6 +4687,16 @@ CSSParserImpl::TranslateDimension(nsCSSValue& aValue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mViewportUnitsEnabled &&
|
||||||
|
(eCSSUnit_ViewportWidth == units ||
|
||||||
|
eCSSUnit_ViewportHeight == units ||
|
||||||
|
eCSSUnit_ViewportMin == units ||
|
||||||
|
eCSSUnit_ViewportMax == units)) {
|
||||||
|
// Viewport units aren't allowed right now, probably because we're
|
||||||
|
// inside an @page declaration. Fail.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (i == ArrayLength(UnitData)) {
|
if (i == ArrayLength(UnitData)) {
|
||||||
// Unknown unit
|
// Unknown unit
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче