We often use ensureShadowRoot, but most of them are not necessary, because a shadow root is created in Something::create method. If we can remove it, the code can be much clearer when supporting multiple shadow trees.
ensureShadowRoot makes the life cycle of shadow root confusing. Most of shadow roots are created near the constructor, so let's remove it to make the life cycle of shadow root understanding.
Let me mention that INPUT and MEDIA may create their shadow root in the non-constructor phase. So when adding shadow root to these elements, we should be careful.
SVG and ValidationMessage also create shadow root in non-constructor phase...
To support Shadow DOM for all the elements, this should be fixed immediately...
Created attachment 157101 [details] Patch
Comment on attachment 157101 [details] Patch Yay! Less code.
Comment on attachment 157101 [details] Patch Clearing flags on attachment: 157101 Committed r125007: <http://trac.webkit.org/changeset/125007>
All reviewed patches have been landed. Closing bug.