Title: [201739] trunk
Revision
201739
Author
[email protected]
Date
2016-06-06 21:02:11 -0700 (Mon, 06 Jun 2016)

Log Message

Update the list of elements attachShadow is allowed
https://bugs.webkit.org/show_bug.cgi?id=157706

Reviewed by Darin Adler.

Source/WebCore:

Update the list of elements on which attachShadow is allowed per the latest shadow DOM spec:
http://www.w3.org/TR/shadow-dom/#widl-Element-attachShadow-ShadowRoot-ShadowRootInit-shadowRootInitDict
which now only allows attachShadow on the following elements and custom elements:
button, details, input, marquee, meter, progress, select, textarea, keygen

In order to check that a given HTML element's local name is a valid custom element name,
this patch moves CustomElementDefinitions::checkName to Document::validateCustomElementName so that
it could be used when either SHADOW_DOM or CUSTOM_ELEMENTS build flag is turned on.

Also removed Element::canHaveUserAgentShadowRoot since it was only used in Element::attachShadow.

Test: fast/shadow-dom/Element-interface-attachShadow.html

* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::defineElement):
* dom/CustomElementDefinitions.cpp:
(WebCore::CustomElementDefinitions::checkName): Moved to Document::validateCustomElementName.
* dom/CustomElementDefinitions.h:
* dom/Document.cpp:
(WebCore::createHTMLElementWithNameValidation):
(WebCore::createFallbackHTMLElement):
(WebCore::Document::validateCustomElementName): Moved from CustomElementDefinitions::checkName.
* dom/Document.h:
* dom/Element.cpp:
(WebCore::canAttachAuthorShadowRoot): Added.
(WebCore::Element::attachShadow):
* dom/Element.h:
* html/HTMLButtonElement.h:
* html/HTMLDetailsElement.h:
* html/HTMLInputElement.h:
* html/HTMLKeygenElement.h:
* html/HTMLMarqueeElement.h:
* html/HTMLMediaElement.h:
* html/HTMLMeterElement.h:
* html/HTMLPlugInElement.h:
* html/HTMLProgressElement.h:
* html/HTMLQuoteElement.h:
* html/HTMLSelectElement.h:
* html/HTMLSummaryElement.h:
* html/HTMLTagNames.in:
* html/HTMLTextAreaElement.h:
* html/HTMLUnknownElement.h:
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):

LayoutTests:

Added more test cases for validating elements on which attachShadow is allowed and disallowed.

* fast/shadow-dom/Element-interface-attachShadow-expected.txt:
* fast/shadow-dom/Element-interface-attachShadow.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201738 => 201739)


--- trunk/LayoutTests/ChangeLog	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/LayoutTests/ChangeLog	2016-06-07 04:02:11 UTC (rev 201739)
@@ -1,3 +1,15 @@
+2016-06-02  Ryosuke Niwa  <[email protected]>
+
+        Update the list of elements attachShadow is allowed
+        https://bugs.webkit.org/show_bug.cgi?id=157706
+
+        Reviewed by Darin Adler.
+
+        Added more test cases for validating elements on which attachShadow is allowed and disallowed.
+
+        * fast/shadow-dom/Element-interface-attachShadow-expected.txt:
+        * fast/shadow-dom/Element-interface-attachShadow.html:
+
 2016-06-03  Ryosuke Niwa  <[email protected]>
 
         Crash inside moveOutOfAllShadowRoots

Modified: trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow-expected.txt (201738 => 201739)


--- trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow-expected.txt	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow-expected.txt	2016-06-07 04:02:11 UTC (rev 201739)
@@ -4,5 +4,8 @@
 PASS Element.attachShadow must throw a TypeError if mode is not "open" or "closed" 
 PASS Element.attachShadow must create an instance of ShadowRoot 
 PASS Element.attachShadow must throw a InvalidStateError if the context object already hosts a shadow tree 
-PASS Element.attachShadow must throw a NotSupportedError for button, details, input, marquee, meter, progress, select, textarea, and keygen elements 
+PASS Element.attachShadow must throw a NotSupportedError on HTML elements whose local name is not one of article, aside, blockquote, body, div, footer, h1, h2, h3, h4, h5, h6, header, nav, p, section, span 
+PASS Element.attachShadow must not throw a NotSupportedError on article, aside, blockquote, body, div, footer, h1, h2, h3, h4, h5, h6, header, nav, p, section, span 
+PASS Element.attachShadow must throw a NotSupportedError on a HTMLKnownElement which does not have a valid custom element 
+PASS Element.attachShadow must throw a NotSupportedError on a HTMLKnownElement which has a valid custom element 
 

