Title: [151788] trunk
Revision
151788
Author
[email protected]
Date
2013-06-20 11:58:42 -0700 (Thu, 20 Jun 2013)

Log Message

REGRESSION (r151451): Text not vertically centered correctly on icloud.com
https://bugs.webkit.org/show_bug.cgi?id=117744

Reviewed by David Hyatt.

Source/WebCore:

The positioned height and width computation adds in the element's border and padding so
don't add it to the intrinsic height and preferred widths of text controls that are
absolutely positioned.

Test: fast/replaced/height-of-positioned-text-control.html

* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::computeLogicalHeight):
(WebCore::RenderTextControl::computePreferredLogicalWidths):

LayoutTests:

* fast/forms/onselect-textfield-expected.txt:
* fast/replaced/height-of-positioned-text-control-expected.html: Added.
* fast/replaced/height-of-positioned-text-control.html: Added.
* fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt:
* platform/mac/fast/forms/input-appearance-preventDefault-expected.png:
* platform/mac/fast/forms/input-appearance-preventDefault-expected.txt:
* platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png: Added.
* platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt:
* platform/qt/fast/forms/input-appearance-preventDefault-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151787 => 151788)


--- trunk/LayoutTests/ChangeLog	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/LayoutTests/ChangeLog	2013-06-20 18:58:42 UTC (rev 151788)
@@ -1,3 +1,20 @@
+2013-06-18  Robert Hogan  <[email protected]>
+
+        REGRESSION (r151451): Text not vertically centered correctly on icloud.com
+        https://bugs.webkit.org/show_bug.cgi?id=117744
+
+        Reviewed by David Hyatt.
+
+        * fast/forms/onselect-textfield-expected.txt:
+        * fast/replaced/height-of-positioned-text-control-expected.html: Added.
+        * fast/replaced/height-of-positioned-text-control.html: Added.
+        * fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt:
+        * platform/mac/fast/forms/input-appearance-preventDefault-expected.png:
+        * platform/mac/fast/forms/input-appearance-preventDefault-expected.txt:
+        * platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png: Added.
+        * platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt:
+        * platform/qt/fast/forms/input-appearance-preventDefault-expected.txt:
+
 2013-06-20  Radu Stavila  <[email protected]>
 
         [CSS Regions] Add new regionOversetChange event

Modified: trunk/LayoutTests/fast/forms/onselect-textfield-expected.txt (151787 => 151788)


--- trunk/LayoutTests/fast/forms/onselect-textfield-expected.txt	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/LayoutTests/fast/forms/onselect-textfield-expected.txt	2013-06-20 18:58:42 UTC (rev 151788)
@@ -9,11 +9,11 @@
 
 Double clicking to make selection for text field
 onselect fired for text field
-After double clicking: text field selection start: 0 end: 5
+After double clicking: text field selection start: 6 end: 10
 
 Calling blur on text field
-After blur: text field selection start: 0 end: 5
+After blur: text field selection start: 6 end: 10
 
 Calling focus on text field
-After focus: text field selection start: 0 end: 5
+After focus: text field selection start: 6 end: 10
 

Added: trunk/LayoutTests/fast/replaced/height-of-positioned-text-control-expected.html (0 => 151788)


--- trunk/LayoutTests/fast/replaced/height-of-positioned-text-control-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/height-of-positioned-text-control-expected.html	2013-06-20 18:58:42 UTC (rev 151788)
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<style>
+    body {
+        margin: 0px;
+        padding: 0px;
+        border: 0px;
+    }
+</style>
+</head>
+<body>
+<input value="No caret should be here"></input>
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/replaced/height-of-positioned-text-control-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/replaced/height-of-positioned-text-control.html (0 => 151788)


