Source/WebCore: Remove positioned float code.
authorinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2012 21:30:56 +0000 (21:30 +0000)
committerinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2012 21:30:56 +0000 (21:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84795

Reviewed by Dan Bernstein.

Backout r92004 and some pieces from r91702.

Test: fast/block/float/positioned-float-crash.html

* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator EFloat):
* css/CSSValueKeywords.in:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::RenderBlock):
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::addOverflowFromFloats):
(WebCore::RenderBlock::layoutBlockChild):
(WebCore::RenderBlock::simplifiedLayout):
(WebCore::RenderBlock::layoutPositionedObjects):
(WebCore::RenderBlock::insertFloatingObject):
(WebCore::RenderBlock::positionNewFloats):
(WebCore::RenderBlock::clearFloats):
(WebCore::RenderBlock::FloatingObjects::clear):
(WebCore::RenderBlock::FloatingObjects::increaseObjectsCount):
(WebCore::RenderBlock::FloatingObjects::decreaseObjectsCount):
* rendering/RenderBlock.h:
(RenderBlock):
(WebCore::RenderBlock::forceLayoutInlineChildren):
(FloatingObject):
(WebCore::RenderBlock::FloatingObject::FloatingObject):
(WebCore::RenderBlock::hasOverhangingFloats):
(WebCore::RenderBlock::FloatingObjects::FloatingObjects):
(FloatingObjects):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateBoxModelInfoFromStyle):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
* rendering/RenderDeprecatedFlexibleBox.h:
(RenderDeprecatedFlexibleBox):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
* rendering/RenderFlexibleBox.h:
(RenderFlexibleBox):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateScrollbarsAfterLayout):
* rendering/style/RenderStyleConstants.h:

LayoutTests: Remove positioned float code.
https://bugs.webkit.org/show_bug.cgi?id=84795

Reviewed by Dan Bernstein.

* fast/block/float/positioned-float-crash-expected.txt: Added.
* fast/block/float/positioned-float-crash.html: Added.

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

16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/block/float/positioned-float-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/float/positioned-float-crash.html [new file with mode: 0755]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFlexibleBox.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/style/RenderStyleConstants.h

index 868c9e3..0e0eaf9 100644 (file)
@@ -1,3 +1,13 @@
+2012-04-30  Abhishek Arya  <inferno@chromium.org>
+
+        Remove positioned float code.
+        https://bugs.webkit.org/show_bug.cgi?id=84795
+        Reviewed by Dan Bernstein.
+
+        * fast/block/float/positioned-float-crash-expected.txt: Added.
+        * fast/block/float/positioned-float-crash.html: Added.
+
 2012-04-30  Sam Weinig  <sam@webkit.org>
 
         Remove BlobBuilder
