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


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

    https://bugs.webkit.org/show_bug.cgi?id=46824
    
    Reviewed by Sam Weinig.
    
    Convert layoutBlockChild (but not the functions it calls) to be block-flow-aware.
    
    fast/blockflow/root-lr.html progresses as a result of this change.
    
    WebCore:
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::estimateLogicalTopPosition):
    (WebCore::RenderBlock::determineLogicalLeftPositionForChild):
    (WebCore::RenderBlock::setLogicalTopForChild):
    (WebCore::RenderBlock::layoutBlockChild):
    * rendering/RenderBlock.h:
    (WebCore::RenderBlock::logicalHeightForChild):
    (WebCore::RenderBlock::logicalTopForChild):
    * rendering/RenderBox.h:
    
    LayoutTests:
    
    * platform/mac/fast/blockflow/root-lr-basic-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68678 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6f5ee6e..03fc736 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-29  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46824
+        
+        Convert layoutBlockChild (but not the functions it calls) to be block-flow-aware.
+
+        fast/blockflow/root-lr.html progresses as a result of this change.
+
+        * platform/mac/fast/blockflow/root-lr-basic-expected.txt:
+
 2010-09-29  Stephen White  <senorblanco at chromium.org>
 
         Unreviewed; test expectations fix.
diff --git a/LayoutTests/platform/mac/fast/blockflow/root-lr-basic-expected.txt b/LayoutTests/platform/mac/fast/blockflow/root-lr-basic-expected.txt
index c345480..564a8b6 100644
--- a/LayoutTests/platform/mac/fast/blockflow/root-lr-basic-expected.txt
+++ b/LayoutTests/platform/mac/fast/blockflow/root-lr-basic-expected.txt
@@ -1,5 +1,5 @@
-layer at (0,0) size 800x1180
+layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 590x1180
+layer at (0,0) size 590x600
   RenderBlock {HTML} at (0,0) size 104x600 [border: (2px solid #000000)]
-    RenderBody {BODY} at (10,600) size 580x580
+    RenderBody {BODY} at (10,0) size 580x580
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a600d63..49f0364 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-09-29  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46824
+        
+        Convert layoutBlockChild (but not the functions it calls) to be block-flow-aware.
+
+        fast/blockflow/root-lr.html progresses as a result of this change.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::estimateLogicalTopPosition):
+        (WebCore::RenderBlock::determineLogicalLeftPositionForChild):
+        (WebCore::RenderBlock::setLogicalTopForChild):
+        (WebCore::RenderBlock::layoutBlockChild):
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::logicalHeightForChild):
+        (WebCore::RenderBlock::logicalTopForChild):
+        * rendering/RenderBox.h:
+
 2010-09-29  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Antonio Gomes.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index d44c8ea..827d92e 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1610,7 +1610,7 @@ int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, i
     return yPos + heightIncrease;
 }
 
-int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& marginInfo)
+int RenderBlock::estimateLogicalTopPosition(RenderBox* child, const MarginInfo& 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.
@@ -1643,7 +1643,7 @@ int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& ma
     return yPosEstimate;
 }
 
