Source/WebCore: Add UserAgentShadowDOM to FormControlElement just before adding Autho...
authorshinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2012 08:11:37 +0000 (08:11 +0000)
committershinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2012 08:11:37 +0000 (08:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90866

Reviewed by Hajime Morita.

It ensures that UserAgentShadowDOM is the oldest ShadowDOM.

To show ValidationMessage, WebKit adds a Shadow DOM to some of FormControlElements.
ValidationMessage assumes that the added Shadow DOM is the oldest, however, there was a case
that a page author might add a Shadow DOM before ValidationMessage adds a Shadow DOM.
It will break the assumption that the Shadow DOM added by ValidationMessage is the oldest.
So we have prohibited a page author adding a Shadow DOM to FormControlElement.

To add UserAgentShadowDOM, we use a callback which is called before a page author adding a Shadow DOM.
It adds a UserAgentShadowDOM if it does not exist, so we can ensure that UserAgentShadowDOM is the oldest.

Tests: fast/dom/shadow/input-with-validation-without-shadow.html
       fast/dom/shadow/input-with-validation.html
       fast/dom/shadow/shadowdom-for-button-complex-shadow.html
       fast/dom/shadow/shadowdom-for-button-only-shadow.html
       fast/dom/shadow/shadowdom-for-button-without-shadow.html
       fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html
       fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html
       fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html
       fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html
       fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html
       fast/dom/shadow/shadowdom-for-keygen-only-shadow.html
       fast/dom/shadow/shadowdom-for-keygen-without-shadow.html
       fast/dom/shadow/shadowdom-for-object-complex-shadow.html
       fast/dom/shadow/shadowdom-for-object-only-shadow.html
       fast/dom/shadow/shadowdom-for-object-without-shadow.html
       fast/dom/shadow/shadowdom-for-output-complex-shadow.html
       fast/dom/shadow/shadowdom-for-output-only-shadow.html
       fast/dom/shadow/shadowdom-for-output-without-shadow.html
       fast/dom/shadow/shadowdom-for-select-complex-shadow.html
       fast/dom/shadow/shadowdom-for-select-only-shadow.html
       fast/dom/shadow/shadowdom-for-select-without-shadow.html
       fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html
       fast/dom/shadow/shadowdom-for-textarea-only-shadow.html
       fast/dom/shadow/shadowdom-for-textarea-without-shadow.html

* dom/ShadowRoot.cpp:
(WebCore::allowsAuthorShadowRoot):
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::ensureUserAgentShadowRoot): Ensures the existence of a UserAgentShadowRoot.
If it does not exist, we create it with empty content.
(WebCore):
* html/FormAssociatedElement.h:
(FormAssociatedElement):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::willAddAuthorShadowRoot):
(WebCore):
* html/HTMLFormControlElement.h:
(HTMLFormControlElement):
* html/ValidationMessage.cpp:
(WebCore::adjustBubblePosition): When AuthroShadowRoot does not a shadow element, ValidationMessage
does not have a renderer. So we have to check the existence of renderer.
(WebCore::ValidationMessage::buildBubbleTree):

LayoutTests: Add UserAgentShadowDOM to FormControlElement just before ading UserShadowDOM
https://bugs.webkit.org/show_bug.cgi?id=90866

Reviewed by Hajime Morita.

Added a lot of tests of ShadowDOM for replaced elements. They don't crash,
but many of them are not rendered correctly. Please see Bug 82313,
which is a meta bug of Shadow DOM for replaced elements.

* fast/dom/shadow/input-with-validation-expected.html: Added.
* fast/dom/shadow/input-with-validation-without-shadow-expected.html: Added.
* fast/dom/shadow/input-with-validation-without-shadow.html: Added.
* fast/dom/shadow/input-with-validation.html: Added.
* fast/dom/shadow/shadow-disable-expected.txt:
* fast/dom/shadow/shadow-disable.html:
* fast/dom/shadow/shadowdom-for-button-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-button-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-button-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-button-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-button-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-button-without-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-fieldset-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-fieldset-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-fieldset-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt: Added.
* fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html: Added.
* fast/dom/shadow/shadowdom-for-keygen-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-keygen-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-keygen-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-keygen-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-keygen-without-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-object-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-object-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-object-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-object-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-object-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-object-without-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-output-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-output-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-output-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-output-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-output-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-output-without-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-select-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-select-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-select-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-select-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-select-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-select-without-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-only-shadow.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-without-shadow-expected.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-without-shadow.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/qt/Skipped:
* platform/wincairo/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123713 268f45cc-cd09-0410-ab3c-d52691b4dbfc

