mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 836329: Fix regression handling 'rem' units in media queries. r=bzbarsky
I confirmed that the added tests fail without the patch and pass with the patch.
This commit is contained in:
parent
3c9398e416
commit
4368b654a3
@ -322,27 +322,35 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
||||
aPresContext->SetUsesRootEMUnits(true);
|
||||
nscoord rootFontSize;
|
||||
|
||||
// NOTE: Be very careful with |styleFont|, since we haven't set
|
||||
// aCanStoreInRuleTree to false yet, so we don't want to introduce
|
||||
// any dependencies on aStyleContext's data here.
|
||||
const nsStyleFont *styleFont =
|
||||
aStyleFont ? aStyleFont : aStyleContext->GetStyleFont();
|
||||
|
||||
if (aUseProvidedRootEmSize) {
|
||||
// We should use the provided aFontSize as the reference length to
|
||||
// scale. This only happens when we are calculating font-size or
|
||||
// an equivalent (scriptminsize or CalcLengthWithInitialFont) on
|
||||
// the root element, in which case aFontSize is already the
|
||||
// value we want.
|
||||
if (aFontSize == -1) {
|
||||
// XXX Should this be styleFont->mSize instead to avoid taking
|
||||
// minfontsize prefs into account?
|
||||
aFontSize = styleFont->mFont.size;
|
||||
}
|
||||
rootFontSize = aFontSize;
|
||||
} else if (aStyleContext && !aStyleContext->GetParent()) {
|
||||
// This is the root element (XXX we don't really know this, but
|
||||
// nsRuleNode::SetFont makes the same assumption!), so we should
|
||||
// use GetStyleFont on this context to get the root element's
|
||||
// font size.
|
||||
const nsStyleFont *styleFont =
|
||||
aStyleFont ? aStyleFont : aStyleContext->GetStyleFont();
|
||||
rootFontSize = styleFont->mFont.size;
|
||||
} else {
|
||||
// This is not the root element or we are calculating something other
|
||||
// than font size, so rem is relative to the root element's font size.
|
||||
nsRefPtr<nsStyleContext> rootStyle;
|
||||
const nsStyleFont *rootStyleFont =
|
||||
aStyleFont ? aStyleFont : aStyleContext->GetStyleFont();
|
||||
const nsStyleFont *rootStyleFont = styleFont;
|
||||
Element* docElement = aPresContext->Document()->GetRootElement();
|
||||
|
||||
if (docElement) {
|
||||
|
@ -233,6 +233,14 @@ function run() {
|
||||
(Math.ceil(value/em_size) + 1) + "em)");
|
||||
should_not_apply("all and (max-" + feature + ": " +
|
||||
(Math.floor(value/em_size) - 1) + "em)");
|
||||
should_not_apply("all and (min-" + feature + ": " +
|
||||
(Math.ceil(value/em_size) + 1) + "rem)");
|
||||
should_apply("all and (min-" + feature + ": " +
|
||||
(Math.floor(value/em_size) - 1) + "rem)");
|
||||
should_apply("all and (max-" + feature + ": " +
|
||||
(Math.ceil(value/em_size) + 1) + "rem)");
|
||||
should_not_apply("all and (max-" + feature + ": " +
|
||||
(Math.floor(value/em_size) - 1) + "rem)");
|
||||
}
|
||||
|
||||
change_state(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user