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

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

Issue 2671173002: Change CSSParserContext to have a Document handle (vs UseCounter). (Closed)
Patch Set: fix todo style 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/properties/CSSPropertyLengthUtils.h" 5 #include "core/css/properties/CSSPropertyLengthUtils.h"
6 6
7 #include "core/css/parser/CSSParserContext.h" 7 #include "core/css/parser/CSSParserContext.h"
8 #include "core/css/parser/CSSPropertyParserHelpers.h" 8 #include "core/css/parser/CSSPropertyParserHelpers.h"
9 #include "core/frame/UseCounter.h" 9 #include "core/frame/UseCounter.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 namespace { 13 namespace {
14 14
15 bool validWidthOrHeightKeyword(CSSValueID id, const CSSParserContext* context) { 15 bool validWidthOrHeightKeyword(CSSValueID id, const CSSParserContext* context) {
16 if (id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || 16 if (id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent ||
17 id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent || 17 id == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent ||
18 id == CSSValueMinContent || id == CSSValueMaxContent || 18 id == CSSValueMinContent || id == CSSValueMaxContent ||
19 id == CSSValueFitContent) { 19 id == CSSValueFitContent) {
20 if (context->isUseCounterRecordingEnabled()) { 20 switch (id) {
21 UseCounter* useCounter = context->useCounter(); 21 case CSSValueWebkitMinContent:
22 switch (id) { 22 context->count(UseCounter::CSSValuePrefixedMinContent);
23 case CSSValueWebkitMinContent: 23 break;
24 useCounter->count(UseCounter::CSSValuePrefixedMinContent); 24 case CSSValueWebkitMaxContent:
25 break; 25 context->count(UseCounter::CSSValuePrefixedMaxContent);
26 case CSSValueWebkitMaxContent: 26 break;
27 useCounter->count(UseCounter::CSSValuePrefixedMaxContent); 27 case CSSValueWebkitFillAvailable:
28 break; 28 context->count(UseCounter::CSSValuePrefixedFillAvailable);
29 case CSSValueWebkitFillAvailable: 29 break;
30 useCounter->count(UseCounter::CSSValuePrefixedFillAvailable); 30 case CSSValueWebkitFitContent:
31 break; 31 context->count(UseCounter::CSSValuePrefixedFitContent);
32 case CSSValueWebkitFitContent: 32 break;
33 useCounter->count(UseCounter::CSSValuePrefixedFitContent); 33 default:
34 break; 34 break;
35 default:
36 break;
37 }
38 } 35 }
39 return true; 36 return true;
40 } 37 }
41 return false; 38 return false;
42 } 39 }
43 40
44 } // namespace 41 } // namespace
45 42
46 CSSValue* CSSPropertyLengthUtils::consumeMaxWidthOrHeight( 43 CSSValue* CSSPropertyLengthUtils::consumeMaxWidthOrHeight(
47 CSSParserTokenRange& range, 44 CSSParserTokenRange& range,
(...skipping 11 matching lines...) Expand all
59 const CSSParserContext* context, 56 const CSSParserContext* context,
60 CSSPropertyParserHelpers::UnitlessQuirk unitless) { 57 CSSPropertyParserHelpers::UnitlessQuirk unitless) {
61 if (range.peek().id() == CSSValueAuto || 58 if (range.peek().id() == CSSValueAuto ||
62 validWidthOrHeightKeyword(range.peek().id(), context)) 59 validWidthOrHeightKeyword(range.peek().id(), context))
63 return CSSPropertyParserHelpers::consumeIdent(range); 60 return CSSPropertyParserHelpers::consumeIdent(range);
64 return CSSPropertyParserHelpers::consumeLengthOrPercent( 61 return CSSPropertyParserHelpers::consumeLengthOrPercent(
65 range, context->mode(), ValueRangeNonNegative, unitless); 62 range, context->mode(), ValueRangeNonNegative, unitless);
66 } 63 }
67 64
68 } // namespace blink 65 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698