Title: [143570] trunk
Revision
143570
Author
commit-qu...@webkit.org
Date
2013-02-21 01:00:07 -0800 (Thu, 21 Feb 2013)

Log Message

File upload control doesn't apply CSS vertical padding or border to file name
https://bugs.webkit.org/show_bug.cgi?id=109011

Patch by Nils Barth <nba...@google.com> on 2013-02-21
Reviewed by Hajime Morrita.

Source/WebCore:

Test: fast/forms/file/file-vertical-padding-border.html

* rendering/RenderFileUploadControl.cpp:
    Add borderTop() and paddingTop() when computing position.
(WebCore::RenderFileUploadControl::paintObject):

LayoutTests:

* fast/forms/file/file-vertical-padding-border.html: Added.
* fast/forms/file/file-vertical-padding-border-expected.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143569 => 143570)


--- trunk/LayoutTests/ChangeLog	2013-02-21 08:27:10 UTC (rev 143569)
+++ trunk/LayoutTests/ChangeLog	2013-02-21 09:00:07 UTC (rev 143570)
@@ -1,3 +1,13 @@
+2013-02-21  Nils Barth  <nba...@google.com>
+
+        File upload control doesn't apply CSS vertical padding or border to file name
+        https://bugs.webkit.org/show_bug.cgi?id=109011
+
+        Reviewed by Hajime Morrita.
+
+        * fast/forms/file/file-vertical-padding-border.html: Added.
+        * fast/forms/file/file-vertical-padding-border-expected.html: Added.
+
 2013-02-20  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: TabbedEditorContainer and OpenResourceDialog should show uiSourceCode path and name instead of parsedURL

Added: trunk/LayoutTests/fast/forms/file/file-vertical-padding-border-expected.html (0 => 143570)


--- trunk/LayoutTests/fast/forms/file/file-vertical-padding-border-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/file-vertical-padding-border-expected.html	2013-02-21 09:00:07 UTC (rev 143570)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>File input alignment with CSS padding and border</title>
+<style type="text/css">
+    span, input {
+        display: inline-block;
+        vertical-align: top;
+        margin: 0px;
+    }
+    .pad-all { padding: 10px; }
+    .pad-top { padding-top: 10px; }
+    .bor-all { border: 10px solid DarkGray; }
+    .bor-top { border-top: 10px solid DarkGray; }
+    input::-webkit-file-upload-button {
+        /* Bug is about file name and padding, not button,
+         * and platform-specific button-rendering is flakey.
+         */
+        -webkit-appearance: none;
+    }
+</style>
+</head>
+<body>
+<p>Bug <a href="" File upload control doesn't apply CSS vertical padding or border to file name</p>
+<p>For this test to pass, the file name (or "No file chosen") should line up with the button text below, with CSS padding and borders overall or on the top, and in combinations thereof.</p>
+<span class="pad-all"><input type="file"/></span>
+<span class="pad-top"><input type="file"/></span>
+<br/>
+<span class="bor-all"><input type="file"/></span>
+<span class="bor-top"><input type="file"/></span>
+<br/>
+<span class="pad-all bor-all"><input type="file"/></span>
+<span class="pad-all bor-top"><input type="file"/></span>
+<br/>
+<span class="pad-top bor-all"><input type="file"/></span>
+<span class="pad-top bor-top"><input type="file"/></span>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/file/file-vertical-padding-border.html (0 => 143570)


--- trunk/LayoutTests/fast/forms/file/file-vertical-padding-border.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/file-vertical-padding-border.html	2013-02-21 09:00:07 UTC (rev 143570)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>File input alignment with CSS padding and border</title>
+<style type="text/css">
+    span, input {
+        display: inline-block;
+        vertical-align: top;
+        margin: 0px;
+    }
+    .pad-all { padding: 10px; }
+    .pad-top { padding-top: 10px; }
+    .bor-all { border: 10px solid DarkGray; }
+    .bor-top { border-top: 10px solid DarkGray; }
+    input::-webkit-file-upload-button {
+        /* Bug is about file name and padding, not button,
+         * and platform-specific button-rendering is flakey.
+         */
+        -webkit-appearance: none;
+    }
+</style>
+</head>
+<body>
+<p>Bug <a href="" File upload control doesn't apply CSS vertical padding or border to file name</p>
+<p>For this test to pass, the file name (or "No file chosen") should line up with the button text below, with CSS padding and borders overall or on the top, and in combinations thereof.</p>
+<span><input type="file" class="pad-all"/></span>
+<span><input type="file" class="pad-top"/></span>
+<br/>
+<span><input type="file" class="bor-all"/></span>
+<span><input type="file" class="bor-top"/></span>
+<br/>
+<span><input type="file" class="pad-all bor-all"/></span>
+<span><input type="file" class="pad-all bor-top"/></span>
+<br/>
+<span><input type="file" class="pad-top bor-all"/></span>
+<span><input type="file" class="pad-top bor-top"/></span>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143569 => 143570)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 08:27:10 UTC (rev 143569)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 09:00:07 UTC (rev 143570)
@@ -1,3 +1,16 @@
+2013-02-21  Nils Barth  <nba...@google.com>
+
+        File upload control doesn't apply CSS vertical padding or border to file name
+        https://bugs.webkit.org/show_bug.cgi?id=109011
+
+        Reviewed by Hajime Morrita.
+
+        Test: fast/forms/file/file-vertical-padding-border.html
+
+        * rendering/RenderFileUploadControl.cpp:
+            Add borderTop() and paddingTop() when computing position.
+        (WebCore::RenderFileUploadControl::paintObject):
+
 2013-02-20  Alexey Proskuryakov  <a...@apple.com>
 
         Stop hardcoding knowledge about blob protocol in ResourceHandle

Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (143569 => 143570)


--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2013-02-21 08:27:10 UTC (rev 143569)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2013-02-21 09:00:07 UTC (rev 143570)
@@ -141,7 +141,7 @@
         // We want to match the button's baseline
         // FIXME: Make this work with transforms.
         if (RenderButton* buttonRenderer = toRenderButton(button->renderer()))
-            textY = paintOffset.y() + buttonRenderer->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
+            textY = paintOffset.y() + borderTop() + paddingTop() + buttonRenderer->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
         else
             textY = baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to