| Index: Source/core/css/MediaQueryEvaluator.cpp
|
| diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
|
| index 68d654cd7fa72a469e092c845cb5a53f694e08da..fcb499febef624e54b253054675b88992a6edd6a 100644
|
| --- a/Source/core/css/MediaQueryEvaluator.cpp
|
| +++ b/Source/core/css/MediaQueryEvaluator.cpp
|
| @@ -334,7 +334,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(Document* document, CSSValue* value, RenderStyle* style, RenderStyle* rootStyle, int& result)
|
| {
|
| if (!value->isPrimitiveValue())
|
| return false;
|
| @@ -343,9 +343,17 @@ static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, Rend
|
|
|
| if (primitiveValue->isNumber()) {
|
| result = primitiveValue->getIntValue();
|
| + bool strict = !document->inQuirksMode();
|
| return !strict || !result;
|
| }
|
|
|
| + if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_REMS) {
|
| + // Use the initial font size instead of <html> font size.
|
| + RefPtr<RenderStyle> defaultStyle = StyleResolver::styleForDocument(document);
|
| + result = primitiveValue->computeLength<int>(style, defaultStyle.get(), 1.0 /* multiplier */, true /* computingFontSize */);
|
| + return true;
|
| + }
|
| +
|
| if (primitiveValue->isLength()) {
|
| result = primitiveValue->computeLength<int>(style, rootStyle, 1.0 /* multiplier */, true /* computingFontSize */);
|
| return true;
|
| @@ -362,7 +370,7 @@ static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
|
| 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(frame->document(), value, style, rootStyle, length) && compareValue(static_cast<int>(height), length, op);
|
| }
|
| // ({,min-,max-}device-height)
|
| // assume if we have a device, assume non-zero
|
| @@ -377,7 +385,7 @@ static bool deviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fra
|
| 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(frame->document(), value, style, rootStyle, length) && compareValue(static_cast<int>(width), length, op);
|
| }
|
| // ({,min-,max-}device-width)
|
| // assume if we have a device, assume non-zero
|
| @@ -394,7 +402,7 @@ static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f
|
| 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(frame->document(), value, style, rootStyle, length) && compareValue(height, length, op);
|
| }
|
|
|
| return height;
|
| @@ -410,7 +418,7 @@ static bool widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* fr
|
| 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(frame->document(), value, style, rootStyle, length) && compareValue(width, length, op);
|
| }
|
|
|
| return width;
|
|
|