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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 switch (value.id) { | 263 switch (value.id) { |
264 case CSSValueFullscreen: | 264 case CSSValueFullscreen: |
265 return mode == WebDisplayModeFullscreen; | 265 return mode == WebDisplayModeFullscreen; |
266 case CSSValueStandalone: | 266 case CSSValueStandalone: |
267 return mode == WebDisplayModeStandalone; | 267 return mode == WebDisplayModeStandalone; |
268 case CSSValueMinimalUi: | 268 case CSSValueMinimalUi: |
269 return mode == WebDisplayModeMinimalUi; | 269 return mode == WebDisplayModeMinimalUi; |
270 case CSSValueBrowser: | 270 case CSSValueBrowser: |
271 return mode == WebDisplayModeBrowser; | 271 return mode == WebDisplayModeBrowser; |
272 default: | 272 default: |
273 ASSERT_NOT_REACHED(); | 273 NOTREACHED(); |
274 return false; | 274 return false; |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 static bool orientationMediaFeatureEval(const MediaQueryExpValue& value, | 278 static bool orientationMediaFeatureEval(const MediaQueryExpValue& value, |
279 MediaFeaturePrefix, | 279 MediaFeaturePrefix, |
280 const MediaValues& mediaValues) { | 280 const MediaValues& mediaValues) { |
281 int width = mediaValues.viewportWidth(); | 281 int width = mediaValues.viewportWidth(); |
282 int height = mediaValues.viewportHeight(); | 282 int height = mediaValues.viewportHeight(); |
283 | 283 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 665 |
666 switch (value.id) { | 666 switch (value.id) { |
667 case CSSValueNone: | 667 case CSSValueNone: |
668 return availableHoverTypes & HoverTypeNone; | 668 return availableHoverTypes & HoverTypeNone; |
669 case CSSValueOnDemand: | 669 case CSSValueOnDemand: |
670 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand); | 670 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand); |
671 return availableHoverTypes & HoverTypeOnDemand; | 671 return availableHoverTypes & HoverTypeOnDemand; |
672 case CSSValueHover: | 672 case CSSValueHover: |
673 return availableHoverTypes & HoverTypeHover; | 673 return availableHoverTypes & HoverTypeHover; |
674 default: | 674 default: |
675 ASSERT_NOT_REACHED(); | 675 NOTREACHED(); |
676 return false; | 676 return false; |
677 } | 677 } |
678 } | 678 } |
679 | 679 |
680 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value, | 680 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value, |
681 MediaFeaturePrefix, | 681 MediaFeaturePrefix, |
682 const MediaValues& mediaValues) { | 682 const MediaValues& mediaValues) { |
683 PointerType pointer = mediaValues.primaryPointerType(); | 683 PointerType pointer = mediaValues.primaryPointerType(); |
684 | 684 |
685 if (!value.isValid()) | 685 if (!value.isValid()) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 return false; | 727 return false; |
728 | 728 |
729 switch (value.id) { | 729 switch (value.id) { |
730 case CSSValueCoarse: | 730 case CSSValueCoarse: |
731 return availablePointers & PointerTypeCoarse; | 731 return availablePointers & PointerTypeCoarse; |
732 case CSSValueFine: | 732 case CSSValueFine: |
733 return availablePointers & PointerTypeFine; | 733 return availablePointers & PointerTypeFine; |
734 case CSSValueNone: | 734 case CSSValueNone: |
735 return availablePointers & PointerTypeNone; | 735 return availablePointers & PointerTypeNone; |
736 default: | 736 default: |
737 ASSERT_NOT_REACHED(); | 737 NOTREACHED(); |
738 return false; | 738 return false; |
739 } | 739 } |
740 } | 740 } |
741 | 741 |
742 static bool scanMediaFeatureEval(const MediaQueryExpValue& value, | 742 static bool scanMediaFeatureEval(const MediaQueryExpValue& value, |
743 MediaFeaturePrefix, | 743 MediaFeaturePrefix, |
744 const MediaValues& mediaValues) { | 744 const MediaValues& mediaValues) { |
745 // Scan only applies to 'tv' media. | 745 // Scan only applies to 'tv' media. |
746 if (!equalIgnoringCase(mediaValues.mediaType(), MediaTypeNames::tv)) | 746 if (!equalIgnoringCase(mediaValues.mediaType(), MediaTypeNames::tv)) |
747 return false; | 747 return false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 // Call the media feature evaluation function. Assume no prefix and let | 818 // Call the media feature evaluation function. Assume no prefix and let |
819 // trampoline functions override the prefix if prefix is used. | 819 // trampoline functions override the prefix if prefix is used. |
820 EvalFunc func = gFunctionMap->at(expr->mediaFeature().impl()); | 820 EvalFunc func = gFunctionMap->at(expr->mediaFeature().impl()); |
821 if (func) | 821 if (func) |
822 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 822 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
823 | 823 |
824 return false; | 824 return false; |
825 } | 825 } |
826 | 826 |
827 } // namespace blink | 827 } // namespace blink |
OLD | NEW |