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

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

Issue 341033003: StylePropertySerializer should expand all property if needed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
Index: Source/core/css/StylePropertySerializer.h
diff --git a/Source/core/css/StylePropertySerializer.h b/Source/core/css/StylePropertySerializer.h
index 1e61bc687f458f2988f0b6605af1749a720b465f..1fcd4018c098410b000b74fcf97f2dada54c3d9d 100644
--- a/Source/core/css/StylePropertySerializer.h
+++ b/Source/core/css/StylePropertySerializer.h
@@ -25,11 +25,66 @@
#include "core/css/CSSValueList.h"
#include "core/css/StylePropertySet.h"
+#include "wtf/BitArray.h"
namespace blink {
class StylePropertySet;
+class PropertyValueForSerializer {
esprehn 2014/09/02 19:41:57 Put this in its own file.
tasak 2014/09/04 06:08:38 I put this into class StylePropertySerializer, bec
+public:
+ PropertyValueForSerializer(StylePropertySet::PropertyReference property)
esprehn 2014/09/02 19:41:56 explicit
tasak 2014/09/04 06:08:38 Done.
+ : m_id(property.id())
+ , m_value(property.value())
+ , m_isImportant(property.isImportant())
+ , m_isImplicit(property.isImplicit())
+ , m_isInherited(property.isInherited()) { }
+
+ PropertyValueForSerializer(CSSPropertyID id, const CSSValue* value, bool isImportant)
+ : m_id(id)
+ , m_value(value)
+ , m_isImportant(isImportant)
+ , m_isImplicit(value->isImplicitInitialValue())
+ , m_isInherited(value->isInheritedValue()) { }
+
+ CSSPropertyID id() const { return m_id; }
+ const CSSValue* value() const { return m_value; }
+ bool isImportant() const { return m_isImportant; }
+ bool isImplicit() const { return m_isImplicit; }
+ bool isInherited() const { return m_isInherited; }
+ bool isValid() const { return m_value; }
+
+private:
+ CSSPropertyID m_id;
rune 2014/09/02 20:13:17 I think I would've put this member below m_value a
tasak 2014/09/04 06:08:38 Done.
+ const CSSValue* m_value;
+ bool m_isImportant;
+ bool m_isImplicit;
+ bool m_isInherited;
+};
+
+class StylePropertySetForSerializer {
esprehn 2014/09/02 19:41:57 ditto
tasak 2014/09/04 06:08:38 I put this into class StylePropertySerializer too.
+public:
+ StylePropertySetForSerializer(const StylePropertySet&);
esprehn 2014/09/02 19:41:57 explicit
tasak 2014/09/04 06:08:38 Done.
+
+ unsigned propertyCount() const;
+ PropertyValueForSerializer propertyAt(unsigned index) const;
+ bool shouldProcessPropertyAt(unsigned index) const;
+ int findPropertyIndex(CSSPropertyID) const;
+ const CSSValue* getPropertyCSSValue(CSSPropertyID) const;
+ String getPropertyValue(CSSPropertyID) const;
+ bool isPropertyImplicit(CSSPropertyID) const;
+ bool propertyIsImportant(CSSPropertyID) const;
+
+private:
+ bool hasExpandedAllProperty() const { return hasAllProperty() && m_needToExpandAll; }
+ bool hasAllProperty() const { return m_allIndex != -1; }
+
+ const StylePropertySet& m_propertySet;
+ int m_allIndex;
+ BitArray<numCSSProperties> m_longhandPropertyUsed;
+ bool m_needToExpandAll;
+};
+
class StylePropertySerializer {
public:
StylePropertySerializer(const StylePropertySet&);
@@ -51,7 +106,7 @@ private:
bool shorthandHasOnlyInitialOrInheritedValue(const StylePropertyShorthand&) const;
void appendBackgroundPropertyAsText(StringBuilder& result, unsigned& numDecls) const;
- const StylePropertySet& m_propertySet;
+ const StylePropertySetForSerializer m_propertySet;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698