Title: [127108] trunk
Revision
127108
Author
[email protected]
Date
2012-08-30 00:19:55 -0700 (Thu, 30 Aug 2012)

Log Message

AuthorShadowDOM support for textarea element.
https://bugs.webkit.org/show_bug.cgi?id=91485

Reviewed by Dimitri Glazkov.

Source/WebCore:

We add AuthorShadowDOM support for textarea element.

Unlike other replaced elements (e.g. meter, progress, img), we do not need to add
extra RenderBlock when we add AuthorShadowDOM. However, since inner element will not have
renderer when AuthorShadowDOM does not have any shadow insertion point, we have to check
the existence of the renderer of inner element.

Tests: fast/dom/shadow/shadowdom-for-textarea-with-attribute.html
       fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html
       fast/dom/shadow/shadowdom-for-textarea-with-style.html
       fast/dom/shadow/shadowdom-for-textarea.html

* dom/ShadowRoot.cpp:
(WebCore::allowsAuthorShadowRoot): Needs allow textarea to have AuthorShadowRoot.
* rendering/RenderTextControl.cpp: When AuthorShadowDOM does not have any insertion point,
innerTextElement() will not have any renderer. We have to tweak these renderers not to be crashed.
(WebCore::RenderTextControl::textBlockWidth):
(WebCore::RenderTextControl::updateFromElement):
(WebCore::RenderTextControl::computeLogicalHeight):
(WebCore::RenderTextControl::hitInnerTextElement):
(WebCore::RenderTextControl::computePreferredLogicalWidths):

LayoutTests:

We have the following tests.
(1) having only <shadow> insertion point.
(2) not having <shadow> insertion point.
(3) having <shadow> and <content> insertion point.
(4) with rows/cols attribute
(5) with placeholder attribute

* fast/dom/shadow/shadow-disable-expected.txt:
* fast/dom/shadow/shadow-disable.html:
* fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html:
* fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html:
* fast/dom/shadow/shadowdom-for-textarea-expected.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html:
* fast/dom/shadow/shadowdom-for-textarea-only-shadow.html:
* fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html.
* fast/dom/shadow/shadowdom-for-textarea-with-attribute.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html.
* fast/dom/shadow/shadowdom-for-textarea-with-placeholder-expected.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html: Added.
* fast/dom/shadow/shadowdom-for-textarea-with-style.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html.
* fast/dom/shadow/shadowdom-for-textarea-without-shadow.html:
* fast/dom/shadow/shadowdom-for-textarea.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127107 => 127108)


--- trunk/LayoutTests/ChangeLog	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/ChangeLog	2012-08-30 07:19:55 UTC (rev 127108)
@@ -1,3 +1,35 @@
+2012-08-30  Shinya Kawanaka  <[email protected]>
+
+        AuthorShadowDOM support for textarea element.
+        https://bugs.webkit.org/show_bug.cgi?id=91485
+
+        Reviewed by Dimitri Glazkov.
+
+        We have the following tests.
+        (1) having only <shadow> insertion point.
+        (2) not having <shadow> insertion point.
+        (3) having <shadow> and <content> insertion point.
+        (4) with rows/cols attribute
+        (5) with placeholder attribute
+
+        * fast/dom/shadow/shadow-disable-expected.txt:
+        * fast/dom/shadow/shadow-disable.html:
+        * fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html:
+        * fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html:
+        * fast/dom/shadow/shadowdom-for-textarea-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html:
+        * fast/dom/shadow/shadowdom-for-textarea-only-shadow.html:
+        * fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html.
+        * fast/dom/shadow/shadowdom-for-textarea-with-attribute.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html.
+        * fast/dom/shadow/shadowdom-for-textarea-with-placeholder-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html: Added.
+        * fast/dom/shadow/shadowdom-for-textarea-with-style.html: Copied from LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html.
+        * fast/dom/shadow/shadowdom-for-textarea-without-shadow.html:
+        * fast/dom/shadow/shadowdom-for-textarea.html: Added.
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+
 2012-08-29  Andrei Bucur  <[email protected]>
 
         Layout Test fast/repaint/japanese-rl-selection-repaint-in-regions.html is failing after r126304

