| Index: Source/core/css/MediaQueryEvaluator.cpp
|
| diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
|
| index 900a6271c08e1f5992d9d651f9106da4b5b3b172..413c80ea910c3007cd921b8f22239eb7c74a7f44 100644
|
| --- a/Source/core/css/MediaQueryEvaluator.cpp
|
| +++ b/Source/core/css/MediaQueryEvaluator.cpp
|
| @@ -337,7 +337,7 @@ static bool gridMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFea
|
| return false;
|
| }
|
|
|
| -static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, int& result)
|
| +static bool computeLength(CSSValue* value, bool strict, RenderStyle* initialStyle, int& result)
|
| {
|
| if (!value->isPrimitiveValue())
|
| return false;
|
| @@ -350,7 +350,9 @@ static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, Rend
|
| }
|
|
|
| if (primitiveValue->isLength()) {
|
| - result = primitiveValue->computeLength<int>(style, rootStyle, 1.0 /* multiplier */, true /* computingFontSize */);
|
| + // Relative (like EM) and root relative (like REM) units are always resolved against the initial values
|
| + // for media queries, hence the two initialStyle parameters.
|
| + result = primitiveValue->computeLength<int>(initialStyle, initialStyle, 1.0 /* multiplier */, true /* computingFontSize */);
|
| return true;
|
| }
|
|
|
| @@ -361,11 +363,10 @@ static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
|
| {
|
| if (value) {
|
| FloatRect sg = screenRect(frame->page()->mainFrame()->view());
|
| - RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
|
| int length;
|
| long height = sg.height();
|
| InspectorInstrumentation::applyScreenHeightOverride(frame, &height);
|
| - return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(height), length, op);
|
| + return computeLength(value, !frame->document()->inQuirksMode(), style, length) && compareValue(static_cast<int>(height), length, op);
|
| }
|
| // ({,min-,max-}device-height)
|
| // assume if we have a device, assume non-zero
|
| @@ -376,11 +377,10 @@ static bool deviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fra
|
| {
|
| if (value) {
|
| FloatRect sg = screenRect(frame->page()->mainFrame()->view());
|
| - RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
|
| int length;
|
| long width = sg.width();
|
| InspectorInstrumentation::applyScreenWidthOverride(frame, &width);
|
| - return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(width), length, op);
|
| + return computeLength(value, !frame->document()->inQuirksMode(), style, length) && compareValue(static_cast<int>(width), length, op);
|
| }
|
| // ({,min-,max-}device-width)
|
| // assume if we have a device, assume non-zero
|
| @@ -395,9 +395,8 @@ static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f
|
| if (value) {
|
| if (RenderView* renderView = frame->document()->renderView())
|
| height = adjustForAbsoluteZoom(height, renderView);
|
| - RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
|
| int length;
|
| - return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(height, length, op);
|
| + return computeLength(value, !frame->document()->inQuirksMode(), style, length) && compareValue(height, length, op);
|
| }
|
|
|
| return height;
|
| @@ -411,9 +410,8 @@ static bool widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* fr
|
| if (value) {
|
| if (RenderView* renderView = frame->document()->renderView())
|
| width = adjustForAbsoluteZoom(width, renderView);
|
| - RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
|
| int length;
|
| - return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(width, length, op);
|
| + return computeLength(value, !frame->document()->inQuirksMode(), style, length) && compareValue(width, length, op);
|
| }
|
|
|
| return width;
|
|
|