RESOLVED FIXED 100922
[Shadow] ShadowRoot should know the existence of element having ElementShadow.
https://bugs.webkit.org/show_bug.cgi?id=100922
Summary [Shadow] ShadowRoot should know the existence of element having ElementShadow.
Shinya Kawanaka
Reported 2012-10-31 23:59:22 PDT
This is similar to https://bugs.webkit.org/show_bug.cgi?id=100921 We would like to know the existence of elements having shadow when we check the necessity of distribution invalidation.
Attachments
Patch (17.18 KB, patch)
2012-11-02 01:40 PDT, Shinya Kawanaka
no flags
Patch (17.12 KB, patch)
2012-11-04 17:47 PST, Shinya Kawanaka
no flags
Patch (16.73 KB, patch)
2012-11-06 00:46 PST, Shinya Kawanaka
no flags
Patch (16.13 KB, patch)
2012-11-06 01:23 PST, Shinya Kawanaka
no flags
Patch for landing (16.14 KB, patch)
2012-11-06 01:31 PST, Shinya Kawanaka
no flags
Shinya Kawanaka
Comment 1 2012-11-01 21:59:59 PDT
The patterns where the number of elements having shadow may be changed are: (1) An element having shadow is inserted. (2) An element having shadow is removed. (3) ShadowRoot is added to an element (4) ShadowRoot is removed from an element.
Shinya Kawanaka
Comment 2 2012-11-02 01:05:33 PDT
Actually we don't have to consider (4) case, since there is no API to remove it.
Shinya Kawanaka
Comment 3 2012-11-02 01:40:29 PDT
Shinya Kawanaka
Comment 4 2012-11-02 01:41:09 PDT
This patch will definitely be conflicted with a patch for Bug 100921.
Shinya Kawanaka
Comment 5 2012-11-04 17:47:51 PST
Hajime Morrita
Comment 6 2012-11-04 23:13:29 PST
Comment on attachment 172250 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172250&action=review > Source/WebCore/dom/Element.cpp:1061 > + if (ElementShadow* elementShadow = shadow()) { ShadowRoot also has insertedInto(). Can we move this to there? insertedInto() is relatively hot function and better to keep slim if possible. Same can be said for removedFrom().
Shinya Kawanaka
Comment 7 2012-11-04 23:19:44 PST
Comment on attachment 172250 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172250&action=review >> Source/WebCore/dom/Element.cpp:1061 >> + if (ElementShadow* elementShadow = shadow()) { > > ShadowRoot also has insertedInto(). Can we move this to there? > insertedInto() is relatively hot function and better to keep slim if possible. > Same can be said for removedFrom(). OK.
Shinya Kawanaka
Comment 8 2012-11-05 20:04:28 PST
The number of calling ShadowRoot::insertedInto and ShadowRoot::removedFrom does not seem balanced correctly... Maybe we have another bug around there?
Shinya Kawanaka
Comment 9 2012-11-06 00:46:06 PST
Hajime Morrita
Comment 10 2012-11-06 01:02:04 PST
Comment on attachment 172508 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172508&action=review > Source/WebCore/dom/ShadowRoot.cpp:263 > + // Note that host element might be being destroyed here. What is the point of this comment? > Source/WebCore/dom/ShadowRoot.h:102 > + void unregisterElementHavingShadow() { --m_numberOfElementsHavingShadow; } Let's ASSERT() the count cannot be zero. > Source/WebCore/dom/ShadowRoot.h:134 > + size_t m_numberOfElementsHavingShadow; This is basically a count of ElementShadow, is that right? If so, I'd prefer more brief name. "ElementHavingShadow" sound a bit cryptic.
Shinya Kawanaka
Comment 11 2012-11-06 01:23:28 PST
Shinya Kawanaka
Comment 12 2012-11-06 01:24:26 PST
(In reply to comment #10) > (From update of attachment 172508 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=172508&action=review > > > Source/WebCore/dom/ShadowRoot.cpp:263 > > + // Note that host element might be being destroyed here. > > What is the point of this comment? Removed. > > > Source/WebCore/dom/ShadowRoot.h:102 > > + void unregisterElementHavingShadow() { --m_numberOfElementsHavingShadow; } > > Let's ASSERT() the count cannot be zero. Added. > > > Source/WebCore/dom/ShadowRoot.h:134 > > + size_t m_numberOfElementsHavingShadow; > > This is basically a count of ElementShadow, is that right? > If so, I'd prefer more brief name. "ElementHavingShadow" sound a bit cryptic. Yes. I used m_numberOfElementShadow... I couldn't come up with better name...
Hajime Morrita
Comment 13 2012-11-06 01:26:16 PST
Comment on attachment 172514 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172514&action=review > Source/WebCore/testing/Internals.cpp:332 > + ec = INVALID_ACCESS_ERR; Let's take check-error-then do happy path pattern. Pushing error path to late is unusual thus confusing.
Shinya Kawanaka
Comment 14 2012-11-06 01:31:18 PST
Created attachment 172518 [details] Patch for landing
WebKit Review Bot
Comment 15 2012-11-06 02:15:32 PST
Comment on attachment 172518 [details] Patch for landing Clearing flags on attachment: 172518 Committed r133575: <http://trac.webkit.org/changeset/133575>
WebKit Review Bot
Comment 16 2012-11-06 02:15:36 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.