Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp

Issue 1474253002: Remove CSSPrimitiveValue::isDotsPer{Inch,Pixel,Centimeter} functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValue.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * CSS Media Query Evaluator 2 * CSS Media Query Evaluator
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * Copyright (C) 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 if (value.unit == CSSPrimitiveValue::UnitType::Number) 308 if (value.unit == CSSPrimitiveValue::UnitType::Number)
309 return compareValue(actualResolution, clampTo<float>(value.value), op); 309 return compareValue(actualResolution, clampTo<float>(value.value), op);
310 310
311 if (!CSSPrimitiveValue::isResolution(value.unit)) 311 if (!CSSPrimitiveValue::isResolution(value.unit))
312 return false; 312 return false;
313 313
314 double canonicalFactor = CSSPrimitiveValue::conversionToCanonicalUnitsScaleF actor(value.unit); 314 double canonicalFactor = CSSPrimitiveValue::conversionToCanonicalUnitsScaleF actor(value.unit);
315 double dppxFactor = CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor (CSSPrimitiveValue::UnitType::DotsPerPixel); 315 double dppxFactor = CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor (CSSPrimitiveValue::UnitType::DotsPerPixel);
316 float valueInDppx = clampTo<float>(value.value * (canonicalFactor / dppxFact or)); 316 float valueInDppx = clampTo<float>(value.value * (canonicalFactor / dppxFact or));
317 if (CSSPrimitiveValue::isDotsPerCentimeter(value.unit)) { 317 if (value.unit == CSSPrimitiveValue::UnitType::DotsPerCentimeter) {
318 // To match DPCM to DPPX values, we limit to 2 decimal points. 318 // To match DPCM to DPPX values, we limit to 2 decimal points.
319 // The http://dev.w3.org/csswg/css3-values/#absolute-lengths recommends 319 // The http://dev.w3.org/csswg/css3-values/#absolute-lengths recommends
320 // "that the pixel unit refer to the whole number of device pixels that best 320 // "that the pixel unit refer to the whole number of device pixels that best
321 // approximates the reference pixel". With that in mind, allowing 2 deci mal 321 // approximates the reference pixel". With that in mind, allowing 2 deci mal
322 // point precision seems appropriate. 322 // point precision seems appropriate.
323 return compareValue( 323 return compareValue(
324 floorf(0.5 + 100 * actualResolution) / 100, 324 floorf(0.5 + 100 * actualResolution) / 100,
325 floorf(0.5 + 100 * valueInDppx) / 100, op); 325 floorf(0.5 + 100 * valueInDppx) / 100, op);
326 } 326 }
327 327
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // Call the media feature evaluation function. Assume no prefix and let 659 // Call the media feature evaluation function. Assume no prefix and let
660 // trampoline functions override the prefix if prefix is used. 660 // trampoline functions override the prefix if prefix is used.
661 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 661 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
662 if (func) 662 if (func)
663 return func(expr->expValue(), NoPrefix, *m_mediaValues); 663 return func(expr->expValue(), NoPrefix, *m_mediaValues);
664 664
665 return false; 665 return false;
666 } 666 }
667 667
668 } // namespace 668 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698