62 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/shadow/input-with-validation-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/input-with-validation-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/input-with-validation-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/input-with-validation.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadow-disable-expected.txt
LayoutTests/fast/dom/shadow/shadow-disable.html
LayoutTests/fast/dom/shadow/shadowdom-for-button-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-button-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-button-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-button-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-button-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-button-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-keygen-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-keygen-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-keygen-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-keygen-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-keygen-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-object-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-object-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-object-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-object-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-object-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-object-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-output-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-output-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-output-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-output-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-output-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-output-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-select-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-select-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-select-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-select-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-select-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-select-without-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/qt/Skipped
LayoutTests/platform/wincairo/Skipped
Source/WebCore/ChangeLog
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/html/FormAssociatedElement.cpp
Source/WebCore/html/FormAssociatedElement.h
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/ValidationMessage.cpp

index c4b425b..31479b8 100644 (file)
@@ -1,3 +1,69 @@
+2012-07-26  Shinya Kawanaka  <shinyak@chromium.org>
+
+        Add UserAgentShadowDOM to FormControlElement just before ading UserShadowDOM
+        https://bugs.webkit.org/show_bug.cgi?id=90866
+
+        Reviewed by Hajime Morita.
+
+        Added a lot of tests of ShadowDOM for replaced elements. They don't crash,
+        but many of them are not rendered correctly. Please see Bug 82313,
+        which is a meta bug of Shadow DOM for replaced elements.
+
+        * fast/dom/shadow/input-with-validation-expected.html: Added.
+        * fast/dom/shadow/input-with-validation-without-shadow-expected.html: Added.
+        * fast/dom/shadow/input-with-validation-without-shadow.html: Added.
+        * fast/dom/shadow/input-with-validation.html: Added.
+        * fast/dom/shadow/shadow-disable-expected.txt:
+        * fast/dom/shadow/shadow-disable.html:
+        * fast/dom/shadow/shadowdom-for-button-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-button-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-button-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-button-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-button-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-button-without-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-fieldset-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-fieldset-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-fieldset-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt: Added.
+        * fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html: Added.
+        * fast/dom/shadow/shadowdom-for-keygen-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-keygen-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-keygen-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-keygen-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-keygen-without-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-object-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-object-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-object-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-object-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-object-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-object-without-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-output-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-output-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-output-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-output-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-output-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-output-without-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-select-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-select-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-select-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-select-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-select-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-select-without-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-only-shadow.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-without-shadow-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-without-shadow.html: Added.
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/qt/Skipped:
+        * platform/wincairo/Skipped:
+
 2012-07-26  Kaustubh Atrawalkar  <kaustubh@motorola.com>
 
         [DRT] LTC:: pageNumberForElementById() could be moved to Internals
diff --git a/LayoutTests/fast/dom/shadow/input-with-validation-expected.html b/LayoutTests/fast/dom/shadow/input-with-validation-expected.html
new file mode 100644 (file)
index 0000000..4e128f1
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>Validation should be shown if Shadow DOM has a shadow element.</p>
+<form id='form' action="input-with-validation.html">
+<input id=password type=password required maxlength=20 title="Needs at least 8 letters.&#x0a;Should not be identical with the current password.">
+<input type=submit id=submit>
+</form>
+
+<script>
+var input = document.getElementById('password');
+
+document.getElementById('submit').click();
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    setTimeout(function() {
+        testRunner.notifyDone();
+    }, 10);
+}
+</script>
+
diff --git a/LayoutTests/fast/dom/shadow/input-with-validation-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/input-with-validation-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..3108af4
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>Validation won't be shown if Shadow DOM does not have a shadow element.</p>
+<form id='form' action="input-with-validation-without-shadow.html">
+<input id=password type=password maxlength=20 title="Needs at least 8 letters.&#x0a;Should not be identical with the current password.">
+<input type=submit id=submit>
+</form>
+
+<script>
+var input = document.getElementById('password');
+
+document.getElementById('submit').click();
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    setTimeout(function() {
+        testRunner.notifyDone();
+    }, 10);
+}
+</script>
+
diff --git a/LayoutTests/fast/dom/shadow/input-with-validation-without-shadow.html b/LayoutTests/fast/dom/shadow/input-with-validation-without-shadow.html
new file mode 100644 (file)
index 0000000..e626857
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>Validation won't be shown if Shadow DOM does not have a shadow element.</p>
+<form id='form' action="input-with-validation-without-shadow.html">
+<input id=password type=password required maxlength=20 title="Needs at least 8 letters.&#x0a;Should not be identical with the current password.">
+<input type=submit id=submit>
+</form>
+
+<script>
+var input = document.getElementById('password');
+var shadowRoot = new WebKitShadowRoot(input);
+
+document.getElementById('submit').click();
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    setTimeout(function() {
+        testRunner.notifyDone();
+    }, 10);
+}
+</script>
+
diff --git a/LayoutTests/fast/dom/shadow/input-with-validation.html b/LayoutTests/fast/dom/shadow/input-with-validation.html
new file mode 100644 (file)
index 0000000..2c2be3c
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>Validation should be shown if Shadow DOM has a shadow element.</p>
+<form id='form' action="input-with-validation.html">
+<input id=password type=password required maxlength=20 title="Needs at least 8 letters.&#x0a;Should not be identical with the current password.">
+<input type=submit id=submit>
+</form>
+
+<script>
+var input = document.getElementById('password');
+var shadowRoot = new WebKitShadowRoot(input);
+shadowRoot.innerHTML = "<shadow></shadow>";
+
+document.getElementById('submit').click();
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    setTimeout(function() {
+        testRunner.notifyDone();
+    }, 10);
+}
+</script>
+
index d9d947c..995eace 100644 (file)
@@ -16,11 +16,11 @@ PASS new WebKitShadowRoot(element) is not null
 VIDEO
 PASS new WebKitShadowRoot(element) is not null
 INPUT
-PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
+PASS new WebKitShadowRoot(element) is not null
 TEXTAREA
-PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
+PASS new WebKitShadowRoot(element) is not null
 SELECT
-PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
+PASS new WebKitShadowRoot(element) is not null
 tref
 PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
 PASS successfullyParsed is true
index 652853d..0d5982a 100644 (file)
@@ -25,13 +25,13 @@ var elementsToSuccess = [
     document.createElement('a'),
     document.createElement('section'),
     document.createElement('audio'),
-    document.createElement('video')
+    document.createElement('video'),
+    document.createElement('input'),
+    document.createElement('textarea'),
+    document.createElement('select')
 ];
 
 var elementsToFail = [
-    document.createElement('input'),
-    document.createElement('textarea'),
-    document.createElement('select'),
     document.getElementById('tref')
 ];
 
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-button-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-button-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..7a957eb
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    button<div style="margin: 20px">
+        <button></button>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-button-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-button-complex-shadow.html
new file mode 100644 (file)
index 0000000..6800d9b
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <button id="host">button</button>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-button-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-button-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..a34c3fc
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <button id="host">button</button>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-button-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-button-only-shadow.html
new file mode 100644 (file)
index 0000000..3ae7ace
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form id="form" action="shadowdom-for-select.html">
+    <button id="host">button</button>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-button-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-button-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..73f046d
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a shadow element, this should be rendered like div.</p>
+<form>
+    <div style="display: inline-block: width: 20px; height: 20px"></div>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-button-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-button-without-shadow.html
new file mode 100644 (file)
index 0000000..88bc112
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a shadow element, this should be rendered like div.</p>
+<form>
+    <button id='host' style="display: inline-block; width: 20px; height: 20px; margin: 0; padding: 0; border: 0">foo bar</button>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..bb835f2
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <legend>legend</legen>
+    <input type="text"></input>
+    <div style="margin: 20px">
+        <fieldset></fieldset>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html
new file mode 100644 (file)
index 0000000..a402bab
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <fieldset id="host">
+        <legend>legend</legend>
+        <input type="text"></input>
+    </fieldset>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..ad7278a
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <fieldset id="host">
+        <legend>legend</legend>
+        <input type="text"></input>
+    </fieldset>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html
new file mode 100644 (file)
index 0000000..5721629
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <fieldset id="host">
+        <legend>legend</legend>
+        <input type="text"></input>
+    </fieldset>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..b2d83df
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <div id="select" style="width: 100px; height: 30px; margin: 0; padding: 0; border: 0"></div>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html
new file mode 100644 (file)
index 0000000..f27fd96
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <fieldset id="host" style="width: 100px; height: 30px; margin: 0; padding: 0; border: 0">
+        <legend>legend</legend>
+        <input type="text"></input>
+    </fieldset>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt b/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent-expected.txt
new file mode 100644 (file)
index 0000000..3e530e8
--- /dev/null
@@ -0,0 +1,16 @@
+When a AuthorShadowRoot is added, UserAgentShadowRoot should exists as the oldest Shadow Root.
+
+PASS oldestShadowRoot is not shadowRoot
+PASS youngerShadowRoot is shadowRoot
+PASS oldestShadowRoot is not shadowRoot
+PASS youngerShadowRoot is shadowRoot
+PASS oldestShadowRoot is not shadowRoot
+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
+
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html b/LayoutTests/fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html
new file mode 100644 (file)
index 0000000..33defb8
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="resources/polyfill.js"></script>
+<script src="../../js/resources/js-test-pre.js"></script>
+
+<p>When a AuthorShadowRoot is added, UserAgentShadowRoot should exists as the oldest Shadow Root.</p>
+<div id='container'>
+    <form>
+        <textarea id='textarea'></textarea>
+        <button id='button'>72</button>
+        <select id='select'><option>hoge</option></select>
+        <output id='output'></output>
+        <keygen id='keygen'></keygen>
+        <fieldset id='fieldset'>
+            <input type="text">
+            <legend>hogehoge</legend>
+        </fieldset>
+    </form>
+</div>
+<pre id='console'></pre>
+
+<script>
+var elems = [
+    "textarea", "button", "select", "keygen", "fieldset"
+];
+
+var shadowRoot;
+var oldestShadowRoot;
+var youngerShadowRoot;
+function test()
+{
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    for (var i = 0; i < elems.length; ++i) {
+        var host = document.getElementById(elems[i]);
+        shadowRoot = new WebKitShadowRoot(host);
+        shadowRoot.innerHTML = "<shadow></shadow>";
+
+        oldestShadowRoot = internals.oldestShadowRoot(host);
+        youngerShadowRoot = internals.youngerShadowRoot(oldestShadowRoot);
+        shouldNotBe('oldestShadowRoot', 'shadowRoot');
+        shouldBe('youngerShadowRoot', 'shadowRoot');
+    }
+
+    container.innerHTML = "";
+}
+
+test();
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..ca9fd4c
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    foobar<div style="margin: 20px">
+        <keygen></keygen>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html
new file mode 100644 (file)
index 0000000..bc0c90c
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <keygen id="host">foobar</keygen>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..3d6174c
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <keygen id="host"></keygen>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-only-shadow.html
new file mode 100644 (file)
index 0000000..9f8f220
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <keygen id="host"></keygen>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..55f3e81
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <div style="display: inline-block; width: 100px; height:30px; margin: 0; padding: 0; border: 0">
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-keygen-without-shadow.html
new file mode 100644 (file)
index 0000000..88bb064
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <keygen id="host" style="width: 100px; height:30px; margin: 0; padding: 0; border: 0">
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-object-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-object-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..91d083e
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <div style="margin: 20px">
+        <object id="host" data="../resources/apple.gif" type="image/gif" width="20" height="20"></object>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-object-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-object-complex-shadow.html
new file mode 100644 (file)
index 0000000..0171312
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <object id="host" data="../resources/apple.gif" type="image/gif" width="20" height="20">
+        <param name="foo" value="bar"></param>
+    </object>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-object-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-object-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..6efe84e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <object id="host" data="../resources/apple.gif" type="image/gif"></object>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-object-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-object-only-shadow.html
new file mode 100644 (file)
index 0000000..ed4d765
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <object id="host" data="../resources/apple.gif" type="image/gif"></object>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host)
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-object-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-object-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..d2a74a0
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a shadow element, this should be rendered like div.</p>
+<form>
+    <div style="display: inline-block; width: 20px; height: 20px"></div>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-object-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-object-without-shadow.html
new file mode 100644 (file)
index 0000000..e348d75
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a shadow element, this should be rendered like div.</p>
+<form>
+    <object id="host" data="../resources/apple.gif" type="image/gif" width="20" height="20"></object>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host)
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-output-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-output-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..8321bce
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    hoge<div style="margin: 20px">
+        <output></output>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-output-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-output-complex-shadow.html
new file mode 100644 (file)
index 0000000..b31d83f
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <output id="host">hoge</output>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-output-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-output-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..4cf141e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <output id="host">foobar</output>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-output-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-output-only-shadow.html
new file mode 100644 (file)
index 0000000..17d3416
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <output id="host">foobar</output>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-output-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-output-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..6848544
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <div style="display: inline-block; width: 100px; height: 30px;"></div>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-output-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-output-without-shadow.html
new file mode 100644 (file)
index 0000000..4820f82
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <output id="host" style="display: inline-block; width: 100px; height: 30px">ohyohyo</output>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-select-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-select-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..b06595a
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <div style="margin: 20px">
+        <select></select>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-select-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-select-complex-shadow.html
new file mode 100644 (file)
index 0000000..9f54296
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <select id="host">
+        <option disabled>Please select</option>
+        <optgroup label="Rank 1"></optgroup>
+        <option value="hoge" selected>hoge</option>
+    </select>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-select-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-select-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..86b5b50
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <select id="host">
+        <option disabled>Please select</option>
+        <optgroup label="Rank 1"></optgroup>
+        <option value="hoge" selected>hoge</option>
+    </select>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-select-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-select-only-shadow.html
new file mode 100644 (file)
index 0000000..3dbbac1
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <select id="host">
+        <option disabled>Please select</option>
+        <optgroup label="Rank 1"></optgroup>
+        <option value="hoge" selected>hoge</option>
+    </select>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-select-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-select-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..1b2581f
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <div style="display: inline-block; width: 100px; height: 30px; margin 0; padding: 0; border: 0"></div>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-select-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-select-without-shadow.html
new file mode 100644 (file)
index 0000000..a1f4095
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a Shadow DOM, the content won't be rendered.</p>
+<form>
+    <select id="host" style="width: 100px; height: 30px; margin 0; padding: 0; border: 0">
+        <option disabled>Please select</option>
+        <optgroup label="Rank 1"></optgroup>
+        <option value="hoge" selected>hoge</option>
+    </select>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html
new file mode 100644 (file)
index 0000000..f0a2ddf
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    hogehoge<div style="margin: 20px">
+        <textarea></textarea>
+    </div>    
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html
new file mode 100644 (file)
index 0000000..997f5f6
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>A mixed case of a shadow element and content element.</p>
+<form>
+    <textarea id="host">hogehoge</textarea>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html
new file mode 100644 (file)
index 0000000..e73207b
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <textarea id="host">Something in the air</textarea>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html
new file mode 100644 (file)
index 0000000..78e1a1a
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <textarea id="host">Something in the air</textarea>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var host = document.getElementById('host');
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = "<shadow></shadow>"
+</script>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow-expected.html b/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow-expected.html
new file mode 100644 (file)
index 0000000..9e2aff7
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a shadow element, this should be rendered like div.</p>
+<form>
+    <div id="host" style="display: inline-block; width: 100px; height: 50px; margin: 0; padding: 0"></div>
+    <input id="submit" type="submit" value="Submit">
+</form>
diff --git a/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html b/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html
new file mode 100644 (file)
index 0000000..a1087cb
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<script src="resources/polyfill.js"></script>
+
+<p>When the AuthorShadowDOM does not have a shadow element, this should be rendered like div.</p>
+<form>
+    <textarea id="host" style="width: 100px; height: 50px; margin: 0; padding: 0; border: 0">Mami</textarea>
+    <input id="submit" type="submit" value="Submit">
+</form>
+
+<script>
+var select = document.getElementById('select');
+var shadowRoot = new WebKitShadowRoot(select);
+</script>
index 3823bf4..8f33645 100644 (file)
@@ -3461,6 +3461,24 @@ BUGWK87321 XP : fast/history/history-traversal-is-asynchronous.html = TEXT PASS
 BUGWK79540 DEBUG : fast/files/workers/worker-read-blob-async.html = PASS CRASH
 BUGWK79540 DEBUG : fast/files/workers/worker-read-blob-sync.html = PASS CRASH
 
