Title: [141459] trunk
Revision
141459
Author
o...@chromium.org
Date
2013-01-31 12:00:12 -0800 (Thu, 31 Jan 2013)

Log Message

REGRESSION(r128517): Percentage heights in quirks mode collapse when printing
https://bugs.webkit.org/show_bug.cgi?id=108382

Reviewed by David Hyatt.

Source/WebCore:

r128517 clean up our containing block finding logic, but broke percentage
heights in quirks mode during printing since the RenderView would have 0 height.
Turns out we already had a long-standing bug where we'd incorrectly
treat collapse percentage heights on the body when printing as well.

Fix both bugs by changing the way we grab the logical height on the RenderView.
RenderView::computeLogicalHeight returns 0 when printing. For the purposes of
stretching and percentage heights, we instead need to return the pageLogicalHeight.

Tests: printing/quirks-percentage-height-body.html
       printing/quirks-percentage-height.html
       printing/standards-percentage-heights.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight):
This FIXME is outdated and already fixed. Also, call viewLogicalHeightForPercentages
which does the same logic except also correctly handles column RenderViews.
(WebCore::RenderBox::viewLogicalHeightForPercentages):
(WebCore::RenderBox::computePercentageLogicalHeight):
* rendering/RenderBox.h:

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::viewLogicalHeightForPercentages):
(WebCore):
(WebCore::RenderBox::computePercentageLogicalHeight):
* rendering/RenderBox.h:
(RenderBox):

LayoutTests:

* platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt:
We're just clipping more content that you can't scroll to anyways. This looks
like an improvement to me.
* printing/css2.1/page-break-inside-000-expected.txt:
We pass this test now!
* printing/quirks-percentage-height-body-expected.html: Added.
* printing/quirks-percentage-height-body.html: Added.
* printing/quirks-percentage-height-expected.html: Added.
* printing/quirks-percentage-height.html: Added.
* printing/standards-percentage-heights-expected.html: Added.
* printing/standards-percentage-heights.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141458 => 141459)


--- trunk/LayoutTests/ChangeLog	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/LayoutTests/ChangeLog	2013-01-31 20:00:12 UTC (rev 141459)
@@ -1,3 +1,22 @@
+2013-01-31  Ojan Vafai  <o...@chromium.org>
+
+        REGRESSION(r128517): Percentage heights in quirks mode collapse when printing
+        https://bugs.webkit.org/show_bug.cgi?id=108382
+
+        Reviewed by David Hyatt.
+
+        * platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt:
+        We're just clipping more content that you can't scroll to anyways. This looks
+        like an improvement to me.
+        * printing/css2.1/page-break-inside-000-expected.txt:
+        We pass this test now!
+        * printing/quirks-percentage-height-body-expected.html: Added.
+        * printing/quirks-percentage-height-body.html: Added.
+        * printing/quirks-percentage-height-expected.html: Added.
+        * printing/quirks-percentage-height.html: Added.
+        * printing/standards-percentage-heights-expected.html: Added.
+        * printing/standards-percentage-heights.html: Added.
+
 2013-01-31  Jessie Berlin  <jber...@apple.com>
 
         inspector/editor/text-editor-ctrl-movements.html was renamed to

Modified: trunk/LayoutTests/platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt (141458 => 141459)


--- trunk/LayoutTests/platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/LayoutTests/platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt	2013-01-31 20:00:12 UTC (rev 141459)
@@ -1,7 +1,7 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 400x600
-layer at (-400,0) size 800x600 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
-  RenderBlock {HTML} at (0,0) size 800x600
+layer at (-16,0) size 416x600 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 416x600
     RenderBody {BODY} at (8,8) size 400x600
       RenderBlock {DIV} at (0,0) size 400x600
         RenderImage {IMG} at (392,0) size 400x600

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (141458 => 141459)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2013-01-31 20:00:12 UTC (rev 141459)
@@ -308,6 +308,10 @@
 webkit.org/b/106405 http/tests/xmlhttprequest/failed-auth.html [ Failure ]
 webkit.org/b/106405 http/tests/xmlhttprequest/remember-bad-password.html [ Failure ]
 
+webkit.org/b/108507 printing/quirks-percentage-height-body.html [ Skip ]
+webkit.org/b/108507 printing/quirks-percentage-height.html [ Skip ]
+webkit.org/b/108507 printing/standards-percentage-heights.html [ Skip ]
+
 webkit.org/b/107356 fast/css/sticky/sticky-top-zoomed.html [ ImageOnlyFailure ]
 
 ### END OF (1) Classified failures with bug reports

