WebKit erroneously add 1px padding in input elements
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 07:42:02 +0000 (07:42 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 07:42:02 +0000 (07:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86784

Reviewed by Kent Tamura.

Source/WebCore:

Fixed the bug by removing the code that added left and right paddings in input elements.
The code was added in r13567 to match a very old version of Internet Explorer but this quirk
does not seem to exists in IE9 (both in quirks and standard modes).

A lot of tests need to be rebaselined due to 1px difference inside input elements, and 2px
differences for the width of input elements. (In some extreme cases, line breaking changed
due to the width change).

Test: fast/forms/input-textarea-padding-match.html

* css/html.css:
(input::-webkit-input-placeholder, isindex::-webkit-input-placeholder):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::createInnerTextStyle):

LayoutTests:

Add a regression.

Also rebaseline tests in separate commits per getting rid of extra 1px padding on left and right.
Input elements' widths got shrunk by 2px in most cases and the text moved 1px to the start
(left for LTR and right for RTL).

* fast/forms/input-textarea-padding-match-expected.html: Added.
* fast/forms/input-textarea-padding-match.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/input-textarea-padding-match-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/input-textarea-padding-match.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/html.css
Source/WebCore/rendering/RenderTextControlSingleLine.cpp

index 862c4a6..f1da413 100644 (file)
@@ -1,3 +1,19 @@
+2012-05-17  Ryosuke Niwa  <rniwa@webkit.org>
+
+        WebKit erroneously add 1px padding in input elements
+        https://bugs.webkit.org/show_bug.cgi?id=86784
+
+        Reviewed by Kent Tamura.
+
+        Add a regression.
+
+        Also rebaseline tests in separate commits per getting rid of extra 1px padding on left and right.
+        Input elements' widths got shrunk by 2px in most cases and the text moved 1px to the start
+        (left for LTR and right for RTL).
+
+        * fast/forms/input-textarea-padding-match-expected.html: Added.
+        * fast/forms/input-textarea-padding-match.html: Added.
+
 2012-05-18  Ryosuke Niwa  <rniwa@webkit.org>
 
         Chromium rebaselines.
diff --git a/LayoutTests/fast/forms/input-textarea-padding-match-expected.html b/LayoutTests/fast/forms/input-textarea-padding-match-expected.html
new file mode 100644 (file)
index 0000000..fca67f4
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test ensures padding inside input and textarea elements match.</p>
+<style type="text/css">
+textarea {
+  display: block;
+  font-family: arial,sans-serif;
+  border: none;
+  padding: 0 0 0 10px;
+  margin: 0;
+  resize: none;
+  width: 20px;
+  height: 10px;
+  overflow: hidden;
+}
+</style>
+<textarea>|</textarea>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/input-textarea-padding-match.html b/LayoutTests/fast/forms/input-textarea-padding-match.html
new file mode 100644 (file)
index 0000000..35347d3
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test ensures padding inside input and textarea elements match.</p>
+<style type="text/css">
+input {
+  display: block;
+  font-family: arial,sans-serif;
+  border: none;
+  padding: 0 0 0 10px;
+  margin: 0;
+  resize: none;
+  width: 20px;
+  height: 10px;
+  overflow: hidden;
+}
+</style>
+<input type="text" value="|">
+</body>
+</html>
index 58bfc76..a1bffb9 100644 (file)
@@ -1,3 +1,25 @@
+2012-05-17  Ryosuke Niwa  <rniwa@webkit.org>
+
+        WebKit erroneously add 1px padding in input elements
+        https://bugs.webkit.org/show_bug.cgi?id=86784
+
+        Reviewed by Kent Tamura.
+
+        Fixed the bug by removing the code that added left and right paddings in input elements.
+        The code was added in r13567 to match a very old version of Internet Explorer but this quirk
+        does not seem to exists in IE9 (both in quirks and standard modes).
+
+        A lot of tests need to be rebaselined due to 1px difference inside input elements, and 2px
+        differences for the width of input elements. (In some extreme cases, line breaking changed
+        due to the width change).
+
+        Test: fast/forms/input-textarea-padding-match.html
+
+        * css/html.css:
+        (input::-webkit-input-placeholder, isindex::-webkit-input-placeholder):
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::createInnerTextStyle):
+
 2012-05-18  Zalan Bujtas  <zbujtas@gmail.com>
 
         [Qt] Gesture tap highlighter needs to take overflow clip into account.
index 65217d6..d1e373b 100644 (file)
@@ -510,8 +510,6 @@ input::-webkit-input-placeholder, isindex::-webkit-input-placeholder {
     white-space: pre;
     word-wrap: normal;
     overflow: hidden;
-    padding-left: 1px;
-    padding-right: 1px;
 }
 
 input[type="password"] {
index f04f3c1..848fc21 100644 (file)
@@ -478,10 +478,6 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const
 
     textBlockStyle->setDisplay(BLOCK);
 
-    // We're adding one extra pixel of padding to match WinIE.
-    textBlockStyle->setPaddingLeft(Length(1, Fixed));
-    textBlockStyle->setPaddingRight(Length(1, Fixed));
-
     return textBlockStyle.release();
 }