Title: [126248] trunk
Revision
126248
Author
[email protected]
Date
2012-08-21 18:47:20 -0700 (Tue, 21 Aug 2012)

Log Message

A shadow element in ShadowDOM of a button element does not work.
https://bugs.webkit.org/show_bug.cgi?id=91486

Reviewed by Dimitri Glazkov.

Source/WebCore:

Since a button element is extended from an HTMLFormControlElement, it creates a UserAgentShadowDOM
just before adding an AuthorShadowDOM. However, actually a button element does not need any UserAgentShadowDOM.
So we have to prevent it from creating UserAgentShadowDOM.

Test: fast/dom/shadow/shadowdom-for-button.html

* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::willAddAuthorShadowRoot):
(WebCore):
* html/HTMLButtonElement.h:

LayoutTests:

* fast/dom/shadow/shadowdom-for-button-expected.html: Added.
* fast/dom/shadow/shadowdom-for-button.html: Added.
* fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt:
* fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html: a button element
does not have user agent shadow dom anymore.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126247 => 126248)


--- trunk/LayoutTests/ChangeLog	2012-08-22 01:45:48 UTC (rev 126247)
+++ trunk/LayoutTests/ChangeLog	2012-08-22 01:47:20 UTC (rev 126248)
@@ -1,3 +1,16 @@
+2012-08-21  Shinya Kawanaka  <[email protected]>
+
+        A shadow element in ShadowDOM of a button element does not work.
+        https://bugs.webkit.org/show_bug.cgi?id=91486
+
+        Reviewed by Dimitri Glazkov.
+
+        * fast/dom/shadow/shadowdom-for-button-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-button.html: Added.
+        * fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt:
+        * fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html: a button element
+        does not have user agent shadow dom anymore.
+
 2012-08-21  Kenneth Russell  <[email protected]>
 
         Unreviewed Chromium gardening. Suppress crashes of new test.

Added: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-button-expected.html (0 => 126248)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-button-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-button-expected.html	2012-08-22 01:47:20 UTC (rev 126248)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+
+<html>
+<body>
+<script src=""
+
+<p>When a button element has a shadow dom having a shadow element, it should get the children of the button element.</p>
+
+<button>Kotori Otonashi</button>
+<button>FOO foo Kotori bar BAR</button>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-button.html (0 => 126248)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-button.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-button.html	2012-08-22 01:47:20 UTC (rev 126248)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+
+<html>
+<body>
+<script src=""
+
+<p>When a button element has a shadow dom having a shadow element, it should get the children of the button element.</p>
+
+<button id="host1">Kotori</button>
+<button id="host2">Kotori</button>
+
+<script>
+var shadowRoot1 = new WebKitShadowRoot(host1);
+shadowRoot1.innerHTML = "<shadow></shadow> Otonashi";
+
+var shadowRoot2 = new WebKitShadowRoot(host2);
+shadowRoot2.innerHTML = "foo <shadow></shadow> bar";
+var shadowRoot3 = new WebKitShadowRoot(host2);
+shadowRoot3.innerHTML = "FOO <shadow></shadow> BAR";
+</script>
+
+</body>
+</html>

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt (126247 => 126248)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt	2012-08-22 01:45:48 UTC (rev 126247)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt	2012-08-22 01:47:20 UTC (rev 126248)
@@ -6,8 +6,6 @@
 PASS youngerShadowRoot is shadowRoot
 PASS oldestShadowRoot is not shadowRoot
 PASS youngerShadowRoot is shadowRoot
-PASS oldestShadowRoot is not shadowRoot
-PASS youngerShadowRoot is shadowRoot
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html (126247 => 126248)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html	2012-08-22 01:45:48 UTC (rev 126247)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html	2012-08-22 01:47:20 UTC (rev 126248)
@@ -7,7 +7,6 @@
 <p>When a AuthorShadowRoot is added, UserAgentShadowRoot should exists as the oldest Shadow Root.</p>
 <div id='container'>
     <form>
-        <button id='button'>72</button>
         <select id='select'><option>hoge</option></select>
         <output id='output'></output>
         <keygen id='keygen'></keygen>
@@ -21,7 +20,7 @@
 
 <script>
 var elems = [
-    "button", "select", "keygen", "fieldset"
+    "select", "keygen", "fieldset"
 ];
 
 var shadowRoot;

Modified: trunk/Source/WebCore/ChangeLog (126247 => 126248)


--- trunk/Source/WebCore/ChangeLog	2012-08-22 01:45:48 UTC (rev 126247)
+++ trunk/Source/WebCore/ChangeLog	2012-08-22 01:47:20 UTC (rev 126248)
@@ -1,3 +1,21 @@
+2012-08-21  Shinya Kawanaka  <[email protected]>
+
+        A shadow element in ShadowDOM of a button element does not work.
+        https://bugs.webkit.org/show_bug.cgi?id=91486
+
+        Reviewed by Dimitri Glazkov.
+
+        Since a button element is extended from an HTMLFormControlElement, it creates a UserAgentShadowDOM
+        just before adding an AuthorShadowDOM. However, actually a button element does not need any UserAgentShadowDOM.
+        So we have to prevent it from creating UserAgentShadowDOM.
+
+        Test: fast/dom/shadow/shadowdom-for-button.html
+
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::willAddAuthorShadowRoot):
+        (WebCore):
+        * html/HTMLButtonElement.h:
+
 2012-08-21  Sukolsak Sakshuwong  <[email protected]>
 
         Remove UndoManager's undoscope content attribute

Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (126247 => 126248)


--- trunk/Source/WebCore/html/HTMLButtonElement.cpp	2012-08-22 01:45:48 UTC (rev 126247)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp	2012-08-22 01:47:20 UTC (rev 126248)
@@ -63,6 +63,10 @@
     return new (arena) RenderButton(this);
 }
 
+void HTMLButtonElement::willAddAuthorShadowRoot()
+{
+}
+
 const AtomicString& HTMLButtonElement::formControlType() const
 {
     switch (m_type) {

Modified: trunk/Source/WebCore/html/HTMLButtonElement.h (126247 => 126248)


--- trunk/Source/WebCore/html/HTMLButtonElement.h	2012-08-22 01:45:48 UTC (rev 126247)
+++ trunk/Source/WebCore/html/HTMLButtonElement.h	2012-08-22 01:47:20 UTC (rev 126248)
@@ -47,6 +47,8 @@
         
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
+    virtual void willAddAuthorShadowRoot() OVERRIDE;
+
     virtual void parseAttribute(const Attribute&) OVERRIDE;
     virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
     virtual void defaultEventHandler(Event*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to