Modified: trunk/LayoutTests/printing/css2.1/page-break-inside-000-expected.txt (141458 => 141459)


--- trunk/LayoutTests/printing/css2.1/page-break-inside-000-expected.txt	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/LayoutTests/printing/css2.1/page-break-inside-000-expected.txt	2013-01-31 20:00:12 UTC (rev 141459)
@@ -1,5 +1,6 @@
 There must be a page break below between "FIRST" and "LAST"
 FIRST dummy dummy dummy dummy dummy dummy dummy dummy dummy FIRST
 
-FAIL: expected page number of "test1" is 0. Was -1
-FAIL: expected page number of "test2" is 1. Was 0
+PASS: page number of "test1" is 0
+PASS: page number of "test2" is 1
+All tests passed

Added: trunk/LayoutTests/printing/quirks-percentage-height-body-expected.html (0 => 141459)


--- trunk/LayoutTests/printing/quirks-percentage-height-body-expected.html	                        (rev 0)
+++ trunk/LayoutTests/printing/quirks-percentage-height-body-expected.html	2013-01-31 20:00:12 UTC (rev 141459)
@@ -0,0 +1,2 @@
+<!-- We page zoom scale down the page by 1.25 when printing. -->
+<body style="margin: 0; height: 50%; width: 50%; border: 5px solid salmon; zoom: 80%;"></body>

Added: trunk/LayoutTests/printing/quirks-percentage-height-body.html (0 => 141459)


--- trunk/LayoutTests/printing/quirks-percentage-height-body.html	                        (rev 0)
+++ trunk/LayoutTests/printing/quirks-percentage-height-body.html	2013-01-31 20:00:12 UTC (rev 141459)
@@ -0,0 +1,5 @@
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<body style="margin: 0; height: 50%; width: 50%; border: 5px solid salmon;"></body>

Added: trunk/LayoutTests/printing/quirks-percentage-height-expected.html (0 => 141459)


--- trunk/LayoutTests/printing/quirks-percentage-height-expected.html	                        (rev 0)
+++ trunk/LayoutTests/printing/quirks-percentage-height-expected.html	2013-01-31 20:00:12 UTC (rev 141459)
@@ -0,0 +1,4 @@
+<!-- We page zoom scale down the page by 1.25 when printing. -->
+<body style="margin: 0; zoom: 80%;">
+    <div style="height: 50%; width: 50%; border: 5px solid salmon;"></div>
+</body>

Added: trunk/LayoutTests/printing/quirks-percentage-height.html (0 => 141459)


--- trunk/LayoutTests/printing/quirks-percentage-height.html	                        (rev 0)
+++ trunk/LayoutTests/printing/quirks-percentage-height.html	2013-01-31 20:00:12 UTC (rev 141459)
@@ -0,0 +1,7 @@
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<body style="margin: 0;">
+    <div style="height: 50%; width: 50%; border: 5px solid salmon;"></div>
+</body>

Added: trunk/LayoutTests/printing/standards-percentage-heights-expected.html (0 => 141459)


--- trunk/LayoutTests/printing/standards-percentage-heights-expected.html	                        (rev 0)
+++ trunk/LayoutTests/printing/standards-percentage-heights-expected.html	2013-01-31 20:00:12 UTC (rev 141459)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<!-- We page zoom scale down the page by 1.25 when printing. -->
+<html style="overflow: hidden; height: 500px; width: 500px; border: 5px solid pink; zoom: 80%;">
+<body style="margin: 0; height: 50%; width: 50%; border: 5px solid salmon;"></body>

Added: trunk/LayoutTests/printing/standards-percentage-heights.html (0 => 141459)


--- trunk/LayoutTests/printing/standards-percentage-heights.html	                        (rev 0)
+++ trunk/LayoutTests/printing/standards-percentage-heights.html	2013-01-31 20:00:12 UTC (rev 141459)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html style="overflow: hidden; height: 500px; width: 500px; border: 5px solid pink">
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<body style="margin: 0; height: 50%; width: 50%; border: 5px solid salmon;"></body>

Modified: trunk/Source/WebCore/ChangeLog (141458 => 141459)


