Empty <button>s should collapse; empty <input type="button"> should not collapse
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2013 21:08:52 +0000 (21:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2013 21:08:52 +0000 (21:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110654

Patch by Christian Biesinger <cbiesinger@chromium.org> on 2013-02-26
Reviewed by Ojan Vafai.

Source/WebCore:

This patch also fixes other height computation issues with flex boxes
related to scroll bars and hasLineIfEmpty()=true. See below for
details.

Tests: css3/flexbox/button.html
       css3/flexbox/position-absolute-child-with-contenteditable.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock): Add a FIXME to make
border/padding/scrollbar inclusion more consistent with other
renderers.
* rendering/RenderButton.h:
(WebCore::RenderButton::hasLineIfEmpty): We only want a line for
<input type=button|submit|reset>, for consistency with Firefox.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock): Start out layoutBlock by
setting the logical height to border + padding + scrollbar height to
ensure that we have space for the scrollbar even without children. The
layoutFlexItems change below is not enough because we also need this
when hasLineIfEmpty() is false.
(WebCore::RenderFlexibleBox::layoutFlexItems): Ensure we have a line
when hasLineIfEmpty() is true by calling setLogicalHeight(border+
padding+scrollbar+lineHeight()) if we don't have a flex line.

LayoutTests:

* css3/flexbox/button-expected.png: Added.
* css3/flexbox/button-expected.txt: Added.
* css3/flexbox/button.html: Added.
Test empty buttons, <input type=button>, and buttons with
overflow:scroll;

* css3/flexbox/position-absolute-child-with-contenteditable-expected.html: Added.
* css3/flexbox/position-absolute-child-with-contenteditable.html: Added.
Test flex boxes with hasLineIfEmpty()=true and absolute positioned
children. Uses contenteditable=true to get that effect.

* platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.png:
* platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.txt:
* platform/chromium-linux/svg/custom/foreign-object-skew-expected.png:
* platform/chromium-linux/svg/custom/foreign-object-skew-expected.txt:
* platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.png:
* platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.txt:
Regenerate test cases that use <input type=button>.

* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
Mark tests for rebaselining.

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

22 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/button-expected.png [new file with mode: 0644]
LayoutTests/css3/flexbox/button-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/button.html [new file with mode: 0644]
LayoutTests/css3/flexbox/position-absolute-child-with-contenteditable-expected.html [new file with mode: 0644]
LayoutTests/css3/flexbox/position-absolute-child-with-contenteditable.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.png
LayoutTests/platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.txt
LayoutTests/platform/chromium-linux/svg/custom/foreign-object-skew-expected.png
LayoutTests/platform/chromium-linux/svg/custom/foreign-object-skew-expected.txt
LayoutTests/platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.png
LayoutTests/platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.txt
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderButton.h
Source/WebCore/rendering/RenderFlexibleBox.cpp

index a85b6fc..f95a444 100644 (file)
@@ -1,3 +1,37 @@
+2013-02-26  Christian Biesinger  <cbiesinger@chromium.org>
+
+        Empty <button>s should collapse; empty <input type="button"> should not collapse
+        https://bugs.webkit.org/show_bug.cgi?id=110654
+
+        Reviewed by Ojan Vafai.
+
+        * css3/flexbox/button-expected.png: Added.
+        * css3/flexbox/button-expected.txt: Added.
+        * css3/flexbox/button.html: Added.
+        Test empty buttons, <input type=button>, and buttons with
+        overflow:scroll;
+
+        * css3/flexbox/position-absolute-child-with-contenteditable-expected.html: Added.
+        * css3/flexbox/position-absolute-child-with-contenteditable.html: Added.
+        Test flex boxes with hasLineIfEmpty()=true and absolute positioned
+        children. Uses contenteditable=true to get that effect.
+
+        * platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.png:
+        * platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.txt:
+        * platform/chromium-linux/svg/custom/foreign-object-skew-expected.png:
+        * platform/chromium-linux/svg/custom/foreign-object-skew-expected.txt:
+        * platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.png:
+        * platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.txt:
+        Regenerate test cases that use <input type=button>.
+
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/qt/TestExpectations:
+        * platform/win/TestExpectations:
+        Mark tests for rebaselining.
+
 2013-02-26  Zan Dobersek  <zdobersek@igalia.com>
 
         Unreviewed gardening.
