The element (StyledElement, to be precise) pointer in CSSMutableStyleDeclaration is really only needed by inline and mapped style declarations. We should factor this out somehow, to reduce the size and complexity of vanilla declarations.
Created attachment 116599 [details] Proposed patch First stab at this: move the element pointer to a CSSElementStyleDeclaration subclass (thin, lives next to CSSMutableStyleDeclaration) and let CSSMappedAttributeDeclaration inherit from it along with the new CSSInlineStyleDeclaration class.
Comment on attachment 116599 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=116599&action=review r=me, nice! > Source/WebCore/css/CSSMutableStyleDeclaration.cpp:615 > + if (isElementStyleDeclaration() && static_cast<CSSElementStyleDeclaration*>(this)->element()) { > + StyledElement* element = static_cast<CSSElementStyleDeclaration*>(this)->element(); This could could live in CSSElementStyleDeclaration > Source/WebCore/css/CSSMutableStyleDeclaration.h:179 > > +class CSSElementStyleDeclaration : public CSSMutableStyleDeclaration { > +public: This should probably have a file of its own at some point. > Source/WebCore/css/CSSStyleDeclaration.h:124 > + // CSSElementStyleDeclaration bits: > + bool m_isElementStyleDeclaration : 1; > + bool m_isInlineStyleDeclaration : 1; Type enum would be another alternative. It might read slightly better in some places (like where the inline bit is passed down in constructor).
Committed r101172: <http://trac.webkit.org/changeset/101172>
This caused https://bugs.webkit.org/show_bug.cgi?id=73213
(In reply to comment #4) > This caused https://bugs.webkit.org/show_bug.cgi?id=73213 and https://bugs.webkit.org/show_bug.cgi?id=73227