RESOLVED FIXED Bug 76262
StyleRecalc should occur when shadow root exists and light children are changed.
https://bugs.webkit.org/show_bug.cgi?id=76262
Summary StyleRecalc should occur when shadow root exists and light children are changed.
Shinya Kawanaka
Reported 2012-01-13 02:33:12 PST
To support dynamic ShadowContentElement fallback, style recalculation should occur when children of node which has shadow tree and content element are changed. To achieve it, maybe we should add some code into Element::childrenChanged. We should measure the performance when adding code.
Attachments
Patch (15.56 KB, patch)
2012-01-19 05:29 PST, Shinya Kawanaka
no flags
Test Patch (19.05 KB, patch)
2012-01-30 18:09 PST, Shinya Kawanaka
no flags
Patch (19.03 KB, patch)
2012-02-01 00:00 PST, Shinya Kawanaka
no flags
Patch (19.86 KB, patch)
2012-02-01 16:50 PST, Shinya Kawanaka
no flags
Patch for landing (19.87 KB, patch)
2012-02-01 19:24 PST, Shinya Kawanaka
no flags
Shinya Kawanaka
Comment 1 2012-01-13 03:09:18 PST
This is a result before adding if-statement. http://dromaeo.com/?id=160729
Shinya Kawanaka
Comment 2 2012-01-13 03:14:35 PST
This is after adding if-statement. About 5% performance degrade? http://dromaeo.com/?id=160730
Shinya Kawanaka
Comment 3 2012-01-13 03:45:01 PST
I've tried a few times again. Before adding if-statement http://dromaeo.com/?id=160732 http://dromaeo.com/?id=160733 http://dromaeo.com/?id=160734 Then, I've added if (hasRareDate() && shadowRoot()) setNeedsStyleRecalc() in the last of Element::childrenChanged. After adding it, http://dromaeo.com/?id=160735 http://dromaeo.com/?id=160736 http://dromaeo.com/?id=160738 It seems adding if-statement is not harmful to performance.
Dimitri Glazkov (Google)
Comment 4 2012-01-13 07:40:20 PST
Can haz patch? :)
Shinya Kawanaka
Comment 5 2012-01-19 05:29:00 PST
WebKit Review Bot
Comment 6 2012-01-19 06:39:09 PST
Comment on attachment 123113 [details] Patch Attachment 123113 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11299091 New failing tests: fast/html/details-replace-text.html fast/html/details-remove-child-2.html fast/html/details-remove-child-1.html
Dimitri Glazkov (Google)
Comment 7 2012-01-19 09:32:37 PST
Why are details tests sad?
Shinya Kawanaka
Comment 8 2012-01-19 18:27:10 PST
(In reply to comment #7) > Why are details tests sad? Hmm... Let me check it.
Shinya Kawanaka
Comment 9 2012-01-19 23:47:36 PST
(In reply to comment #8) > (In reply to comment #7) > > Why are details tests sad? > > Hmm... > Let me check it. Some unnecessary RenderBlock exists in DETAILS block. I'm thinking we should reconsider the attach order of light children when a shadow tree exists (Bug 76611) to fix it...
Hajime Morrita
Comment 10 2012-01-19 23:59:55 PST
(In reply to comment #9) > Some unnecessary RenderBlock exists in DETAILS block. > I'm thinking we should reconsider the attach order of light children when a shadow tree exists (Bug 76611) to fix it... Yeah, let's fix Bug 76611 before this one.
Shinya Kawanaka
Comment 11 2012-01-25 23:29:44 PST
I was investigating why anonymous RenderBlock was created today. Let's consider the following. <div>foo<div>bar</div></div> This will create renderer tree like the following: RenderBlock RenderBlock (anonymous) RenderText <-- (1) RenderBlock {DIV} <-- (2) RenderText When (1) is removed, the parent RenderBlock is not deleted. If (2) is removed, the previous anonymous RenderBlock is deleted. Also, let's consider the following. <div>foo<div>bar</div>baz</div> RenderBlock RenderBlock (anonymous) RenderText RenderBlock {DIV} RenderText RenderBlock (anonymous) RenderText When foo and baz are removed, these anonymous RenderBlock won't be removed. When DIV is deleted, those anonymous RenderBlocks are merged, then removed.
Shinya Kawanaka
Comment 12 2012-01-25 23:31:39 PST
I'm now thinking left anonymous RenderBlock are not harmful at all... Can I change the test result (and create a bug to delete empty anonymous render block)? Or should I think another way?
Shinya Kawanaka
Comment 13 2012-01-26 01:50:02 PST
(In reply to comment #12) > I'm now thinking left anonymous RenderBlock are not harmful at all... > > Can I change the test result (and create a bug to delete empty anonymous render block)? > Or should I think another way? Hmm... I'm now thinking when detaching SUMMARY, anonymous RenderBlock for DETAILS should be deleted. If SUMMARY and DETAILS are DIV, anonymous RenderBlock is deleted.
Dimitri Glazkov (Google)
Comment 14 2012-01-26 09:18:41 PST
(In reply to comment #2) > This is after adding if-statement. About 5% performance degrade? > http://dromaeo.com/?id=160730 I think you need a bit more investigation here. I don't understand how DOM attributes test could be even impacted by this.
Shinya Kawanaka
Comment 15 2012-01-30 03:56:31 PST
(In reply to comment #14) > (In reply to comment #2) > > This is after adding if-statement. About 5% performance degrade? > > http://dromaeo.com/?id=160730 > > I think you need a bit more investigation here. I don't understand how DOM attributes test could be even impacted by this. OKay... (In reply to comment #14) > (In reply to comment #2) > > This is after adding if-statement. About 5% performance degrade? > > http://dromaeo.com/?id=160730 > > I think you need a bit more investigation here. I don't understand how DOM attributes test could be even impacted by this. I agree that DOM attribute test is not relevant to this. But I think DOM modification test is relevant, because childrenChanged is called when children are changed. From the test result (especially from appendChild test and insertBefore test), I don't think my patch affect performance so much.
Shinya Kawanaka
Comment 16 2012-01-30 18:09:05 PST
Created attachment 124647 [details] Test Patch
Shinya Kawanaka
Comment 17 2012-01-30 18:45:30 PST
(In reply to comment #16) > Created an attachment (id=124647) [details] > Test Patch Ah, actually this patch depends on Bug 76611...
WebKit Review Bot
Comment 18 2012-01-30 19:15:34 PST
Comment on attachment 124647 [details] Test Patch Attachment 124647 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11150498 New failing tests: fast/html/details-replace-text.html fast/html/details-remove-child-2.html fast/html/details-remove-child-1.html
Shinya Kawanaka
Comment 19 2012-02-01 00:00:44 PST
Shinya Kawanaka
Comment 20 2012-02-01 00:01:40 PST
(In reply to comment #19) > Created an attachment (id=124891) [details] > Patch Now Bug 76611 was fixed, this patch won't make tests sad...hopefully.
Hajime Morrita
Comment 21 2012-02-01 01:35:06 PST
Comment on attachment 124891 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=124891&action=review > Source/WebCore/ChangeLog:8 > + Set style recalculation flag when a child element is changed. Could you elaborate why we need this change? > Source/WebCore/dom/Element.cpp:1371 > + setNeedsStyleRecalc(); This could be shadowRoot->hostChildrenChanged().
Shinya Kawanaka
Comment 22 2012-02-01 16:50:12 PST
Hajime Morrita
Comment 23 2012-02-01 18:43:04 PST
Comment on attachment 125045 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=125045&action=review > Source/WebCore/ChangeLog:9 > + So we have to recalculate content element again. "recalculate content element" sounds strange. What we need to recompute is inclusion of that, right?
Shinya Kawanaka
Comment 24 2012-02-01 19:24:08 PST
Created attachment 125064 [details] Patch for landing
WebKit Review Bot
Comment 25 2012-02-02 18:47:21 PST
Comment on attachment 125064 [details] Patch for landing Clearing flags on attachment: 125064 Committed r106613: <http://trac.webkit.org/changeset/106613>
WebKit Review Bot
Comment 26 2012-02-02 18:47:27 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.