-void RenderBlock::determineHorizontalPosition(RenderBox* child)
+void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
 {
     int xPos = borderLeft() + paddingLeft();
     if (style()->direction() == LTR) {
@@ -1733,6 +1733,17 @@ void RenderBlock::handleAfterSideOfBlock(int top, int bottom, MarginInfo& margin
     setCollapsedBottomMargin(marginInfo);
 }
 
+void RenderBlock::setLogicalTopForChild(RenderBox* child, int logicalTop)
+{
+    if (style()->isVerticalBlockFlow()) {
+        view()->addLayoutDelta(IntSize(0, child->y() - logicalTop));
+        child->setLocation(child->x(), logicalTop);
+    } else {
+        view()->addLayoutDelta(IntSize(child->x() - logicalTop, 0));
+        child->setLocation(logicalTop, child->y());
+    }
+}
+
 void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom)
 {
     if (gPercentHeightDescendantsMap) {
@@ -1805,48 +1816,50 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
 
 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatBottom, int& maxFloatBottom)
 {
-    int oldTopPosMargin = maxPosMarginBefore();
-    int oldTopNegMargin = maxNegMarginBefore();
+    int oldPosMarginBefore = maxPosMarginBefore();
+    int oldNegMarginBefore = maxNegMarginBefore();
 
-    // The child is a normal flow object.  Compute its vertical margins now.
+    // The child is a normal flow object.  Compute the margins we will use for collapsing now.
     child->computeBlockDirectionMargins(this);
 
-    // Do not allow a collapse if the margin top collapse style is set to SEPARATE.
+    // Do not allow a collapse if the margin-before-collapse style is set to SEPARATE.
     if (child->style()->marginBeforeCollapse() == MSEPARATE) {
         marginInfo.setAtBeforeSideOfBlock(false);
         marginInfo.clearMargin();
     }
 
-    // Try to guess our correct y position.  In most cases this guess will
-    // be correct.  Only if we're wrong (when we compute the real y position)
+    // Try to guess our correct logical top position.  In most cases this guess will
+    // be correct.  Only if we're wrong (when we compute the real logical top position)
     // will we have to potentially relayout.
-    int yPosEstimate = estimateVerticalPosition(child, marginInfo);
+    int logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo);
 
     // Cache our old rect so that we can dirty the proper repaint rects if the child moves.
     IntRect oldRect(child->x(), child->y() , child->width(), child->height());
+    int oldLogicalTop = logicalTopForChild(child);
+
 #ifndef NDEBUG
     IntSize oldLayoutDelta = view()->layoutDelta();
 #endif
     // Go ahead and position the child as though it didn't collapse with the top.
-    view()->addLayoutDelta(IntSize(0, child->y() - yPosEstimate));
-    child->setLocation(child->x(), yPosEstimate);
+    setLogicalTopForChild(child, logicalTopEstimate);
 
     RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
     bool markDescendantsWithFloats = false;
-    if (yPosEstimate != oldRect.y() && !child->avoidsFloats() && childRenderBlock && childRenderBlock->containsFloats())
+    if (logicalTopEstimate != oldLogicalTop && !child->avoidsFloats() && childRenderBlock && childRenderBlock->containsFloats())
         markDescendantsWithFloats = true;
     else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) {
         // If an element might be affected by the presence of floats, then always mark it for
         // layout.
         int fb = max(previousFloatBottom, floatBottom());
-        if (fb > yPosEstimate)
+        if (fb > logicalTopEstimate)
             markDescendantsWithFloats = true;
     }
 
     if (childRenderBlock) {
         if (markDescendantsWithFloats)
             childRenderBlock->markAllDescendantsWithFloatsForLayout();
-        previousFloatBottom = max(previousFloatBottom, oldRect.y() + toRenderBlock(child)->floatBottom());
+        if (!child->isBlockFlowRoot())
+            previousFloatBottom = max(previousFloatBottom, oldLogicalTop + childRenderBlock->floatBottom());
     }
 
     bool paginated = view()->layoutState()->isPaginated();
@@ -1863,23 +1876,23 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
 
     // Now determine the correct ypos based off examination of collapsing margin
     // values.
-    int yBeforeClear = collapseMargins(child, marginInfo);
+    int logicalTopBeforeClear = collapseMargins(child, marginInfo);
 
     // Now check for clear.
-    int yAfterClear = clearFloatsIfNeeded(child, marginInfo, oldTopPosMargin, oldTopNegMargin, yBeforeClear);
+    int logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
     
     if (paginated) {
-        int oldY = yAfterClear;
+        int oldTop = logicalTopAfterClear;
         
         // If the object has a page or column break value of "before", then we should shift to the top of the next page.
-        yAfterClear = applyBeforeBreak(child, yAfterClear);
+        logicalTopAfterClear = applyBeforeBreak(child, logicalTopAfterClear);
     
         // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one.
-        int yBeforeUnsplittableAdjustment = yAfterClear;
-        int yAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, yAfterClear);
+        int logicalTopBeforeUnsplittableAdjustment = logicalTopAfterClear;
+        int logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, logicalTopAfterClear);
         
         int paginationStrut = 0;
-        int unsplittableAdjustmentDelta = yAfterUnsplittableAdjustment - yBeforeUnsplittableAdjustment;
+        int unsplittableAdjustmentDelta = logicalTopAfterUnsplittableAdjustment - logicalTopBeforeUnsplittableAdjustment;
         if (unsplittableAdjustmentDelta)
             paginationStrut = unsplittableAdjustmentDelta;
         else if (childRenderBlock && childRenderBlock->paginationStrut())
