2011-04-06 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 14:10:02 +0000 (14:10 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 14:10:02 +0000 (14:10 +0000)
        Reviewed by Eric Seidel.

        Move RenderBlock::positionNewFloatOnLine to RenderBlockLineLayout.cpp
        https://bugs.webkit.org/show_bug.cgi?id=57943

        * rendering/RenderBlock.cpp: Removed positionNewFloatOnLine.
        * rendering/RenderBlockLineLayout.cpp:
        (WebCore::RenderBlock::positionNewFloatOnLine): Moved from RenderBlock.cpp

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockLineLayout.cpp

index 5aef3d2dc26a19f1f8e6963c3fe0b1aa9803c751..584f2ebe4d3ae846912af3306f1b6b3a9b9a91cb 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Move RenderBlock::positionNewFloatOnLine to RenderBlockLineLayout.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=57943
+
+        * rendering/RenderBlock.cpp: Removed positionNewFloatOnLine.
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::positionNewFloatOnLine): Moved from RenderBlock.cpp
+
 2011-04-05  Diego Gonzalez  <diegohcg@webkit.org>
 
         Buildfix after r82125.
index e571306aa458a19d7ac8c5232d26f07c1ee3a318..7baeb20efa4102fea56d8e7cbb47ac537fd54e00 100644 (file)
@@ -3320,59 +3320,6 @@ bool RenderBlock::positionNewFloats()
     return true;
 }
 
-bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFloatFromPreviousLine, bool firstLine, int& lineLeftOffset, int& lineRightOffset)
-{
-    bool didPosition = positionNewFloats();
-    if (!didPosition)
-        return didPosition;
-
-    int blockOffset = logicalHeight();
-    if (blockOffset >= logicalTopForFloat(newFloat) && blockOffset < logicalBottomForFloat(newFloat)) {
-        if (newFloat->type() == FloatingObject::FloatLeft)
-            lineLeftOffset = logicalRightForFloat(newFloat);
-        else
-            lineRightOffset = logicalLeftForFloat(newFloat);
-    }
-    
-    if (!newFloat->m_paginationStrut)
-        return didPosition;
-     
-    FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
-    ASSERT(floatingObjectSet.last() == newFloat);
-
-    int floatLogicalTop = logicalTopForFloat(newFloat);
-    int paginationStrut = newFloat->m_paginationStrut;
-    
-    if (floatLogicalTop - paginationStrut != logicalHeight())
-        return didPosition;
-
-    FloatingObjectSetIterator it = floatingObjectSet.end();
-    --it; // Last float is newFloat, skip that one.
-    FloatingObjectSetIterator begin = floatingObjectSet.begin();
-    while (it != begin) {
-        --it;
-        FloatingObject* f = *it;
-        if (f == lastFloatFromPreviousLine)
-            break;
-        if (logicalTopForFloat(f) == logicalHeight()) {
-            ASSERT(!f->m_paginationStrut);
-            f->m_paginationStrut = paginationStrut;
-            RenderBox* o = f->m_renderer;
-            setLogicalTopForChild(o, logicalTopForChild(o) + marginBeforeForChild(o) + paginationStrut);
-            if (o->isRenderBlock())
-                toRenderBlock(o)->setChildNeedsLayout(true, false);
-            o->layoutIfNeeded();
-            setLogicalTopForFloat(f, logicalTopForFloat(f) + f->m_paginationStrut);
-        }
-    }
-        
-    setLogicalHeight(blockOffset + paginationStrut);
-    lineLeftOffset = logicalLeftOffsetForLine(logicalHeight(), firstLine);
-    lineRightOffset = logicalRightOffsetForLine(logicalHeight(), firstLine);
-
-    return didPosition;
-}
-
 void RenderBlock::newLine(EClear clear)
 {
     positionNewFloats();
index 2457f14e6013cc7d2697c6a5610bb2477311e8ca..04aac36ab2e1eb699e45d65296b68d4e16f748e5 100644 (file)
@@ -2244,4 +2244,57 @@ void RenderBlock::checkLinesForTextOverflow()
     }
 }
 
+bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFloatFromPreviousLine, bool firstLine, int& lineLeftOffset, int& lineRightOffset)
+{
+    bool didPosition = positionNewFloats();
+    if (!didPosition)
+        return didPosition;
+
+    int blockOffset = logicalHeight();
+    if (blockOffset >= logicalTopForFloat(newFloat) && blockOffset < logicalBottomForFloat(newFloat)) {
+        if (newFloat->type() == FloatingObject::FloatLeft)
+            lineLeftOffset = logicalRightForFloat(newFloat);
+        else
+            lineRightOffset = logicalLeftForFloat(newFloat);
+    }
+
+    if (!newFloat->m_paginationStrut)
+        return didPosition;
+
+    FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    ASSERT(floatingObjectSet.last() == newFloat);
+
+    int floatLogicalTop = logicalTopForFloat(newFloat);
+    int paginationStrut = newFloat->m_paginationStrut;
+
+    if (floatLogicalTop - paginationStrut != logicalHeight())
+        return didPosition;
+
+    FloatingObjectSetIterator it = floatingObjectSet.end();
+    --it; // Last float is newFloat, skip that one.
+    FloatingObjectSetIterator begin = floatingObjectSet.begin();
+    while (it != begin) {
+        --it;
+        FloatingObject* f = *it;
+        if (f == lastFloatFromPreviousLine)
+            break;
+        if (logicalTopForFloat(f) == logicalHeight()) {
+            ASSERT(!f->m_paginationStrut);
+            f->m_paginationStrut = paginationStrut;
+            RenderBox* o = f->m_renderer;
+            setLogicalTopForChild(o, logicalTopForChild(o) + marginBeforeForChild(o) + paginationStrut);
+            if (o->isRenderBlock())
+                toRenderBlock(o)->setChildNeedsLayout(true, false);
+            o->layoutIfNeeded();
+            setLogicalTopForFloat(f, logicalTopForFloat(f) + f->m_paginationStrut);
+        }
+    }
+
+    setLogicalHeight(blockOffset + paginationStrut);
+    lineLeftOffset = logicalLeftOffsetForLine(logicalHeight(), firstLine);
+    lineRightOffset = logicalRightOffsetForLine(logicalHeight(), firstLine);
+
+    return didPosition;
+}
+
 }