diff --git a/LayoutTests/fast/block/float/positioned-float-crash-expected.txt b/LayoutTests/fast/block/float/positioned-float-crash-expected.txt
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/block/float/positioned-float-crash.html b/LayoutTests/fast/block/float/positioned-float-crash.html
new file mode 100755 (executable)
index 0000000..84adb4a
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<body style="position: fixed;">
+<div style="position: fixed; float: -webkit-positioned;"></div>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+document.body.offsetTop;
+document.body.parentNode.removeChild(document.body);
+document.documentElement.offsetTop;
+document.documentElement.innerHTML = "PASS";
+</script>
+</body>
+</html>
+
index 68aa233..ecca44e 100644 (file)
@@ -1,3 +1,55 @@
+2012-04-30  Abhishek Arya  <inferno@chromium.org>
+
+        Remove positioned float code.
+        https://bugs.webkit.org/show_bug.cgi?id=84795
+
+        Reviewed by Dan Bernstein.
+
+        Backout r92004 and some pieces from r91702.
+
+        Test: fast/block/float/positioned-float-crash.html
+
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator EFloat):
+        * css/CSSValueKeywords.in:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::RenderBlock):
+        (WebCore::RenderBlock::layoutBlock):
+        (WebCore::RenderBlock::addOverflowFromFloats):
+        (WebCore::RenderBlock::layoutBlockChild):
+        (WebCore::RenderBlock::simplifiedLayout):
+        (WebCore::RenderBlock::layoutPositionedObjects):
+        (WebCore::RenderBlock::insertFloatingObject):
+        (WebCore::RenderBlock::positionNewFloats):
+        (WebCore::RenderBlock::clearFloats):
+        (WebCore::RenderBlock::FloatingObjects::clear):
+        (WebCore::RenderBlock::FloatingObjects::increaseObjectsCount):
+        (WebCore::RenderBlock::FloatingObjects::decreaseObjectsCount):
+        * rendering/RenderBlock.h:
+        (RenderBlock):
+        (WebCore::RenderBlock::forceLayoutInlineChildren):
+        (FloatingObject):
+        (WebCore::RenderBlock::FloatingObject::FloatingObject):
+        (WebCore::RenderBlock::hasOverhangingFloats):
+        (WebCore::RenderBlock::FloatingObjects::FloatingObjects):
+        (FloatingObjects):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::updateBoxModelInfoFromStyle):
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
+        * rendering/RenderDeprecatedFlexibleBox.h:
+        (RenderDeprecatedFlexibleBox):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutBlock):
+        * rendering/RenderFlexibleBox.h:
+        (RenderFlexibleBox):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollbarsAfterLayout):
+        * rendering/style/RenderStyleConstants.h:
+
 2012-04-29  Sam Weinig  <sam@webkit.org>
 
         Remove BlobBuilder
index 5670baf..cf07357 100644 (file)
@@ -564,8 +564,8 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
         if (valueID == CSSValueShow || valueID == CSSValueHide)
             return true;
         break;
-    case CSSPropertyFloat: // left | right | none | positioned | center (for buggy CSS, maps to none)
-        if (valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone || valueID == CSSValueCenter || valueID == CSSValueWebkitPositioned)
+    case CSSPropertyFloat: // left | right | none | center (for buggy CSS, maps to none)
+        if (valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone || valueID == CSSValueCenter)
             return true;
         break;
     case CSSPropertyFontStyle: // normal | italic | oblique | inherit
index a305f18..d607713 100644 (file)
@@ -1387,9 +1387,6 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
         case RightFloat:
             m_value.ident = CSSValueRight;
             break;
-        case PositionedFloat:
-            m_value.ident = CSSValueWebkitPositioned;
-            break;
     }
 }
 
@@ -1403,8 +1400,6 @@ template<> inline CSSPrimitiveValue::operator EFloat() const
         case CSSValueNone:
         case CSSValueCenter:  // Non-standard CSS value
             return NoFloat;
-        case CSSValueWebkitPositioned:
-            return PositionedFloat;
         default:
             ASSERT_NOT_REACHED();
             return NoFloat;
index 6482812..46b4c95 100644 (file)
@@ -876,9 +876,6 @@ off
 optimizeQuality
 -webkit-optimize-contrast
 
-// Positioned Floats
--webkit-positioned
-
 // -webkit-wrap-shape
 nonzero
 evenodd
index 8b25763..da2de69 100755 (executable)
@@ -200,7 +200,6 @@ RenderBlock::RenderBlock(Node* node)
       : RenderBox(node)
       , m_lineHeight(-1)
       , m_beingDestroyed(false)
-      , m_hasPositionedFloats(false)
       , m_hasMarkupTruncation(false)
 {
     setChildrenInline(true);
@@ -1361,7 +1360,7 @@ bool RenderBlock::recomputeLogicalWidth()
     return oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth();
 }
 
-void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass)
+void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight)
 {
     ASSERT(needsLayout());
 
@@ -1378,12 +1377,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
 
     m_overflow.clear();
 
-    // If nothing changed about our floating positioned objects, let's go ahead and try to place them as
-    // floats to avoid doing two passes.
-    BlockLayoutPass floatsLayoutPass = layoutPass;
-    if (floatsLayoutPass == NormalLayoutPass && !relayoutChildren && !positionedFloatsNeedRelayout())
-        floatsLayoutPass = PositionedFloatLayoutPass;
-    clearFloats(floatsLayoutPass);
+    clearFloats();
 
     LayoutUnit previousHeight = logicalHeight();
     setLogicalHeight(0);
@@ -1488,7 +1482,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
             for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
                 if (child->isBlockFlow() && !child->isFloatingOrPositioned()) {
                     RenderBlock* block = toRenderBlock(child);
-                    if (block->lowestFloatLogicalBottomIncludingPositionedFloats() + block->logicalTop() > newHeight)
+                    if (block->lowestFloatLogicalBottom() + block->logicalTop() > newHeight)
                         addOverhangingFloats(block, false);
                 }
             }
