Title: [223389] trunk
Revision
223389
Author
[email protected]
Date
2017-10-16 05:10:47 -0700 (Mon, 16 Oct 2017)

Log Message

Don't use intrinsic width if our container's width is zero
https://bugs.webkit.org/show_bug.cgi?id=178073

Reviewed by Sergio Villar Senin.

Source/WebCore:

Based on Blink r173212 by <[email protected]>.
https://chromium.googlesource.com/chromium/src/+/1592e8a1e8e56dfa6e5d709c50b129ae659c2fad

Since at least r798 we use a replaced element's intrinsic width
if its containing block has a width of zero. As a result our rendering
of width100percent-image.html has disagreed with all other browsers
and we display replaced elements when they should be invisible.

Test: fast/replaced/container-width-zero.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
If our container has zero width then let our width be zero too.

LayoutTests:

New rebaseline for width100percent-image.html test.

* fast/replaced/container-width-zero-expected.txt: Added.
* fast/replaced/container-width-zero.html: Added.
* platform/ios/fast/replaced/width100percent-image-expected.txt:
* platform/gtk/fast/replaced/width100percent-image-expected.png:
* platform/gtk/fast/replaced/width100percent-image-expected.txt:
* platform/mac/fast/replaced/width100percent-image-expected.png:
* platform/mac/fast/replaced/width100percent-image-expected.txt:
* platform/win/TestExpectations: Skips test as it needs a rebaseline.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (223388 => 223389)


--- trunk/LayoutTests/ChangeLog	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/LayoutTests/ChangeLog	2017-10-16 12:10:47 UTC (rev 223389)
@@ -1,3 +1,21 @@
+2017-10-16  Manuel Rego Casasnovas  <[email protected]>
+
+        Don't use intrinsic width if our container's width is zero
+        https://bugs.webkit.org/show_bug.cgi?id=178073
+
+        Reviewed by Sergio Villar Senin.
+
+        New rebaseline for width100percent-image.html test.
+
+        * fast/replaced/container-width-zero-expected.txt: Added.
+        * fast/replaced/container-width-zero.html: Added.
+        * platform/ios/fast/replaced/width100percent-image-expected.txt:
+        * platform/gtk/fast/replaced/width100percent-image-expected.png:
+        * platform/gtk/fast/replaced/width100percent-image-expected.txt:
+        * platform/mac/fast/replaced/width100percent-image-expected.png:
+        * platform/mac/fast/replaced/width100percent-image-expected.txt:
+        * platform/win/TestExpectations: Skips test as it needs a rebaseline.
+
 2017-10-16  Wenson Hsieh  <[email protected]>
 
         On ToT, event.dataTransfer.getData("text/uri-list") returns an empty string when dragging an image

Added: trunk/LayoutTests/fast/replaced/container-width-zero-expected.txt (0 => 223389)


--- trunk/LayoutTests/fast/replaced/container-width-zero-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/container-width-zero-expected.txt	2017-10-16 12:10:47 UTC (rev 223389)
@@ -0,0 +1,6 @@
+Bug #178073 - Don't use intrinsic width if our container's width is zero
+
+The test passes if you see PASS and no red.
+
+
+PASS

Added: trunk/LayoutTests/fast/replaced/container-width-zero.html (0 => 223389)


--- trunk/LayoutTests/fast/replaced/container-width-zero.html	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/container-width-zero.html	2017-10-16 12:10:47 UTC (rev 223389)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<script src=""
+<body _onload_="checkLayout('#video')">
+
+<p><a href="" #178073</a> - Don't use intrinsic width if our container's width is zero</p>
+<p>The test passes if you see PASS and no red.<p>
+
+<div style="margin-right: 2500px;">
+  <video id="video" style="width: 100%; background-color: red;" data-expected-width=0></video>
+</div>
+
+</body>

Modified: trunk/LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.txt (223388 => 223389)


--- trunk/LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.txt	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.txt	2017-10-16 12:10:47 UTC (rev 223389)
@@ -1,31 +1,31 @@
-layer at (0,0) size 785x646
-  RenderView at (0,0) size 785x600
-layer at (0,0) size 785x646
-  RenderBlock {HTML} at (0,0) size 785x646
-    RenderBody {BODY} at (8,8) size 769x630
-      RenderBlock (anonymous) at (0,0) size 769x36
+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 (anonymous) at (0,0) size 784x36
         RenderText {#text} at (0,0) size 761x35
           text run at (0,0) width 718: "The following elements behave differently in different browsers. Our current behavior will cause them to overlap, "
           text run at (718,0) width 43: "but we"
           text run at (0,18) width 236: "may need to change this in the future."
-      RenderTable {TABLE} at (0,36) size 769x279
-        RenderTableSection {TBODY} at (0,0) size 769x279
-          RenderTableRow {TR} at (0,1) size 769x277
-            RenderTableCell {TD} at (1,1) size 2x277 [r=0 c=0 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (4,1) size 2x277 [r=0 c=1 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (7,1) size 2x277 [r=0 c=2 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (10,129) size 758x21 [r=0 c=3 rs=1 cs=1]
-              RenderText {#text} at (1,1) size 4x18
-                text run at (1,2) width 4: " "
-      RenderBlock (anonymous) at (0,315) size 769x36
+      RenderTable {TABLE} at (0,36) size 784x22
+        RenderTableSection {TBODY} at (0,0) size 784x22
+          RenderTableRow {TR} at (0,1) size 784x20
+            RenderTableCell {TD} at (1,10) size 2x2 [r=0 c=0 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (4,10) size 2x2 [r=0 c=1 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (7,10) size 2x2 [r=0 c=2 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (10,1) size 773x20 [r=0 c=3 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 4x17
+                text run at (1,1) width 4: " "
+      RenderBlock (anonymous) at (0,58) size 784x36
         RenderBR {BR} at (0,0) size 0x17
         RenderBR {BR} at (0,18) size 0x17
-      RenderTable {TABLE} at (0,351) size 769x279
-        RenderTableSection {TBODY} at (0,0) size 769x279
-          RenderTableRow {TR} at (0,1) size 769x277
+      RenderTable {TABLE} at (0,94) size 784x279
+        RenderTableSection {TBODY} at (0,0) size 784x279
+          RenderTableRow {TR} at (0,1) size 784x277
             RenderTableCell {TD} at (1,1) size 216x277 [r=0 c=0 rs=1 cs=1]
               RenderImage {IMG} at (1,1) size 214x275
             RenderTableCell {TD} at (218,1) size 216x277 [r=0 c=1 rs=1 cs=1]
@@ -32,6 +32,6 @@
               RenderImage {IMG} at (1,1) size 214x275
             RenderTableCell {TD} at (435,1) size 216x277 [r=0 c=2 rs=1 cs=1]
               RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (652,129) size 116x21 [r=0 c=3 rs=1 cs=1]
+            RenderTableCell {TD} at (652,129) size 131x21 [r=0 c=3 rs=1 cs=1]
               RenderText {#text} at (1,1) size 4x18
                 text run at (1,2) width 4: " "

Modified: trunk/LayoutTests/platform/ios/fast/replaced/width100percent-image-expected.txt (223388 => 223389)


--- trunk/LayoutTests/platform/ios/fast/replaced/width100percent-image-expected.txt	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/LayoutTests/platform/ios/fast/replaced/width100percent-image-expected.txt	2017-10-16 12:10:47 UTC (rev 223389)
@@ -1,29 +1,29 @@
-layer at (0,0) size 800x654
+layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x654
-  RenderBlock {HTML} at (0,0) size 800x654
-    RenderBody {BODY} at (8,8) size 784x638
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock (anonymous) at (0,0) size 784x40
         RenderText {#text} at (0,0) size 776x39
           text run at (0,0) width 733: "The following elements behave differently in different browsers. Our current behavior will cause them to overlap, "
           text run at (732,0) width 44: "but we"
           text run at (0,20) width 241: "may need to change this in the future."
-      RenderTable {TABLE} at (0,40) size 784x279
-        RenderTableSection {TBODY} at (0,0) size 784x279
-          RenderTableRow {TR} at (0,1) size 784x277
-            RenderTableCell {TD} at (1,1) size 2x277 [r=0 c=0 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (4,1) size 2x277 [r=0 c=1 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (7,1) size 2x277 [r=0 c=2 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (10,128) size 773x23 [r=0 c=3 rs=1 cs=1]
-              RenderText {#text} at (1,1) size 4x20
-                text run at (1,2) width 4: " "
-      RenderBlock (anonymous) at (0,319) size 784x40
+      RenderTable {TABLE} at (0,40) size 784x24
+        RenderTableSection {TBODY} at (0,0) size 784x24
+          RenderTableRow {TR} at (0,1) size 784x22
+            RenderTableCell {TD} at (1,11) size 2x2 [r=0 c=0 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (4,11) size 2x2 [r=0 c=1 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (7,11) size 2x2 [r=0 c=2 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (10,1) size 773x22 [r=0 c=3 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 4x19
+                text run at (1,1) width 4: " "
+      RenderBlock (anonymous) at (0,64) size 784x40
         RenderBR {BR} at (0,0) size 0x19
         RenderBR {BR} at (0,20) size 0x19
-      RenderTable {TABLE} at (0,359) size 784x279
+      RenderTable {TABLE} at (0,104) size 784x279
         RenderTableSection {TBODY} at (0,0) size 784x279
           RenderTableRow {TR} at (0,1) size 784x277
             RenderTableCell {TD} at (1,1) size 216x277 [r=0 c=0 rs=1 cs=1]

Modified: trunk/LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.txt (223388 => 223389)


--- trunk/LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.txt	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.txt	2017-10-16 12:10:47 UTC (rev 223389)
@@ -1,31 +1,31 @@
-layer at (0,0) size 785x646
-  RenderView at (0,0) size 785x600
-layer at (0,0) size 785x646
-  RenderBlock {HTML} at (0,0) size 785x646
-    RenderBody {BODY} at (8,8) size 769x630
-      RenderBlock (anonymous) at (0,0) size 769x36
-        RenderText {#text} at (0,0) size 753x36
+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 (anonymous) at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 776x36
           text run at (0,0) width 733: "The following elements behave differently in different browsers. Our current behavior will cause them to overlap, "
-          text run at (732,0) width 21: "but"
-          text run at (0,18) width 264: "we may need to change this in the future."
-      RenderTable {TABLE} at (0,36) size 769x279
-        RenderTableSection {TBODY} at (0,0) size 769x279
-          RenderTableRow {TR} at (0,1) size 769x277
-            RenderTableCell {TD} at (1,1) size 2x277 [r=0 c=0 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (4,1) size 2x277 [r=0 c=1 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (7,1) size 2x277 [r=0 c=2 rs=1 cs=1]
-              RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (10,129) size 758x21 [r=0 c=3 rs=1 cs=1]
-              RenderText {#text} at (1,1) size 4x19
-                text run at (1,2) width 4: " "
-      RenderBlock (anonymous) at (0,315) size 769x36
+          text run at (732,0) width 44: "but we"
+          text run at (0,18) width 241: "may need to change this in the future."
+      RenderTable {TABLE} at (0,36) size 784x22
+        RenderTableSection {TBODY} at (0,0) size 784x22
+          RenderTableRow {TR} at (0,1) size 784x20
+            RenderTableCell {TD} at (1,10) size 2x2 [r=0 c=0 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (4,10) size 2x2 [r=0 c=1 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (7,10) size 2x2 [r=0 c=2 rs=1 cs=1]
+              RenderImage {IMG} at (1,1) size 0x0
+            RenderTableCell {TD} at (10,1) size 773x20 [r=0 c=3 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 4x18
+                text run at (1,1) width 4: " "
+      RenderBlock (anonymous) at (0,58) size 784x36
         RenderBR {BR} at (0,0) size 0x18
         RenderBR {BR} at (0,18) size 0x18
-      RenderTable {TABLE} at (0,351) size 769x279
-        RenderTableSection {TBODY} at (0,0) size 769x279
-          RenderTableRow {TR} at (0,1) size 769x277
+      RenderTable {TABLE} at (0,94) size 784x279
+        RenderTableSection {TBODY} at (0,0) size 784x279
+          RenderTableRow {TR} at (0,1) size 784x277
             RenderTableCell {TD} at (1,1) size 216x277 [r=0 c=0 rs=1 cs=1]
               RenderImage {IMG} at (1,1) size 214x275
             RenderTableCell {TD} at (218,1) size 216x277 [r=0 c=1 rs=1 cs=1]
@@ -32,6 +32,6 @@
               RenderImage {IMG} at (1,1) size 214x275
             RenderTableCell {TD} at (435,1) size 216x277 [r=0 c=2 rs=1 cs=1]
               RenderImage {IMG} at (1,1) size 214x275
-            RenderTableCell {TD} at (652,129) size 116x21 [r=0 c=3 rs=1 cs=1]
+            RenderTableCell {TD} at (652,129) size 131x21 [r=0 c=3 rs=1 cs=1]
               RenderText {#text} at (1,1) size 4x19
                 text run at (1,2) width 4: " "

Modified: trunk/LayoutTests/platform/win/TestExpectations (223388 => 223389)


--- trunk/LayoutTests/platform/win/TestExpectations	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/LayoutTests/platform/win/TestExpectations	2017-10-16 12:10:47 UTC (rev 223389)
@@ -82,6 +82,7 @@
 fast/css/text-overflow-ellipsis-bidi.html [ Skip ]
 fast/css/text-overflow-ellipsis-strict.html [ Skip ]
 
+webkit.org/b/178337 fast/replaced/width100percent-image.html [ Skip ]
 
 ################################################################################
 ##############    Missing Functionality Prevents Testing        ################

Modified: trunk/Source/WebCore/ChangeLog (223388 => 223389)


--- trunk/Source/WebCore/ChangeLog	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/Source/WebCore/ChangeLog	2017-10-16 12:10:47 UTC (rev 223389)
@@ -1,3 +1,24 @@
+2017-10-16  Manuel Rego Casasnovas  <[email protected]>
+
+        Don't use intrinsic width if our container's width is zero
+        https://bugs.webkit.org/show_bug.cgi?id=178073
+
+        Reviewed by Sergio Villar Senin.
+
+        Based on Blink r173212 by <[email protected]>.
+        https://chromium.googlesource.com/chromium/src/+/1592e8a1e8e56dfa6e5d709c50b129ae659c2fad
+
+        Since at least r798 we use a replaced element's intrinsic width
+        if its containing block has a width of zero. As a result our rendering
+        of width100percent-image.html has disagreed with all other browsers
+        and we display replaced elements when they should be invisible.
+
+        Test: fast/replaced/container-width-zero.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
+        If our container has zero width then let our width be zero too.
+
 2017-10-16  Wenson Hsieh  <[email protected]>
 
         On ToT, event.dataTransfer.getData("text/uri-list") returns an empty string when dragging an image

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (223388 => 223389)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2017-10-16 11:59:45 UTC (rev 223388)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2017-10-16 12:10:47 UTC (rev 223389)
@@ -2975,8 +2975,8 @@
                 return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
             if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercentOrCalculated())))
                 return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLength(logicalWidth, cw));
+            return LayoutUnit();
         }
-        FALLTHROUGH;
         case Intrinsic:
         case MinIntrinsic:
         case Auto:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to