[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hyatt at apple.com hyatt at apple.com
Wed Dec 22 13:33:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1259d7310a31d055e850513c5b8e7c8186636072
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 16:12:58 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=46030, aintitcool.com doesn't paginate correctly when printed.
    
    Reviewed by Sam Weinig.
    
    This happens because the site always has a document width that will exceed the page width.
    We incorrectly apply a double scale instead of clipping after the first scale still doesn't fit.
    The fix for the issue is to cap the right layout overflow to the page width and to just clip out
    any additional excess.  This is the code in FrameView.cpp.
    
    This patch also cleans up table cell invalidation to reduce the # of relayouts.  This change is not
    a correctness fix.  It's just performance.
    
    I'm not sure how to write a test for this, since the double scale is an artifact of how WebKit mac calls
    back in when really printing.
    
    * page/FrameView.cpp:
    (WebCore::FrameView::forceLayoutForPagination):
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::layoutBlockChild):
    (WebCore::RenderBlock::layoutPositionedObjects):
    (WebCore::RenderBlock::positionNewFloats):
    * rendering/RenderBlock.h:
    (WebCore::RenderBlock::markForPaginationRelayout):
    * rendering/RenderFlexibleBox.cpp:
    (WebCore::RenderFlexibleBox::layoutHorizontalBox):
    (WebCore::RenderFlexibleBox::layoutVerticalBox):
    * rendering/RenderTableSection.cpp:
    (WebCore::RenderTableSection::layoutRows):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67853 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2aff585..816884e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-09-18  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46030, aintitcool.com doesn't paginate correctly when printed.
+        
+        This happens because the site always has a document width that will exceed the page width.
+        We incorrectly apply a double scale instead of clipping after the first scale still doesn't fit.
+        The fix for the issue is to cap the right layout overflow to the page width and to just clip out
+        any additional excess.  This is the code in FrameView.cpp.
+        
+        This patch also cleans up table cell invalidation to reduce the # of relayouts.  This change is not
+        a correctness fix.  It's just performance.
+        
+        I'm not sure how to write a test for this, since the double scale is an artifact of how WebKit mac calls
+        back in when really printing.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::forceLayoutForPagination):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutBlockChild):
+        (WebCore::RenderBlock::layoutPositionedObjects):
+        (WebCore::RenderBlock::positionNewFloats):
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::markForPaginationRelayout):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutHorizontalBox):
+        (WebCore::RenderFlexibleBox::layoutVerticalBox):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::layoutRows):
+
 2010-09-20  Ilya Tikhonovsky  <loislo at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 0907fe5..279e651 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -2101,6 +2101,9 @@ void FrameView::forceLayoutForPagination(const FloatSize& pageSize, float maximu
             root->setWidth(pageW);
             root->setNeedsLayoutAndPrefWidthsRecalc();
             forceLayout();
+            int docHeight = root->bottomLayoutOverflow();
+            root->clearLayoutOverflow();
+            root->addLayoutOverflow(IntRect(0, 0, pageW, docHeight)); // This is how we clip in case we overflow again.
         }
     }
 
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index bd06bae..2f19e4b 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1848,7 +1848,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
 
     bool paginated = view()->layoutState()->isPaginated();
     if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight && childRenderBlock && view()->layoutState()->pageY(child->y()) != childRenderBlock->pageY())
-        childRenderBlock->setChildNeedsLayout(true, false);
+        childRenderBlock->markForPaginationRelayout();
 
     bool childHadLayout = child->m_everHadLayout;
     bool childNeededLayout = child->needsLayout();
@@ -1916,7 +1916,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
             if (!child->avoidsFloats() && childRenderBlock->containsFloats())
                 childRenderBlock->markAllDescendantsWithFloatsForLayout();
             if (paginated && !child->needsLayout() && view()->layoutState()->m_pageHeight && view()->layoutState()->pageY(child->y()) != childRenderBlock->pageY())
-                child->setChildNeedsLayout(true, false);
+                childRenderBlock->markForPaginationRelayout();
         }
 
         // Our guess was wrong. Make the child lay itself out again.
@@ -2018,7 +2018,7 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren)
             if (!r->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
                 RenderBlock* childRenderBlock = r->isRenderBlock() ? toRenderBlock(r) : 0;
                 if (childRenderBlock && view()->layoutState()->pageY(childRenderBlock->y()) != childRenderBlock->pageY())
-                    childRenderBlock->setChildNeedsLayout(true, false);
+                    childRenderBlock->markForPaginationRelayout();
             }
 
             // We don't have to do a full layout.  We just have to update our position. Try that first. If we have shrink-to-fit width