@@ -1498,7 +1492,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
     if (previousHeight != newHeight)
         relayoutChildren = true;
 
-    bool needAnotherLayoutPass = layoutPositionedObjects(relayoutChildren || isRoot());
+    layoutPositionedObjects(relayoutChildren || isRoot());
 
     computeRegionRangeForBlock();
 
@@ -1559,11 +1553,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
         }
     }
     
-    if (needAnotherLayoutPass && layoutPass == NormalLayoutPass) {
-        setChildNeedsLayout(true, MarkOnlyThis);
-        layoutBlock(false, pageLogicalHeight, PositionedFloatLayoutPass);
-    } else
-        setNeedsLayout(false);
+    setNeedsLayout(false);
 }
 
 void RenderBlock::addOverflowFromChildren()
@@ -1635,7 +1625,7 @@ void RenderBlock::addOverflowFromFloats()
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* r = *it;
-        if (r->isDescendant() && !r->m_renderer->isPositioned())
+        if (r->isDescendant())
             addOverflowFromChild(r->m_renderer, IntSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r)));
     }
     return;
@@ -2236,7 +2226,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay
     else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) {
         // If an element might be affected by the presence of floats, then always mark it for
         // layout.
-        LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottomIncludingPositionedFloats());
+        LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottom());
         if (fb > logicalTopEstimate)
             markDescendantsWithFloats = true;
     }
@@ -2245,7 +2235,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay
         if (markDescendantsWithFloats)
             childRenderBlock->markAllDescendantsWithFloatsForLayout();
         if (!child->isWritingModeRoot())
-            previousFloatLogicalBottom = max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlock->lowestFloatLogicalBottomIncludingPositionedFloats());
+            previousFloatLogicalBottom = max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlock->lowestFloatLogicalBottom());
     }
 
     if (!child->needsLayout())
@@ -2384,8 +2374,8 @@ bool RenderBlock::simplifiedLayout()
         simplifiedNormalFlowLayout();
 
     // Lay out our positioned objects if our positioned child bit is set.
-    if (posChildNeedsLayout() && layoutPositionedObjects(false))
-        return false; // If a positioned float is causing our normal flow to change, then we have to bail and do a full layout.
+    if (posChildNeedsLayout())
+        layoutPositionedObjects(false);
 
     // Recompute our overflow information.
     // FIXME: We could do better here by computing a temporary overflow object from layoutPositionedObjects and only
@@ -2405,41 +2395,14 @@ bool RenderBlock::simplifiedLayout()
     return true;
 }
 
