diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp b/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp index 42e71e531f9..413c80ea910 100644 --- a/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp +++ b/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp @@ -272,8 +272,8 @@ static bool deviceAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle*, Fra static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) { - // FIXME: Possibly handle other media types than 'screen' and 'print'. - float actualResolution = 0; + // FIXME: Possible handle other media types than 'screen' and 'print'. + float deviceScaleFactor = 0; // This checks the actual media type applied to the document, and we know // this method only got called if this media type matches the one defined @@ -281,16 +281,16 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) // media type of the query will either be "print" or "all". String mediaType = frame->view()->mediaType(); if (equalIgnoringCase(mediaType, "screen")) - actualResolution = clampTo<float>(frame->devicePixelRatio()); + deviceScaleFactor = frame->page()->deviceScaleFactor(); else if (equalIgnoringCase(mediaType, "print")) { // The resolution of images while printing should not depend on the DPI // of the screen. Until we support proper ways of querying this info // we use 300px which is considered minimum for current printers. - actualResolution = 300 / cssPixelsPerInch; + deviceScaleFactor = 300 / cssPixelsPerInch; } if (!value) - return !!actualResolution; + return !!deviceScaleFactor; if (!value->isPrimitiveValue()) return false; @@ -298,7 +298,7 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) CSSPrimitiveValue* resolution = toCSSPrimitiveValue(value); if (resolution->isNumber()) - return compareValue(actualResolution, resolution->getFloatValue(), op); + return compareValue(deviceScaleFactor, resolution->getFloatValue(), op); if (!resolution->isResolution()) return false; @@ -310,11 +310,11 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) // approximates the reference pixel". With that in mind, allowing 2 decimal // point precision seems appropriate. return compareValue( - floorf(0.5 + 100 * actualResolution) / 100, + floorf(0.5 + 100 * deviceScaleFactor) / 100, floorf(0.5 + 100 * resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX)) / 100, op); } - return compareValue(actualResolution, resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX), op); + return compareValue(deviceScaleFactor, resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX), op); } static bool devicePixelRatioMediaFeatureEval(CSSValue *value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) |