+// Shadow DOM for replaced elements is not rendered correctly yet.
+BUGWK90860 : fast/dom/shadow/shadowdom-for-object-complex-shadow.html = IMAGE
+BUGWK90860 : fast/dom/shadow/shadowdom-for-object-only-shadow.html = IMAGE
+BUGWK90860 : fast/dom/shadow/shadowdom-for-object-without-shadow.html = IMAGE
+BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html = IMAGE
+BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-only-shadow.html = IMAGE
+BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-without-shadow.html = IMAGE
+BUGWK91486 : fast/dom/shadow/shadowdom-for-button-complex-shadow.html = IMAGE
+BUGWK91486 : fast/dom/shadow/shadowdom-for-button-only-shadow.html = IMAGE
+BUGWK91486 : fast/dom/shadow/shadowdom-for-button-without-shadow.html = IMAGE
+BUGWK91487 : fast/dom/shadow/shadowdom-for-select-complex-shadow.html = IMAGE
+BUGWK91487 : fast/dom/shadow/shadowdom-for-select-without-shadow.html = IMAGE
+BUGWK91488 : fast/dom/shadow/shadowdom-for-output-only-shadow.html = IMAGE
+BUGWK91489 : fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html = IMAGE
+BUGWK91489 : fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html = IMAGE
+BUGWK91491 : fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html = IMAGE
+BUGWK91491 : fast/dom/shadow/shadowdom-for-keygen-without-shadow.html = IMAGE
+
 // Requires setUseDeferredFrameLoading() API from LayoutTestController.
 BUGWK87652 SKIP : http/tests/appcache/load-from-appcache-defer-resume-crash.html = PASS
 
