Title: [176082] trunk
Revision
176082
Author
[email protected]
Date
2014-11-13 12:15:33 -0800 (Thu, 13 Nov 2014)

Log Message

REGRESSION (r172826): Password field placeholder text is missing if
placeholder attribute precedes type attribute

<https://bugs.webkit.org/show_bug.cgi?id=138682>
<rdar://problem/18574213>

Source/WebCore:

When the placeholder attribute is encountered, a shadow tree is created
to include the placeholder element. When the type attribute is
encountered, the previous shadow tree is destroyed, and a new shadow
tree is created. TextFieldInputType::createShadowSubtree() did not
handle creating the placeholder element.

This regressed in r172826 because prior to r172826, the placeholder
element would be recreated when
HTMLTextFormControlElement::updatePlaceholderVisibility() was called.
In r172826, updatePlaceholderVisibility() was changed to only show or
hide the placeholder element if it exists.

Reviewed by Benjamin Poulain.

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtree):
Call updatePlaceholderVisibility() to insert the placeholder element
(after the inner text element has been inserted, as it appears before
it in the shadow DOM).

LayoutTests:

Reviewed by Benjamin Poulain.

* fast/forms/placeholder-attribute-ordering-expected.html: Added.
* fast/forms/placeholder-attribute-ordering.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176081 => 176082)


--- trunk/LayoutTests/ChangeLog	2014-11-13 19:57:04 UTC (rev 176081)
+++ trunk/LayoutTests/ChangeLog	2014-11-13 20:15:33 UTC (rev 176082)
@@ -1,3 +1,16 @@
+2014-11-12  Jon Honeycutt  <[email protected]>
+
+        REGRESSION (r172826): Password field placeholder text is missing if
+        placeholder attribute precedes type attribute
+
+        <https://bugs.webkit.org/show_bug.cgi?id=138682>
+        <rdar://problem/18574213> 
+
+        Reviewed by Benjamin Poulain.
+
+        * fast/forms/placeholder-attribute-ordering-expected.html: Added.
+        * fast/forms/placeholder-attribute-ordering.html: Added.
+
 2014-11-13  Joanmarie Diggs  <[email protected]>
 
         AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes

Added: trunk/LayoutTests/fast/forms/placeholder-attribute-ordering-expected.html (0 => 176082)


--- trunk/LayoutTests/fast/forms/placeholder-attribute-ordering-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/placeholder-attribute-ordering-expected.html	2014-11-13 20:15:33 UTC (rev 176082)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <p>This test ensures that placeholder text is shown regardless of the 'type' and 'placeholder' attribute order.</p>
+    <div>
+        <input type="text" placeholder="12334567890">
+        <input type="text" placeholder="12334567890">
+        <input type="text" placeholder="12334567890">
+        <input type="text" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+        <input type="text" placeholder="12334567890">
+    </div>
+    <div>
+        <input type="password" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+        <input type="text" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+    </div>
+    <div>
+        <input type="number" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+        <input type="text" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+    </div>
+    <div>
+        <input type="text" placeholder="12334567890">
+        <input type="password" placeholder="12334567890">
+        <input type="number" placeholder="12334567890">
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/placeholder-attribute-ordering.html (0 => 176082)


--- trunk/LayoutTests/fast/forms/placeholder-attribute-ordering.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/placeholder-attribute-ordering.html	2014-11-13 20:15:33 UTC (rev 176082)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <p>This test ensures that placeholder text is shown regardless of the 'type' and 'placeholder' attribute order.</p>
+    <div>
+        <input type="text" placeholder="12334567890">
+        <input placeholder="12334567890" type="text">
+        <input type="text" id="a" placeholder="12334567890">
+        <input type="text" id="b" placeholder="NA">
+        <input type="text" id="c">
+        <input type="text" id="d">
+        <input id="e">
+    </div>
+    <div>
+        <input type="password" placeholder="12334567890">
+        <input placeholder="12334567890" type="password">
+        <input type="password" id="f" placeholder="12334567890">
+        <input type="password" id="g" placeholder="NA">
+        <input type="password" id="h">
+        <input type="password" id="i">
+        <input id="j">
+    </div>
+    <div>
+        <input type="number" placeholder="12334567890">
+        <input placeholder="12334567890" type="number">
+        <input type="number" id="k" placeholder="12334567890">
+        <input type="number" id="l" placeholder="456">
+        <input type="number" id="m">
+        <input type="number" id="n">
+        <input id="o">
+    </div>
+    <div>
+        <input id="p">
+        <input id="q">
+        <input id="r">
+    </div>
+    <script>
+        for (var id of ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"])
+            document.getElementById(id).placeholder = "12334567890";
+
+        document.getElementById("c").type = "password";
+        document.getElementById("d").type = "number";
+        document.getElementById("e").type = "text";
+
+        document.getElementById("h").type = "text";
+        document.getElementById("i").type = "number";
+        document.getElementById("j").type = "password";
+
+        document.getElementById("m").type = "text";
+        document.getElementById("n").type = "password";
+        document.getElementById("o").type = "number";
+
+        document.getElementById("p").type = "text";
+        document.getElementById("q").type = "password";
+        document.getElementById("r").type = "number";
+        for (var id of ["p", "q", "r"])
+            document.getElementById(id).placeholder = "12334567890";
+    </script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (176081 => 176082)


--- trunk/Source/WebCore/ChangeLog	2014-11-13 19:57:04 UTC (rev 176081)
+++ trunk/Source/WebCore/ChangeLog	2014-11-13 20:15:33 UTC (rev 176082)
@@ -1,3 +1,31 @@
+2014-11-12  Jon Honeycutt  <[email protected]>
+
+        REGRESSION (r172826): Password field placeholder text is missing if
+        placeholder attribute precedes type attribute
+
+        <https://bugs.webkit.org/show_bug.cgi?id=138682>
+        <rdar://problem/18574213> 
+
+        When the placeholder attribute is encountered, a shadow tree is created
+        to include the placeholder element. When the type attribute is
+        encountered, the previous shadow tree is destroyed, and a new shadow
+        tree is created. TextFieldInputType::createShadowSubtree() did not
+        handle creating the placeholder element. 
+
+        This regressed in r172826 because prior to r172826, the placeholder
+        element would be recreated when
+        HTMLTextFormControlElement::updatePlaceholderVisibility() was called.
+        In r172826, updatePlaceholderVisibility() was changed to only show or
+        hide the placeholder element if it exists.
+
+        Reviewed by Benjamin Poulain.
+
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::createShadowSubtree):
+        Call updatePlaceholderVisibility() to insert the placeholder element
+        (after the inner text element has been inserted, as it appears before
+        it in the shadow DOM).
+
 2014-11-13  Joanmarie Diggs  <[email protected]>
 
         AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (176081 => 176082)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2014-11-13 19:57:04 UTC (rev 176081)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2014-11-13 20:15:33 UTC (rev 176082)
@@ -255,6 +255,7 @@
     m_innerText = TextControlInnerTextElement::create(document);
     if (!createsContainer) {
         element().userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
+        updatePlaceholderText();
         return;
     }
 
@@ -267,6 +268,8 @@
     m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
     m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);
 
+    updatePlaceholderText();
+
     if (shouldHaveSpinButton) {
         m_innerSpinButton = SpinButtonElement::create(document, *this);
         m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to