-bool RenderBlock::positionedFloatsNeedRelayout()
-{
-    if (!hasPositionedFloats())
-        return false;
-    
-    RenderBox* positionedObject;
-    Iterator end = m_positionedObjects->end();
-    for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
-        positionedObject = *it;
-        if (!positionedObject->isFloating())
-            continue;
-
-        if (positionedObject->needsLayout())
-            return true;
-
-        if (positionedObject->style()->hasStaticBlockPosition(isHorizontalWritingMode()) && positionedObject->parent() != this && positionedObject->parent()->isBlockFlow())
-            return true;
-        
-        if (view()->layoutState()->pageLogicalHeightChanged() || (view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(logicalTop()) != pageLogicalOffset()))
-            return true;
-    }
-    
-    return false;
-}
-
-bool RenderBlock::layoutPositionedObjects(bool relayoutChildren)
+void RenderBlock::layoutPositionedObjects(bool relayoutChildren)
 {
     if (!m_positionedObjects)
-        return false;
+        return;
         
     if (hasColumns())
         view()->layoutState()->clearPaginationInformation(); // Positioned objects are not part of the column flow, so they don't paginate with the columns.
 
-    bool didFloatingBoxRelayout = false;
-
     RenderBox* r;
     Iterator end = m_positionedObjects->end();
     for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
@@ -2458,11 +2421,6 @@ bool RenderBlock::layoutPositionedObjects(bool relayoutChildren)
         if (!r->needsLayout())
             r->markForPaginationRelayoutIfNeeded();
         
-        // FIXME: Technically we could check the old placement and the new placement of the box and only invalidate if
-        // the margin box of the object actually changed.
-        if (r->needsLayout() && r->isFloating())
-            didFloatingBoxRelayout = true;
-
         // 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
         // and we hit the available width constraint, the layoutIfNeeded() will catch it and do a full layout.
         if (r->needsPositionedMovementLayoutOnly() && r->tryLayoutDoingPositionedMovementOnly())
@@ -2499,8 +2457,6 @@ bool RenderBlock::layoutPositionedObjects(bool relayoutChildren)
     
     if (hasColumns())
         view()->layoutState()->m_columnInfo = columnInfo(); // FIXME: Kind of gross. We just put this back into the layout state so that pop() will work.
-        
-    return didFloatingBoxRelayout;
 }
 
 void RenderBlock::markPositionedObjectsForLayout()
@@ -3518,18 +3474,16 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o)
     
     // Our location is irrelevant if we're unsplittable or no pagination is in effect.
     // Just go ahead and lay out the float.
-    if (!o->isPositioned()) {
-        bool isChildRenderBlock = o->isRenderBlock();
-        if (isChildRenderBlock && !o->needsLayout() && view()->layoutState()->pageLogicalHeightChanged())
-            o->setChildNeedsLayout(true, MarkOnlyThis);
+    bool isChildRenderBlock = o->isRenderBlock();
+    if (isChildRenderBlock && !o->needsLayout() && view()->layoutState()->pageLogicalHeightChanged())
+        o->setChildNeedsLayout(true, MarkOnlyThis);
             
-        bool needsBlockDirectionLocationSetBeforeLayout = isChildRenderBlock && view()->layoutState()->needsBlockDirectionLocationSetBeforeLayout();
-        if (!needsBlockDirectionLocationSetBeforeLayout || isWritingModeRoot()) // We are unsplittable if we're a block flow root.
-            o->layoutIfNeeded();
-        else {
-            o->computeLogicalWidth();
-            o->computeBlockDirectionMargins(this);
-        }
+    bool needsBlockDirectionLocationSetBeforeLayout = isChildRenderBlock && view()->layoutState()->needsBlockDirectionLocationSetBeforeLayout();
+    if (!needsBlockDirectionLocationSetBeforeLayout || isWritingModeRoot()) // We are unsplittable if we're a block flow root.
+        o->layoutIfNeeded();
+    else {
+        o->computeLogicalWidth();
+        o->computeBlockDirectionMargins(this);
     }
     setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o));
 
@@ -3683,9 +3637,8 @@ bool RenderBlock::positionNewFloats()
     for (; it != end; ++it) {
         FloatingObject* floatingObject = *it;
         // The containing block is responsible for positioning floats, so if we have floats in our
-        // list that come from somewhere else, do not attempt to position them. Also don't attempt to handle
-        // positioned floats, since the positioning layout code handles those.
-        if (floatingObject->renderer()->containingBlock() != this || floatingObject->renderer()->isPositioned())
+        // list that come from somewhere else, do not attempt to position them.
+        if (floatingObject->renderer()->containingBlock() != this)
             continue;
 
         RenderBox* childBox = floatingObject->renderer();
@@ -4045,41 +3998,11 @@ void RenderBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l
     }
 }
 
