This is a follow up t bug 77936. userAgentShadowRoot() could have an assertion to type debug field. Also, it will make ua-shadow related code more readable.
I think Element should have this method, right? A lot of code use the following pattern shadow()->oldestShadowRoot()->... But we should be able to do: userAgentShadowRoot()->...
Created attachment 152919 [details] Patch
Comment on attachment 152919 [details] Patch Attachment 152919 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/13269368
Comment on attachment 152919 [details] Patch Attachment 152919 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/13273405
Comment on attachment 152919 [details] Patch Attachment 152919 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13277399
Created attachment 152930 [details] Patch
Comment on attachment 152930 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=152930&action=review This is much cleaner, thanks! > Source/WebCore/html/HTMLMediaElement.cpp:4185 > + if (ShadowRoot* userAgent = userAgentShadowRoot()) { > + Node* node = userAgent->firstChild(); > + return node && node->isMediaControls(); > + } Isn't it true that userAgentShadowRoot()->firstChild() *must* be the media controls? If so, I think "&& node->isMediaControls()" could be replaced with "ASSERT(node->isMediaControls())".
(In reply to comment #7) > (From update of attachment 152930 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=152930&action=review > > This is much cleaner, thanks! > > > Source/WebCore/html/HTMLMediaElement.cpp:4185 > > + if (ShadowRoot* userAgent = userAgentShadowRoot()) { > > + Node* node = userAgent->firstChild(); > > + return node && node->isMediaControls(); > > + } > > Isn't it true that userAgentShadowRoot()->firstChild() *must* be the media controls? If so, I think "&& node->isMediaControls()" could be replaced with "ASSERT(node->isMediaControls())". If firstChild() exists, it must be the media control, I believe. I'll update the patch, and if it passes tests, I'll land it.
Created attachment 153150 [details] Patch for landing
Comment on attachment 153150 [details] Patch for landing Clearing flags on attachment: 153150 Committed r123071: <http://trac.webkit.org/changeset/123071>
All reviewed patches have been landed. Closing bug.