Modified: trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow.html (201738 => 201739)


--- trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow.html	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/LayoutTests/fast/shadow-dom/Element-interface-attachShadow.html	2016-06-07 04:02:11 UTC (rev 201739)
@@ -78,8 +78,22 @@
     }, 'Calling attachShadow({mode: "open"}) after attachShadow({mode: "closed"}) on the same element must throw');
 }, 'Element.attachShadow must throw a InvalidStateError if the context object already hosts a shadow tree');
 
+var htmlElementNames = ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi',
+    'bdo', 'bgsound', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup',
+    'command', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption',
+    'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr',
+    'html', 'i', 'iframe', 'image', 'img', 'input', 'ins', 'isindex', 'kbd', 'keygen', 'label', 'layer', 'legend', 'li', 'link', 'listing',
+    'main', 'map', 'mark', 'marquee', 'menu', 'meta', 'meter', 'nav', 'nobr', 'noembed', 'noframes', 'nolayer', 'object', 'ol', 'optgroup',
+    'option', 'output', 'p', 'param', 'picture', 'plaintext', 'pre', 'progress', 'q', 'rb', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script',
+    'section', 'select', 'slot', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td',
+    'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr', 'xmp', 'noscript'];
+var allowingAttachShadow = ["article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "nav", "p", "section", "span"];
+
 test(function () {
-    for (var elementName of ['button', 'details', 'input', 'marquee', 'meter', 'progress', 'select', 'textarea', 'keygen']) {
+    for (var elementName of htmlElementNames) {
+        if (allowingAttachShadow.indexOf(elementName) >= 0)
+            continue;
+
         assert_throws({'name': 'NotSupportedError'}, function () {
             document.createElement(elementName).attachShadow({mode: "open"});
         }, 'Calling attachShadow({mode: "open"}) on ' + elementName + ' element must throw');
@@ -88,8 +102,38 @@
             document.createElement(elementName).attachShadow({mode: "closed"});
         }, 'Calling attachShadow({mode: "closed"}) on ' + elementName + ' element must throw');
     }
-}, 'Element.attachShadow must throw a NotSupportedError for button, details, input, marquee, meter, progress, select, textarea, and keygen elements');
+}, 'Element.attachShadow must throw a NotSupportedError on HTML elements whose local name is not one of ' + allowingAttachShadow.join(', '));
 
+test(function () {
+    for (var elementName of allowingAttachShadow) {
+        assert_true(document.createElement(elementName).attachShadow({mode: "open"}) instanceof ShadowRoot,
+            'Calling attachShadow({mode: "open"}) on ' + elementName + ' element must not throw');
+
+        assert_true(document.createElement(elementName).attachShadow({mode: "closed"}) instanceof ShadowRoot,
+            'Calling attachShadow({mode: "closed"}) on ' + elementName + ' element must not throw');
+    }
+}, 'Element.attachShadow must not throw a NotSupportedError on ' + allowingAttachShadow.join(', '));
+
+test(function () {
+    assert_throws({'name': 'NotSupportedError'}, function () {
+        document.createElement('w3cfutureelement').attachShadow({mode: "open"});
+    }, 'Calling attachShadow({mode: "open"}) on a HTML element whose local name is "w3cfutureelement" must throw');
+
+    assert_throws({'name': 'NotSupportedError'}, function () {
+        document.createElement('w3cfutureelement').attachShadow({mode: "closed"});
+    }, 'Calling attachShadow({mode: "closed"}) on a HTML element whose local name is "w3cfutureelement" must throw');
+
+}, 'Element.attachShadow must throw a NotSupportedError on a HTMLKnownElement which does not have a valid custom element');
+
+test(function () {
+    assert_true(document.createElement('custom-element').attachShadow({mode: "open"}) instanceof ShadowRoot,
+        'Calling attachShadow({mode: "open"}) on a HTML element whose local name is "custom-element" element must not throw');
+
+    assert_true(document.createElement('custom-element').attachShadow({mode: "closed"}) instanceof ShadowRoot,
+        'Calling attachShadow({mode: "closed"}) on a HTML element whose local name is "custom-element" must not throw');
+
+}, 'Element.attachShadow must throw a NotSupportedError on a HTMLKnownElement which has a valid custom element');
+
 </script>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (201738 => 201739)