index 4dcfc2f..4916c37 100644 (file)
@@ -678,6 +678,24 @@ BUGWK86961 : fast/dom/shadow/cppevent-in-shadow.html = CRASH
 // Selection problem in Shadow DOM test (passes on GTK)
 BUGWKEFL : fast/dom/shadow/selections-in-shadow.html = TEXT
 
+// Shadow DOM for replaced elements is not rendered correctly yet.
+BUGWK90860 : fast/dom/shadow/shadowdom-for-object-complex-shadow.html = IMAGE
+BUGWK90860 : fast/dom/shadow/shadowdom-for-object-only-shadow.html = IMAGE
+BUGWK90860 : fast/dom/shadow/shadowdom-for-object-without-shadow.html = IMAGE
+BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html = IMAGE
+BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-only-shadow.html = IMAGE
+BUGWK91485 : fast/dom/shadow/shadowdom-for-textarea-without-shadow.html = IMAGE
+BUGWK91486 : fast/dom/shadow/shadowdom-for-button-complex-shadow.html = IMAGE
+BUGWK91486 : fast/dom/shadow/shadowdom-for-button-only-shadow.html = IMAGE
+BUGWK91486 : fast/dom/shadow/shadowdom-for-button-without-shadow.html = IMAGE
+BUGWK91487 : fast/dom/shadow/shadowdom-for-select-complex-shadow.html = IMAGE
+BUGWK91487 : fast/dom/shadow/shadowdom-for-select-without-shadow.html = IMAGE
+BUGWK91488 : fast/dom/shadow/shadowdom-for-output-only-shadow.html = IMAGE
+BUGWK91489 : fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html = IMAGE
+BUGWK91489 : fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html = IMAGE
+BUGWK91491 : fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html = IMAGE
+BUGWK91491 : fast/dom/shadow/shadowdom-for-keygen-without-shadow.html = IMAGE
+
 // This test is specific to QuickTime media engine.
 BUGWKEFL SKIP : media/video-does-not-loop.html = PASS
 