-void RenderBlock::addPositionedFloats()
-{
-    if (!m_positionedObjects)
-        return;
-    
-    Iterator end = m_positionedObjects->end();
-    for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
-        RenderBox* positionedObject = *it;
-        if (!positionedObject->isFloating())
-            continue;
-
-        ASSERT(!positionedObject->needsLayout());
-
-        // If we're a positioned float, then we need to insert ourselves as a floating object also. We only do
-        // this after the positioned object has received a layout, since otherwise the dimensions and placement
-        // won't be correct.
-        FloatingObject* floatingObject = insertFloatingObject(positionedObject);
-        setLogicalLeftForFloat(floatingObject, logicalLeftForChild(positionedObject) - marginLogicalLeftForChild(positionedObject));
-        setLogicalTopForFloat(floatingObject, logicalTopForChild(positionedObject) - marginBeforeForChild(positionedObject));
-        setLogicalHeightForFloat(floatingObject, logicalHeightForChild(positionedObject) + marginBeforeForChild(positionedObject) + marginAfterForChild(positionedObject));
-
-        m_floatingObjects->addPlacedObject(floatingObject);
-        
-        m_hasPositionedFloats = true;
-    }
-}
-
-void RenderBlock::clearFloats(BlockLayoutPass layoutPass)
+void RenderBlock::clearFloats()
 {
     if (m_floatingObjects)
         m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
 
-    // Clear our positioned floats boolean.
-    m_hasPositionedFloats = false;
-
     HashSet<RenderBox*> oldIntrudingFloatSet;
     if (!childrenInline() && m_floatingObjects) {
         const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
@@ -4097,8 +4020,6 @@ void RenderBlock::clearFloats(BlockLayoutPass layoutPass)
             deleteAllValues(m_floatingObjects->set());
             m_floatingObjects->clear();
         }
-        if (layoutPass == PositionedFloatLayoutPass)
-            addPositionedFloats();
         if (!oldIntrudingFloatSet.isEmpty())
             markAllDescendantsWithFloatsForLayout();
         return;
@@ -4120,9 +4041,6 @@ void RenderBlock::clearFloats(BlockLayoutPass layoutPass)
         m_floatingObjects->clear();
     }
 
-    if (layoutPass == PositionedFloatLayoutPass)
-        addPositionedFloats();
-
     // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add 
     // floats in an invalid context. This will cause a crash arising from a bad cast on the parent.
     // See <rdar://problem/8049753>, where float property is applied on a text node in a SVG.
@@ -4133,7 +4051,7 @@ void RenderBlock::clearFloats(BlockLayoutPass layoutPass)
     // out of flow (like floating/positioned elements), and we also skip over any objects that may have shifted
     // to avoid floats.
     RenderBlock* parentBlock = toRenderBlock(parent());