--- trunk/LayoutTests/fast/replaced/height-of-positioned-text-control.html	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/height-of-positioned-text-control.html	2013-06-20 18:58:42 UTC (rev 151788)
@@ -0,0 +1,15 @@
+<!doctype html>
+<head>
+<style>
+    body {
+        margin: 0px;
+        padding: 0px;
+        border: 0px;
+    }
+</style>
+</head>
+<body>
+<input style="position: absolute; top: 0px; left: 0px;" value="No caret should be here"></input>
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/replaced/height-of-positioned-text-control.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt (151787 => 151788)


--- trunk/LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt	2013-06-20 18:58:42 UTC (rev 151788)
@@ -6,10 +6,10 @@
       RenderBlock {P} at (0,0) size 784x19
         RenderText {#text} at (0,0) size 581x19
           text run at (0,0) width 581: "webkit.org/b/93735: Use the replaced height and width computation for positioned form controls"
-layer at (7,32) size 408x28
-  RenderTextControl {INPUT} at (7,32) size 408x28
-layer at (9,36) size 404x20
-  RenderBlock {DIV} at (2,4) size 404x20
+layer at (7,32) size 404x24
+  RenderTextControl {INPUT} at (7,32) size 404x24
+layer at (9,34) size 400x20
+  RenderBlock {DIV} at (2,2) size 400x20
 layer at (7,82) size 56x34
   RenderButton {INPUT} at (7,82) size 56x34 [bgcolor=#C0C0C0]
     RenderBlock (anonymous) at (6,6) size 44x24
@@ -20,6 +20,6 @@
     RenderBlock (anonymous) at (4,4) size 108x20
       RenderText at (0,0) size 80x20
         text run at (0,0) width 80: "test"
-layer at (7,182) size 423x48
-  RenderTextControl {TEXTAREA} at (7,182) size 423x48
-    RenderBlock {DIV} at (2,2) size 419x20
+layer at (7,182) size 419x44
+  RenderTextControl {TEXTAREA} at (7,182) size 419x44
+    RenderBlock {DIV} at (2,2) size 415x20

Modified: trunk/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt (151787 => 151788)


--- trunk/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt	2013-06-20 18:58:42 UTC (rev 151788)
@@ -8,10 +8,10 @@
         text run at (0,18) width 666: "This tests that preventDefault called onmousedown will prevent a caret from being placed in the text field."
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0
-layer at (12,52) size 129x25
-  RenderTextControl {INPUT} at (12,52) size 129x25 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-layer at (15,58) size 123x13 scrollWidth 130
-  RenderBlock {DIV} at (3,6) size 123x13
+layer at (12,52) size 123x19
+  RenderTextControl {INPUT} at (12,52) size 123x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+layer at (15,55) size 117x13 scrollWidth 130
+  RenderBlock {DIV} at (3,3) size 117x13
     RenderText {#text} at (0,0) size 129x13
       text run at (0,0) width 129: "No caret should be here"
 layer at (10,70) size 323x36

Modified: trunk/LayoutTests/platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt (151787 => 151788)


--- trunk/LayoutTests/platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/LayoutTests/platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt	2013-06-20 18:58:42 UTC (rev 151788)
@@ -6,10 +6,10 @@
       RenderBlock {P} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 608x18
           text run at (0,0) width 608: "webkit.org/b/93735: Use the replaced height and width computation for positioned form controls"
-layer at (7,32) size 412x32
-  RenderTextControl {INPUT} at (7,32) size 412x32 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-layer at (10,38) size 406x20
-  RenderBlock {DIV} at (3,6) size 406x20
+layer at (7,32) size 406x26
+  RenderTextControl {INPUT} at (7,32) size 406x26 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+layer at (10,35) size 400x20
+  RenderBlock {DIV} at (3,3) size 400x20
 layer at (7,82) size 57x21
   RenderButton {INPUT} at (7,82) size 57x21 [bgcolor=#C0C0C0]
     RenderBlock (anonymous) at (8,2) size 41x16
@@ -20,6 +20,6 @@
     RenderBlock (anonymous) at (0,0) size 55x21
       RenderText at (8,2) size 24x16
         text run at (8,2) width 24: "test"
-layer at (7,182) size 427x52 clip at (8,183) size 425x50
-  RenderTextControl {TEXTAREA} at (7,182) size 427x52 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 421x20
+layer at (7,182) size 421x46 clip at (8,183) size 419x44
+  RenderTextControl {TEXTAREA} at (7,182) size 421x46 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    RenderBlock {DIV} at (3,3) size 415x20

Modified: trunk/LayoutTests/platform/qt/fast/forms/input-appearance-preventDefault-expected.txt (151787 => 151788)


--- trunk/LayoutTests/platform/qt/fast/forms/input-appearance-preventDefault-expected.txt	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/LayoutTests/platform/qt/fast/forms/input-appearance-preventDefault-expected.txt	2013-06-20 18:58:42 UTC (rev 151788)
@@ -8,10 +8,10 @@
         text run at (0,19) width 630: "This tests that preventDefault called onmousedown will prevent a caret from being placed in the text field."
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0
-layer at (12,52) size 196x27
-  RenderTextControl {INPUT} at (12,52) size 196x27
-layer at (14,56) size 192x19
-  RenderBlock {DIV} at (2,4) size 192x19
+layer at (12,52) size 192x23
+  RenderTextControl {INPUT} at (12,52) size 192x23
+layer at (14,54) size 188x19
+  RenderBlock {DIV} at (2,2) size 188x19
     RenderText {#text} at (0,0) size 146x19
       text run at (0,0) width 146: "No caret should be here"
 layer at (10,70) size 308x38

Modified: trunk/Source/WebCore/ChangeLog (151787 => 151788)


--- trunk/Source/WebCore/ChangeLog	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/Source/WebCore/ChangeLog	2013-06-20 18:58:42 UTC (rev 151788)
@@ -1,3 +1,20 @@
+2013-06-18  Robert Hogan  <[email protected]>
+
+        REGRESSION (r151451): Text not vertically centered correctly on icloud.com
+        https://bugs.webkit.org/show_bug.cgi?id=117744
+
+        Reviewed by David Hyatt.
+
+        The positioned height and width computation adds in the element's border and padding so 
+        don't add it to the intrinsic height and preferred widths of text controls that are
+        absolutely positioned.
+
+        Test: fast/replaced/height-of-positioned-text-control.html
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::computeLogicalHeight):
+        (WebCore::RenderTextControl::computePreferredLogicalWidths):
+
 2013-06-20  Roger Fong  <[email protected]>
 
         Make Windows makefile copy build output to a different folder.

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (151787 => 151788)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2013-06-20 18:55:36 UTC (rev 151787)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2013-06-20 18:58:42 UTC (rev 151788)
@@ -149,7 +149,10 @@
     ASSERT(innerText);
     if (RenderBox* innerTextBox = innerText->renderBox()) {
         LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
-        m_intrinsicLogicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight();
+        m_intrinsicLogicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight);
+        // The positioned height computation will add in border and padding.
+        if (!isOutOfFlowPositioned())
+            m_intrinsicLogicalHeight += 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 ((isHorizontalWritingMode() && (style()->overflowX() == OSCROLL ||  (style()->overflowX() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap)))
@@ -292,10 +295,13 @@
         m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->logicalMaxWidth().value()));
     }
 
-    LayoutUnit toAdd = borderAndPaddingLogicalWidth();
 
-    m_minPreferredLogicalWidth += toAdd;
-    m_maxPreferredLogicalWidth += toAdd;
+    // The positioned height computation will add in border and padding.
+    if (!isOutOfFlowPositioned()) {
+        LayoutUnit toAdd = borderAndPaddingLogicalWidth();
+        m_minPreferredLogicalWidth += toAdd;
+        m_maxPreferredLogicalWidth += toAdd;
+    }
 
     setPreferredLogicalWidthsDirty(false);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to