Bug 149187 - Add ShadowRoot interface and Element.prototype.attachShadow
Summary: Add ShadowRoot interface and Element.prototype.attachShadow
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 149230
  Show dependency treegraph
 
Reported: 2015-09-15 15:04 PDT by Ryosuke Niwa
Modified: 2015-09-19 01:31 PDT (History)
7 users (show)

See Also:


Attachments
Adds the interface and method (85.26 KB, patch)
2015-09-15 15:22 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Updated per Antti's comment (92.97 KB, patch)
2015-09-15 17:04 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (93.54 KB, patch)
2015-09-15 17:33 PDT, Ryosuke Niwa
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-mavericks-wk2 (908.04 KB, application/zip)
2015-09-15 18:41 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-mavericks (658.04 KB, application/zip)
2015-09-15 19:22 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-09-15 15:04:17 PDT
Add the new ShadowRoot interface and Element.prototype.attachShadow behind a build flag.
Comment 1 Ryosuke Niwa 2015-09-15 15:22:23 PDT
Created attachment 261248 [details]
Adds the interface and method
Comment 2 Antti Koivisto 2015-09-15 15:36:19 PDT
Comment on attachment 261248 [details]
Adds the interface and method

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

> Source/WebCore/dom/Element.cpp:1665
> +    ShadowRoot::EncapsulationMode encapsulationMode = ShadowRoot::EncapsulationMode::Closed;

auto encapsulationMode =

> Source/WebCore/dom/ShadowRoot.h:46
>      enum ShadowRootType {
>          UserAgentShadowRoot = 0,
> +        AuthorShadowRoot = 1,
>      };

Enum class would be nice here too:

enum class ShadowRootType : uint8_t { UserAgent, Author };

> Source/WebCore/dom/ShadowRoot.h:93
>      unsigned m_resetStyleInheritance : 1;
>      unsigned m_type : 1;
> +    unsigned m_encapsulationMode : 1;

We could just use enums instead of bitfields. If you make enum classes uint8_t there is no size difference and there is probably no need to super-optimize shadow root size anyway.
Comment 3 Antti Koivisto 2015-09-15 15:36:28 PDT
r=me
Comment 4 Antti Koivisto 2015-09-15 15:38:00 PDT
Comment on attachment 261248 [details]
Adds the interface and method

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

>> Source/WebCore/dom/ShadowRoot.h:46
>>      };
> 
> Enum class would be nice here too:
> 
> enum class ShadowRootType : uint8_t { UserAgent, Author };

Actually just

enum class Type : uint8_t { UserAgent, Author }; 

since we are in ShadowRoot scope already.
Comment 5 Ryosuke Niwa 2015-09-15 17:04:07 PDT
Created attachment 261265 [details]
Updated per Antti's comment
Comment 6 Antti Koivisto 2015-09-15 17:10:56 PDT
Comment on attachment 261265 [details]
Updated per Antti's comment

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

> Source/WebCore/dom/ShadowRoot.h:86
>      unsigned m_resetStyleInheritance : 1;

This could a bool.
Comment 7 Ryosuke Niwa 2015-09-15 17:33:27 PDT
Created attachment 261269 [details]
Patch for landing
Comment 8 Ryosuke Niwa 2015-09-15 17:33:49 PDT
Comment on attachment 261269 [details]
Patch for landing

I'm gonna wait for EWS.
Comment 9 Build Bot 2015-09-15 18:41:45 PDT
Comment on attachment 261269 [details]
Patch for landing

Attachment 261269 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/174961

New failing tests:
js/dom/constructor-length.html
js/dom/dom-static-property-for-in-iteration.html
js/dom/global-constructors-attributes.html
Comment 10 Build Bot 2015-09-15 18:41:49 PDT
Created attachment 261278 [details]
Archive of layout-test-results from ews106 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 11 Build Bot 2015-09-15 19:22:04 PDT
Comment on attachment 261269 [details]
Patch for landing

Attachment 261269 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/175023

New failing tests:
js/dom/constructor-length.html
js/dom/dom-static-property-for-in-iteration.html
js/dom/global-constructors-attributes.html
Comment 12 Build Bot 2015-09-15 19:22:07 PDT
Created attachment 261282 [details]
Archive of layout-test-results from ews101 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 13 Ryosuke Niwa 2015-09-15 19:41:05 PDT
Committed r189841: <http://trac.webkit.org/changeset/189841>
Comment 14 Alexey Proskuryakov 2015-09-15 23:53:42 PDT
Could you please update Mavericks results for js/dom/global-constructors-attributes.html ?

https://build.webkit.org/results/Apple%20Mavericks%20Release%20WK2%20(Tests)/r189845%20(17187)/js/dom/global-constructors-attributes-diff.txt
Comment 15 Ryosuke Niwa 2015-09-16 00:14:51 PDT
(In reply to comment #14)
> Could you please update Mavericks results for
> js/dom/global-constructors-attributes.html ?
> 
> https://build.webkit.org/results/Apple%20Mavericks%20Release%20WK2%20(Tests)/
> r189845%20(17187)/js/dom/global-constructors-attributes-diff.txt

Oops, sorry. I missed that. Rebaselined it in http://trac.webkit.org/changeset/189852.
Comment 16 Alexey Proskuryakov 2015-09-16 09:02:13 PDT
More test result updating in r189865 (for El Capitan). I hate these mega-tests.
Comment 17 Jake Nielsen 2015-09-18 13:56:04 PDT
Updated iOS results expectations in r189980