Changeset 230573 in webkit


Ignore:
Timestamp:
Apr 12, 2018 7:51:35 AM (6 years ago)
Author:
Alan Bujtas
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):

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r230565 r230573  
     12018-04-12  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LayoutReloaded] Introduce needsLayout to InlineFormattingContext
     4        https://bugs.webkit.org/show_bug.cgi?id=184538
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js:
     9        (BlockFormattingContext.prototype._adjustBottomWithFIXME):
     10        (BlockFormattingContext):
     11        (BlockFormattingContext.prototype._firstInFlowChildWithNeedsLayout): Deleted.
     12        (BlockFormattingContext.prototype._nextInFlowSiblingWithNeedsLayout): Deleted.
     13        * LayoutReloaded/FormattingContext/FormattingContext.js:
     14        (FormattingContext.prototype._firstInFlowChildWithNeedsLayout):
     15        (FormattingContext.prototype._nextInFlowSiblingWithNeedsLayout):
     16        (FormattingContext):
     17        * LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js:
     18        (InlineFormattingContext.prototype.layout):
     19        (InlineFormattingContext.prototype._handleInlineContainer):
     20        (InlineFormattingContext.prototype._handleInlineBlockContainer):
     21        (InlineFormattingContext.prototype._handleInlineContent):
     22        (InlineFormattingContext.prototype._clearAndMoveToNext):
     23        (InlineFormattingContext):
     24
    1252018-04-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    226
  • trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js

    r230555 r230573  
    179179        return bottom;
    180180    }
    181 
    182     _firstInFlowChildWithNeedsLayout(layoutBox) {
    183         if (!layoutBox.isContainer())
    184             return null;
    185         for (let child = layoutBox.firstInFlowOrFloatChild(); child; child = child.nextInFlowOrFloatSibling()) {
    186             if (this.formattingState().needsLayout(child))
    187                 return child;
    188         }
    189         return null;
    190     }
    191 
    192     _nextInFlowSiblingWithNeedsLayout(layoutBox) {
    193         for (let sibling = layoutBox.nextInFlowOrFloatSibling(); sibling; sibling = sibling.nextInFlowOrFloatSibling()) {
    194             if (this.formattingState().needsLayout(sibling))
    195                 return sibling;
    196         }
    197         return null;
    198     }
    199181}
  • trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js

    r230555 r230573  
    333333        return outOfFlowBoxes;
    334334    }
     335
     336    _firstInFlowChildWithNeedsLayout(layoutBox) {
     337        if (!layoutBox.isContainer())
     338            return null;
     339        for (let child = layoutBox.firstInFlowOrFloatChild(); child; child = child.nextInFlowOrFloatSibling()) {
     340            if (this.formattingState().needsLayout(child))
     341                return child;
     342        }
     343        return null;
     344    }
     345
     346    _nextInFlowSiblingWithNeedsLayout(layoutBox) {
     347        for (let sibling = layoutBox.nextInFlowOrFloatSibling(); sibling; sibling = sibling.nextInFlowOrFloatSibling()) {
     348            if (this.formattingState().needsLayout(sibling))
     349                return sibling;
     350        }
     351        return null;
     352    }
    335353}
  • trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js

    r230484 r230573  
    3838        this.m_line = this._createNewLine();
    3939        let inlineContainerStack = new Array();
    40         this._addToLayoutQueue(this.formattingRoot().firstInFlowOrFloatChild());
     40        this._addToLayoutQueue(this._firstInFlowChildWithNeedsLayout(this.formattingRoot()));
    4141        while (this._descendantNeedsLayout()) {
    4242            let layoutBox = this._nextInLayoutQueue();
     
    5454        this._commitLine();
    5555        ASSERT(!this.m_inlineContainerStack.length);
     56        ASSERT(!this.formattingState().layoutNeeded());
    5657   }
    5758
     
    6263            this.m_inlineContainerStack.push(inlineContainer);
    6364            this._adjustLineForInlineContainerStart(inlineContainer);
    64             this._addToLayoutQueue(inlineContainer.firstInFlowOrFloatChild());
     65            this._addToLayoutQueue(this._firstInFlowChildWithNeedsLayout(inlineContainer));
    6566            // Keep the inline container in the layout stack so that we can finish it when all the descendants are all set.
    6667            return;
     
    6869        this.m_inlineContainerStack.pop(inlineContainer);
    6970        this._adjustLineForInlineContainerEnd(inlineContainer);
    70         this._removeFromLayoutQueue(inlineContainer);
    71         this._addToLayoutQueue(inlineContainer.nextInFlowOrFloatSibling());
     71        this._clearAndMoveToNext(inlineContainer);
    7272        // Place inflow positioned children.
    7373        this._placeInFlowPositionedChildren(inlineContainer);
     
    8585        displayBox.setHeight(Utils.height(inlineBlockContainer) + Utils.computedVerticalBorderAndPadding(inlineBlockContainer.node()));
    8686        this._adjustLineForInlineContainerEnd(inlineBlockContainer);
    87 
    8887        this._line().addInlineContainerBox(displayBox.size());
    89         this._removeFromLayoutQueue(inlineBlockContainer);
    90         this._addToLayoutQueue(inlineBlockContainer.nextInFlowOrFloatSibling());
     88        this._clearAndMoveToNext(inlineBlockContainer);
    9189    }
    9290
     
    9896        else
    9997            ASSERT_NOT_REACHED();
    100         this._removeFromLayoutQueue(layoutBox);
    101         this._addToLayoutQueue(layoutBox.nextInFlowOrFloatSibling());
     98        this._clearAndMoveToNext(layoutBox);
    10299    }
    103100
     
    213210        return horizontalPosition - rootLeft;
    214211     }
     212
     213    _clearAndMoveToNext(layoutBox) {
     214        this._removeFromLayoutQueue(layoutBox);
     215        this.formattingState().clearNeedsLayout(layoutBox);
     216        this._addToLayoutQueue(this._nextInFlowSiblingWithNeedsLayout(layoutBox));
     217    }
    215218}
    216219
Note: See TracChangeset for help on using the changeset viewer.