Bug 87223 - [Shadow DOM] Node distribution should be orthogonal from node attachment
Summary: [Shadow DOM] Node distribution should be orthogonal from node attachment
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hajime Morrita
URL:
Keywords:
Depends on: 87608 87617
Blocks: 85263
  Show dependency treegraph
 
Reported: 2012-05-23 00:23 PDT by Hajime Morrita
Modified: 2012-05-29 20:33 PDT (History)
5 users (show)

See Also:


Attachments
WIP: passes tests (31.85 KB, patch)
2012-05-25 01:23 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
Patch (34.08 KB, patch)
2012-05-28 04:15 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
Patch (34.21 KB, patch)
2012-05-28 17:50 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
Fixing win build (34.19 KB, patch)
2012-05-28 20:42 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
Patch for landing (34.20 KB, patch)
2012-05-29 17:31 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hajime Morrita 2012-05-23 00:23:26 PDT
We are computing node distribution during node attachment, which is horrible.
It should be orthogonal concept and should be able to happen independently.
Comment 1 Hajime Morrita 2012-05-25 01:23:36 PDT
Created attachment 144000 [details]
WIP: passes tests
Comment 2 Hajime Morrita 2012-05-25 01:24:54 PDT
I'm not ultra confident whether this lazy approach is better.
Maybe it's better to keep the structure fresh.
Comment 3 Early Warning System Bot 2012-05-25 01:30:26 PDT
Comment on attachment 144000 [details]
WIP: passes tests

Attachment 144000 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12801394
Comment 4 Early Warning System Bot 2012-05-25 01:33:02 PDT
Comment on attachment 144000 [details]
WIP: passes tests

Attachment 144000 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12808301
Comment 5 Gyuyoung Kim 2012-05-25 01:33:48 PDT
Comment on attachment 144000 [details]
WIP: passes tests

Attachment 144000 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12807374
Comment 6 WebKit Review Bot 2012-05-25 01:37:57 PDT
Comment on attachment 144000 [details]
WIP: passes tests

Attachment 144000 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12803404
Comment 7 Build Bot 2012-05-25 01:38:55 PDT
Comment on attachment 144000 [details]
WIP: passes tests

Attachment 144000 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12793407
Comment 8 Build Bot 2012-05-25 01:45:33 PDT
Comment on attachment 144000 [details]
WIP: passes tests

Attachment 144000 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12791459
Comment 9 Dimitri Glazkov (Google) 2012-05-25 08:44:15 PDT
Comment on attachment 144000 [details]
WIP: passes tests

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

I will need to re-read this patch several times to really understand all the stuff that's happening. I like the direction and encourage you to continue your work.

> Source/WebCore/dom/Element.cpp:136
> +        elementShadow->removeAllShadowRoots();

Curious why you decided to split this off from destructor.

> Source/WebCore/html/HTMLFormControlElement.cpp:-75
> -    m_validationMessage = nullptr;

Can this change be split off into a separate patch?

> Source/WebCore/html/shadow/ContentDistributor.h:54
> +        Dated = 1,
> +        Spoiling = 2,

What do these two mean?
Comment 10 Hajime Morrita 2012-05-27 17:29:56 PDT
Hi Dimitri, Thanks for taking a look!
I'll update the patch with more detailed explanation on its ChangeLog entry.

(In reply to comment #9)
> (From update of attachment 144000 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=144000&action=review
> 
> I will need to re-read this patch several times to really understand all the stuff that's happening. I like the direction and encourage you to continue your work.
> 
> > Source/WebCore/dom/Element.cpp:136
> > +        elementShadow->removeAllShadowRoots();
> 
> Curious why you decided to split this off from destructor.
That's because InsertionPoint::detach(), which is called during this,
now touches its ascendants. But the shadow root is already disconnected 
from the host at the point of the destructor. 
We need to give a change to insertion point to notify its removal to the host,
to invalidate the distribution.

> 
> > Source/WebCore/html/HTMLFormControlElement.cpp:-75
> > -    m_validationMessage = nullptr;
> 
> Can this change be split off into a separate patch?
Sure. I have no intention to land this patch at once.

> 
> > Source/WebCore/html/shadow/ContentDistributor.h:54
> > +        Dated = 1,
> > +        Spoiling = 2,
> 
> What do these two mean?
Wel... Dated should be Invalid, and Spoiling could be Invalidating....
We need to distinguish these two because 
a tree-detach after invalidation can trigger ensureDistribution().
which we need to prevent. "Spoiling" (should be Invalidating) state lets the caller know 
the distribution is under invalidation and it shouldn't re-distribute there.
Comment 11 Hajime Morrita 2012-05-28 04:15:56 PDT
Created attachment 144327 [details]
Patch
Comment 12 Build Bot 2012-05-28 04:41:58 PDT
Comment on attachment 144327 [details]
Patch

Attachment 144327 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12844198
Comment 13 Build Bot 2012-05-28 04:42:07 PDT
Comment on attachment 144327 [details]
Patch

Attachment 144327 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12851143
Comment 14 WebKit Review Bot 2012-05-28 04:42:26 PDT
Comment on attachment 144327 [details]
Patch

Attachment 144327 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12842180
Comment 15 Early Warning System Bot 2012-05-28 04:45:26 PDT
Comment on attachment 144327 [details]
Patch

Attachment 144327 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12843191
Comment 16 Early Warning System Bot 2012-05-28 04:47:44 PDT
Comment on attachment 144327 [details]
Patch

Attachment 144327 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12841231
Comment 17 Gyuyoung Kim 2012-05-28 04:55:55 PDT
Comment on attachment 144327 [details]
Patch

Attachment 144327 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12845213
Comment 18 Hajime Morrita 2012-05-28 17:50:46 PDT
Created attachment 144415 [details]
Patch
Comment 19 Build Bot 2012-05-28 18:14:06 PDT
Comment on attachment 144415 [details]
Patch

Attachment 144415 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12852270
Comment 20 Hajime Morrita 2012-05-28 20:42:29 PDT
Created attachment 144436 [details]
Fixing win build
Comment 21 Dimitri Glazkov (Google) 2012-05-29 10:01:57 PDT
Comment on attachment 144436 [details]
Fixing win build

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

This is a much cleaner design! I looked over the code a few times, and it seems to be workable. Let's give it a spin.

> Source/WebCore/ChangeLog:14
> +        This change extracts these code to a set of ContentDistributor methods, which are

"these code" is awkward. Maybe "these bits of code"?

> Source/WebCore/ChangeLog:30
> +        Here is such DOM mutations:

"Here are"
Comment 22 Hajime Morrita 2012-05-29 17:31:28 PDT
Thanks for reviewing this big chunk!
I'll land this after recovering from the syntax error ;-)
Comment 23 Hajime Morrita 2012-05-29 17:31:49 PDT
Created attachment 144655 [details]
Patch for landing
Comment 24 WebKit Review Bot 2012-05-29 20:33:37 PDT
Comment on attachment 144655 [details]
Patch for landing

Clearing flags on attachment: 144655

Committed r118886: <http://trac.webkit.org/changeset/118886>
Comment 25 WebKit Review Bot 2012-05-29 20:33:43 PDT
All reviewed patches have been landed.  Closing bug.