index 2afcbdb..1f364c2 100644 (file)
@@ -235,6 +235,29 @@ fast/dom/shadow/shadow-root-resetStyleInheritance.html
 fast/dom/shadow/shadow-ul-li.html
 fast/dom/shadow/tab-order-iframe-and-shadow.html
 fast/dom/shadow/user-modify-inheritance.html
+fast/dom/shadow/shadowdom-for-object-complex-shadow.html
+fast/dom/shadow/shadowdom-for-object-only-shadow.html
+fast/dom/shadow/shadowdom-for-object-without-shadow.html
+fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html
+fast/dom/shadow/shadowdom-for-textarea-only-shadow.html
+fast/dom/shadow/shadowdom-for-textarea-without-shadow.html
+fast/dom/shadow/shadowdom-for-button-complex-shadow.html
+fast/dom/shadow/shadowdom-for-button-only-shadow.html
+fast/dom/shadow/shadowdom-for-button-without-shadow.html
+fast/dom/shadow/shadowdom-for-select-complex-shadow.html
+fast/dom/shadow/shadowdom-for-select-only-shadow.html
+fast/dom/shadow/shadowdom-for-select-without-shadow.html
+fast/dom/shadow/shadowdom-for-output-complex-shadow.html
+fast/dom/shadow/shadowdom-for-output-only-shadow.html
+fast/dom/shadow/shadowdom-for-output-without-shadow.html
+fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html
+fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html
+fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html
+fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html
+fast/dom/shadow/shadowdom-for-keygen-only-shadow.html
+fast/dom/shadow/shadowdom-for-keygen-without-shadow.html
+fast/dom/shadow/input-with-validation.html
+fast/dom/shadow/input-with-validation-without-shadow.html
 
 # Fail until SUBPIXEL_LAYOUT is enabled
 # https://bugs.webkit.org/show_bug.cgi?id=85532
index d4bbb22..76fc98f 100644 (file)
@@ -2011,6 +2011,29 @@ fast/dom/shadow/shadow-element-rendering-multiple.html
 fast/dom/shadow/multiple-shadowroot.html
 fast/dom/shadow/multiple-shadowroot-rendering.html
 fast/dom/shadow/multiple-shadowroot-adopt.html