@@ -1888,26 +1901,25 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
         if (paginationStrut) {
             // We are willing to propagate out to our parent block as long as we were at the top of the block prior
             // to collapsing our margins, and as long as we didn't clear or move as a result of other pagination.
-            if (atBeforeSideOfBlock && oldY == yBeforeClear && !isPositioned() && !isTableCell()) {
+            if (atBeforeSideOfBlock && oldTop == logicalTopBeforeClear && !isPositioned() && !isTableCell()) {
                 // FIXME: Should really check if we're exceeding the page height before propagating the strut, but we don't
                 // have all the information to do so (the strut only has the remaining amount to push).  Gecko gets this wrong too
                 // and pushes to the next page anyway, so not too concerned about it.
-                setPaginationStrut(yAfterClear + paginationStrut);
+                setPaginationStrut(logicalTopAfterClear + paginationStrut);
                 if (childRenderBlock)
                     childRenderBlock->setPaginationStrut(0);
             } else
-                yAfterClear += paginationStrut;
+                logicalTopAfterClear += paginationStrut;
         }
 
         // Similar to how we apply clearance.  Go ahead and boost height() to be the place where we're going to position the child.
-        setLogicalHeight(height() + (yAfterClear - oldY));
+        setLogicalHeight(logicalHeight() + (logicalTopAfterClear - oldTop));
     }
 
-    view()->addLayoutDelta(IntSize(0, yPosEstimate - yAfterClear));
-    child->setLocation(child->x(), yAfterClear);
+    setLogicalTopForChild(child, logicalTopAfterClear);
 
-    // Now we have a final y position.  See if it really does end up being different from our estimate.
-    if (yAfterClear != yPosEstimate) {
+    // Now we have a final top position.  See if it really does end up being different from our estimate.
+    if (logicalTopAfterClear != logicalTopEstimate) {
         if (child->shrinkToAvoidFloats()) {
             // The child's width depends on the line width.
             // When the child shifts to clear an item, its width can
@@ -1931,13 +1943,13 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
     if (marginInfo.atBeforeSideOfBlock() && !child->isSelfCollapsingBlock())
         marginInfo.setAtBeforeSideOfBlock(false);
 
-    // Now place the child in the correct horizontal position
-    determineHorizontalPosition(child);
+    // Now place the child in the correct left position
+    determineLogicalLeftPositionForChild(child);
 
     // Update our height now that the child has been placed in the correct position.
-    setLogicalHeight(height() + child->height());
+    setLogicalHeight(logicalHeight() + logicalHeightForChild(child));
     if (child->style()->marginAfterCollapse() == MSEPARATE) {
-        setLogicalHeight(height() + child->marginBottom());
+        setLogicalHeight(logicalHeight() + child->marginAfterUsing(style()));
         marginInfo.clearMargin();
     }
     // If the child has overhanging floats that intrude into following siblings (or possibly out
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index cecd84c..dde49dc 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -566,10 +566,13 @@ private:
     bool handleRunInChild(RenderBox* child);
     int collapseMargins(RenderBox* child, MarginInfo&);
     int clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin, int yPos);
-    int estimateVerticalPosition(RenderBox* child, const MarginInfo&);
-    void determineHorizontalPosition(RenderBox* child);
+    int estimateLogicalTopPosition(RenderBox* child, const MarginInfo&);
+    void determineLogicalLeftPositionForChild(RenderBox* child);
     void handleAfterSideOfBlock(int top, int bottom, MarginInfo&);
     void setCollapsedBottomMargin(const MarginInfo&);
+    void setLogicalTopForChild(RenderBox* child, int logicalTop);
+    int logicalHeightForChild(RenderBox* child) { return style()->isVerticalBlockFlow() ? child->height() : child->width(); }
+    int logicalTopForChild(RenderBox* child) { return style()->isVerticalBlockFlow() ? child->y() : child->x(); }
     // End helper functions and structs used by layoutBlockChildren.
 
     // Pagination routines.
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index c63259d..de0a633 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -189,7 +189,12 @@ public:
     void setMarginEnd(int);
     void setMarginBefore(int);
     void setMarginAfter(int);
-    
+
+    int marginStartUsing(const RenderStyle*) const;
+    int marginEndUsing(const RenderStyle*) const;
+    int marginBeforeUsing(const RenderStyle*) const;
+    int marginAfterUsing(const RenderStyle*) const;
+
     // The following five functions are used to implement collapsing margins.
     // All objects know their maximal positive and negative margins.  The
     // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
@@ -428,11 +433,6 @@ private:
     void setMarginBeforeUsing(const RenderStyle*, int);
     void setMarginAfterUsing(const RenderStyle*, int);
 
-    int marginStartUsing(const RenderStyle*) const;
-    int marginEndUsing(const RenderStyle*) const;
-    int marginBeforeUsing(const RenderStyle*) const;
-    int marginAfterUsing(const RenderStyle*) const;
-
 private:
     // The width/height of the contents + borders + padding.  The x/y location is relative to our container (which is not always our parent).
     IntRect m_frameRect;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list