-    bool parentHasFloats = parentBlock->hasPositionedFloats();
+    bool parentHasFloats = false;
     RenderObject* prev = previousSibling();
     while (prev && (prev->isFloatingOrPositioned() || !prev->isBox() || !prev->isRenderBlock() || toRenderBlock(prev)->avoidsFloats())) {
         if (prev->isFloating())
@@ -4149,14 +4067,14 @@ void RenderBlock::clearFloats(BlockLayoutPass layoutPass)
     LayoutUnit logicalLeftOffset = 0;
     if (prev)
         logicalTopOffset -= toRenderBox(prev)->logicalTop();
-    else if (!parentHasFloats) {
+    else {
         prev = parentBlock;
         logicalLeftOffset += parentBlock->logicalLeftOffsetForContent();
     }
 
     // Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.    
     RenderBlock* block = toRenderBlock(prev);
-    if (block && block->m_floatingObjects && block->lowestFloatLogicalBottomIncludingPositionedFloats() > logicalTopOffset)
+    if (block->m_floatingObjects && block->lowestFloatLogicalBottom() > logicalTopOffset)
         addIntrudingFloats(block, logicalLeftOffset, logicalTopOffset);
 
     if (childrenInline()) {
@@ -7043,20 +6961,6 @@ LayoutUnit RenderBlock::marginAfterForChild(const RenderBoxModelObject* child) c
     return child->marginBottom();
 }
 
-LayoutUnit RenderBlock::marginLogicalLeftForChild(const RenderBoxModelObject* child) const
-{
-    if (isHorizontalWritingMode())
-        return child->marginLeft();
-    return child->marginTop();
-}
-
-LayoutUnit RenderBlock::marginLogicalRightForChild(const RenderBoxModelObject* child) const
-{
-    if (isHorizontalWritingMode())
-        return child->marginRight();
-    return child->marginBottom();
-}
-
 LayoutUnit RenderBlock::marginStartForChild(const RenderBoxModelObject* child) const
 {
     if (isHorizontalWritingMode())
@@ -7227,27 +7131,22 @@ inline void RenderBlock::FloatingObjects::clear()
     m_placedFloatsTree.clear();
     m_leftObjectsCount = 0;
     m_rightObjectsCount = 0;
-    m_positionedObjectsCount = 0;
 }
 
 inline void RenderBlock::FloatingObjects::increaseObjectsCount(FloatingObject::Type type)
 {    
     if (type == FloatingObject::FloatLeft)
         m_leftObjectsCount++;
-    else if (type == FloatingObject::FloatRight)
+    else 
         m_rightObjectsCount++;
-    else
-        m_positionedObjectsCount++;
 }
 
 inline void RenderBlock::FloatingObjects::decreaseObjectsCount(FloatingObject::Type type)
 {
     if (type == FloatingObject::FloatLeft)
         m_leftObjectsCount--;
-    else if (type == FloatingObject::FloatRight)
-        m_rightObjectsCount--;
     else
-        m_positionedObjectsCount--;
+        m_rightObjectsCount--;
 }
 
 inline RenderBlock::FloatingObjectInterval RenderBlock::FloatingObjects::intervalForFloatingObject(FloatingObject* floatingObject)
index d8e60a7..7ab0352 100644 (file)
@@ -96,8 +96,7 @@ public:
     virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
     virtual void removeChild(RenderObject*);
 
-    enum BlockLayoutPass { NormalLayoutPass, PositionedFloatLayoutPass };
-    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);
+    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0);
 
     void insertPositionedObject(RenderBox*);
     void removePositionedObject(RenderBox*);
@@ -283,15 +282,12 @@ public:
     LayoutUnit logicalWidthForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->width() : child->height(); }
     LayoutUnit logicalHeightForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->height() : child->width(); }
     LayoutUnit logicalTopForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->y() : child->x(); }
-    LayoutUnit logicalLeftForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->x() : child->y(); }
     void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
     void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
     LayoutUnit marginBeforeForChild(const RenderBoxModelObject* child) const;
     LayoutUnit marginAfterForChild(const RenderBoxModelObject* child) const;
     LayoutUnit marginStartForChild(const RenderBoxModelObject* child) const;
     LayoutUnit marginEndForChild(const RenderBoxModelObject* child) const;
-    LayoutUnit marginLogicalLeftForChild(const RenderBoxModelObject* child) const;
-    LayoutUnit marginLogicalRightForChild(const RenderBoxModelObject* child) const;
     void setMarginStartForChild(RenderBox* child, LayoutUnit);
     void setMarginEndForChild(RenderBox* child, LayoutUnit);
     void setMarginBeforeForChild(RenderBox* child, LayoutUnit);
@@ -405,7 +401,7 @@ protected:
 
     virtual void layout();
 
-    bool layoutPositionedObjects(bool relayoutChildren);
+    void layoutPositionedObjects(bool relayoutChildren);
 
     virtual void paint(PaintInfo&, const LayoutPoint&);
     virtual void paintObject(PaintInfo&, const LayoutPoint&);
@@ -459,7 +455,7 @@ protected:
     {
         LayoutUnit repaintLogicalTop = 0;
         LayoutUnit repaintLogicalBottom = 0;
-        clearFloats(NormalLayoutPass);
+        clearFloats();
         layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom);
     }
 #endif
@@ -528,15 +524,14 @@ private:
     struct FloatingObject {
         WTF_MAKE_NONCOPYABLE(FloatingObject); WTF_MAKE_FAST_ALLOCATED;
     public:
-        // FloatLeftRight is a mask to query for both left and right but not positioned.
-        // FloatAll is a mask to query for all types of floats.
-        enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3, FloatPositioned = 4, FloatAll = 7 };
+        // Note that Type uses bits so you can use FloatLeftRight as a mask to query for both left and right.
+        enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3 };
 
         FloatingObject(EFloat type)
             : m_renderer(0)
             , m_originatingLine(0)
             , m_paginationStrut(0)
