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

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

Issue 1590193002: Partial implementation of inline StylePropertyMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maps
Patch Set: Remove spurious file Created 4 years, 9 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/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/cssom/SimpleLength.h" 8 #include "core/css/cssom/SimpleLength.h"
9 #include "core/css/cssom/StyleValue.h" 9 #include "core/css/cssom/StyleValue.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 StyleValue* StylePropertyMap::get(const String& propertyName) 13 StyleValue* StylePropertyMap::get(const String& propertyName)
14 { 14 {
15 return get(cssPropertyID(propertyName)); 15 CSSPropertyID propertyID = cssPropertyID(propertyName);
16 if (propertyID != CSSPropertyInvalid) {
17 return get(propertyID);
18 }
19 // TODO(meade): Handle custom properties here.
20 return nullptr;
16 } 21 }
17 22
18 HeapVector<Member<StyleValue>> StylePropertyMap::getAll(const String& propertyNa me) 23 HeapVector<Member<StyleValue>> StylePropertyMap::getAll(const String& propertyNa me)
19 { 24 {
20 return getAll(cssPropertyID(propertyName)); 25 CSSPropertyID propertyID = cssPropertyID(propertyName);
26 if (propertyID != CSSPropertyInvalid) {
27 return getAll(propertyID);
28 }
29 // TODO(meade): Handle custom properties here.
30 return HeapVector<Member<StyleValue>>();
21 } 31 }
22 32
23 bool StylePropertyMap::has(const String& propertyName) 33 bool StylePropertyMap::has(const String& propertyName)
24 { 34 {
25 return has(cssPropertyID(propertyName)); 35 CSSPropertyID propertyID = cssPropertyID(propertyName);
36 if (propertyID != CSSPropertyInvalid) {
37 return has(propertyID);
38 }
39 // TODO(meade): Handle custom properties here.
40 return false;
26 } 41 }
27 42
28 void StylePropertyMap::set(const String& propertyName, StyleValueOrStyleValueSeq uenceOrString& item, ExceptionState& exceptionState) 43 void StylePropertyMap::set(const String& propertyName, StyleValueOrStyleValueSeq uenceOrString& item, ExceptionState& exceptionState)
29 { 44 {
30 set(cssPropertyID(propertyName), item, exceptionState); 45 CSSPropertyID propertyID = cssPropertyID(propertyName);
46 if (propertyID != CSSPropertyInvalid) {
47 set(propertyID, item, exceptionState);
48 return;
49 }
50 // TODO(meade): Handle custom properties here.
51 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
Timothy Loh 2016/03/23 03:45:09 Why do only some of these have exceptions? Are we
meade_UTC10 2016/03/29 06:27:37 Dunno. Probably assumed that setting something tha
31 } 52 }
32 53
33 void StylePropertyMap::append(const String& propertyName, StyleValueOrStyleValue SequenceOrString& item, ExceptionState& exceptionState) 54 void StylePropertyMap::append(const String& propertyName, StyleValueOrStyleValue SequenceOrString& item, ExceptionState& exceptionState)
34 { 55 {
35 append(cssPropertyID(propertyName), item, exceptionState); 56 CSSPropertyID propertyID = cssPropertyID(propertyName);
57 if (propertyID != CSSPropertyInvalid) {
58 append(propertyID, item, exceptionState);
59 return;
60 }
61 // TODO(meade): Handle custom properties here.
62 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
36 } 63 }
37 64
38 void StylePropertyMap::remove(const String& propertyName, ExceptionState& except ionState) 65 void StylePropertyMap::remove(const String& propertyName, ExceptionState& except ionState)
39 { 66 {
40 remove(cssPropertyID(propertyName), exceptionState); 67 CSSPropertyID propertyID = cssPropertyID(propertyName);
68 if (propertyID != CSSPropertyInvalid) {
69 remove(propertyID, exceptionState);
70 return;
71 }
72 // TODO(meade): Handle custom properties here.
73 exceptionState.throwTypeError("Invalid propertyName: " + propertyName);
41 } 74 }
42 75
43 } // namespace blink 76 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698