--- trunk/Source/WebCore/ChangeLog	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/Source/WebCore/ChangeLog	2013-01-31 20:00:12 UTC (rev 141459)
@@ -1,3 +1,39 @@
+2013-01-31  Ojan Vafai  <o...@chromium.org>
+
+        REGRESSION(r128517): Percentage heights in quirks mode collapse when printing
+        https://bugs.webkit.org/show_bug.cgi?id=108382
+
+        Reviewed by David Hyatt.
+
+        r128517 clean up our containing block finding logic, but broke percentage
+        heights in quirks mode during printing since the RenderView would have 0 height.
+        Turns out we already had a long-standing bug where we'd incorrectly
+        treat collapse percentage heights on the body when printing as well.
+
+        Fix both bugs by changing the way we grab the logical height on the RenderView.
+        RenderView::computeLogicalHeight returns 0 when printing. For the purposes of
+        stretching and percentage heights, we instead need to return the pageLogicalHeight.
+
+        Tests: printing/quirks-percentage-height-body.html
+               printing/quirks-percentage-height.html
+               printing/standards-percentage-heights.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalHeight):
+        This FIXME is outdated and already fixed. Also, call viewLogicalHeightForPercentages
+        which does the same logic except also correctly handles column RenderViews.
+        (WebCore::RenderBox::viewLogicalHeightForPercentages):
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        * rendering/RenderBox.h:
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalHeight):
+        (WebCore::RenderBox::viewLogicalHeightForPercentages):
+        (WebCore):
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        * rendering/RenderBox.h:
+        (RenderBox):
+
 2013-01-31  Dirk Schulze  <k...@webkit.org>
 
         [canvas] Implement currentPath to get and set the current path of the context

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (141458 => 141459)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-01-31 20:00:12 UTC (rev 141459)
@@ -2416,27 +2416,24 @@
     bool paginatedContentNeedsBaseHeight = document()->printing() && h.isPercent()
         && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->logicalHeight().isPercent()));
     if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
-        // FIXME: Finish accounting for block flow here.
-        // https://bugs.webkit.org/show_bug.cgi?id=46603
         LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
-        LayoutUnit visHeight;
-        if (document()->printing())
-            visHeight = static_cast<LayoutUnit>(view()->pageLogicalHeight());
-        else  {
-            if (isHorizontalWritingMode())
-                visHeight = view()->viewHeight();
-            else
-                visHeight = view()->viewWidth();
-        }
+        LayoutUnit visibleHeight = viewLogicalHeightForPercentages();
         if (isRoot())
-            computedValues.m_extent = max(computedValues.m_extent, visHeight - margins);
+            computedValues.m_extent = max(computedValues.m_extent, visibleHeight - margins);
         else {
             LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight();
-            computedValues.m_extent = max(computedValues.m_extent, visHeight - marginsBordersPadding);
+            computedValues.m_extent = max(computedValues.m_extent, visibleHeight - marginsBordersPadding);
         }
     }
 }
 
+LayoutUnit RenderBox::viewLogicalHeightForPercentages() const
+{
+    if (document()->printing())
+        return static_cast<LayoutUnit>(view()->pageLogicalHeight());
+    return view()->viewLogicalHeight();
+}
+
 LayoutUnit RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height) const
 {
     LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height);
@@ -2542,13 +2539,14 @@
             LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
             availableHeight = max<LayoutUnit>(0, contentBoxHeight);
         }
-    } else if (cb->isRenderView() || isOutOfFlowPositionedWithSpecifiedHeight) {
+    } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
         // Don't allow this to affect the block' height() member variable, since this
         // can get called while the block is still laying out its kids.
         LogicalExtentComputedValues computedValues;
         cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues);
         availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalHeight() - cb->scrollbarLogicalHeight();
-    }
+    } else if (cb->isRenderView())
+        availableHeight = viewLogicalHeightForPercentages();
 
     if (availableHeight == -1)
         return availableHeight;

Modified: trunk/Source/WebCore/rendering/RenderBox.h (141458 => 141459)


--- trunk/Source/WebCore/rendering/RenderBox.h	2013-01-31 19:56:23 UTC (rev 141458)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2013-01-31 20:00:12 UTC (rev 141459)
@@ -641,6 +641,8 @@
         LayoutUnit offsetFromLogicalTopOfFirstPage = 0, bool checkForPerpendicularWritingMode = true) const;
     LayoutUnit containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode = true) const;
 
+    LayoutUnit viewLogicalHeightForPercentages() const;
+
     void computePositionedLogicalHeight(LogicalExtentComputedValues&) const;
     void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
                                             LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to