Bug 100921 - [Shadow] ShadowRoot should be able to know the existence of <content>
Summary: [Shadow] ShadowRoot should be able to know the existence of <content>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shinya Kawanaka
URL:
Keywords:
Depends on:
Blocks: 100451
  Show dependency treegraph
 
Reported: 2012-10-31 23:57 PDT by Shinya Kawanaka
Modified: 2012-11-02 23:40 PDT (History)
2 users (show)

See Also:


Attachments
Patch (13.04 KB, patch)
2012-11-01 00:16 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (14.06 KB, patch)
2012-11-01 19:15 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch for landing (13.89 KB, patch)
2012-11-02 22:57 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shinya Kawanaka 2012-10-31 23:57:38 PDT
We would like to check whether we have to invalidate distribution when element attribute is changed.
If we know the non-existence of <content>, we can skip traversing the descendants of ShadowRoot to check invalidation necessity.

Larger context is: https://bugs.webkit.org/show_bug.cgi?id=100451
Comment 1 Shinya Kawanaka 2012-11-01 00:02:08 PDT
We will be able to speed up ShadowRoot::hasInsertionPoint() maybe?
Comment 2 Shinya Kawanaka 2012-11-01 00:16:37 PDT
Created attachment 171786 [details]
Patch
Comment 3 Hajime Morrita 2012-11-01 03:22:12 PDT
Comment on attachment 171786 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=171786&action=review

> Source/WebCore/html/shadow/HTMLContentElement.cpp:104
> +        if (ShadowRoot* root = shadowRoot()) {

Can this be null?

> Source/WebCore/html/shadow/HTMLContentElement.cpp:118
> +            root = insertionPoint->shadowRoot();

I don't have confident but this seems wrong. 
insertionPoint can come from outside the shadow subtree. 
Coud you add tests to cover nested shadow subtree case?
Comment 4 Shinya Kawanaka 2012-11-01 18:32:12 PDT
Comment on attachment 171786 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=171786&action=review

>> Source/WebCore/html/shadow/HTMLContentElement.cpp:118
>> +            root = insertionPoint->shadowRoot();
> 
> I don't have confident but this seems wrong. 
> insertionPoint can come from outside the shadow subtree. 
> Coud you add tests to cover nested shadow subtree case?

Let me check. In that case, <shadow> might have the same bug.
Comment 5 Shinya Kawanaka 2012-11-01 19:11:16 PDT
I've confirmed that insertionPoint can be from the outside of shadow tree.
But in that case, shadowRoot() returns non-null value.

I think this code works as expected, but it's confusing.
Comment 6 Shinya Kawanaka 2012-11-01 19:13:00 PDT
I mean: when node is removed from ShadowTree, shadowRoot() return null, since we cannot reach ShadowRoot by moving parent-side. Otherwise, we can reach shadowRoot(), so it's OK.
Comment 7 Shinya Kawanaka 2012-11-01 19:14:22 PDT
(In reply to comment #3)
> (From update of attachment 171786 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=171786&action=review
> 
> > Source/WebCore/html/shadow/HTMLContentElement.cpp:104
> > +        if (ShadowRoot* root = shadowRoot()) {
> 
> Can this be null?
> 

Since it's active, this should not be null. Thanks.
Comment 8 Shinya Kawanaka 2012-11-01 19:15:33 PDT
Created attachment 171972 [details]
Patch
Comment 9 WebKit Review Bot 2012-11-02 10:21:24 PDT
Comment on attachment 171972 [details]
Patch

Rejecting attachment 171972 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
webkit-commit-queue/Source/WebKit/chromium/webkit --revision 165669 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
51>At revision 165669.

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/14670881
Comment 10 Shinya Kawanaka 2012-11-02 22:57:26 PDT
Created attachment 172209 [details]
Patch for landing
Comment 11 WebKit Review Bot 2012-11-02 23:40:40 PDT
Comment on attachment 172209 [details]
Patch for landing

Clearing flags on attachment: 172209

Committed r133392: <http://trac.webkit.org/changeset/133392>
Comment 12 WebKit Review Bot 2012-11-02 23:40:44 PDT
All reviewed patches have been landed.  Closing bug.