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

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

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and review changes Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/PropertySetCSSStyleDeclaration.cpp ('k') | Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/StylePropertySet.h
diff --git a/Source/core/css/StylePropertySet.h b/Source/core/css/StylePropertySet.h
index 8e9c913568e04c9741be2b1f0a5ec6b577769a8f..81b5ad1afd10dcd69aa53b2a8d5e053e698ac36f 100644
--- a/Source/core/css/StylePropertySet.h
+++ b/Source/core/css/StylePropertySet.h
@@ -25,6 +25,7 @@
#include "core/css/CSSParserMode.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSProperty.h"
+#include "core/css/CSSVariablesIterator.h"
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "wtf/ListHashSet.h"
#include "wtf/Vector.h"
@@ -174,6 +175,7 @@ inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() c
class MutableStylePropertySet : public StylePropertySet {
public:
+ ~MutableStylePropertySet() { }
static PassRefPtr<MutableStylePropertySet> create(CSSParserMode = CSSQuirksMode);
static PassRefPtr<MutableStylePropertySet> create(const CSSProperty* properties, unsigned count);
@@ -204,6 +206,8 @@ public:
bool removeVariable(const AtomicString& name);
bool clearVariables();
+ PassRefPtr<CSSVariablesIterator> variablesIterator() { return VariablesIterator::create(this); }
+
void mergeAndOverrideOnConflict(const StylePropertySet*);
void clear();
@@ -215,6 +219,26 @@ public:
Vector<CSSProperty, 4> m_propertyVector;
private:
+ class VariablesIterator : public CSSVariablesIterator {
+ public:
+ virtual ~VariablesIterator() { }
+ static PassRefPtr<VariablesIterator> create(MutableStylePropertySet*);
+ private:
+ explicit VariablesIterator(MutableStylePropertySet* propertySet) : m_propertySet(propertySet) { }
+ void takeRemainingNames(Vector<AtomicString>& remainingNames) { m_remainingNames.swap(remainingNames); }
+ virtual void advance() OVERRIDE;
+ virtual bool atEnd() const OVERRIDE { return m_remainingNames.isEmpty(); }
+ virtual AtomicString name() const OVERRIDE { return m_remainingNames.last(); }
+ virtual String value() const OVERRIDE { return m_propertySet->variableValue(name()); }
+ virtual void addedVariable(const AtomicString& name) OVERRIDE;
+ virtual void removedVariable(const AtomicString& name) OVERRIDE;
+ virtual void clearedVariables() OVERRIDE;
+
+ RefPtr<MutableStylePropertySet> m_propertySet;
+ Vector<AtomicString> m_remainingNames;
+ Vector<AtomicString> m_newNames;
+ };
+
explicit MutableStylePropertySet(CSSParserMode);
explicit MutableStylePropertySet(const StylePropertySet&);
MutableStylePropertySet(const CSSProperty* properties, unsigned count);
« no previous file with comments | « Source/core/css/PropertySetCSSStyleDeclaration.cpp ('k') | Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698