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

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

Issue 2673963002: Drop hover:on-demand support & let touch-screens report "none" instead. (Closed)
Patch Set: Fixed a "yikes!" Created 3 years, 9 months 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
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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 MediaFeaturePrefix, 637 MediaFeaturePrefix,
638 const MediaValues& mediaValues) { 638 const MediaValues& mediaValues) {
639 HoverType hover = mediaValues.primaryHoverType(); 639 HoverType hover = mediaValues.primaryHoverType();
640 640
641 if (!value.isValid()) 641 if (!value.isValid())
642 return hover != HoverTypeNone; 642 return hover != HoverTypeNone;
643 643
644 if (!value.isID) 644 if (!value.isID)
645 return false; 645 return false;
646 646
647 if (value.id == CSSValueOnDemand)
648 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand);
649
650 return (hover == HoverTypeNone && value.id == CSSValueNone) || 647 return (hover == HoverTypeNone && value.id == CSSValueNone) ||
651 (hover == HoverTypeOnDemand && value.id == CSSValueOnDemand) ||
652 (hover == HoverTypeHover && value.id == CSSValueHover); 648 (hover == HoverTypeHover && value.id == CSSValueHover);
653 } 649 }
654 650
655 static bool anyHoverMediaFeatureEval(const MediaQueryExpValue& value, 651 static bool anyHoverMediaFeatureEval(const MediaQueryExpValue& value,
656 MediaFeaturePrefix, 652 MediaFeaturePrefix,
657 const MediaValues& mediaValues) { 653 const MediaValues& mediaValues) {
658 int availableHoverTypes = mediaValues.availableHoverTypes(); 654 int availableHoverTypes = mediaValues.availableHoverTypes();
659 655
660 if (!value.isValid()) 656 if (!value.isValid())
661 return availableHoverTypes & ~HoverTypeNone; 657 return availableHoverTypes & ~HoverTypeNone;
662 658
663 if (!value.isID) 659 if (!value.isID)
664 return false; 660 return false;
665 661
666 switch (value.id) { 662 switch (value.id) {
667 case CSSValueNone: 663 case CSSValueNone:
668 return availableHoverTypes & HoverTypeNone; 664 return availableHoverTypes & HoverTypeNone;
669 case CSSValueOnDemand:
670 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand);
671 return availableHoverTypes & HoverTypeOnDemand;
672 case CSSValueHover: 665 case CSSValueHover:
673 return availableHoverTypes & HoverTypeHover; 666 return availableHoverTypes & HoverTypeHover;
674 default: 667 default:
675 ASSERT_NOT_REACHED(); 668 ASSERT_NOT_REACHED();
676 return false; 669 return false;
677 } 670 }
678 } 671 }
679 672
680 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value, 673 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value,
681 MediaFeaturePrefix, 674 MediaFeaturePrefix,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 // Call the media feature evaluation function. Assume no prefix and let 811 // Call the media feature evaluation function. Assume no prefix and let
819 // trampoline functions override the prefix if prefix is used. 812 // trampoline functions override the prefix if prefix is used.
820 EvalFunc func = gFunctionMap->at(expr->mediaFeature().impl()); 813 EvalFunc func = gFunctionMap->at(expr->mediaFeature().impl());
821 if (func) 814 if (func)
822 return func(expr->expValue(), NoPrefix, *m_mediaValues); 815 return func(expr->expValue(), NoPrefix, *m_mediaValues);
823 816
824 return false; 817 return false;
825 } 818 }
826 819
827 } // namespace blink 820 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/media/mq-hover-expected.txt ('k') | third_party/WebKit/Source/core/css/MediaQueryExp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698