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

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

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 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/CSSOMKeywords.h" 5 #include "core/css/cssom/CSSOMKeywords.h"
6 6
7 #include "core/css/CSSPropertyIDTemplates.h" 7 #include "core/css/CSSPropertyIDTemplates.h"
8 #include "core/css/cssom/CSSKeywordValue.h" 8 #include "core/css/cssom/CSSKeywordValue.h"
9 #include "wtf/HashMap.h" 9 #include "wtf/HashMap.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 namespace { 13 namespace {
14 14
15 using KeywordTable = HashMap<CSSPropertyID, Vector<CSSValueID>>; 15 using KeywordTable = HashMap<CSSPropertyID, Vector<CSSValueID>>;
16 16
17 KeywordTable createKeywordTable() { 17 KeywordTable createKeywordTable() {
18 KeywordTable table; 18 KeywordTable table;
19 19
20 {% for property_id, property in properties.items() if property.keywordIDs %} 20 {% for property_id, property in properties.items() if property.keywordIDs %}
21 { 21 {
22 Vector<CSSValueID> {{property.lower_camel_name}}Keywords; 22 Vector<CSSValueID> {{property.lower_camel_name}}Keywords;
23 {% for keywordValueID in property.keywordIDs %} 23 {% for keywordValueID in property.keywordIDs %}
24 {{property.lower_camel_name}}Keywords.push_back({{keywordValueID}}); 24 {{property.lower_camel_name}}Keywords.push_back({{keywordValueID}});
25 {% endfor %} 25 {% endfor %}
26 table.set({{property_id}}, {{property.lower_camel_name}}Keywords); 26 table.Set({{property_id}}, {{property.lower_camel_name}}Keywords);
27 } 27 }
28 {% endfor %} 28 {% endfor %}
29 return table; 29 return table;
30 } 30 }
31 31
32 KeywordTable& keywordTable() { 32 KeywordTable& keywordTable() {
33 DEFINE_STATIC_LOCAL(KeywordTable, keywordTable, (createKeywordTable())); 33 DEFINE_STATIC_LOCAL(KeywordTable, keywordTable, (createKeywordTable()));
34 return keywordTable; 34 return keywordTable;
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 bool CSSOMKeywords::validKeywordForProperty(CSSPropertyID id, 39 bool CSSOMKeywords::ValidKeywordForProperty(CSSPropertyID id,
40 const CSSKeywordValue& keyword) { 40 const CSSKeywordValue& keyword) {
41 CSSValueID valueID = keyword.keywordValueID(); 41 CSSValueID valueID = keyword.KeywordValueID();
42 if (valueID == CSSValueInvalid) { 42 if (valueID == CSSValueInvalid) {
43 return false; 43 return false;
44 } 44 }
45 45
46 if (valueID == CSSValueInherit || valueID == CSSValueInitial || 46 if (valueID == CSSValueInherit || valueID == CSSValueInitial ||
47 valueID == CSSValueUnset) { 47 valueID == CSSValueUnset) {
48 // These are css-wide keywords that are valid for all properties. 48 // These are css-wide keywords that are valid for all properties.
49 return true; 49 return true;
50 } 50 }
51 51
52 const KeywordTable::iterator tableIterator = keywordTable().find(id); 52 const KeywordTable::iterator tableIterator = keywordTable().Find(id);
53 if (tableIterator == keywordTable().end()) { 53 if (tableIterator == keywordTable().end()) {
54 return false; 54 return false;
55 } 55 }
56 56
57 return tableIterator->value.contains(valueID); 57 return tableIterator->value.Contains(valueID);
58 } 58 }
59 59
60 } // namespace blink 60 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698