OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/css/MediaQueryEvaluator.h" | 31 #include "core/css/MediaQueryEvaluator.h" |
32 | 32 |
33 #include "CSSValueKeywords.h" | 33 #include "CSSValueKeywords.h" |
34 #include "core/css/CSSAspectRatioValue.h" | 34 #include "core/css/CSSAspectRatioValue.h" |
35 #include "core/css/CSSHelper.h" | 35 #include "core/css/CSSHelper.h" |
36 #include "core/css/CSSPrimitiveValue.h" | 36 #include "core/css/CSSPrimitiveValue.h" |
| 37 #include "core/css/CSSToLengthConversionData.h" |
37 #include "core/css/MediaFeatureNames.h" | 38 #include "core/css/MediaFeatureNames.h" |
38 #include "core/css/MediaList.h" | 39 #include "core/css/MediaList.h" |
39 #include "core/css/MediaQuery.h" | 40 #include "core/css/MediaQuery.h" |
40 #include "core/css/resolver/MediaQueryResult.h" | 41 #include "core/css/resolver/MediaQueryResult.h" |
41 #include "core/dom/NodeRenderStyle.h" | 42 #include "core/dom/NodeRenderStyle.h" |
42 #include "core/inspector/InspectorInstrumentation.h" | 43 #include "core/inspector/InspectorInstrumentation.h" |
43 #include "core/frame/Frame.h" | 44 #include "core/frame/Frame.h" |
44 #include "core/frame/FrameView.h" | 45 #include "core/frame/FrameView.h" |
45 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
46 #include "core/page/Settings.h" | 47 #include "core/page/Settings.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 341 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
341 | 342 |
342 if (primitiveValue->isNumber()) { | 343 if (primitiveValue->isNumber()) { |
343 result = primitiveValue->getIntValue(); | 344 result = primitiveValue->getIntValue(); |
344 return !strict || !result; | 345 return !strict || !result; |
345 } | 346 } |
346 | 347 |
347 if (primitiveValue->isLength()) { | 348 if (primitiveValue->isLength()) { |
348 // Relative (like EM) and root relative (like REM) units are always reso
lved against the initial values | 349 // Relative (like EM) and root relative (like REM) units are always reso
lved against the initial values |
349 // for media queries, hence the two initialStyle parameters. | 350 // for media queries, hence the two initialStyle parameters. |
350 result = primitiveValue->computeLength<int>(initialStyle, initialStyle,
1.0 /* multiplier */, true /* computingFontSize */); | 351 result = primitiveValue->computeLength<int>(CSSToLengthConversionData(in
itialStyle, initialStyle, 1.0 /* zoom */, true /* computingFontSize */)); |
351 return true; | 352 return true; |
352 } | 353 } |
353 | 354 |
354 return false; | 355 return false; |
355 } | 356 } |
356 | 357 |
357 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
ame* frame, MediaFeaturePrefix op) | 358 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
ame* frame, MediaFeaturePrefix op) |
358 { | 359 { |
359 if (value) { | 360 if (value) { |
360 int length; | 361 int length; |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // and let trampoline functions override the prefix if prefix is | 686 // and let trampoline functions override the prefix if prefix is |
686 // used | 687 // used |
687 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 688 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
688 if (func) | 689 if (func) |
689 return func(expr->value(), m_style.get(), m_frame, NoPrefix); | 690 return func(expr->value(), m_style.get(), m_frame, NoPrefix); |
690 | 691 |
691 return false; | 692 return false; |
692 } | 693 } |
693 | 694 |
694 } // namespace | 695 } // namespace |
OLD | NEW |