-            , m_shouldPaint(false)
+            , m_shouldPaint(true)
             , m_isDescendant(false)
             , m_isPlaced(false)
 #ifndef NDEBUG
@@ -547,9 +542,7 @@ private:
             if (type == LeftFloat)
                 m_type = FloatLeft;
             else if (type == RightFloat)
-                m_type = FloatRight;
-            else if (type == PositionedFloat)
-                m_type = FloatPositioned;
+                m_type = FloatRight;  
         }
 
         FloatingObject(Type type, const LayoutRect& frameRect)
@@ -558,7 +551,7 @@ private:
             , m_frameRect(frameRect)
             , m_paginationStrut(0)
             , m_type(type)
-            , m_shouldPaint(type != FloatPositioned)
+            , m_shouldPaint(true)
             , m_isDescendant(false)
             , m_isPlaced(true)
 #ifndef NDEBUG
@@ -611,7 +604,7 @@ private:
         int m_paginationStrut;
 
     private:
-        unsigned m_type : 3; // Type (left/right aligned or positioned)
+        unsigned m_type : 2; // Type (left or right aligned)
         unsigned m_shouldPaint : 1;
         unsigned m_isDescendant : 1;
         unsigned m_isPlaced : 1;
@@ -748,23 +741,18 @@ private:
     // Returns true if and only if it has positioned any floats.
     bool positionNewFloats();
 
-    bool hasPositionedFloats() const { return m_hasPositionedFloats; }
-    void addPositionedFloats();
-    bool positionedFloatsNeedRelayout();
+    void clearFloats();
 
-    void clearFloats(BlockLayoutPass);
     LayoutUnit getClearDelta(RenderBox* child, LayoutUnit yPos);
 
     virtual bool avoidsFloats() const;
 
-    bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottomIncludingPositionedFloats() > logicalHeight(); }
+    bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
     bool hasOverhangingFloat(RenderBox*);
     void addIntrudingFloats(RenderBlock* prev, LayoutUnit xoffset, LayoutUnit yoffset);
     LayoutUnit addOverhangingFloats(RenderBlock* child, bool makeChildPaintOtherFloats);
 
-    LayoutUnit lowestFloatLogicalBottom() const { return lowestFloatLogicalBottom(FloatingObject::FloatLeftRight); }
-    LayoutUnit lowestFloatLogicalBottomIncludingPositionedFloats() const { return lowestFloatLogicalBottom(FloatingObject::FloatAll); }
-    LayoutUnit lowestFloatLogicalBottom(FloatingObject::Type) const;
+    LayoutUnit lowestFloatLogicalBottom(FloatingObject::Type = FloatingObject::FloatLeftRight) const; 
     LayoutUnit nextFloatLogicalBottomBelow(LayoutUnit) const;
     
     virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
@@ -1023,7 +1011,6 @@ protected:
             : m_placedFloatsTree(UninitializedTree)
             , m_leftObjectsCount(0)
             , m_rightObjectsCount(0)