diff --git a/LayoutTests/css3/flexbox/button-expected.png b/LayoutTests/css3/flexbox/button-expected.png
new file mode 100644 (file)
index 0000000..05d7060
Binary files /dev/null and b/LayoutTests/css3/flexbox/button-expected.png differ
diff --git a/LayoutTests/css3/flexbox/button-expected.txt b/LayoutTests/css3/flexbox/button-expected.txt
new file mode 100644 (file)
index 0000000..3e27333
--- /dev/null
@@ -0,0 +1,35 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x254
+  RenderBlock {HTML} at (0,0) size 800x254
+    RenderBody {BODY} at (8,8) size 784x238
+      RenderBlock (anonymous) at (0,0) size 784x40
+        RenderText {#text} at (0,0) size 755x39
+          text run at (0,0) width 379: "Test for empty buttons, which inherit from RenderFlexibleBox. "
+          text run at (379,0) width 376: "Empty <input> buttons should not collapse, which makes them"
+          text run at (0,20) width 431: "different from most flex boxes. Empty <button>s should collapse. Note "
+        RenderInline {A} at (0,0) size 74x19 [color=#0000EE]
+          RenderText {#text} at (431,20) size 74x19
+            text run at (431,20) width 74: "bug 110654"
+        RenderText {#text} at (505,20) size 4x19
+          text run at (505,20) width 4: "."
+      RenderBlock {HR} at (0,48) size 784x2 [border: (1px inset #000000)]
+      RenderBlock (anonymous) at (0,58) size 784x66
+        RenderText {#text} at (0,0) size 76x19
+          text run at (0,0) width 76: "Simple case."
+        RenderBR {BR} at (76,0) size 0x19
+        RenderButton {BUTTON} at (2,32) size 16x6 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
+        RenderBR {BR} at (20,20) size 0x19
+        RenderButton {INPUT} at (2,42) size 16x22 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
+        RenderBR {BR} at (20,46) size 0x19
+      RenderBlock {HR} at (0,132) size 784x2 [border: (1px inset #000000)]
+      RenderBlock (anonymous) at (0,142) size 784x96
+        RenderText {#text} at (0,0) size 739x19
+          text run at (0,0) width 739: "Empty <button> and <input type=button> with overflow: scroll;. The presence of the scrollbar should not shrink the button."
+        RenderBR {BR} at (739,0) size 0x19
+        RenderBR {BR} at (35,20) size 0x19
+        RenderBR {BR} at (35,61) size 0x19
+layer at (10,182) size 31x21 clip at (12,184) size 12x2
+  RenderButton {BUTTON} at (2,32) size 31x21 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
+layer at (10,207) size 31x37 clip at (12,209) size 12x18
+  RenderButton {INPUT} at (2,57) size 31x37 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
diff --git a/LayoutTests/css3/flexbox/button.html b/LayoutTests/css3/flexbox/button.html
new file mode 100644 (file)
index 0000000..d7e44e6
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="resources/flexbox.css" rel="stylesheet">
+<style>
+    .scroll { overflow: scroll; }
+    .abspos { position: absolute; background-color: pink; }
+    .flexbox { background-color: lightgray; padding: 1px; }
+    .small { height: 3px; }
+</style>
+</head><body>
+Test for empty buttons, which inherit from RenderFlexibleBox.  Empty
+&lt;input&gt; buttons should not collapse, which makes them different from most
+flex boxes. Empty &lt;button&gt;s should collapse. Note <a
+href="https://bugs.webkit.org/show_bug.cgi?id=110654"> bug 110654</a>.
+<hr>
+Simple case.<br>
+<button></button><br>
+<input type="button"></input><br>
+<hr>
+Empty &lt;button&gt; and &lt;input type=button&gt; with overflow: scroll;.
+The presence of the scrollbar should not shrink the button.<br>
+<button class="scroll"></button><br>
+<input type="button" class="scroll"></input><br>
diff --git a/LayoutTests/css3/flexbox/position-absolute-child-with-contenteditable-expected.html b/LayoutTests/css3/flexbox/position-absolute-child-with-contenteditable-expected.html
new file mode 100644 (file)
index 0000000..5971ac8
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    .abspos { position: absolute; background-color: pink; }
+    .gray { background-color: lightgray; padding: 1px; }
+    .small { height: 3px; }
+</style>
+</head><body>
+Absolutely positioned element as a child of a flexbox with hasLineIfEmpty()=true.
+Such a flex box should get a line instead of collapsing to just border+padding.
+In other words, the grey area should be (slightly) taller than the pink one.<br>
+<div class="gray" contenteditable="true"><div class="abspos">Content</div></div>
+<hr>
+...but if it does specify a height, we need to respect it.<br>
+<div class="small gray" contenteditable="true"><div class="abspos">Content</div></div>
+
diff --git a/LayoutTests/css3/flexbox/position-absolute-child-with-contenteditable.html b/LayoutTests/css3/flexbox/position-absolute-child-with-contenteditable.html
new file mode 100644 (file)
index 0000000..a28f869
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="resources/flexbox.css" rel="stylesheet">
+<style>
+    .abspos { position: absolute; background-color: pink; }
+    .flexbox { background-color: lightgray; padding: 1px; }
+    .small { height: 3px; }
+</style>
+</head><body>
+Absolutely positioned element as a child of a flexbox with hasLineIfEmpty()=true.
+Such a flex box should get a line instead of collapsing to just border+padding.
+In other words, the grey area should be (slightly) taller than the pink one.<br>
+<div class="flexbox" contenteditable="true"><div class="abspos">Content</div></div>
+<hr>
+...but if it does specify a height, we need to respect it.<br>
+<div class="flexbox small" contenteditable="true"><div class="abspos">Content</div></div>
+
index fa939cc..c1b4467 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.png and b/LayoutTests/platform/chromium-linux/css2.1/20110323/replaced-elements-001-expected.png differ
index 935e2c6..c94f921 100644 (file)
@@ -1,19 +1,19 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x140
-  RenderBlock {HTML} at (0,0) size 800x140
-    RenderBody {BODY} at (8,16) size 784x108
+layer at (0,0) size 800x172
+  RenderBlock {HTML} at (0,0) size 800x172
+    RenderBody {BODY} at (8,16) size 784x140
       RenderBlock {P} at (0,0) size 784x20
         RenderText {#text} at (0,0) size 569x19
           text run at (0,0) width 569: "Below, there should be 2 orange boxes horizontally centered within their respective green bars."
-      RenderBlock {DIV} at (16,36) size 752x28 [bgcolor=#008000]
+      RenderBlock {DIV} at (16,36) size 752x44 [bgcolor=#008000]
         RenderBlock (anonymous) at (0,0) size 752x20
           RenderText {#text} at (0,0) size 36x19
             text run at (0,0) width 36: "         "
-        RenderButton {INPUT} at (368,22) size 16x6 [bgcolor=#FFA500] [border: (2px outset #DDDDDD)]
-      RenderBlock {FORM} at (0,80) size 784x28
-        RenderBlock {DIV} at (16,0) size 752x28 [bgcolor=#008000]
+        RenderButton {INPUT} at (368,22) size 16x22 [bgcolor=#FFA500] [border: (2px outset #DDDDDD)]
+      RenderBlock {FORM} at (0,96) size 784x44
+        RenderBlock {DIV} at (16,0) size 752x44 [bgcolor=#008000]
           RenderBlock (anonymous) at (0,0) size 752x20
             RenderText {#text} at (0,0) size 36x19
               text run at (0,0) width 36: "         "
-          RenderButton {INPUT} at (368,22) size 16x6 [bgcolor=#FFA500] [border: (2px outset #DDDDDD)]
+          RenderButton {INPUT} at (368,22) size 16x22 [bgcolor=#FFA500] [border: (2px outset #DDDDDD)]
index ffc4a21..55a49d2 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/svg/custom/foreign-object-skew-expected.png and b/LayoutTests/platform/chromium-linux/svg/custom/foreign-object-skew-expected.png differ
index ca81f95..36b6ae8 100644 (file)
@@ -6,11 +6,11 @@ layer at (0,0) size 800x600
       RenderBlock {xhtml:div} at (0,0) size 580x20
         RenderText {#text} at (0,0) size 74x19
           text run at (0,0) width 74: "This is a test"
-      RenderBlock (anonymous) at (0,20) size 580x40
+      RenderBlock (anonymous) at (0,20) size 580x46
         RenderInline {xhtml:a} at (0,0) size 62x19 [color=#0000EE]
           RenderText {#text} at (0,0) size 62x19
             text run at (0,0) width 62: "and a link."
         RenderBR {xhtml:br} at (62,0) size 0x19
-        RenderButton {xhtml:input} at (2,32) size 16x6 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
+        RenderButton {xhtml:input} at (2,22) size 16x22 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
         RenderText {#text} at (0,0) size 0x0
     RenderSVGRect {rect} at (9,9) size 582x382 [stroke={[type=SOLID] [color=#008000]}] [x=10.00] [y=10.00] [width=580.00] [height=380.00]
index 94f4aaa..c1e7538 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.png and b/LayoutTests/platform/chromium-linux/tables/mozilla/bugs/bug92647-2-expected.png differ
index 4fcef36..8e8cbaf 100644 (file)
@@ -3,14 +3,14 @@ layer 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
-      RenderTable {TABLE} at (0,0) size 52x30 [border: (1px outset #808080)]
-        RenderTableSection {TBODY} at (1,1) size 50x28
-          RenderTableRow {TR} at (0,2) size 50x24
-            RenderTableCell {TD} at (2,2) size 46x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-              RenderTable {TABLE} at (2,2) size 42x20 [border: (1px outset #808080)]
-                RenderTableSection {TBODY} at (1,1) size 40x18
-                  RenderTableRow {TR} at (0,2) size 40x14
-                    RenderTableCell {TD} at (2,7) size 4x4 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-                    RenderTableCell {TD} at (8,2) size 24x14 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
-                      RenderButton {INPUT} at (4,4) size 16x6 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
-                    RenderTableCell {TD} at (34,7) size 4x4 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+      RenderTable {TABLE} at (0,0) size 52x46 [border: (1px outset #808080)]
+        RenderTableSection {TBODY} at (1,1) size 50x44
+          RenderTableRow {TR} at (0,2) size 50x40
+            RenderTableCell {TD} at (2,2) size 46x40 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderTable {TABLE} at (2,2) size 42x36 [border: (1px outset #808080)]
+                RenderTableSection {TBODY} at (1,1) size 40x34
+                  RenderTableRow {TR} at (0,2) size 40x30
+                    RenderTableCell {TD} at (2,15) size 4x4 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                    RenderTableCell {TD} at (8,2) size 24x30 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+                      RenderButton {INPUT} at (4,4) size 16x22 [bgcolor=#DDDDDD] [border: (2px outset #DDDDDD)]
+                    RenderTableCell {TD} at (34,15) size 4x4 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
index 43662ed..d10f2ff 100644 (file)
@@ -4431,3 +4431,9 @@ webkit.org/b/110876 html5lib/generated/run-tests7-data.html [ Timeout Pass ]
 webkit.org/b/110876 html5lib/generated/run-tests9-data.html [ Timeout Pass ]
 webkit.org/b/110876 html5lib/generated/run-webkit01-data.html [ Timeout Pass ]
 
+# Need rebaseline
+webkit.org/b/110654 [ Mac Win ] css2.1/20110323/replaced-elements-001.htm [ Failure ]
+webkit.org/b/110654 [ Mac Win ] svg/custom/foreign-object-skew.svg [ Failure ]
+webkit.org/b/110654 [ Mac Win ] tables/mozilla/bugs/bug92647-2.html [ Failure ]
+# New test
+webkit.org/b/110654 [ Mac Win ] css3/flexbox/button.html [ Failure ]
index 8b9047f..797f577 100644 (file)
@@ -1869,3 +1869,10 @@ webkit.org/b/110694 html5lib/runner.html [ Failure ]
 webkit.org/b/110694 html5lib/generated/run-domjs-unsafe-data.html [ Failure ]
 webkit.org/b/110694 html5lib/generated/run-pending-spec-changes-plain-text-unsafe-data.html [ Failure ]
 webkit.org/b/110694 html5lib/generated/run-plain-text-unsafe-data.html [ Failure ]
+
+# Need rebaseline
+webkit.org/b/110654 css2.1/20110323/replaced-elements-001.htm [ Failure ]
+webkit.org/b/110654 svg/custom/foreign-object-skew.svg [ Failure ]
+webkit.org/b/110654 tables/mozilla/bugs/bug92647-2.html [ Failure ]
+# New test
+webkit.org/b/110654 css3/flexbox/button.html [ Failure ]
index 3eaa225..6aa4bfb 100644 (file)
@@ -1413,6 +1413,13 @@ webkit.org/b/110694 html5lib/generated/run-domjs-unsafe-data.html [ Failure ]
 webkit.org/b/110694 html5lib/generated/run-pending-spec-changes-plain-text-unsafe-data.html [ Failure ]
 webkit.org/b/110694 html5lib/generated/run-plain-text-unsafe-data.html [ Failure ]
 
+# Need rebaseline
+webkit.org/b/110654 css2.1/20110323/replaced-elements-001.htm [ Failure ]
+webkit.org/b/110654 svg/custom/foreign-object-skew.svg [ Failure ]
+webkit.org/b/110654 tables/mozilla/bugs/bug92647-2.html [ Failure ]
+# New test
+webkit.org/b/110654 css3/flexbox/button.html [ Failure ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Tests failing
 #////////////////////////////////////////////////////////////////////////////////////////
index a0325b0..1d12297 100644 (file)
@@ -1437,3 +1437,10 @@ webkit.org/b/110186 inspector-protocol/page/javascriptDialogEvents.html [ Skip ]
 webkit.org/b/110554 http/tests/security/feed-urls-from-remote.html [ Failure ]
 webkit.org/b/110555 fast/canvas/canvas-currentPath.html [ Failure ]
 webkit.org/b/110555 fast/canvas/canvas-path-constructors.html [ Failure ]
+
+# Need rebaseline
+webkit.org/b/110654 css2.1/20110323/replaced-elements-001.htm [ Failure ]
+webkit.org/b/110654 svg/custom/foreign-object-skew.svg [ Failure ]
+webkit.org/b/110654 tables/mozilla/bugs/bug92647-2.html [ Failure ]
+# New test
+webkit.org/b/110654 css3/flexbox/button.html [ Failure ]
index 9a3c913..125d32d 100644 (file)
@@ -2673,3 +2673,10 @@ webkit.org/b/110054 compositing/geometry/limit-layer-bounds-fixed.html [ Failure
 
 # [Qt] newly added svg/as-background-image/svg-transformed-background.html fails
 webkit.org/b/110442 svg/as-background-image/svg-transformed-background.html [ Skip ]
+
+# Need rebaseline
+webkit.org/b/110654 css2.1/20110323/replaced-elements-001.htm [ Failure ]
+webkit.org/b/110654 svg/custom/foreign-object-skew.svg [ Failure ]
+webkit.org/b/110654 tables/mozilla/bugs/bug92647-2.html [ Failure ]
+# New test
+webkit.org/b/110654 css3/flexbox/button.html [ Failure ]
index 3b70b46..a62a429 100644 (file)
@@ -2646,3 +2646,10 @@ webkit.org/b/109994 fast/forms/button-generated-content.html [ Failure ]
 webkit.org/b/109994 fast/forms/select-baseline.html [ Failure ]
 webkit.org/b/109994 svg/custom/foreign-object-skew.svg [ Failure ]
 webkit.org/b/109994 tables/mozilla/bugs/bug92647-2.html [ Failure ]
+
+# Need rebaseline
+webkit.org/b/110654 css2.1/20110323/replaced-elements-001.htm [ Failure ]
+webkit.org/b/110654 svg/custom/foreign-object-skew.svg [ Failure ]
+webkit.org/b/110654 tables/mozilla/bugs/bug92647-2.html [ Failure ]
+# New test
+webkit.org/b/110654 css3/flexbox/button.html [ Failure ]
index 0c2843c..98416d3 100644 (file)
@@ -1,3 +1,35 @@
+2013-02-26  Christian Biesinger  <cbiesinger@chromium.org>
+
+        Empty <button>s should collapse; empty <input type="button"> should not collapse
+        https://bugs.webkit.org/show_bug.cgi?id=110654
+
+        Reviewed by Ojan Vafai.
+
+        This patch also fixes other height computation issues with flex boxes
+        related to scroll bars and hasLineIfEmpty()=true. See below for
+        details.
+
+        Tests: css3/flexbox/button.html
+               css3/flexbox/position-absolute-child-with-contenteditable.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutBlock): Add a FIXME to make
+        border/padding/scrollbar inclusion more consistent with other
+        renderers.
+        * rendering/RenderButton.h:
+        (WebCore::RenderButton::hasLineIfEmpty): We only want a line for
+        <input type=button|submit|reset>, for consistency with Firefox.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutBlock): Start out layoutBlock by
+        setting the logical height to border + padding + scrollbar height to
+        ensure that we have space for the scrollbar even without children. The
+        layoutFlexItems change below is not enough because we also need this
+        when hasLineIfEmpty() is false.
+        (WebCore::RenderFlexibleBox::layoutFlexItems): Ensure we have a line
+        when hasLineIfEmpty() is true by calling setLogicalHeight(border+
+        padding+scrollbar+lineHeight()) if we don't have a flex line.
+
 2013-02-26  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r143941.
index 5ab47a0..2c17fe1 100644 (file)
@@ -1520,6 +1520,8 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
     clearFloats();
 
     LayoutUnit previousHeight = logicalHeight();
+    // FIXME: should this start out as borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(),
+    // for consistency with other render classes?
     setLogicalHeight(0);
 
     bool pageLogicalHeightChanged = false;
index a2fb0cb..9bdc487 100644 (file)
@@ -61,7 +61,7 @@ private:
     virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
-    virtual bool hasLineIfEmpty() const { return true; }
+    virtual bool hasLineIfEmpty() const { return node() && node()->toInputElement(); }
 
     virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
 
index f42e7dc..bc23122 100644 (file)
@@ -308,7 +308,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
         relayoutChildren = true;
 
     LayoutUnit previousHeight = logicalHeight();
-    setLogicalHeight(0);
+    setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight());
 
     LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
 
@@ -727,6 +727,17 @@ void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren, Vector<LineContex
 
         layoutAndPlaceChildren(crossAxisOffset, orderedChildren, childSizes, availableFreeSpace, relayoutChildren, lineContexts);
     }
+    if (hasLineIfEmpty()) {
+        // Even if computeNextFlexLine returns true, the flexbox might not have
+        // a line because all our children might be out of flow positioned.
+        // Instead of just checking if we have a line, make sure the flexbox
+        // has at least a line's worth of height to cover this case.
+        LayoutUnit minHeight = borderAndPaddingLogicalHeight()
+            + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)
+            + scrollbarLogicalHeight();
+        if (height() < minHeight)
+            setLogicalHeight(minHeight);
+    }
 }
 
 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemList& children, LayoutUnit& availableFreeSpace)