Bug 73121

Summary: Factor element pointer out of CSSMutableStyleDeclaration.
Product: WebKit Reporter: Andreas Kling <kling>
Component: CSSAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: koivisto, macpherson, ossy, rafaelw, vsevik
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 73227    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch koivisto: review+

Andreas Kling
Reported 2011-11-25 03:53:33 PST
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.
Attachments
Proposed patch (25.66 KB, patch)
2011-11-25 04:42 PST, Andreas Kling
koivisto: review+
Andreas Kling
Comment 1 2011-11-25 04:42:18 PST
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.
Antti Koivisto
Comment 2 2011-11-25 05:11:36 PST
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).
Andreas Kling
Comment 3 2011-11-25 06:57:55 PST
Vsevolod Vlasov
Comment 4 2011-11-28 06:23:13 PST
Csaba Osztrogonác
Comment 5 2011-11-29 07:23:58 PST
Note You need to log in before you can comment on or make changes to this bug.