-            , m_positionedObjectsCount(0)
             , m_horizontalWritingMode(horizontalWritingMode)
             , m_renderer(renderer)
         {
@@ -1038,7 +1025,6 @@ protected:
 
         bool hasLeftObjects() const { return m_leftObjectsCount > 0; }
         bool hasRightObjects() const { return m_rightObjectsCount > 0; }
-        bool hasPositionedObjects() const { return m_positionedObjectsCount > 0; }
         const FloatingObjectSet& set() const { return m_set; }
         const FloatingObjectTree& placedFloatsTree()
         {
@@ -1060,7 +1046,6 @@ protected:
         FloatingObjectTree m_placedFloatsTree;
         unsigned m_leftObjectsCount;
         unsigned m_rightObjectsCount;
-        unsigned m_positionedObjectsCount;
         bool m_horizontalWritingMode;
         const RenderBlock* m_renderer;
     };
@@ -1111,9 +1096,8 @@ protected:
     RenderObjectChildList m_children;
     RenderLineBoxList m_lineBoxes;   // All of the root line boxes created for this block flow.  For example, <div>Hello<br>world.</div> will have two total lines for the <div>.
 
-    mutable signed m_lineHeight : 29;
+    mutable signed m_lineHeight : 30;
     unsigned m_beingDestroyed : 1;
-    unsigned m_hasPositionedFloats : 1;
     unsigned m_hasMarkupTruncation : 1;
 
     // RenderRubyBase objects need to be able to split and merge, moving their children around
index 37eca28..a86bb7b 100644 (file)
@@ -419,7 +419,7 @@ void RenderBox::updateBoxModelInfoFromStyle()
         setHasBoxDecorations(true);
 
     setPositioned(styleToUse->isPositioned());
-    setFloating(styleToUse->isFloating() && (!isPositioned() || styleToUse->floating() == PositionedFloat));
+    setFloating(!isPositioned() && styleToUse->isFloating());
 
     // We also handle <body> and <html>, whose overflow applies to the viewport.
     if (styleToUse->overflowX() != OVISIBLE && !isRootObject && (isRenderBlock() || isTableRow() || isTableSection())) {
index b46ab93..16f694b 100644 (file)
@@ -218,7 +218,7 @@ void RenderDeprecatedFlexibleBox::computePreferredLogicalWidths()
     setPreferredLogicalWidthsDirty(false);
 }
 
-void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass)
+void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
 {
     ASSERT(needsLayout());
 
@@ -272,7 +272,7 @@ void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit
     if (previousSize.height() != height())
         relayoutChildren = true;
 
-    bool needAnotherLayoutPass = layoutPositionedObjects(relayoutChildren || isRoot());
+    layoutPositionedObjects(relayoutChildren || isRoot());
 
     computeRegionRangeForBlock();
 
@@ -310,11 +310,7 @@ void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit
     // Repaint with our new bounds if they are different from our old bounds.
     repainter.repaintAfterLayout();
 
-    if (needAnotherLayoutPass && layoutPass == NormalLayoutPass) {
-        setChildNeedsLayout(true, MarkOnlyThis);
-        layoutBlock(false, pageLogicalHeight);
-    } else
-        setNeedsLayout(false);
+    setNeedsLayout(false);
 }
 
 // The first walk over our kids is to find out if we have any flexible children.
index 9a42bd4..4d912f4 100644 (file)
@@ -40,7 +40,7 @@ public:
     void calcHorizontalPrefWidths();
     void calcVerticalPrefWidths();
 
-    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0, BlockLayoutPass = NormalLayoutPass);
+    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0);
     void layoutHorizontalBox(bool relayoutChildren);
     void layoutVerticalBox(bool relayoutChildren);
 
index a8be252..ffc0610 100644 (file)
@@ -230,7 +230,7 @@ void RenderFlexibleBox::computePreferredLogicalWidths()
     setPreferredLogicalWidthsDirty(false);
 }
 
-void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit, BlockLayoutPass)
+void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
 {
     ASSERT(needsLayout());
 
index b97457b..6c21b04 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     virtual bool isFlexibleBox() const { return true; }
     virtual void computePreferredLogicalWidths();
-    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);
+    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0);
 
     bool isHorizontalFlow() const;
 
index 4d6b737..cbf5241 100644 (file)
@@ -2497,7 +2497,7 @@ void RenderLayer::updateScrollbarsAfterLayout()
                 if (renderer()->isRenderBlock()) {
                     RenderBlock* block = toRenderBlock(renderer());
                     block->scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
-                    block->layoutBlock(true); // FIXME: Need to handle positioned floats triggering extra relayouts.
+                    block->layoutBlock(true);
                 } else
                     renderer()->layout();
                 m_inOverflowRelayout = false;
index 01e3d06..741acc6 100644 (file)
@@ -98,7 +98,7 @@ enum EPosition {
 };
 
 enum EFloat {
-    NoFloat, LeftFloat, RightFloat, PositionedFloat
+    NoFloat, LeftFloat, RightFloat
 };
 
 enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD };