Title: [230573] trunk/Tools
Revision
230573
Author
za...@apple.com
Date
2018-04-12 07:51:35 -0700 (Thu, 12 Apr 2018)

Log Message

[LayoutReloaded] Introduce needsLayout to InlineFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=184538

Reviewed by Antti Koivisto.

* LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
(BlockFormattingContext.prototype._adjustBottomWithFIXME):
(BlockFormattingContext):
(BlockFormattingContext.prototype._firstInFlowChildWithNeedsLayout): Deleted.
(BlockFormattingContext.prototype._nextInFlowSiblingWithNeedsLayout): Deleted.
* LayoutReloaded/FormattingContext/FormattingContext.js:
(FormattingContext.prototype._firstInFlowChildWithNeedsLayout):
(FormattingContext.prototype._nextInFlowSiblingWithNeedsLayout):
(FormattingContext):
* LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
(InlineFormattingContext.prototype.layout):
(InlineFormattingContext.prototype._handleInlineContainer):
(InlineFormattingContext.prototype._handleInlineBlockContainer):
(InlineFormattingContext.prototype._handleInlineContent):
(InlineFormattingContext.prototype._clearAndMoveToNext):
(InlineFormattingContext):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (230572 => 230573)


--- trunk/Tools/ChangeLog	2018-04-12 14:12:28 UTC (rev 230572)
+++ trunk/Tools/ChangeLog	2018-04-12 14:51:35 UTC (rev 230573)
@@ -1,3 +1,27 @@
+2018-04-12  Zalan Bujtas  <za...@apple.com>
+
+        [LayoutReloaded] Introduce needsLayout to InlineFormattingContext
+        https://bugs.webkit.org/show_bug.cgi?id=184538
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
+        (BlockFormattingContext.prototype._adjustBottomWithFIXME):
+        (BlockFormattingContext):
+        (BlockFormattingContext.prototype._firstInFlowChildWithNeedsLayout): Deleted.
+        (BlockFormattingContext.prototype._nextInFlowSiblingWithNeedsLayout): Deleted.
+        * LayoutReloaded/FormattingContext/FormattingContext.js:
+        (FormattingContext.prototype._firstInFlowChildWithNeedsLayout):
+        (FormattingContext.prototype._nextInFlowSiblingWithNeedsLayout):
+        (FormattingContext):
+        * LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
+        (InlineFormattingContext.prototype.layout):
+        (InlineFormattingContext.prototype._handleInlineContainer):
+        (InlineFormattingContext.prototype._handleInlineBlockContainer):
+        (InlineFormattingContext.prototype._handleInlineContent):
+        (InlineFormattingContext.prototype._clearAndMoveToNext):
+        (InlineFormattingContext):
+
 2018-04-12  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [GStreamer] Speed up GStreamer dependency build by removing examples compilation

Modified: trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js (230572 => 230573)


--- trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js	2018-04-12 14:12:28 UTC (rev 230572)
+++ trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js	2018-04-12 14:51:35 UTC (rev 230573)
@@ -178,22 +178,4 @@
         }
         return bottom;
     }
-
-    _firstInFlowChildWithNeedsLayout(layoutBox) {
-        if (!layoutBox.isContainer())
-            return null;
-        for (let child = layoutBox.firstInFlowOrFloatChild(); child; child = child.nextInFlowOrFloatSibling()) {
-            if (this.formattingState().needsLayout(child))
-                return child;
-        }
-        return null;
-    }
-
-    _nextInFlowSiblingWithNeedsLayout(layoutBox) {
-        for (let sibling = layoutBox.nextInFlowOrFloatSibling(); sibling; sibling = sibling.nextInFlowOrFloatSibling()) {
-            if (this.formattingState().needsLayout(sibling))
-                return sibling;
-        }
-        return null;
-    }
 }

Modified: trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js (230572 => 230573)


--- trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js	2018-04-12 14:12:28 UTC (rev 230572)
+++ trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js	2018-04-12 14:51:35 UTC (rev 230573)
@@ -332,4 +332,22 @@
         }
         return outOfFlowBoxes;
     }
