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

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

Issue 2678933002: Added a UseCounter for hover:on-demand media query parsing. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | 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 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
647 return (hover == HoverTypeNone && value.id == CSSValueNone) || 650 return (hover == HoverTypeNone && value.id == CSSValueNone) ||
648 (hover == HoverTypeOnDemand && value.id == CSSValueOnDemand) || 651 (hover == HoverTypeOnDemand && value.id == CSSValueOnDemand) ||
649 (hover == HoverTypeHover && value.id == CSSValueHover); 652 (hover == HoverTypeHover && value.id == CSSValueHover);
650 } 653 }
651 654
652 static bool anyHoverMediaFeatureEval(const MediaQueryExpValue& value, 655 static bool anyHoverMediaFeatureEval(const MediaQueryExpValue& value,
653 MediaFeaturePrefix, 656 MediaFeaturePrefix,
654 const MediaValues& mediaValues) { 657 const MediaValues& mediaValues) {
655 int availableHoverTypes = mediaValues.availableHoverTypes(); 658 int availableHoverTypes = mediaValues.availableHoverTypes();
656 659
657 if (!value.isValid()) 660 if (!value.isValid())
658 return availableHoverTypes & ~HoverTypeNone; 661 return availableHoverTypes & ~HoverTypeNone;
659 662
660 if (!value.isID) 663 if (!value.isID)
661 return false; 664 return false;
662 665
663 switch (value.id) { 666 switch (value.id) {
664 case CSSValueNone: 667 case CSSValueNone:
665 return availableHoverTypes & HoverTypeNone; 668 return availableHoverTypes & HoverTypeNone;
666 case CSSValueOnDemand: 669 case CSSValueOnDemand:
670 UseCounter::count(mediaValues.document(), UseCounter::CSSValueOnDemand);
667 return availableHoverTypes & HoverTypeOnDemand; 671 return availableHoverTypes & HoverTypeOnDemand;
668 case CSSValueHover: 672 case CSSValueHover:
669 return availableHoverTypes & HoverTypeHover; 673 return availableHoverTypes & HoverTypeHover;
670 default: 674 default:
671 ASSERT_NOT_REACHED(); 675 ASSERT_NOT_REACHED();
672 return false; 676 return false;
673 } 677 }
674 } 678 }
675 679
676 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value, 680 static bool pointerMediaFeatureEval(const MediaQueryExpValue& value,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // Call the media feature evaluation function. Assume no prefix and let 818 // Call the media feature evaluation function. Assume no prefix and let
815 // trampoline functions override the prefix if prefix is used. 819 // trampoline functions override the prefix if prefix is used.
816 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 820 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
817 if (func) 821 if (func)
818 return func(expr->expValue(), NoPrefix, *m_mediaValues); 822 return func(expr->expValue(), NoPrefix, *m_mediaValues);
819 823
820 return false; 824 return false;
821 } 825 }
822 826
823 } // namespace blink 827 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698