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

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: Rebaselined Created 6 years, 2 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/CSSValueList.h ('k') | Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/StylePropertySerializer.h
diff --git a/Source/core/css/StylePropertySerializer.h b/Source/core/css/StylePropertySerializer.h
index 72647d44221721784a99ef88c6a522cfdf69dab9..94059e070b7f2aa4012856ea83df89c5cf27b20e 100644
--- a/Source/core/css/StylePropertySerializer.h
+++ b/Source/core/css/StylePropertySerializer.h
@@ -26,6 +26,8 @@
#include "core/css/CSSValueList.h"
#include "core/css/StylePropertySet.h"
+#include "wtf/BitArray.h"
+
namespace blink {
class StylePropertySet;
@@ -33,7 +35,8 @@ class StylePropertyShorthand;
class StylePropertySerializer {
public:
- StylePropertySerializer(const StylePropertySet&);
+ explicit StylePropertySerializer(const StylePropertySet&);
+
String asText() const;
String getPropertyValue(CSSPropertyID) const;
private:
@@ -52,7 +55,62 @@ private:
bool shorthandHasOnlyInitialOrInheritedValue(const StylePropertyShorthand&) const;
void appendBackgroundPropertyAsText(StringBuilder& result, unsigned& numDecls) const;
- const StylePropertySet& m_propertySet;
+ // Only StylePropertySerializer uses the following two classes.
+ class PropertyValueForSerializer {
+ public:
+ explicit PropertyValueForSerializer(StylePropertySet::PropertyReference property)
+ : m_value(property.value())
+ , m_id(property.id())
+ , m_isImportant(property.isImportant())
+ , m_isImplicit(property.isImplicit())
+ , m_isInherited(property.isInherited()) { }
+
+ PropertyValueForSerializer(CSSPropertyID id, const CSSValue* value, bool isImportant)
+ : m_value(value)
+ , m_id(id)
+ , 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:
+ const CSSValue* m_value;
+ CSSPropertyID m_id;
+ bool m_isImportant;
+ bool m_isImplicit;
+ bool m_isInherited;
+ };
+
+ class StylePropertySetForSerializer {
+ public:
+ explicit StylePropertySetForSerializer(const StylePropertySet&);
+
+ 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;
+ };
+
+ const StylePropertySetForSerializer m_propertySet;
};
} // namespace blink
« no previous file with comments | « Source/core/css/CSSValueList.h ('k') | Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698