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

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

Issue 2054633002: [Typed OM] Implement FilteredComputedStylePropertyMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CORE_EXPORT FilteredCSPMap Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/StylePropertyMap.h" 5 #include "core/css/cssom/StylePropertyMap.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/css/CSSValueList.h" 8 #include "core/css/CSSValueList.h"
9 #include "core/css/cssom/CSSSimpleLength.h" 9 #include "core/css/cssom/CSSSimpleLength.h"
10 #include "core/css/cssom/CSSStyleValue.h" 10 #include "core/css/cssom/CSSStyleValue.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 CSSStyleValue* StylePropertyMap::get(const String& propertyName, ExceptionState& exceptionState) 49 CSSStyleValue* StylePropertyMap::get(const String& propertyName, ExceptionState& exceptionState)
50 { 50 {
51 CSSPropertyID propertyID = cssPropertyID(propertyName); 51 CSSPropertyID propertyID = cssPropertyID(propertyName);
52 if (propertyID == CSSPropertyInvalid) { 52 if (propertyID == CSSPropertyInvalid) {
53 // TODO(meade): Handle custom properties here. 53 // TODO(meade): Handle custom properties here.
54 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); 54 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
55 return nullptr; 55 return nullptr;
56 } 56 }
57 57
58 CSSStyleValueVector styleVector = getAll(propertyID); 58 CSSStyleValueVector styleVector = getAllInternal(propertyID);
59 if (styleVector.isEmpty()) 59 if (styleVector.isEmpty())
60 return nullptr; 60 return nullptr;
61 61
62 return styleVector[0]; 62 return styleVector[0];
63 } 63 }
64 64
65 CSSStyleValueVector StylePropertyMap::getAll(const String& propertyName, Excepti onState& exceptionState) 65 CSSStyleValueVector StylePropertyMap::getAll(const String& propertyName, Excepti onState& exceptionState)
66 { 66 {
67 CSSPropertyID propertyID = cssPropertyID(propertyName); 67 CSSPropertyID propertyID = cssPropertyID(propertyName);
68 if (propertyID != CSSPropertyInvalid) 68 if (propertyID != CSSPropertyInvalid)
69 return getAll(propertyID); 69 return getAllInternal(propertyID);
70 70
71 // TODO(meade): Handle custom properties here. 71 // TODO(meade): Handle custom properties here.
72 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); 72 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
73 return CSSStyleValueVector(); 73 return CSSStyleValueVector();
74 } 74 }
75 75
76 bool StylePropertyMap::has(const String& propertyName, ExceptionState& exception State) 76 bool StylePropertyMap::has(const String& propertyName, ExceptionState& exception State)
77 { 77 {
78 CSSPropertyID propertyID = cssPropertyID(propertyName); 78 CSSPropertyID propertyID = cssPropertyID(propertyName);
79 if (propertyID != CSSPropertyInvalid) 79 if (propertyID != CSSPropertyInvalid)
80 return !getAll(propertyID).isEmpty(); 80 return !getAllInternal(propertyID).isEmpty();
81 81
82 // TODO(meade): Handle custom properties here. 82 // TODO(meade): Handle custom properties here.
83 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); 83 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
84 return false; 84 return false;
85 } 85 }
86 86
87 void StylePropertyMap::set(const String& propertyName, CSSStyleValueOrCSSStyleVa lueSequenceOrString& item, ExceptionState& exceptionState) 87 void StylePropertyMap::set(const String& propertyName, CSSStyleValueOrCSSStyleVa lueSequenceOrString& item, ExceptionState& exceptionState)
88 { 88 {
89 CSSPropertyID propertyID = cssPropertyID(propertyName); 89 CSSPropertyID propertyID = cssPropertyID(propertyName);
90 if (propertyID != CSSPropertyInvalid) { 90 if (propertyID != CSSPropertyInvalid) {
(...skipping 25 matching lines...) Expand all
116 // TODO(meade): Handle custom properties here. 116 // TODO(meade): Handle custom properties here.
117 exceptionState.throwTypeError("Invalid propertyName: " + propertyName); 117 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
118 } 118 }
119 119
120 StylePropertyMap::IterationSource* StylePropertyMap::startIteration(ScriptState* , ExceptionState&) 120 StylePropertyMap::IterationSource* StylePropertyMap::startIteration(ScriptState* , ExceptionState&)
121 { 121 {
122 return new StylePropertyMapIterationSource(getIterationEntries()); 122 return new StylePropertyMapIterationSource(getIterationEntries());
123 } 123 }
124 124
125 } // namespace blink 125 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698