Changeset 229696 in webkit
- Timestamp:
- Mar 17, 2018 1:49:54 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r229693 r229696 1 2018-03-17 Zalan Bujtas <zalan@apple.com> 2 3 [LayoutReloaded] Ensure that positioning happens within the formatting context 4 https://bugs.webkit.org/show_bug.cgi?id=183722 5 6 Reviewed by Antti Koivisto. 7 8 All sizing and positioning need to happen in the formatting context that the box lives in 9 including the final position of in- and out-of-flow descendants. 10 11 * LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js: 12 (BlockFormattingContext.prototype.layout): 13 (BlockFormattingContext.prototype._placeInFlowPositionedChildren): 14 * LayoutReloaded/LayoutTree/Box.js: 15 (Layout.Box.prototype.establishesBlockFormattingContext): 16 (Layout.Box.prototype.isPositioned): 17 (Layout.Box.prototype.isRelativelyPositioned): 18 (Layout.Box.prototype.isAbsolutelyPositioned): 19 (Layout.Box.prototype.isOutOfFlowPositioned): 20 (Layout.Box.prototype.containingBlock): 21 (Layout.Box.prototype.isRelativePositioned): Deleted. 22 (Layout.Box.prototype.isAbsolutePositioned): Deleted. 23 * LayoutReloaded/Utils.js: 24 (Utils.isRelativelyPositioned): 25 (Utils.isAbsolutelyPositioned): 26 (Utils.isRelativePositioned): Deleted. 27 (Utils.isAbsolutePositioned): Deleted. 28 * LayoutReloaded/misc/headers/Box.h: 29 1 30 2018-03-16 Wenson Hsieh <wenson_hsieh@apple.com> 2 31 -
trunk/Tools/LayoutReloaded/FormattingContext/BlockFormatting/BlockFormattingContext.js
r229692 r229696 66 66 // Adjust position now that we have all the previous floats placed in this context -if needed. 67 67 this.floatingContext().computePosition(layoutBox); 68 // Move positioned children to their final position.69 if (layoutBox.isContainer() ) {68 // Move in-flow positioned children to their final position. If this layoutBox also establishes a formatting context, then positioning already has happend. 69 if (layoutBox.isContainer() && !layoutBox.establishesFormattingContext()) 70 70 this._placeInFlowPositionedChildren(layoutBox); 71 // Place the out of flow content.72 this._placeOutOfFlowDescendants(layoutBox);73 }74 71 // We are done with laying out this box. 75 72 this._removeFromLayoutQueue(layoutBox); … … 80 77 } 81 78 } 82 // And finally place the out of flow descendants for the root. 79 // And finally place the in- and out-of-flow descendants. 80 this._placeInFlowPositionedChildren(this.rootContainer()); 83 81 this._placeOutOfFlowDescendants(this.rootContainer()); 84 82 } … … 122 120 123 121 _placeInFlowPositionedChildren(container) { 124 for (let inFlowChild = container.firstInFlowChild(); inFlowChild; inFlowChild = inFlowChild.nextInFlowSibling()) 125 this._computeInFlowPositionedPosition(inFlowChild); 122 for (let inFlowChild = container.firstInFlowChild(); inFlowChild; inFlowChild = inFlowChild.nextInFlowSibling()) { 123 if (!inFlowChild.isInFlowPositioned()) 124 continue; 125 this._computeInFlowPositionedPosition(inFlowChild); 126 } 126 127 } 127 128 -
trunk/Tools/LayoutReloaded/LayoutTree/Box.js
r229671 r229696 178 178 // that are not block boxes, and block boxes with 'overflow' other than 'visible' (except when that value has been propagated to the viewport) 179 179 // establish new block formatting contexts for their contents. 180 return this.isFloatingPositioned() || this.isAbsolute Positioned() || (this.isBlockContainerBox() && !this.isBlockLevelBox())180 return this.isFloatingPositioned() || this.isAbsolutelyPositioned() || (this.isBlockContainerBox() && !this.isBlockLevelBox()) 181 181 || (this.isBlockLevelBox() && !Utils.isOverflowVisible(this)); 182 182 } … … 187 187 188 188 isPositioned() { 189 return this.isOutOfFlowPositioned() || this.isRelative Positioned();190 } 191 192 isRelative Positioned() {193 return Utils.isRelative Positioned(this);194 } 195 196 isAbsolute Positioned() {197 return Utils.isAbsolute Positioned(this);189 return this.isOutOfFlowPositioned() || this.isRelativelyPositioned(); 190 } 191 192 isRelativelyPositioned() { 193 return Utils.isRelativelyPositioned(this); 194 } 195 196 isAbsolutelyPositioned() { 197 return Utils.isAbsolutelyPositioned(this) || this.isFixedPositioned(); 198 198 } 199 199 … … 209 209 210 210 isOutOfFlowPositioned() { 211 return this.isAbsolute Positioned() || this.isFixedPositioned();211 return this.isAbsolutelyPositioned() || this.isFixedPositioned(); 212 212 } 213 213 … … 235 235 if (!this.isPositioned() || this.isInFlowPositioned()) 236 236 return this.parent(); 237 let parent = this.parent(); 238 while (parent.parent()) { 239 if (this.isAbsolutePositioned() && parent.isPositioned()) 240 return parent; 241 parent = parent.parent(); 242 } 243 return parent; 237 if (this.isAbsolutelyPositioned() && !this.isFixedPositioned()) { 238 let ascendant = this.parent(); 239 while (ascendant.parent() && !ascendant.isPositioned()) 240 ascendant = ascendant.parent(); 241 return ascendant; 242 } 243 if (this.isFixedPositioned()) { 244 let ascendant = this.parent(); 245 while (ascendant.parent()) 246 ascendant = ascendant.parent(); 247 return ascendant; 248 } 249 ASSERT_NOT_REACHED(); 250 return null; 244 251 } 245 252 -
trunk/Tools/LayoutReloaded/Utils.js
r229664 r229696 432 432 } 433 433 434 static isRelative Positioned(box) {434 static isRelativelyPositioned(box) { 435 435 if (box.isAnonymous()) 436 436 return false; … … 439 439 } 440 440 441 static isAbsolute Positioned(box) {441 static isAbsolutelyPositioned(box) { 442 442 if (box.isAnonymous()) 443 443 return false; -
trunk/Tools/LayoutReloaded/misc/headers/Box.h
r229658 r229696 69 69 bool isInFlow() const; 70 70 bool isPositioned() const; 71 bool isRelative Positioned() const;72 bool isAbsolute Positioned() const;71 bool isRelativelyPositioned() const; 72 bool isAbsolutelyPositioned() const; 73 73 bool isFixedPositioned() const; 74 74 bool isOutOfFlowPositioned() const;
Note: See TracChangeset
for help on using the changeset viewer.