100% height elements to not respond to vertical browser rescaling
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 21:15:46 +0000 (21:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 21:15:46 +0000 (21:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=43022

Patch by Terry Anderson <tdanderson@chromium.org> on 2012-03-16
Reviewed by Julien Chaffraix.

Source/WebCore:

Test: fast/replaced/vertical-resize-100percent-element.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
    For the case where a replaced element has a percentage height,
    we update the entries in RenderBlock::gPercentHeightDescendantsMap
    corresponding to all ancestors of the replaced element.

LayoutTests:

* fast/replaced/resources/vertical-resize-100percent-contents.html: Added.
* fast/replaced/vertical-resize-100percent-element-expected.txt: Added.
* fast/replaced/vertical-resize-100percent-element.html: Added.
      Layout test to ensure that an image with 100% height is resized when
      its containing iframe is vertically resized to be larger or smaller.
* platform/chromium-linux/tables/mozilla_expected_failures/bugs/bug85016-expected.png:
* platform/chromium-win/tables/mozilla_expected_failures/bugs/bug85016-expected.txt:
      Rebaseline for chromium. This patch causes a progression in this layout test.  In the
      diff, note that the viewport has height 585, which is 600 minus 15 pixels to account for
      the horizontal scrollbar.  In the old expected output the first image to be displayed
      has height 600, which is incorrect because it should be 100% of the viewport height.
      The new expected output shows the first image with the correct height of 585.
* platform/chromium/test_expectations.txt:
      WIN will need a regenerated image, and MAC will need a regenerated image+text.
* platform/gtk/Skipped:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
      Skip the rebaselined test on all other platforms.

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/replaced/resources/vertical-resize-100percent-contents.html [new file with mode: 0644]
LayoutTests/fast/replaced/vertical-resize-100percent-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/replaced/vertical-resize-100percent-element.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux/tables/mozilla_expected_failures/bugs/bug85016-expected.png
LayoutTests/platform/chromium-win/tables/mozilla_expected_failures/bugs/bug85016-expected.txt
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp

index 44f3f2c18b0c52e8e485cbbf494df89870c96bae..f81acb675d60c7f18d0751193c6cf93d758e079d 100644 (file)
@@ -1,3 +1,30 @@
+2012-03-16  Terry Anderson  <tdanderson@chromium.org>
+
+        100% height elements to not respond to vertical browser rescaling
+        https://bugs.webkit.org/show_bug.cgi?id=43022
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/replaced/resources/vertical-resize-100percent-contents.html: Added.
+        * fast/replaced/vertical-resize-100percent-element-expected.txt: Added.
+        * fast/replaced/vertical-resize-100percent-element.html: Added.
+              Layout test to ensure that an image with 100% height is resized when
+              its containing iframe is vertically resized to be larger or smaller.
+        * platform/chromium-linux/tables/mozilla_expected_failures/bugs/bug85016-expected.png:
+        * platform/chromium-win/tables/mozilla_expected_failures/bugs/bug85016-expected.txt:
+              Rebaseline for chromium. This patch causes a progression in this layout test.  In the
+              diff, note that the viewport has height 585, which is 600 minus 15 pixels to account for
+              the horizontal scrollbar.  In the old expected output the first image to be displayed
+              has height 600, which is incorrect because it should be 100% of the viewport height.
+              The new expected output shows the first image with the correct height of 585.
+        * platform/chromium/test_expectations.txt:
+              WIN will need a regenerated image, and MAC will need a regenerated image+text.
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+              Skip the rebaselined test on all other platforms.
+
 2012-03-16  Levi Weintraub  <leviw@chromium.org>
 
         Unreviewed gardening. Marking media/track/track-active-cues.html as flaky timeout on windows.
diff --git a/LayoutTests/fast/replaced/resources/vertical-resize-100percent-contents.html b/LayoutTests/fast/replaced/resources/vertical-resize-100percent-contents.html
new file mode 100644 (file)
index 0000000..c049c5d
--- /dev/null
@@ -0,0 +1,33 @@
+<html>
+<head>
+<style>
+html, body {
+    border: 0;
+    margin: 0;
+    height: 100%;
+}
+
+#container {
+    position: relative;
+    margin: 0 auto;
+    height: auto !important;
+    min-height: 100%;
+}
+
+#footer {
+    position: absolute;
+    width: 100%;
+    bottom: 0;
+    background: gray;
+}
+</style>
+</head>
+<body>
+<div id="container">
+    <div><img id="img" src="compass.jpg" style="width: 100%; height: 100%;"></div>
+    <div id="footer">
+    Layout test for <a href="https://bugs.webkit.org/show_bug.cgi?id=43022">https://bugs.webkit.org/show_bug.cgi?id=43022</a>
+    </div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/replaced/vertical-resize-100percent-element-expected.txt b/LayoutTests/fast/replaced/vertical-resize-100percent-element-expected.txt
new file mode 100644 (file)
index 0000000..496f2b7
--- /dev/null
@@ -0,0 +1,14 @@
+
+Layout test for https://bugs.webkit.org/show_bug.cgi?id=43022. Checks to see if an image having a percentage height is resized when its containing iframe is vertically resized. This test only works in DumpRenderTree since it involves accessing the internal elements of an iframe.
+
+Original frame height was 500
+Original image height was 500
+Vertically resizing the frame to be larger
+New frame height is 600
+New image height is 600
+PASSED: Image size is correct
+Vertically resizing the frame to be smaller
+New frame height is 450
+New image height is 450
+PASSED: Image size is correct
+
diff --git a/LayoutTests/fast/replaced/vertical-resize-100percent-element.html b/LayoutTests/fast/replaced/vertical-resize-100percent-element.html
new file mode 100644 (file)
index 0000000..39cce01
--- /dev/null
@@ -0,0 +1,54 @@
+<html>
+<head>
+<script>
+var theFrame, theImage;
+
+function log(msg)
+{
+    var console = document.getElementById('console');
+    console.appendChild(document.createTextNode(msg));
+    console.appendChild(document.createElement('br'));
+}
+
+function resizeAndCheck(newSize)
+{
+    theFrame.height = newSize;
+
+    log("New frame height is " + theFrame.height);
+    log("New image height is " + theImage.height);
+
+    if (theImage.height == newSize)
+        log("PASSED: Image size is correct");
+    else
+        log("FAILED: Image size is not correct");
+}
+
+function run()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    theFrame = document.getElementById('frame');
+    var frContents = theFrame.contentWindow.document;
+    theImage = frContents.getElementById('img');
+
+    log("Original frame height was " + theFrame.height);
+    log("Original image height was " + theImage.height);
+    
+    log("Vertically resizing the frame to be larger");
+    resizeAndCheck(600);
+
+    log("Vertically resizing the frame to be smaller");
+    resizeAndCheck(450);
+}
+
+</script>
+</head>
+
+<body onload="run()">
+<iframe height="500" width="500" id="frame" src="resources/vertical-resize-100percent-contents.html"></iframe> 
+<p>Layout test for https://bugs.webkit.org/show_bug.cgi?id=43022. Checks to see if an image having a percentage height is resized when its containing iframe is vertically resized. This test only works in DumpRenderTree since it involves accessing the internal elements of an iframe.</p>
+<p id="console"></p>
+</body>
+
+</html>
index d9a167eedb0173b08d1cc65f9336d1f4496e59cd..fbdc9dff340d33eea0488a887c662027956f33e8 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/tables/mozilla_expected_failures/bugs/bug85016-expected.png and b/LayoutTests/platform/chromium-linux/tables/mozilla_expected_failures/bugs/bug85016-expected.png differ
index d24153899f8ea415b876d445ece09ac768a9e3c4..46f83e6d5da893f2d0668ace4ed144bede2eb1b2 100644 (file)
@@ -1,25 +1,25 @@
-layer at (0,0) size 983x3048
+layer at (0,0) size 961x2988
   RenderView at (0,0) size 785x585
