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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 MediaFeaturePrefix, | 636 MediaFeaturePrefix, |
637 const MediaValues& mediaValues) { | 637 const MediaValues& mediaValues) { |
638 HoverType hover = mediaValues.primaryHoverType(); | 638 HoverType hover = mediaValues.primaryHoverType(); |
639 | 639 |
640 if (!value.isValid()) | 640 if (!value.isValid()) |
641 return hover != HoverTypeNone; | 641 return hover != HoverTypeNone; |
642 | 642 |
643 if (!value.isID) | 643 if (!value.isID) |
644 return false; | 644 return false; |
645 | 645 |
| 646 if (value.id == CSSValueOnDemand) |
| 647 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand); |
| 648 |
646 return (hover == HoverTypeNone && value.id == CSSValueNone) || | 649 return (hover == HoverTypeNone && value.id == CSSValueNone) || |
647 (hover == HoverTypeOnDemand && value.id == CSSValueOnDemand) || | 650 (hover == HoverTypeOnDemand && value.id == CSSValueOnDemand) || |
648 (hover == HoverTypeHover && value.id == CSSValueHover); | 651 (hover == HoverTypeHover && value.id == CSSValueHover); |
649 } | 652 } |
650 | 653 |
651 static bool anyHoverMediaFeatureEval(const MediaQueryExpValue& value, | 654 static bool anyHoverMediaFeatureEval(const MediaQueryExpValue& value, |
652 MediaFeaturePrefix, | 655 MediaFeaturePrefix, |
653 const MediaValues& mediaValues) { | 656 const MediaValues& mediaValues) { |
654 int availableHoverTypes = mediaValues.availableHoverTypes(); | 657 int availableHoverTypes = mediaValues.availableHoverTypes(); |
655 | 658 |
656 if (!value.isValid()) | 659 if (!value.isValid()) |
657 return availableHoverTypes & ~HoverTypeNone; | 660 return availableHoverTypes & ~HoverTypeNone; |
658 | 661 |
659 if (!value.isID) | 662 if (!value.isID) |
660 return false; | 663 return false; |
661 | 664 |
662 switch (value.id) { | 665 switch (value.id) { |
663 case CSSValueNone: | 666 case CSSValueNone: |
664 return availableHoverTypes & HoverTypeNone; | 667 return availableHoverTypes & HoverTypeNone; |
665 case CSSValueOnDemand: | 668 case CSSValueOnDemand: |
| 669 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand); |
666 return availableHoverTypes & HoverTypeOnDemand; | 670 return availableHoverTypes & HoverTypeOnDemand; |
667 case CSSValueHover: | 671 case CSSValueHover: |
668 return availableHoverTypes & HoverTypeHover; | 672 return availableHoverTypes & HoverTypeHover; |
669 default: | 673 default: |
670 ASSERT_NOT_REACHED(); | 674 ASSERT_NOT_REACHED(); |
671 return false; | 675 return false; |
672 } | 676 } |
673 } | 677 } |
674 | 678 |
675 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value, | 679 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // Call the media feature evaluation function. Assume no prefix and let | 775 // Call the media feature evaluation function. Assume no prefix and let |
772 // trampoline functions override the prefix if prefix is used. | 776 // trampoline functions override the prefix if prefix is used. |
773 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 777 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
774 if (func) | 778 if (func) |
775 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 779 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
776 | 780 |
777 return false; | 781 return false; |
778 } | 782 } |
779 | 783 |
780 } // namespace blink | 784 } // namespace blink |
OLD | NEW |