+
+    _firstInFlowChildWithNeedsLayout(layoutBox) {
+        if (!layoutBox.isContainer())
+            return null;
+        for (let child = layoutBox.firstInFlowOrFloatChild(); child; child = child.nextInFlowOrFloatSibling()) {
+            if (this.formattingState().needsLayout(child))
+                return child;
+        }
+        return null;
+    }
+
+    _nextInFlowSiblingWithNeedsLayout(layoutBox) {
+        for (let sibling = layoutBox.nextInFlowOrFloatSibling(); sibling; sibling = sibling.nextInFlowOrFloatSibling()) {
+            if (this.formattingState().needsLayout(sibling))
+                return sibling;
+        }
+        return null;
+    }
 }

Modified: trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js (230572 => 230573)


--- trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js	2018-04-12 14:12:28 UTC (rev 230572)
+++ trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js	2018-04-12 14:51:35 UTC (rev 230573)
@@ -37,7 +37,7 @@
             return;
         this.m_line = this._createNewLine();
         let inlineContainerStack = new Array();
-        this._addToLayoutQueue(this.formattingRoot().firstInFlowOrFloatChild());
+        this._addToLayoutQueue(this._firstInFlowChildWithNeedsLayout(this.formattingRoot()));
         while (this._descendantNeedsLayout()) {
             let layoutBox = this._nextInLayoutQueue();
             if (layoutBox.isInlineContainer())
@@ -53,6 +53,7 @@
         this._layoutOutOfFlowDescendants(this.formattingRoot());
         this._commitLine();
         ASSERT(!this.m_inlineContainerStack.length);
+        ASSERT(!this.formattingState().layoutNeeded());
    }
 
     _handleInlineContainer(inlineContainer) {
@@ -61,14 +62,13 @@
         if (inlineContainerStart) {
             this.m_inlineContainerStack.push(inlineContainer);
             this._adjustLineForInlineContainerStart(inlineContainer);
-            this._addToLayoutQueue(inlineContainer.firstInFlowOrFloatChild());
+            this._addToLayoutQueue(this._firstInFlowChildWithNeedsLayout(inlineContainer));
             // Keep the inline container in the layout stack so that we can finish it when all the descendants are all set.
             return;
         }
         this.m_inlineContainerStack.pop(inlineContainer);
         this._adjustLineForInlineContainerEnd(inlineContainer);
-        this._removeFromLayoutQueue(inlineContainer);
-        this._addToLayoutQueue(inlineContainer.nextInFlowOrFloatSibling());
+        this._clearAndMoveToNext(inlineContainer);
         // Place inflow positioned children.
         this._placeInFlowPositionedChildren(inlineContainer);
     }
@@ -84,10 +84,8 @@
         this.layoutState().layout(inlineBlockContainer);
         displayBox.setHeight(Utils.height(inlineBlockContainer) + Utils.computedVerticalBorderAndPadding(inlineBlockContainer.node()));
         this._adjustLineForInlineContainerEnd(inlineBlockContainer);
-
         this._line().addInlineContainerBox(displayBox.size());
-        this._removeFromLayoutQueue(inlineBlockContainer);
-        this._addToLayoutQueue(inlineBlockContainer.nextInFlowOrFloatSibling());
+        this._clearAndMoveToNext(inlineBlockContainer);
     }
 
     _handleInlineContent(layoutBox) {
@@ -97,8 +95,7 @@
             this._handleFloatingBox(layoutBox);
         else
             ASSERT_NOT_REACHED();
-        this._removeFromLayoutQueue(layoutBox);
-        this._addToLayoutQueue(layoutBox.nextInFlowOrFloatSibling());
+        this._clearAndMoveToNext(layoutBox);
     }
 
     _handleInlineBox(inlineBox) {
@@ -212,5 +209,11 @@
             return root.contentBox().left();
         return horizontalPosition - rootLeft;
      }
+
+    _clearAndMoveToNext(layoutBox) {
+        this._removeFromLayoutQueue(layoutBox);
+        this.formattingState().clearNeedsLayout(layoutBox);
+        this._addToLayoutQueue(this._nextInFlowSiblingWithNeedsLayout(layoutBox));
+    }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to