-layer at (0,0) size 785x3048
-  RenderBlock {HTML} at (0,0) size 785x3048
-    RenderBody {BODY} at (32,32) size 721x2984
-      RenderBlock {DIV} at (32,0) size 657x668 [border: (1px solid #008000)]
-        RenderBlock {DIV} at (33,33) size 591x602 [border: (1px solid #FF0000)]
-          RenderImage {IMG} at (1,1) size 589x600
+layer at (0,0) size 785x2988
+  RenderBlock {HTML} at (0,0) size 785x2988
+    RenderBody {BODY} at (32,32) size 721x2924
+      RenderBlock {DIV} at (32,0) size 657x653 [border: (1px solid #008000)]
+        RenderBlock {DIV} at (33,33) size 591x587 [border: (1px solid #FF0000)]
+          RenderImage {IMG} at (1,1) size 589x585
           RenderText {#text} at (0,0) size 0x0
-      RenderBlock {P} at (0,700) size 721x20
+      RenderBlock {P} at (0,685) size 721x20
         RenderText {#text} at (0,0) size 506x19
           text run at (0,0) width 506: "percentage height images in DIV with no height (red) in a DIV with no height (green)"
-      RenderBlock {DIV} at (32,752) size 657x672 [border: (3px dotted #008000)]
-        RenderBlock {DIV} at (35,35) size 587x602 [border: (1px solid #FF0000)]
-          RenderImage {IMG} at (1,1) size 883x600
+      RenderBlock {DIV} at (32,737) size 657x657 [border: (3px dotted #008000)]
+        RenderBlock {DIV} at (35,35) size 587x587 [border: (1px solid #FF0000)]
+          RenderImage {IMG} at (1,1) size 861x585
           RenderText {#text} at (0,0) size 0x0
-      RenderBlock {P} at (0,1456) size 721x20
+      RenderBlock {P} at (0,1426) size 721x20
         RenderText {#text} at (0,0) size 443x19
           text run at (0,0) width 443: "percentage height image in table cell (red), in a DIV with no height (green)"
-      RenderBlock {DIV} at (32,1508) size 657x1476
-        RenderTable {TABLE} at (0,0) size 260x1476 [border: (1px solid #FF0000)]
-          RenderTableSection {TBODY} at (1,1) size 258x1474
-            RenderTableRow {TR} at (0,2) size 258x1470
-              RenderTableCell {TD} at (2,650) size 254x174 [border: (1px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
+      RenderBlock {DIV} at (32,1478) size 657x1446
+        RenderTable {TABLE} at (0,0) size 260x1446 [border: (1px solid #FF0000)]
+          RenderTableSection {TBODY} at (1,1) size 258x1444
+            RenderTableRow {TR} at (0,2) size 258x1440
+              RenderTableCell {TD} at (2,635) size 254x174 [border: (1px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
                 RenderImage {IMG} at (2,2) size 250x170
index 2c4c4081bf47c02d949f5746385d618816b5ef48..2e70fd04936e78fcaccb5ae9943f98bef15740bd 100644 (file)
@@ -3935,3 +3935,7 @@ BUGYANGGUO WIN : fast/repaint/moving-shadow-on-path.html = TEXT
 BUGYANGGUO WIN : svg/css/stars-with-shadow.html = TEXT
 
 BUGWK81325 : fast/canvas/webgl/context-lost.html = TEXT
+
+// Needs rebaseline due to a progression 
+BUGWK43022 WIN : tables/mozilla_expected_failures/bugs/bug85016.html = IMAGE
+BUGWK43022 MAC : tables/mozilla_expected_failures/bugs/bug85016.html = IMAGE+TEXT
index d2edc5c6935155601ba4651f8750bedc8e9c5334..9dd91227ab97d163386e3be61643ebc5539a50f9 100644 (file)
@@ -1599,3 +1599,6 @@ editing/selection/move-by-word-visually-single-space-inline-element.html
 editing/selection/move-by-word-visually-single-space-one-element.html
 editing/selection/move-by-word-visually-textarea.html
 editing/selection/move-by-word-visually-wrong-left-right.html
+
+# https://bugs.webkit.org/show_bug.cgi?id=43022
+tables/mozilla_expected_failures/bugs/bug85016.html
index 42fb8dff42b7fd1042b0f993f873f2b450cba8e7..02fb4d797be5e906c8606ea4f2e6a11b9d0beef8 100644 (file)
@@ -589,3 +589,6 @@ canvas/philip/tests/2d.shadow.image.transparent.2.html
 # https://bugs.webkit.org/show_bug.cgi?id=62698
 # Needs BatteryClient implementation.
 batterystatus/
+
+# https://bugs.webkit.org/show_bug.cgi?id=43022
+tables/mozilla_expected_failures/bugs/bug85016.html
index d834adb46b0941fa3cc2278738bd5ef2c89a7826..56d3567b9d0888a83c22e200554a86013cf74262 100644 (file)
@@ -2060,6 +2060,9 @@ fast/table/027-vertical.html
 tables/mozilla/bugs/bug14929.html
 tables/mozilla/bugs/bug2947.html
 
+# Needs a rebaseline, caused by https://bugs.webkit.org/show_bug.cgi?id=43022
+tables/mozilla_expected_failures/bugs/bug85016.html
+
 # ============================================================================= #
 # Failed canvas tests from http://philip.html5.org/tests/canvas/suite/tests/
 # ============================================================================= #
index 84569e59af279c4da011fdae3721689a28996643..b1148602cb624db1960f398f1f426236eeec2124 100644 (file)
@@ -1848,3 +1848,6 @@ fast/forms/textfield-overflow.html
 
 # http://bugs.webkit.org/show_bug.cgi?id=81006
 svg/custom/delete-text-crash.html
+
+# https://bugs.webkit.org/show_bug.cgi?id=43022
+tables/mozilla_expected_failures/bugs/bug85016.html
index 648bca5ce7745c7c21f76c88f8e2428ed24ef6af..7a3e69f5a7fafb4e406bcb15150d2bf736f182c2 100644 (file)
@@ -1,3 +1,18 @@
+2012-03-16  Terry Anderson  <tdanderson@chromium.org>
+
+        100% height elements to not respond to vertical browser rescaling
+        https://bugs.webkit.org/show_bug.cgi?id=43022
+
+        Reviewed by Julien Chaffraix.
+
+        Test: fast/replaced/vertical-resize-100percent-element.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+            For the case where a replaced element has a percentage height,
+            we update the entries in RenderBlock::gPercentHeightDescendantsMap
+            corresponding to all ancestors of the replaced element.
+
 2012-03-15  Daniel Cheng  <dcheng@chromium.org>
 
         [chromium] Refactor ClipboardChromium and DataTransferItemList/DataTransferItem to support HTML spec
index 631a5133200d611847b473bc6fa4cb66f8bd8fee..a6335c0e05ced65f6bef59081b3c826b3dbc9a07 100644 (file)
@@ -2346,6 +2346,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co
                         return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
                     }
                     cb = cb->containingBlock();
+                    toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderBox*>(this));
                 }
             }
             return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));