Changeset 230621 in webkit
- Timestamp:
- Apr 12, 2018 8:09:03 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r230601 r230621 1 2018-04-12 Zalan Bujtas <zalan@apple.com> 2 3 [LayoutReloaded] Move root container ownership to layout state 4 https://bugs.webkit.org/show_bug.cgi?id=184575 5 6 Reviewed by Antti Koivisto. 7 8 Now the root container is on the associated layout state (ICB only at this point though). 9 10 * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js: 11 (BlockFormattingContext.prototype.layout): 12 * LayoutReloaded/FormattingContext/FormattingContext.js: 13 (FormattingContext.prototype._layoutOutOfFlowDescendants): 14 * LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js: 15 (InlineFormattingContext.prototype._handleInlineBlockContainer): 16 (InlineFormattingContext.prototype._handleFloatingBox): 17 * LayoutReloaded/Layout.js: 18 (layout): 19 * LayoutReloaded/LayoutState.js: 20 (LayoutState): 21 (LayoutState.prototype.formattingContext): 22 (LayoutState.prototype.establishedFormattingState): 23 (LayoutState.prototype.formattingStateForBox): 24 (LayoutState.prototype.needsLayout): 25 (LayoutState.prototype.displayBox): 26 (LayoutState.prototype._formattingContext): 27 (LayoutState.prototype.layout): Deleted. 28 (LayoutState.prototype.formattingStates): Deleted. 29 (LayoutState.prototype.initialDisplayBox): Deleted. 30 * LayoutReloaded/Utils.js: 31 (Utils._dumpBox): 32 (Utils._findDisplayBox): Deleted. 33 1 34 2018-04-12 Jonathan Bedard <jbedard@apple.com> 2 35 -
trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js
r230573 r230621 48 48 this._computeStaticPosition(layoutBox); 49 49 if (layoutBox.establishesFormattingContext()) { 50 this.layoutState(). layout(layoutBox);50 this.layoutState().formattingContext(layoutBox).layout(); 51 51 break; 52 52 } -
trunk/Tools/LayoutReloaded/FormattingContext/FormattingContext.js
r230580 r230621 174 174 this._addToLayoutQueue(outOfFlowBox); 175 175 this._computeOutOfFlowWidth(outOfFlowBox); 176 this.layoutState(). layout(outOfFlowBox);176 this.layoutState().formattingContext(outOfFlowBox).layout(); 177 177 this._computeOutOfFlowHeight(outOfFlowBox); 178 178 this._computeOutOfFlowPosition(outOfFlowBox); -
trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js
r230573 r230621 82 82 this._adjustLineForInlineContainerStart(inlineBlockContainer); 83 83 displayBox.setWidth(Utils.width(inlineBlockContainer) + Utils.computedHorizontalBorderAndPadding(inlineBlockContainer.node())); 84 this.layoutState(). layout(inlineBlockContainer);84 this.layoutState().formattingContext(inlineBlockContainer).layout(); 85 85 displayBox.setHeight(Utils.height(inlineBlockContainer) + Utils.computedVerticalBorderAndPadding(inlineBlockContainer.node())); 86 86 this._adjustLineForInlineContainerEnd(inlineBlockContainer); … … 123 123 _handleFloatingBox(floatingBox) { 124 124 this._computeFloatingWidth(floatingBox); 125 this.layoutState(). layout(floatingBox);125 this.layoutState().formattingContext(floatingBox).layout(); 126 126 this._computeFloatingHeight(floatingBox); 127 127 let displayBox = this.displayBox(floatingBox); -
trunk/Tools/LayoutReloaded/Layout.js
r229786 r230621 29 29 let displayBox = new Display.Box(); 30 30 displayBox.setSize(viewportSize); 31 let layoutState = new LayoutState( displayBox);32 layoutState. layout(initialContainingBlock);31 let layoutState = new LayoutState(initialContainingBlock, displayBox); 32 layoutState.formattingContext(initialContainingBlock).layout(); 33 33 return Utils.layoutTreeDump(initialContainingBlock, layoutState); 34 34 } -
trunk/Tools/LayoutReloaded/LayoutState.js
r230580 r230621 25 25 26 26 class LayoutState { 27 constructor(initialDisplayBox) { 27 constructor(rootContainer, rootDisplayBox) { 28 ASSERT(rootContainer.establishesFormattingContext()); 29 this.m_rootContainer = rootContainer; 30 this.m_rootDisplayBox = rootDisplayBox; 31 28 32 this.m_formattingStates = new Map(); 29 this.m_initialDisplayBox = initialDisplayBox;30 33 } 31 34 32 layout(formattingRoot) { 33 let formattingState = this._createFormattingState(formattingRoot); 34 this.m_formattingStates.set(formattingRoot, formattingState); 35 this.formattingContext(formattingState).layout(); 36 } 37 38 formattingContext(formattingState) { 39 if (formattingState instanceof BlockFormattingState) 40 return new BlockFormattingContext(formattingState); 41 if (formattingState instanceof InlineFormattingState) 42 return new InlineFormattingContext(formattingState); 43 ASSERT_NOT_REACHED(); 44 return null; 45 } 46 47 formattingStates() { 48 return this.m_formattingStates; 35 formattingContext(formattingRoot) { 36 return this._formattingContext(this.establishedFormattingState(formattingRoot)); 49 37 } 50 38 51 39 establishedFormattingState(formattingRoot) { 52 40 ASSERT(formattingRoot.establishesFormattingContext()); 53 return this.m_formattingStates.get(formattingRoot); 41 let formattingState = this.m_formattingStates.get(formattingRoot); 42 if (formattingState) 43 return formattingState; 44 formattingState = this._createFormattingState(formattingRoot); 45 this.m_formattingStates.set(formattingRoot, formattingState); 46 return formattingState; 54 47 } 55 48 56 49 formattingStateForBox(layoutBox) { 57 for (let formattingEntry of this. formattingStates()) {50 for (let formattingEntry of this.m_formattingStates) { 58 51 let formattingRoot = formattingEntry[0]; 59 52 let formattingState = formattingEntry[1]; … … 74 67 75 68 needsLayout() { 76 for (let formattingEntry of this. formattingStates()) {69 for (let formattingEntry of this.m_formattingStates) { 77 70 let formattingState = formattingEntry[1]; 78 71 if (formattingState.layoutNeeded()) … … 83 76 84 77 displayBox(layoutBox) { 85 for (let formattingEntry of this. formattingStates()) {78 for (let formattingEntry of this.m_formattingStates) { 86 79 let formattingState = formattingEntry[1]; 87 80 let displayBox = formattingState.displayBoxes().get(layoutBox); … … 89 82 return displayBox; 90 83 } 91 // It must be the ICB. 92 ASSERT(!layoutBox.parent()); 93 return this.initialDisplayBox(); 94 } 95 96 initialDisplayBox() { 97 return this.m_initialDisplayBox; 84 // It must be the root container. 85 ASSERT(layoutBox == this.m_rootContainer); 86 return this.m_rootDisplayBox; 98 87 } 99 88 … … 108 97 } 109 98 99 _formattingContext(formattingState) { 100 if (formattingState instanceof BlockFormattingState) 101 return new BlockFormattingContext(formattingState); 102 if (formattingState instanceof InlineFormattingState) 103 return new InlineFormattingContext(formattingState); 104 ASSERT_NOT_REACHED(); 105 return null; 106 } 110 107 } -
trunk/Tools/LayoutReloaded/Utils.js
r230580 r230621 554 554 } 555 555 556 static _findDisplayBox(layoutState, box) {557 for (let formattingEntry of layoutState.formattingStates()) {558 let formattingState = formattingEntry[1];559 let displayBox = formattingState.displayBoxes().get(box);560 if (displayBox)561 return displayBox;562 }563 ASSERT(!box.parent());564 return layoutState.initialDisplayBox();565 }566 567 556 static _dumpBox(layoutState, box, level) { 568 557 // Skip anonymous boxes for now -This is the case where WebKit does not generate an anon inline container for text content where the text is a direct child … … 575 564 if (box.name() == "RenderInline") { 576 565 if (box.isInFlowPositioned()) { 577 let displayBox = Utils._findDisplayBox(layoutState,box);566 let displayBox = layoutState.displayBox(box); 578 567 let boxRect = displayBox.rect(); 579 568 return indentation + box.node().tagName + " " + box.name() + " (" + Utils.precisionRoundWithDecimals(boxRect.left()) + ", " + Utils.precisionRoundWithDecimals(boxRect.top()) + ")\n"; … … 583 572 if (box.isAnonymous()) 584 573 return ""; 585 let displayBox = Utils._findDisplayBox(layoutState,box);574 let displayBox = layoutState.displayBox(box); 586 575 let boxRect = displayBox.rect(); 587 576 return indentation + (box.node().tagName ? (box.node().tagName + " ") : "") + box.name() + " at (" + boxRect.left() + "," + boxRect.top() + ") size " + boxRect.width() + "x" + boxRect.height() + "\n";
Note: See TracChangeset
for help on using the changeset viewer.