--- trunk/Source/WebCore/ChangeLog	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/ChangeLog	2016-06-07 04:02:11 UTC (rev 201739)
@@ -1,3 +1,55 @@
+2016-06-02  Ryosuke Niwa  <[email protected]>
+
+        Update the list of elements attachShadow is allowed
+        https://bugs.webkit.org/show_bug.cgi?id=157706
+
+        Reviewed by Darin Adler.
+
+        Update the list of elements on which attachShadow is allowed per the latest shadow DOM spec:
+        http://www.w3.org/TR/shadow-dom/#widl-Element-attachShadow-ShadowRoot-ShadowRootInit-shadowRootInitDict
+        which now only allows attachShadow on the following elements and custom elements:
+        button, details, input, marquee, meter, progress, select, textarea, keygen
+
+        In order to check that a given HTML element's local name is a valid custom element name,
+        this patch moves CustomElementDefinitions::checkName to Document::validateCustomElementName so that
+        it could be used when either SHADOW_DOM or CUSTOM_ELEMENTS build flag is turned on.
+
+        Also removed Element::canHaveUserAgentShadowRoot since it was only used in Element::attachShadow.
+
+        Test: fast/shadow-dom/Element-interface-attachShadow.html
+
+        * bindings/js/JSDocumentCustom.cpp:
+        (WebCore::JSDocument::defineElement):
+        * dom/CustomElementDefinitions.cpp:
+        (WebCore::CustomElementDefinitions::checkName): Moved to Document::validateCustomElementName.
+        * dom/CustomElementDefinitions.h:
+        * dom/Document.cpp:
+        (WebCore::createHTMLElementWithNameValidation):
+        (WebCore::createFallbackHTMLElement):
+        (WebCore::Document::validateCustomElementName): Moved from CustomElementDefinitions::checkName.
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::canAttachAuthorShadowRoot): Added.
+        (WebCore::Element::attachShadow):
+        * dom/Element.h:
+        * html/HTMLButtonElement.h:
+        * html/HTMLDetailsElement.h:
+        * html/HTMLInputElement.h:
+        * html/HTMLKeygenElement.h:
+        * html/HTMLMarqueeElement.h:
+        * html/HTMLMediaElement.h:
+        * html/HTMLMeterElement.h:
+        * html/HTMLPlugInElement.h:
+        * html/HTMLProgressElement.h:
+        * html/HTMLQuoteElement.h:
+        * html/HTMLSelectElement.h:
+        * html/HTMLSummaryElement.h:
+        * html/HTMLTagNames.in:
+        * html/HTMLTextAreaElement.h:
+        * html/HTMLUnknownElement.h:
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
+
 2016-06-03  Ryosuke Niwa  <[email protected]>
 
         Crash inside moveOutOfAllShadowRoots

Modified: trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp (201738 => 201739)


--- trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp	2016-06-07 04:02:11 UTC (rev 201739)
@@ -158,14 +158,14 @@
         return jsUndefined();
     }
 
