2011-05-02 Joseph Pecoraro <joepeck@webkit.org>
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2011 00:20:46 +0000 (00:20 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2011 00:20:46 +0000 (00:20 +0000)
        Reviewed by David Kilzer.

        Respect fixed text-indent on ::-webkit-input-placeholder
        https://bugs.webkit.org/show_bug.cgi?id=59825

        Placeholder text does not appear in the render tree
        dumps, so this is a pixel test for the position of
        the placeholder affected by text-indent.

        * fast/forms/input-placeholder-text-indent.html: Added.
        * platform/mac/fast/forms/input-placeholder-text-indent-expected.png: Added.
        * platform/mac/fast/forms/input-placeholder-text-indent-expected.txt: Added.

2011-05-02  Joseph Pecoraro  <joepeck@webkit.org>

        Reviewed by David Kilzer.

        Respect fixed text-indent on ::-webkit-input-placeholder
        https://bugs.webkit.org/show_bug.cgi?id=59825

        Test: fast/forms/input-placeholder-text-indent.html

        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::paintPlaceholder): indent by
        a fixed text-indent size specified on the placeholder style.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/input-placeholder-text-indent.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTextControl.cpp

index f92fe97..9fd8554 100644 (file)
@@ -1,3 +1,18 @@
+2011-05-02  Joseph Pecoraro  <joepeck@webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Respect fixed text-indent on ::-webkit-input-placeholder
+        https://bugs.webkit.org/show_bug.cgi?id=59825
+
+        Placeholder text does not appear in the render tree
+        dumps, so this is a pixel test for the position of
+        the placeholder affected by text-indent.
+
+        * fast/forms/input-placeholder-text-indent.html: Added.
+        * platform/mac/fast/forms/input-placeholder-text-indent-expected.png: Added.
+        * platform/mac/fast/forms/input-placeholder-text-indent-expected.txt: Added.
+
 2011-05-02  Eric Uhrhane  <ericu@chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/forms/input-placeholder-text-indent.html b/LayoutTests/fast/forms/input-placeholder-text-indent.html
new file mode 100644 (file)
index 0000000..811cd93
--- /dev/null
@@ -0,0 +1,25 @@
+<style>
+input { font-size: 30px; width: 500px; }
+input.a::-webkit-input-placeholder { text-indent: 0px; }
+input.b::-webkit-input-placeholder { text-indent: 10px; }
+input.c::-webkit-input-placeholder { text-indent: 200px; }
+input.d::-webkit-input-placeholder { text-indent: -10px; }
+input.e::-webkit-input-placeholder { text-indent: 50%; } /* Ignored. */
+</style>
+
+<div style="direction:ltr">
+    <input placeholder="placeholder"><br>
+    <input class="a" placeholder="placeholder"><br>
+    <input class="b" placeholder="placeholder"><br>
+    <input class="c" placeholder="placeholder"><br>
+    <input class="d" placeholder="placeholder"><br>
+    <input class="e" placeholder="placeholder"><br>
+</div>
+<div style="direction:rtl">
+    <input placeholder="placeholder"><br>
+    <input class="a" placeholder="placeholder"><br>
+    <input class="b" placeholder="placeholder"><br>
+    <input class="c" placeholder="placeholder"><br>
+    <input class="d" placeholder="placeholder"><br>
+    <input class="e" placeholder="placeholder"><br>
+</div>
diff --git a/LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.png b/LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.png
new file mode 100644 (file)
index 0000000..028e312
Binary files /dev/null and b/LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.txt b/LayoutTests/platform/mac/fast/forms/input-placeholder-text-indent-expected.txt
new file mode 100644 (file)
index 0000000..398883f
--- /dev/null
@@ -0,0 +1,55 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x270
+        RenderTextControl {INPUT} at (0,2) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (500,34) size 0x0
+        RenderTextControl {INPUT} at (0,47) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (500,79) size 0x0
+        RenderTextControl {INPUT} at (0,92) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (500,124) size 0x0
+        RenderTextControl {INPUT} at (0,137) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (500,169) size 0x0
+        RenderTextControl {INPUT} at (0,182) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (500,214) size 0x0
+        RenderTextControl {INPUT} at (0,227) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (500,259) size 0x0
+      RenderBlock {DIV} at (0,270) size 784x270
+        RenderTextControl {INPUT} at (284,2) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (284,34) size 0x0
+        RenderTextControl {INPUT} at (284,47) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (284,79) size 0x0
+        RenderTextControl {INPUT} at (284,92) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (284,124) size 0x0
+        RenderTextControl {INPUT} at (284,137) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (284,169) size 0x0
+        RenderTextControl {INPUT} at (284,182) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (284,214) size 0x0
+        RenderTextControl {INPUT} at (284,227) size 500x41 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderBR {BR} at (284,259) size 0x0
+layer at (11,13) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (11,58) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (11,103) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (11,148) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (11,193) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (11,238) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (295,283) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (295,328) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (295,373) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (295,418) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (295,463) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
+layer at (295,508) size 494x35
+  RenderBlock {DIV} at (3,3) size 494x35
index d03d3eb..bac47e9 100644 (file)
@@ -1,3 +1,16 @@
+2011-05-02  Joseph Pecoraro  <joepeck@webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Respect fixed text-indent on ::-webkit-input-placeholder
+        https://bugs.webkit.org/show_bug.cgi?id=59825
+
+        Test: fast/forms/input-placeholder-text-indent.html
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::paintPlaceholder): indent by
+        a fixed text-indent size specified on the placeholder style.
+
 2011-05-02  Eric Uhrhane  <ericu@chromium.org>
 
         Reviewed by Eric Seidel.
index eb7ff50..2db396f 100644 (file)
@@ -642,10 +642,11 @@ void RenderTextControl::paintPlaceholder(PaintInfo& paintInfo, int tx, int ty)
     if (textRenderer) {
         IntPoint textPoint;
         textPoint.setY(ty + textBlockInsetTop() + placeholderStyle->fontMetrics().ascent());
+        int styleTextIndent = placeholderStyle->textIndent().isFixed() ? placeholderStyle->textIndent().calcMinValue(0) : 0;
         if (placeholderStyle->isLeftToRightDirection())
-            textPoint.setX(tx + textBlockInsetLeft());
+            textPoint.setX(tx + styleTextIndent + textBlockInsetLeft());
         else
-            textPoint.setX(tx + width() - textBlockInsetRight() - style()->font().width(textRun));
+            textPoint.setX(tx + width() - textBlockInsetRight() - styleTextIndent - style()->font().width(textRun));
         
         paintInfo.context->drawBidiText(placeholderStyle->font(), textRun, textPoint);
     }