[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:55:56 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 64ee5f772c8e84bec7fe2ef437949ce347339646
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 29 22:22:59 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=46844, make estimateLogicalTopPosition
    block-flow-aware.
    
    Reviewed by Sam Weinig.
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::estimateLogicalTopPosition):
    (WebCore::RenderBlock::collapsedMarginBeforeForChild):
    (WebCore::RenderBlock::collapsedMarginAfterForChild):
    * rendering/RenderBlock.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68696 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dea56c3..2a54f92 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-29  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46844, make estimateLogicalTopPosition
+        block-flow-aware.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::estimateLogicalTopPosition):
+        (WebCore::RenderBlock::collapsedMarginBeforeForChild):
+        (WebCore::RenderBlock::collapsedMarginAfterForChild):
+        * rendering/RenderBlock.h:
+
 2010-09-29  Chris Rogers  <crogers at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index c9f1805..ba2d9c9 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1614,33 +1614,33 @@ int RenderBlock::estimateLogicalTopPosition(RenderBox* child, const MarginInfo&
 {
     // FIXME: We need to eliminate the estimation of vertical position, because when it's wrong we sometimes trigger a pathological
     // relayout if there are intruding floats.
-    int yPosEstimate = height();
+    int logicalTopEstimate = logicalHeight();
     if (!marginInfo.canCollapseWithMarginBefore()) {
-        int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginBefore();
-        yPosEstimate += max(marginInfo.margin(), childMarginTop);
+        int childMarginBefore = child->selfNeedsLayout() ? marginBeforeForChild(child) : collapsedMarginBeforeForChild(child);
+        logicalTopEstimate += max(marginInfo.margin(), childMarginBefore);
     }
     
     bool paginated = view()->layoutState()->isPaginated();
 
-    // Adjust yPosEstimate down to the next page if the margins are so large that we don't fit on the current
+    // Adjust logicalTopEstimate down to the next page if the margins are so large that we don't fit on the current
     // page.
-    if (paginated && yPosEstimate > height())
-        yPosEstimate = min(yPosEstimate, nextPageTop(height()));
+    if (paginated && logicalTopEstimate > logicalHeight())
+        logicalTopEstimate = min(logicalTopEstimate, nextPageTop(logicalHeight()));
 
-    yPosEstimate += getClearDelta(child, yPosEstimate);
+    logicalTopEstimate += getClearDelta(child, logicalTopEstimate);
     
     if (paginated) {
         // If the object has a page or column break value of "before", then we should shift to the top of the next page.
-        yPosEstimate = applyBeforeBreak(child, yPosEstimate);
+        logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate);
     
         // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one.
-        yPosEstimate = adjustForUnsplittableChild(child, yPosEstimate);
+        logicalTopEstimate = adjustForUnsplittableChild(child, logicalTopEstimate);
         
         if (!child->selfNeedsLayout() && child->isRenderBlock())
-            yPosEstimate += toRenderBlock(child)->paginationStrut();
+            logicalTopEstimate += toRenderBlock(child)->paginationStrut();
     }
 
-    return yPosEstimate;
+    return logicalTopEstimate;
 }
 
 void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
@@ -6020,6 +6020,40 @@ void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, int& d
     }  
 }
 
+int RenderBlock::collapsedMarginBeforeForChild(RenderBox* child) const
+{
+    // If the child has the same directionality as we do, then we can just return its
+    // collapsed margin.
+    if (!child->isBlockFlowRoot())
+        return child->collapsedMarginBefore();
+    
+    // The child has a different directionality.  If the child is parallel, then it's just
+    // flipped relative to us.  We can use the collapsed margin for the opposite edge.
+    if (child->style()->isVerticalBlockFlow() == style()->isVerticalBlockFlow())
+        return child->collapsedMarginAfter();
+    
+    // The child is perpendicular to us, which means its margins don't collapse but are on the
+    // "logical left/right" sides of the child box.  We can just return the raw margin in this case.  
+    return marginBeforeForChild(child);
+}
+
+int RenderBlock::collapsedMarginAfterForChild(RenderBox* child) const
+{
+    // If the child has the same directionality as we do, then we can just return its
+    // collapsed margin.
+    if (!child->isBlockFlowRoot())
+        return child->collapsedMarginAfter();
+    
+    // The child has a different directionality.  If the child is parallel, then it's just
+    // flipped relative to us.  We can use the collapsed margin for the opposite edge.
+    if (child->style()->isVerticalBlockFlow() == style()->isVerticalBlockFlow())
+        return child->collapsedMarginBefore();
+    
+    // The child is perpendicular to us, which means its margins don't collapse but are on the
+    // "logical left/right" side of the child box.  We can just return the raw margin in this case.  
+    return marginAfterForChild(child);
+}
+
 int RenderBlock::marginBeforeForChild(RenderBoxModelObject* child) const
 {
     switch (style()->blockFlow()) {
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 107ce88..5926e7e 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -180,6 +180,8 @@ public:
     void setMarginEndForChild(RenderBox* child, int);
     void setMarginBeforeForChild(RenderBox* child, int);
     void setMarginAfterForChild(RenderBox* child, int);
+    int collapsedMarginBeforeForChild(RenderBox* child) const;
+    int collapsedMarginAfterForChild(RenderBox* child) const;
 
 protected:
     // These functions are only used internally to manipulate the render tree structure via remove/insert/appendChildNode.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list