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

Unified Diff: third_party/WebKit/Source/core/css/StylePropertySet.h

Issue 1405293012: [Variables] Enable get/setProperty and similar APIs from the CSSOM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/StylePropertySet.h
diff --git a/third_party/WebKit/Source/core/css/StylePropertySet.h b/third_party/WebKit/Source/core/css/StylePropertySet.h
index e88b4eea4a61d500af6a11c96115b6f85d132e77..951a63a29fd760d533dd226f1a89ff758308e874 100644
--- a/third_party/WebKit/Source/core/css/StylePropertySet.h
+++ b/third_party/WebKit/Source/core/css/StylePropertySet.h
@@ -23,6 +23,7 @@
#include "core/CSSPropertyNames.h"
#include "core/CoreExport.h"
+#include "core/css/CSSCustomPropertyDeclaration.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSProperty.h"
#include "core/css/PropertySetCSSStyleDeclaration.h"
@@ -91,12 +92,16 @@ public:
bool isEmpty() const;
PropertyReference propertyAt(unsigned index) const { return PropertyReference(*this, index); }
int findPropertyIndex(CSSPropertyID) const;
+ int findCustomPropertyIndex(const AtomicString& propertyName) const;
bool hasProperty(CSSPropertyID property) const { return findPropertyIndex(property) != -1; }
PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const;
+ PassRefPtrWillBeRawPtr<CSSCustomPropertyDeclaration> getCustomPropertyCSSValue(const AtomicString&) const;
String getPropertyValue(CSSPropertyID) const;
+ String getCustomPropertyValue(const AtomicString&) const;
bool propertyIsImportant(CSSPropertyID) const;
+ bool customPropertyIsImportant(const AtomicString&) const;
CSSPropertyID getPropertyShorthand(CSSPropertyID) const;
bool isPropertyImplicit(CSSPropertyID) const;
@@ -157,6 +162,7 @@ public:
const RawPtrWillBeMember<CSSValue>* valueArray() const;
const StylePropertyMetadata* metadataArray() const;
int findPropertyIndex(CSSPropertyID) const;
+ int findCustomPropertyIndex(const AtomicString& propertyName) const;
DECLARE_TRACE_AFTER_DISPATCH();
@@ -198,12 +204,14 @@ public:
// These expand shorthand properties into multiple properties.
bool setProperty(CSSPropertyID unresolvedProperty, const String& value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
void setProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool important = false);
+ bool setCustomProperty(const AtomicString& propertyName, const String& value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
// These do not. FIXME: This is too messy, we can do better.
bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = false);
bool setProperty(const CSSProperty&, CSSProperty* slot = 0);
bool removeProperty(CSSPropertyID, String* returnText = 0);
+ bool removeCustomProperty(const AtomicString&, String* returnText = 0);
bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
void removeEquivalentProperties(const StylePropertySet*);
void removeEquivalentProperties(const CSSStyleDeclaration*);
@@ -215,6 +223,7 @@ public:
CSSStyleDeclaration* ensureCSSStyleDeclaration();
int findPropertyIndex(CSSPropertyID) const;
+ int findCustomPropertyIndex(const AtomicString& propertyName) const;
DECLARE_TRACE_AFTER_DISPATCH();
@@ -223,6 +232,8 @@ private:
explicit MutableStylePropertySet(const StylePropertySet&);
MutableStylePropertySet(const CSSProperty* properties, unsigned count);
+ bool removePropertyAtIndex(int, String* returnText);
+
bool removeShorthandProperty(CSSPropertyID);
CSSProperty* findCSSPropertyWithID(CSSPropertyID);
OwnPtrWillBeMember<PropertySetCSSStyleDeclaration> m_cssomWrapper;
@@ -295,6 +306,13 @@ inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const
return toImmutableStylePropertySet(this)->findPropertyIndex(propertyID);
}
+inline int StylePropertySet::findCustomPropertyIndex(const AtomicString& propertyName) const
+{
+ if (m_isMutable)
+ return toMutableStylePropertySet(this)->findCustomPropertyIndex(propertyName);
+ return toImmutableStylePropertySet(this)->findCustomPropertyIndex(propertyName);
+}
+
} // namespace blink
#endif // StylePropertySet_h

Powered by Google App Engine
This is Rietveld 408576698