Title: [108645] trunk/Source/WebCore
Revision
108645
Author
[email protected]
Date
2012-02-23 11:12:01 -0800 (Thu, 23 Feb 2012)

Log Message

Cleanup RenderBlock::moveChildrenTo
https://bugs.webkit.org/show_bug.cgi?id=79319

Reviewed by Eric Seidel.

Refactoring, no change in behavior expected.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::moveChildrenTo):
Removed inline check that was redundant, switched to |while| to a |for|
to show what's going on more closely and adds a call to moveChildTo to
share more code between the 2 functions.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108644 => 108645)


--- trunk/Source/WebCore/ChangeLog	2012-02-23 19:06:33 UTC (rev 108644)
+++ trunk/Source/WebCore/ChangeLog	2012-02-23 19:12:01 UTC (rev 108645)
@@ -1,3 +1,18 @@
+2012-02-23  Julien Chaffraix  <[email protected]>
+
+        Cleanup RenderBlock::moveChildrenTo
+        https://bugs.webkit.org/show_bug.cgi?id=79319
+
+        Reviewed by Eric Seidel.
+
+        Refactoring, no change in behavior expected.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::moveChildrenTo):
+        Removed inline check that was redundant, switched to |while| to a |for|
+        to show what's going on more closely and adds a call to moveChildTo to
+        share more code between the 2 functions.
+
 2012-02-23  Simon Hausmann  <[email protected]>
 
         [Qt] Add support for touch cancellation

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (108644 => 108645)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-02-23 19:06:33 UTC (rev 108644)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-02-23 19:12:01 UTC (rev 108645)
@@ -997,18 +997,12 @@
 void RenderBlock::moveChildrenTo(RenderBlock* toBlock, RenderObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert)
 {
     ASSERT(!beforeChild || toBlock == beforeChild->parent());
-    RenderObject* nextChild = startChild;
-    while (nextChild && nextChild != endChild) {
-        RenderObject* child = nextChild;
-        nextChild = child->nextSibling();
-        if (fullRemoveInsert) {
-            // Takes care of adding the new child correctly if toBlock and fromBlock
-            // have different kind of children (block vs inline).
-            toBlock->addChildIgnoringContinuation(children()->removeChildNode(this, child), beforeChild);
-        } else
-            toBlock->children()->insertChildNode(toBlock, children()->removeChildNode(this, child, false), beforeChild, false);
-        if (child == endChild)
-            return;
+
+    for (RenderObject* child = startChild; child && child != endChild; ) {
+        // Save our next sibling as moveChildTo will clear it.
+        RenderObject* nextSibling = child->nextSibling();
+        moveChildTo(toBlock, child, beforeChild, fullRemoveInsert);
+        child = nextSibling;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to