@@ -3051,7 +3051,7 @@ bool RenderBlock::positionNewFloats()
             RenderBlock* childBlock = o->isRenderBlock() ? toRenderBlock(o) : 0;
 
             if (childBlock && view()->layoutState()->m_pageHeight && view()->layoutState()->pageY(o->y()) != childBlock->pageY())
-                childBlock->setChildNeedsLayout(true, false);
+                childBlock->markForPaginationRelayout();
             o->layoutIfNeeded();
 
             // If we are unsplittable and don't fit, then we need to move down.
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index b55ca0e..fdfd021 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -90,8 +90,15 @@ public:
 
     void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0, bool inLayout = true);
     void markPositionedObjectsForLayout();
+    void markForPaginationRelayout()
+    { 
+        if (isTable())
+            markDescendantBlocksAndLinesForLayout();
+        else
+            setChildNeedsLayout(true, false);
+    }
     virtual void markDescendantBlocksAndLinesForLayout(bool inLayout = true);
-
+    
     bool containsFloats() { return m_floatingObjects && !m_floatingObjects->isEmpty(); }
     bool containsFloat(RenderObject*);
 
diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp
index f0cbc1e..36ab375 100644
--- a/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/WebCore/rendering/RenderFlexibleBox.cpp
@@ -369,7 +369,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
             if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
                 RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
                 if (childRenderBlock && view()->layoutState()->pageY(child->y()) != childRenderBlock->pageY())
-                    childRenderBlock->setChildNeedsLayout(true, false);
+                    childRenderBlock->markForPaginationRelayout();
             }
 
             // Now do the layout.
@@ -443,7 +443,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
             if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
                 RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
                 if (childRenderBlock && view()->layoutState()->pageY(child->y()) != childRenderBlock->pageY())
-                    childRenderBlock->setChildNeedsLayout(true, false);
+                    childRenderBlock->markForPaginationRelayout();
             }
 
             child->layoutIfNeeded();
@@ -713,7 +713,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
             if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
                 RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
                 if (childRenderBlock && view()->layoutState()->pageY(child->y()) != childRenderBlock->pageY())
-                    childRenderBlock->setChildNeedsLayout(true, false);
+                    childRenderBlock->markForPaginationRelayout();
             }
 
             // Now do a layout.
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 4a872d6..b5a9c69 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -602,15 +602,6 @@ int RenderTableSection::layoutRows(int toAdd)
             int be = rHeight - heightWithoutIntrinsicPadding - te;
             cell->setIntrinsicPaddingTop(te);
             cell->setIntrinsicPaddingBottom(be);
-            if (te != oldTe || be != oldBe) {
-                cell->setNeedsLayout(true, false);
-                cell->layoutIfNeeded();
-                if (view()->layoutState()->m_pageHeight && cell->height() != rHeight)
-                    cell->setHeight(rHeight); // FIXME: Pagination might have made us change size.  For now just shrink or grow the cell to fit without doing a relayout.
-            }
-
-            if ((te != oldTe || be > oldBe) && !table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout())
-                cell->repaint();
             
             IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
         
@@ -619,6 +610,20 @@ int RenderTableSection::layoutRows(int toAdd)
             else
                 cell->setLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
 
+            if (te != oldTe || be != oldBe)
+                cell->setNeedsLayout(true, false);
+            
+            if (!cell->needsLayout() && view()->layoutState()->m_pageHeight && view()->layoutState()->pageY(cell->y()) != cell->pageY())
+                cell->setChildNeedsLayout(true, false);
+                
+            cell->layoutIfNeeded();
+            
+            if (view()->layoutState()->m_pageHeight && cell->height() != rHeight)
+                cell->setHeight(rHeight); // FIXME: Pagination might have made us change size.  For now just shrink or grow the cell to fit without doing a relayout.
+
+            if ((te != oldTe || be > oldBe) && !table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout())
+                cell->repaint();
+
             // If the cell moved, we have to repaint it as well as any floating/positioned
             // descendants.  An exception is if we need a layout.  In this case, we know we're going to
             // repaint ourselves (and the cell) anyway.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list