Bug 69406

Summary: IsShadowRootFlag should not depend on whether the ShadowRoot is attached to a host
Product: WebKit Reporter: Dominic Cooney <dominicc>
Component: DOMAssignee: Dominic Cooney <dominicc>
Status: RESOLVED FIXED    
Severity: Normal CC: dglazkov, morrita, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 69266    
Attachments:
Description Flags
Patch none

Description Dominic Cooney 2011-10-05 00:58:45 PDT
To improve performance I am proposing we use IsShadowRootFlag and isSVGShadowRoot virtual slightly differently:

getFlag(IsShadowRootFlag) => ShadowRoot or SVGShadowRoot
getFlag(IsShadowRootFlag) && !getFlag(IsSVGElementFlag) => ShadowRoot (ie new style)
getFlag(IsShadowRootFlag) && getFlag(IsSVGElementFlag) => SVGShadowRoot

This will fix a performance regression in parentNode (see bug 69266) and remove a virtual from Node (isSVGShadowRoot can just consult flags.)

One way isSVGShadowRoot and getFlag(IsShadowRootFlag) vary today is that isSVGShadowRoot is associated with the SVGShadowRoot type the vtable; it never changes for a given instance. But ShadowRoot sets and clears getFlag(IsShadowRootFlag) when a ShadowRoot is attached/detached to a host. I think this is needless variation. I think we should always set IsShadowRootFlag for ShadowRoot instances. If the caller wants to find out whether it is associated with a host, it can test null-ness of shadowHost().
Comment 1 Dominic Cooney 2011-10-05 01:16:03 PDT
Created attachment 109757 [details]
Patch
Comment 2 Hajime Morrita 2011-10-05 18:46:20 PDT
Comment on attachment 109757 [details]
Patch

Looks sane.
Comment 3 WebKit Review Bot 2011-10-05 19:26:41 PDT
Comment on attachment 109757 [details]
Patch

Clearing flags on attachment: 109757

Committed r96782: <http://trac.webkit.org/changeset/96782>
Comment 4 WebKit Review Bot 2011-10-05 19:26:45 PDT
All reviewed patches have been landed.  Closing bug.