+fast/dom/shadow/shadowdom-for-object-complex-shadow.html
+fast/dom/shadow/shadowdom-for-object-only-shadow.html
+fast/dom/shadow/shadowdom-for-object-without-shadow.html
+fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html
+fast/dom/shadow/shadowdom-for-textarea-only-shadow.html
+fast/dom/shadow/shadowdom-for-textarea-without-shadow.html
+fast/dom/shadow/shadowdom-for-button-complex-shadow.html
+fast/dom/shadow/shadowdom-for-button-only-shadow.html
+fast/dom/shadow/shadowdom-for-button-without-shadow.html
+fast/dom/shadow/shadowdom-for-select-complex-shadow.html
+fast/dom/shadow/shadowdom-for-select-only-shadow.html
+fast/dom/shadow/shadowdom-for-select-without-shadow.html
+fast/dom/shadow/shadowdom-for-output-complex-shadow.html
+fast/dom/shadow/shadowdom-for-output-only-shadow.html
+fast/dom/shadow/shadowdom-for-output-without-shadow.html
+fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html
+fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html
+fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html
+fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html
+fast/dom/shadow/shadowdom-for-keygen-only-shadow.html
+fast/dom/shadow/shadowdom-for-keygen-without-shadow.html
+fast/dom/shadow/input-with-validation.html
+fast/dom/shadow/input-with-validation-without-shadow.html
 
 # CSS Regions support not yet enabled. http://webkit.org/b/57312
 fast/regions
index 5596291..8233ae1 100644 (file)
@@ -1,3 +1,64 @@
+2012-07-26  Shinya Kawanaka  <shinyak@chromium.org>
+
+        Add UserAgentShadowDOM to FormControlElement just before adding AuthorShadowDOM
+        https://bugs.webkit.org/show_bug.cgi?id=90866
+
+        Reviewed by Hajime Morita.
+
+        It ensures that UserAgentShadowDOM is the oldest ShadowDOM.
+
+        To show ValidationMessage, WebKit adds a Shadow DOM to some of FormControlElements.
+        ValidationMessage assumes that the added Shadow DOM is the oldest, however, there was a case
+        that a page author might add a Shadow DOM before ValidationMessage adds a Shadow DOM.
+        It will break the assumption that the Shadow DOM added by ValidationMessage is the oldest.
+        So we have prohibited a page author adding a Shadow DOM to FormControlElement.
+
+        To add UserAgentShadowDOM, we use a callback which is called before a page author adding a Shadow DOM.
+        It adds a UserAgentShadowDOM if it does not exist, so we can ensure that UserAgentShadowDOM is the oldest.
+
+        Tests: fast/dom/shadow/input-with-validation-without-shadow.html
+               fast/dom/shadow/input-with-validation.html
+               fast/dom/shadow/shadowdom-for-button-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-button-only-shadow.html
+               fast/dom/shadow/shadowdom-for-button-without-shadow.html
+               fast/dom/shadow/shadowdom-for-fieldset-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-fieldset-only-shadow.html
+               fast/dom/shadow/shadowdom-for-fieldset-without-shadow.html
+               fast/dom/shadow/shadowdom-for-form-associated-element-useragent.html
+               fast/dom/shadow/shadowdom-for-keygen-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-keygen-only-shadow.html
+               fast/dom/shadow/shadowdom-for-keygen-without-shadow.html
+               fast/dom/shadow/shadowdom-for-object-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-object-only-shadow.html
+               fast/dom/shadow/shadowdom-for-object-without-shadow.html
+               fast/dom/shadow/shadowdom-for-output-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-output-only-shadow.html
+               fast/dom/shadow/shadowdom-for-output-without-shadow.html
+               fast/dom/shadow/shadowdom-for-select-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-select-only-shadow.html
+               fast/dom/shadow/shadowdom-for-select-without-shadow.html
+               fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html
+               fast/dom/shadow/shadowdom-for-textarea-only-shadow.html
+               fast/dom/shadow/shadowdom-for-textarea-without-shadow.html
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::allowsAuthorShadowRoot):
+        * html/FormAssociatedElement.cpp:
+        (WebCore::FormAssociatedElement::ensureUserAgentShadowRoot): Ensures the existence of a UserAgentShadowRoot.
+        If it does not exist, we create it with empty content.
+        (WebCore):
+        * html/FormAssociatedElement.h:
+        (FormAssociatedElement):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::willAddAuthorShadowRoot):
+        (WebCore):
+        * html/HTMLFormControlElement.h:
+        (HTMLFormControlElement):
+        * html/ValidationMessage.cpp:
+        (WebCore::adjustBubblePosition): When AuthroShadowRoot does not a shadow element, ValidationMessage
+        does not have a renderer. So we have to check the existence of renderer.
+        (WebCore::ValidationMessage::buildBubbleTree):
+
 2012-07-26  Kaustubh Atrawalkar  <kaustubh@motorola.com>
 
         [DRT] LTC:: pageNumberForElementById() could be moved to Internals
