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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/CSSOMTypes.cpp.tmpl

Issue 2867883003: [CSS Typed OM] Delete obsolete number and length classes from Typed OM (Closed)
Patch Set: rebase Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/cssom/CSSOMTypes.h" 5 #include "core/css/cssom/CSSOMTypes.h"
6 6
7 #include "core/css/CSSPropertyMetadata.h" 7 #include "core/css/CSSPropertyMetadata.h"
8 #include "core/css/cssom/CSSOMKeywords.h" 8 #include "core/css/cssom/CSSOMKeywords.h"
9 #include "core/css/cssom/CSSKeywordValue.h" 9 #include "core/css/cssom/CSSKeywordValue.h"
10 #include "core/css/cssom/CSSLengthValue.h"
11 #include "core/css/cssom/CSSStyleValue.h" 10 #include "core/css/cssom/CSSStyleValue.h"
12 11
13 namespace blink { 12 namespace blink {
14 13
15 bool CSSOMTypes::PropertyCanTake(CSSPropertyID id, 14 bool CSSOMTypes::PropertyCanTake(CSSPropertyID id,
16 const CSSStyleValue& styleValue) { 15 const CSSStyleValue& styleValue) {
17 // Shortcut special case. 16 // Shortcut special case.
18 if (styleValue.GetType() == CSSStyleValue::kSimpleLengthType || 17 if (styleValue.GetType() == CSSStyleValue::kSimpleLengthType ||
19 styleValue.GetType() == CSSStyleValue::kCalcLengthType) { 18 styleValue.GetType() == CSSStyleValue::kCalcLengthType) {
20 if (ToCSSLengthValue(styleValue).ContainsPercent() && 19 // TODO(meade): Rewrite this once the new length types are spec'd.
21 !CSSPropertyMetadata::PropertySupportsPercentage(id)) { 20 // if (ToCSSLengthValue(styleValue).ContainsPercent() &&
22 return false; 21 // !CSSPropertyMetadata::PropertySupportsPercentage(id)) {
23 } 22 // return false;
23 // }
24 } else if (styleValue.GetType() == CSSStyleValue::kKeywordType) { 24 } else if (styleValue.GetType() == CSSStyleValue::kKeywordType) {
25 // Keywords are also handled differently. 25 // Keywords are also handled differently.
26 return CSSOMKeywords::ValidKeywordForProperty( 26 return CSSOMKeywords::ValidKeywordForProperty(
27 id, ToCSSKeywordValue(styleValue)); 27 id, ToCSSKeywordValue(styleValue));
28 } else if (styleValue.GetType() == CSSStyleValue::kUnknown) { 28 } else if (styleValue.GetType() == CSSStyleValue::kUnknown) {
29 // The check happens later in this case. 29 // The check happens later in this case.
30 return true; 30 return true;
31 } 31 }
32 32
33 return CSSOMTypes::PropertyCanTakeType(id, styleValue.GetType()); 33 return CSSOMTypes::PropertyCanTakeType(id, styleValue.GetType());
34 } 34 }
35 35
36 bool CSSOMTypes::PropertyCanTakeType(CSSPropertyID id, 36 bool CSSOMTypes::PropertyCanTakeType(CSSPropertyID id,
37 CSSStyleValue::StyleValueType type) { 37 CSSStyleValue::StyleValueType type) {
38 switch (id) { 38 switch (id) {
39 {% for property_id, property in properties.items() if property.typedom_types %} 39 {% for property_id, property in properties.items() if property.typedom_types %}
40 case {{property_id}}: 40 case {{property_id}}:
41 return ( 41 return (
42 {% for type in property.typedom_types %} 42 {% for type in property.typedom_types %}
43 {{ "|| " if not loop.first }}type == CSSStyleValue::k{{type}}Type 43 {{ "|| " if not loop.first }}type == CSSStyleValue::k{{type}}Type
44 {% endfor %} 44 {% endfor %}
45 ); 45 );
46 {% endfor %} 46 {% endfor %}
47 default: 47 default:
48 return false; 48 return false;
49 } 49 }
50 } 50 }
51 51
52 } // namespace blink 52 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698