Modified: trunk/LayoutTests/fast/dom/shadow/shadow-disable-expected.txt (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadow-disable-expected.txt	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-disable-expected.txt	2012-08-30 07:19:55 UTC (rev 127108)
@@ -17,10 +17,10 @@
 PASS new WebKitShadowRoot(element) is not null
 SELECT
 PASS new WebKitShadowRoot(element) is not null
+TEXTAREA
+PASS new WebKitShadowRoot(element) is not null
 INPUT
 PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
-TEXTAREA
-PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
 tref
 PASS new WebKitShadowRoot(element) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/dom/shadow/shadow-disable.html (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadow-disable.html	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-disable.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -26,12 +26,12 @@
     document.createElement('section'),
     document.createElement('audio'),
     document.createElement('video'),
-    document.createElement('select')
+    document.createElement('select'),
+    document.createElement('textarea')
 ];
 
 var elementsToFail = [
     document.createElement('input'),
-    document.createElement('textarea'),
     document.getElementById('tref')
 ];
 

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow-expected.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -1,10 +1,29 @@
 <!DOCTYPE html>
-<script src=""
+<html>
+<head>
+<style>
+.textarea-like {
+    width: 255px;
+    height: 96px;
+    border: 1px solid black;
+    overflow-y: scroll;
+    position: relative;
+    top: 2px;
+    margin: 2px 2px 2px 2px;
+    padding: 2px 2px 2px 2px;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    font: -webkit-small-control;
+    font-family: monospace;
+}
+</style>
+</head>
+<body>
 
 <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">
+    <div class="textarea-like">textarea<p>paragraph<b>bold</b>paragraph</p><div style="margin: 20px">textarea</div></div>
 </form>
+
+</body>
+</html>

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-complex-shadow.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -1,14 +1,34 @@
 <!DOCTYPE html>
+<html>
+<head>
+<style>
+textarea {
+   resize: none;
+}
+</style>
+</head>
+<body>
 <script src=""
 
 <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">
+    <textarea id="host" rows="6" cols="30">textarea</textarea>
 </form>
 
 <script>
-var host = document.getElementById('host');
+var p = document.createElement('p');
+p.innerHTML = "paragraph<b>bold</b>paragraph";
+host.appendChild(p);
+
 var shadowRoot = new WebKitShadowRoot(host);
-shadowRoot.innerHTML = "<content></content><div style='margin: 20px'><shadow></shadow></div>"
+
+// <content></content><div style="margin: 20px"><shadow></shadow></div>
+shadowRoot.appendChild(document.createElement('content'));
+var div = document.createElement('div');
+div.setAttribute('style', 'margin: 20px');
+div.appendChild(document.createElement('shadow'));
+shadowRoot.appendChild(div);
 </script>
+
+</body>
+</html>

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


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-expected.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+
+<form>
+    <textarea id="host" cols="20" rows="4">(before)
+Something in the air
+(after)</textarea>
+</form>
+
+</body>
+</html>

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -3,6 +3,6 @@
 
 <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">
+    <textarea>Something in the air</textarea>
 </form>
+

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -4,11 +4,9 @@
 <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>"
+shadowRoot.appendChild(document.createElement('shadow'));
 </script>

Copied: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html (from rev 127107, trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html) (0 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<script src=""
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <textarea rows="8" cols="20">Something in the air</textarea>
+</form>

Copied: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html (from rev 127107, trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html) (0 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<script src=""
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <textarea id="host" rows="8" cols="20">Something in the air</textarea>
+</form>
+
+<script>
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.appendChild(document.createElement('shadow'));
+</script>

Added: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-placeholder-expected.html (0 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-placeholder-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-placeholder-expected.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="" type="text/css">
+</head>
+<body>
+
+<div>
+    <textarea placeholder="This is a placeholder text." rows="4" cols="30" style="position: absolute; background-color: transparent;"></textarea>
+    <textarea rows="4" cols="30">before
+
+after</textarea>
+    
+</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html (0 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="" type="text/css">
+<script src=""
+</head>
+<body>
+
+<textarea id="host" rows="4" cols="30" placeholder="This is a placeholder text."></textarea>
+
+<script>
+var shadowRoot1 = new WebKitShadowRoot(host);
+shadowRoot1.appendChild(document.createTextNode('before'));
+shadowRoot1.appendChild(document.createElement('shadow'));
+shadowRoot1.appendChild(document.createTextNode('after'));
+</script>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html (0 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+textarea {
+    margin: 10px;
+    border: 2px dashed black;
+    padding: 10px;
+}
+</head>
+<body>
+
+<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p>
+<form>
+    <textarea>Something in the air</textarea>
+</form>
+
+</body>
+</html>

Copied: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html (from rev 127107, trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html) (0 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+textarea {
+    margin: 10px;
+    border: 2px dashed black;
+    padding: 10px;
+}
+</head>
+<body>
+<script src=""
+
+<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>
+</form>
+
+<script>
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.appendChild(document.createElement('shadow'));
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html (127107 => 127108)


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-without-shadow.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -8,6 +8,5 @@
 </form>
 
 <script>
-var select = document.getElementById('select');
-var shadowRoot = new WebKitShadowRoot(select);
+var shadowRoot = new WebKitShadowRoot(host);
 </script>

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


--- trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowdom-for-textarea.html	2012-08-30 07:19:55 UTC (rev 127108)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+
+<form>
+    <textarea id="host" cols="20" rows="4">Something in the air</textarea>
+</form>
+
+<script>
+var shadowRoot = new WebKitShadowRoot(host);
+
+var div = document.createElement('div');
+div.innerHTML = "(before)<shadow></shadow>(after)";
+shadowRoot.appendChild(div);
+</script>
+
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (127107 => 127108)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-30 07:19:55 UTC (rev 127108)
@@ -3246,8 +3246,6 @@
 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-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

Modified: trunk/LayoutTests/platform/efl/TestExpectations (127107 => 127108)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-08-30 07:19:55 UTC (rev 127108)
@@ -769,9 +769,6 @@
 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
 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

Modified: trunk/Source/WebCore/ChangeLog (127107 => 127108)


--- trunk/Source/WebCore/ChangeLog	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/Source/WebCore/ChangeLog	2012-08-30 07:19:55 UTC (rev 127108)
@@ -1,3 +1,32 @@
+2012-08-30  Shinya Kawanaka  <[email protected]>
+
+        AuthorShadowDOM support for textarea element.
+        https://bugs.webkit.org/show_bug.cgi?id=91485
+
+        Reviewed by Dimitri Glazkov.
+
+        We add AuthorShadowDOM support for textarea element.
+
+        Unlike other replaced elements (e.g. meter, progress, img), we do not need to add
+        extra RenderBlock when we add AuthorShadowDOM. However, since inner element will not have
+        renderer when AuthorShadowDOM does not have any shadow insertion point, we have to check
+        the existence of the renderer of inner element.
+
+        Tests: fast/dom/shadow/shadowdom-for-textarea-with-attribute.html
+               fast/dom/shadow/shadowdom-for-textarea-with-placeholder.html
+               fast/dom/shadow/shadowdom-for-textarea-with-style.html
+               fast/dom/shadow/shadowdom-for-textarea.html
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::allowsAuthorShadowRoot): Needs allow textarea to have AuthorShadowRoot.
+        * rendering/RenderTextControl.cpp: When AuthorShadowDOM does not have any insertion point,
+        innerTextElement() will not have any renderer. We have to tweak these renderers not to be crashed.
+        (WebCore::RenderTextControl::textBlockWidth):
+        (WebCore::RenderTextControl::updateFromElement):
+        (WebCore::RenderTextControl::computeLogicalHeight):
+        (WebCore::RenderTextControl::hitInnerTextElement):
+        (WebCore::RenderTextControl::computePreferredLogicalWidths):
+
 2012-08-29  Adam Barth  <[email protected]>
 
         [V8] ScriptController::matchesCurrentContext duplicates code from ScriptController::currentWorldContext

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (127107 => 127108)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-08-30 07:19:55 UTC (rev 127108)
@@ -88,7 +88,7 @@
     // So we would like to prohibit having a AuthorShadowDOM for a while. The same thing happens to
     // textarea element also.
     // https://bugs.webkit.org/show_bug.cgi?id=92608
-    if (isHTMLInputElement(element) || isHTMLTextAreaElement(element))
+    if (isHTMLInputElement(element))
         return false;
 
     // FIXME: We disable multiple shadow subtrees for SVG for while, because there will be problems to support it.

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (127107 => 127108)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2012-08-30 06:54:19 UTC (rev 127107)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2012-08-30 07:19:55 UTC (rev 127108)
@@ -110,13 +110,18 @@
 {
     Element* innerText = innerTextElement();
     ASSERT(innerText);
-    return width() - borderAndPaddingWidth() - innerText->renderBox()->paddingLeft() - innerText->renderBox()->paddingRight();
+
+    LayoutUnit unitWidth = width() - borderAndPaddingWidth();
+    if (innerText->renderer())
+        unitWidth -= innerText->renderBox()->paddingLeft() + innerText->renderBox()->paddingRight();
+
+    return unitWidth;
 }
 
 void RenderTextControl::updateFromElement()
 {
     Element* innerText = innerTextElement();
-    if (innerText)
+    if (innerText && innerText->renderer())
         updateUserModifyProperty(node(), innerText->renderer()->style());
 }
 
@@ -143,13 +148,14 @@
 {
     HTMLElement* innerText = innerTextElement();
     ASSERT(innerText);
-    RenderBox* innerTextBox = innerText->renderBox();
-    LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
-    setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight());
+    if (RenderBox* innerTextBox = innerText->renderBox()) {
+        LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
+        setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight());
 
-    // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
-    if (style()->overflowX() == OSCROLL ||  (style()->overflowX() == OAUTO && innerText->renderer()->style()->wordWrap() == NormalWordWrap))
-        setHeight(height() + scrollbarThickness());
+        // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
+        if (style()->overflowX() == OSCROLL ||  (style()->overflowX() == OAUTO && innerText->renderer()->style()->wordWrap() == NormalWordWrap))
+            setHeight(height() + scrollbarThickness());
+    }
 
     RenderBlock::computeLogicalHeight();
 }
@@ -157,6 +163,9 @@
 void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
 {
     HTMLElement* innerText = innerTextElement();
+    if (!innerText->renderer())
+        return;
+
     LayoutPoint adjustedLocation = accumulatedOffset + location();
     LayoutPoint localPoint = pointInContainer - toLayoutSize(adjustedLocation + innerText->renderBox()->location());
     if (hasOverflowClip())
@@ -257,8 +266,9 @@
     else {
         // Use average character width. Matches IE.
         AtomicString family = style()->font().family().family();
-        RenderBox* innerTextRenderBox = innerTextElement()->renderBox();
-        m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)) + innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
+        m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family));
+        if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
+            m_maxPreferredLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
     }
 
     if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to