index 67bb861..9e82ab2 100644 (file)
@@ -75,13 +75,6 @@ ShadowRoot::~ShadowRoot()
 
 static bool allowsAuthorShadowRoot(Element* element)
 {
-    // FIXME: ValidationMessage recreates shadow root dynamically.
-    // https://bugs.webkit.org/show_bug.cgi?id=77937
-    // Especially, INPUT recreates shadow root dynamically.
-    // https://bugs.webkit.org/show_bug.cgi?id=77930
-    if (element->isFormControlElement())
-        return false;
-
     // FIXME: We disable multiple shadow subtrees for SVG for while, because there will be problems to support it.
     // https://bugs.webkit.org/show_bug.cgi?id=78205
     // Especially SVG TREF recreates shadow root dynamically.
index f05177c..99377df 100644 (file)
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "FormAssociatedElement.h"
 
+#include "ElementShadow.h"
 #include "FormController.h"
 #include "HTMLFormControlElement.h"
 #include "HTMLFormElement.h"
@@ -66,6 +67,15 @@ ValidityState* FormAssociatedElement::validity()
     return m_validityState.get();
 }
 
+ShadowRoot* FormAssociatedElement::ensureUserAgentShadowRoot()
+{
+    Element* element = toHTMLElement(this);
+    if (ShadowRoot* shadowRoot = element->userAgentShadowRoot())
+        return shadowRoot;
+
+    return ShadowRoot::create(element, ShadowRoot::UserAgentShadowRoot, ASSERT_NO_EXCEPTION).get();
+}
+
 void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument)
 {
     HTMLElement* element = toHTMLElement(this);
index b135df1..f981063 100644 (file)
@@ -46,6 +46,8 @@ public:
     HTMLFormElement* form() const { return m_form; }
     ValidityState* validity();
 
+    ShadowRoot* ensureUserAgentShadowRoot();
+
     virtual bool isFormControlElement() const = 0;
     virtual bool isFormControlElementWithState() const;
     virtual bool isEnumeratable() const = 0;
index 913c4dd..d52d0ba 100644 (file)
@@ -69,6 +69,11 @@ HTMLFormControlElement::~HTMLFormControlElement()
 {
 }
 
+void HTMLFormControlElement::willAddAuthorShadowRoot()
+{
+    ensureUserAgentShadowRoot();
+}
+
 String HTMLFormControlElement::formEnctype() const
 {
     return FormSubmission::Attributes::parseEncodingType(fastGetAttribute(formenctypeAttr));
index b82d4ee..b132cbe 100644 (file)
@@ -45,6 +45,8 @@ public:
 
     HTMLFormElement* form() const { return FormAssociatedElement::form(); }
 
+    void willAddAuthorShadowRoot() OVERRIDE;
+
     String formEnctype() const;
     void setFormEnctype(const String&);
     String formMethod() const;
index 1901f46..79d8c57 100644 (file)
@@ -114,10 +114,12 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble
         return;
     double hostX = hostRect.x();
     double hostY = hostRect.y();
-    if (RenderBox* container = bubble->renderer()->containingBlock()) {
-        FloatPoint containerLocation = container->localToAbsolute();
-        hostX -= containerLocation.x() + container->borderLeft();
-        hostY -= containerLocation.y() + container->borderTop();
+    if (RenderObject* renderer = bubble->renderer()) {
+        if (RenderBox* container = renderer->containingBlock()) {
+            FloatPoint containerLocation = container->localToAbsolute();
+            hostX -= containerLocation.x() + container->borderLeft();
+            hostY -= containerLocation.y() + container->borderTop();
+        }
     }
 
     bubble->setInlineStyleProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX);
@@ -132,6 +134,7 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble
 void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*)
 {
     HTMLElement* host = toHTMLElement(m_element);
+    ShadowRoot* shadowRoot = m_element->ensureUserAgentShadowRoot();
 
     Document* doc = host->document();
     m_bubble = HTMLDivElement::create(doc);
@@ -140,7 +143,7 @@ void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*)
     // contains non-absolute or non-fixed renderers as children.
     m_bubble->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
     ExceptionCode ec = 0;
-    host->ensureShadowRoot()->appendChild(m_bubble.get(), ec);
+    shadowRoot->appendChild(m_bubble.get(), ec);
     ASSERT(!ec);
     host->document()->updateLayout();
     adjustBubblePosition(host->getRect(), m_bubble.get());