-    switch (CustomElementDefinitions::checkName(tagName)) {
-    case CustomElementDefinitions::NameStatus::Valid:
+    switch (Document::validateCustomElementName(tagName)) {
+    case CustomElementNameValidationStatus::Valid:
         break;
-    case CustomElementDefinitions::NameStatus::ConflictsWithBuiltinNames:
+    case CustomElementNameValidationStatus::ConflictsWithBuiltinNames:
         return throwSyntaxError(&state, "Custom element name cannot be same as one of the builtin elements");
-    case CustomElementDefinitions::NameStatus::NoHyphen:
+    case CustomElementNameValidationStatus::NoHyphen:
         return throwSyntaxError(&state, "Custom element name must contain a hyphen");
-    case CustomElementDefinitions::NameStatus::ContainsUpperCase:
+    case CustomElementNameValidationStatus::ContainsUpperCase:
         return throwSyntaxError(&state, "Custom element name cannot contain an upper case letter");
     }
 

Modified: trunk/Source/WebCore/dom/CustomElementDefinitions.cpp (201738 => 201739)


--- trunk/Source/WebCore/dom/CustomElementDefinitions.cpp	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/dom/CustomElementDefinitions.cpp	2016-06-07 04:02:11 UTC (rev 201739)
@@ -39,36 +39,6 @@
 
 namespace WebCore {
 
-CustomElementDefinitions::NameStatus CustomElementDefinitions::checkName(const AtomicString& tagName)
-{
-    bool containsHyphen = false;
-    for (unsigned i = 0; i < tagName.length(); i++) {
-        if (isASCIIUpper(tagName[i]))
-            return NameStatus::ContainsUpperCase;
-        if (tagName[i] == '-')
-            containsHyphen = true;
-    }
-
-    if (!containsHyphen)
-        return NameStatus::NoHyphen;
-
-    // FIXME: We should be taking the advantage of QualifiedNames in SVG and MathML.
-    if (tagName == SVGNames::color_profileTag.localName()
-        || tagName == SVGNames::font_faceTag.localName()
-        || tagName == SVGNames::font_face_formatTag.localName()
-        || tagName == SVGNames::font_face_nameTag.localName()
-        || tagName == SVGNames::font_face_srcTag.localName()
-        || tagName == SVGNames::font_face_uriTag.localName()
-        || tagName == SVGNames::missing_glyphTag.localName()
-#if ENABLE(MATHML)
-        || tagName == MathMLNames::annotation_xmlTag.localName()
-#endif
-        )
-        return NameStatus::ConflictsWithBuiltinNames;
-
-    return NameStatus::Valid;
-}
-
 void CustomElementDefinitions::addElementDefinition(Ref<JSCustomElementInterface>&& interface)
 {
     AtomicString localName = interface->name().localName();

Modified: trunk/Source/WebCore/dom/CustomElementDefinitions.h (201738 => 201739)


--- trunk/Source/WebCore/dom/CustomElementDefinitions.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/dom/CustomElementDefinitions.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -56,9 +56,6 @@
     JSCustomElementInterface* findInterface(const JSC::JSObject*) const;
     bool containsConstructor(const JSC::JSObject*) const;
 
-    enum class NameStatus { Valid, ConflictsWithBuiltinNames, NoHyphen, ContainsUpperCase };
-    static NameStatus checkName(const AtomicString& tagName);
-
 private:
     HashMap<AtomicString, Vector<RefPtr<Element>>> m_upgradeCandidatesMap;
     HashMap<AtomicString, RefPtr<JSCustomElementInterface>> m_nameMap;

Modified: trunk/Source/WebCore/dom/Document.cpp (201738 => 201739)


--- trunk/Source/WebCore/dom/Document.cpp	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-06-07 04:02:11 UTC (rev 201739)
@@ -889,7 +889,7 @@
     QualifiedName qualifiedName(nullAtom, localName, xhtmlNamespaceURI);
 
 #if ENABLE(CUSTOM_ELEMENTS)
-    if (CustomElementDefinitions::checkName(localName) == CustomElementDefinitions::NameStatus::Valid) {
+    if (Document::validateCustomElementName(localName) == CustomElementNameValidationStatus::Valid) {
         Ref<HTMLElement> element = HTMLElement::create(qualifiedName, document);
         element->setIsUnresolvedCustomElement();
         document.ensureCustomElementDefinitions().addUpgradeCandidate(element.get());
@@ -1074,7 +1074,7 @@
         }
     }
     // FIXME: Should we also check the equality of prefix between the custom element and name?
-    if (CustomElementDefinitions::checkName(name.localName()) == CustomElementDefinitions::NameStatus::Valid) {
+    if (Document::validateCustomElementName(name.localName()) == CustomElementNameValidationStatus::Valid) {
         Ref<HTMLElement> element = HTMLElement::create(name, document);
         element->setIsUnresolvedCustomElement();
         document.ensureCustomElementDefinitions().addUpgradeCandidate(element.get());
@@ -1112,6 +1112,40 @@
     return element.releaseNonNull();
 }
 
+#if ENABLE(CUSTOM_ELEMENTS) || ENABLE(SHADOW_DOM)
+CustomElementNameValidationStatus Document::validateCustomElementName(const AtomicString& localName)
+{
+    bool containsHyphen = false;
+    for (auto character : StringView(localName).codeUnits()) {
+        if (isASCIIUpper(character))
+            return CustomElementNameValidationStatus::ContainsUpperCase;
+        if (character == '-')
+            containsHyphen = true;
+    }
+
+    if (!containsHyphen)
+        return CustomElementNameValidationStatus::NoHyphen;
+
+#if ENABLE(MATHML)
+    const auto& annotationXmlLocalName = MathMLNames::annotation_xmlTag.localName();
+#else
+    static NeverDestroyed<const AtomicString> annotationXmlLocalName(ASCIILiteral("annotation-xml"));
+#endif
+
+    if (localName == SVGNames::color_profileTag.localName()
+        || localName == SVGNames::font_faceTag.localName()
+        || localName == SVGNames::font_face_formatTag.localName()
+        || localName == SVGNames::font_face_nameTag.localName()
+        || localName == SVGNames::font_face_srcTag.localName()
+        || localName == SVGNames::font_face_uriTag.localName()
+        || localName == SVGNames::missing_glyphTag.localName()
+        || localName == annotationXmlLocalName)
+        return CustomElementNameValidationStatus::ConflictsWithBuiltinNames;
+
+    return CustomElementNameValidationStatus::Valid;
+}
+#endif
+
 #if ENABLE(CSS_GRID_LAYOUT)
 bool Document::isCSSGridLayoutEnabled() const
 {

Modified: trunk/Source/WebCore/dom/Document.h (201738 => 201739)


--- trunk/Source/WebCore/dom/Document.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/dom/Document.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -281,6 +281,8 @@
     DisabledByContentDispositionAttachmentSandbox
 };
 
+enum class CustomElementNameValidationStatus { Valid, ConflictsWithBuiltinNames, NoHyphen, ContainsUpperCase };
+
 class Document
     : public ContainerNode
     , public TreeScope
@@ -387,6 +389,10 @@
     WEBCORE_EXPORT RefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
     WEBCORE_EXPORT Ref<Element> createElement(const QualifiedName&, bool createdByParser);
 
+#if ENABLE(CUSTOM_ELEMENTS) || ENABLE(SHADOW_DOM)
+    static CustomElementNameValidationStatus validateCustomElementName(const AtomicString&);
+#endif
+
 #if ENABLE(CSS_GRID_LAYOUT)
     bool isCSSGridLayoutEnabled() const;
 #endif

Modified: trunk/Source/WebCore/dom/Element.cpp (201738 => 201739)


--- trunk/Source/WebCore/dom/Element.cpp	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/dom/Element.cpp	2016-06-07 04:02:11 UTC (rev 201739)
@@ -1685,14 +1685,46 @@
     return nullptr;
 }
 
-bool Element::canHaveUserAgentShadowRoot() const
+#if ENABLE(SHADOW_DOM)
+static bool canAttachAuthorShadowRoot(const Element& element)
 {
-    return false;
+    static NeverDestroyed<HashSet<AtomicString>> tagNames = [] {
+        const AtomicString tagList[] = {
+            articleTag.localName(),
+            asideTag.localName(),
+            blockquoteTag.localName(),
+            bodyTag.localName(),
+            divTag.localName(),
+            footerTag.localName(),
+            h1Tag.localName(),
+            h2Tag.localName(),
+            h3Tag.localName(),
+            h4Tag.localName(),
+            h5Tag.localName(),
+            h6Tag.localName(),
+            headerTag.localName(),
+            navTag.localName(),
+            pTag.localName(),
+            sectionTag.localName(),
+            spanTag.localName()
+        };
+
+        HashSet<AtomicString> set;
+        for (auto& name : tagList)
+            set.add(name);
+        return set;
+    }();
+
+    if (!is<HTMLElement>(element))
+        return false;
+
+    const auto& localName = element.localName();
+    return tagNames.get().contains(localName) || Document::validateCustomElementName(localName) == CustomElementNameValidationStatus::Valid;
 }
 
 RefPtr<ShadowRoot> Element::attachShadow(const ShadowRootInit& init, ExceptionCode& ec)
 {
-    if (canHaveUserAgentShadowRoot()) {
+    if (!canAttachAuthorShadowRoot(*this)) {
         ec = NOT_SUPPORTED_ERR;
         return nullptr;
     }
@@ -1719,6 +1751,7 @@
     }
     return root;
 }
+#endif
 
 ShadowRoot* Element::userAgentShadowRoot() const
 {

Modified: trunk/Source/WebCore/dom/Element.h (201738 => 201739)


--- trunk/Source/WebCore/dom/Element.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/dom/Element.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -254,8 +254,10 @@
         ShadowRootMode mode;
     };
 
+#if ENABLE(SHADOW_DOM)
     ShadowRoot* shadowRootForBindings(JSC::ExecState&) const;
     RefPtr<ShadowRoot> attachShadow(const ShadowRootInit&, ExceptionCode&);
+#endif
 
     ShadowRoot* userAgentShadowRoot() const;
     WEBCORE_EXPORT ShadowRoot& ensureUserAgentShadowRoot();
@@ -594,7 +596,6 @@
     Ref<Node> cloneNodeInternal(Document&, CloningOperation) override;
     virtual Ref<Element> cloneElementWithoutAttributesAndChildren(Document&);
 
-    virtual bool canHaveUserAgentShadowRoot() const;
     void removeShadowRoot();
 
     const RenderStyle* existingComputedStyle();

Modified: trunk/Source/WebCore/html/HTMLButtonElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLButtonElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLButtonElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -52,7 +52,6 @@
 
     // HTMLFormControlElement always creates one, but buttons don't need it.
     bool alwaysCreateUserAgentShadowRoot() const override { return false; }
-    bool canHaveUserAgentShadowRoot() const final { return true; }
 
     void parseAttribute(const QualifiedName&, const AtomicString&) override;
     bool isPresentationAttribute(const QualifiedName&) const override;

Modified: trunk/Source/WebCore/html/HTMLDetailsElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLDetailsElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -42,7 +42,6 @@
     void parseAttribute(const QualifiedName&, const AtomicString&) override;
 
     void didAddUserAgentShadowRoot(ShadowRoot*) override;
-    bool canHaveUserAgentShadowRoot() const final { return true; }
     bool hasCustomFocusLogic() const final { return true; }
 
     bool m_isOpen { false };

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -333,7 +333,6 @@
     enum AutoCompleteSetting { Uninitialized, On, Off };
 
     void didAddUserAgentShadowRoot(ShadowRoot*) final;
-    bool canHaveUserAgentShadowRoot() const final { return true; }
 
     void willChangeForm() final;
     void didChangeForm() final;

Modified: trunk/Source/WebCore/html/HTMLKeygenElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLKeygenElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLKeygenElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -55,8 +55,6 @@
     void reset() override;
     bool shouldSaveAndRestoreFormControlState() const override;
 
-    bool canHaveUserAgentShadowRoot() const final { return true; }
-
     bool isKeytypeRSA() const;
 
     HTMLSelectElement* shadowSelect() const;

Modified: trunk/Source/WebCore/html/HTMLMarqueeElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLMarqueeElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLMarqueeElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -62,8 +62,6 @@
     void resume() override;
     const char* activeDOMObjectName() const override { return "HTMLMarqueeElement"; }
 
-    bool canHaveUserAgentShadowRoot() const final { return true; }
-
     RenderMarquee* renderMarquee() const;
 };
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -504,9 +504,6 @@
 
     bool alwaysCreateUserAgentShadowRoot() const override { return true; }
 
-    // FIXME: Shadow DOM spec says we should be able to create shadow root on audio and video elements
-    bool canHaveUserAgentShadowRoot() const final { return true; }
-
     bool supportsFocus() const override;
     bool isMouseFocusable() const override;
     bool rendererIsNeeded(const RenderStyle&) override;

Modified: trunk/Source/WebCore/html/HTMLMeterElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLMeterElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLMeterElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -76,7 +76,6 @@
 
     void didElementStateChange();
     void didAddUserAgentShadowRoot(ShadowRoot*) override;
-    bool canHaveUserAgentShadowRoot() const final { return true; }
 
     RefPtr<MeterValueElement> m_value;
 };

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLPlugInElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -117,9 +117,6 @@
 
     bool dispatchBeforeLoadEvent(const String& sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake.
 
-    // FIXME: Shadow DOM spec says we should be able to create shadow root on applet, embed, and object.
-    bool canHaveUserAgentShadowRoot() const final { return true; }
-
     // This will load the plugin if necessary.
     virtual RenderWidget* renderWidgetLoadingPlugin() const = 0;
 

Modified: trunk/Source/WebCore/html/HTMLProgressElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLProgressElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLProgressElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -62,7 +62,6 @@
 
     void didElementStateChange();
     void didAddUserAgentShadowRoot(ShadowRoot*) override;
-    bool canHaveUserAgentShadowRoot() const final { return true; }
     bool isDeterminate() const;
 
     ProgressValueElement* m_value;

Modified: trunk/Source/WebCore/html/HTMLQuoteElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLQuoteElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLQuoteElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -35,7 +35,7 @@
 
 private:
     HTMLQuoteElement(const QualifiedName&, Document&);
-    
+
     bool isURLAttribute(const Attribute&) const override;
 };
 

Modified: trunk/Source/WebCore/html/HTMLSelectElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLSelectElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLSelectElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -119,8 +119,6 @@
     
     bool canStartSelection() const final { return false; }
 
-    bool canHaveUserAgentShadowRoot() const final { return true; }
-
     bool isEnumeratable() const final { return true; }
     bool supportLabels() const final { return true; }
 

Modified: trunk/Source/WebCore/html/HTMLSummaryElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLSummaryElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLSummaryElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -42,8 +42,6 @@
 
     void didAddUserAgentShadowRoot(ShadowRoot*) override;
 
-    // FIXME: Shadow DOM spec says we should be able to create shadow root on this element
-    bool canHaveUserAgentShadowRoot() const final { return true; }
     bool hasCustomFocusLogic() const final { return true; }
 
     HTMLDetailsElement* detailsElement() const;

Modified: trunk/Source/WebCore/html/HTMLTagNames.in (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLTagNames.in	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLTagNames.in	2016-06-07 04:02:11 UTC (rev 201739)
@@ -33,7 +33,6 @@
 col interfaceName=HTMLTableColElement
 colgroup interfaceName=HTMLTableColElement
 command interfaceName=HTMLElement
-webkitShadowContent interfaceName=HTMLElement, noConstructor
 data
 datalist interfaceName=HTMLDataListElement, conditional=DATALIST_ELEMENT
 dd interfaceName=HTMLElement

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -71,7 +71,6 @@
     enum WrapMethod { NoWrap, SoftWrap, HardWrap };
 
     void didAddUserAgentShadowRoot(ShadowRoot*) override;
-    bool canHaveUserAgentShadowRoot() const final { return true; }
 
     void maxLengthAttributeChanged(const AtomicString& newValue);
 

Modified: trunk/Source/WebCore/html/HTMLUnknownElement.h (201738 => 201739)


--- trunk/Source/WebCore/html/HTMLUnknownElement.h	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/HTMLUnknownElement.h	2016-06-07 04:02:11 UTC (rev 201739)
@@ -47,12 +47,6 @@
     {
     }
 
-#if ENABLE(METER_ELEMENT)
-    bool canHaveUserAgentShadowRoot() const final { return false; }
-#else
-    bool canHaveUserAgentShadowRoot() const final { return localName() == "meter"; }
-#endif
-
     bool isHTMLUnknownElement() const override { return true; }
 };
 

Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (201738 => 201739)


--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2016-06-07 03:24:54 UTC (rev 201738)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2016-06-07 04:02:11 UTC (rev 201739)
@@ -673,7 +673,7 @@
 
         QualifiedName qualifiedName(nullAtom, localName, xhtmlNamespaceURI);
 #if ENABLE(CUSTOM_ELEMENTS)
-        if (CustomElementDefinitions::checkName(localName) == CustomElementDefinitions::NameStatus::Valid) {
+        if (Document::validateCustomElementName(localName) == CustomElementNameValidationStatus::Valid) {
             element = HTMLElement::create(qualifiedName, ownerDocument);
             element->setIsUnresolvedCustomElement();
             ownerDocument.ensureCustomElementDefinitions().addUpgradeCandidate(*element);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to