Changeset 230700 in webkit
- Timestamp:
- Apr 16, 2018 10:17:26 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r230699 r230700 1 2018-04-16 Zalan Bujtas <zalan@apple.com> 2 3 [LayoutReloaded] Add support for replaced box. 4 https://bugs.webkit.org/show_bug.cgi?id=184680 5 6 Reviewed by Antti Koivisto. 7 8 Basic support for inline replaced. 9 10 * LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js: 11 (InlineFormattingContext.prototype._handleInlineBox): 12 (InlineFormattingContext.prototype._handleInlineBlock): 13 (InlineFormattingContext.prototype._handleReplaced): 14 * LayoutReloaded/FormattingContext/InlineFormatting/Line.js: 15 (Line.prototype.lastLineBox): 16 (Line.prototype.addInlineBox): 17 (Line.prototype.addInlineContainerBox): Deleted. 18 * LayoutReloaded/TreeBuilder.js: 19 (TreeBuilder.prototype._createAndAttachBox): 20 * LayoutReloaded/Utils.js: 21 (Utils._dumpBox): 22 * LayoutReloaded/test/index.html: 23 * LayoutReloaded/test/inline-simple-replaced.html: Added. 24 1 25 2018-04-16 Zalan Bujtas <zalan@apple.com> 2 26 -
trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js
r230699 r230700 105 105 if (inlineBox.text()) 106 106 return this._handleText(inlineBox); 107 else 108 return this._handleReplaced(inlineBox); 107 109 } 108 110 … … 111 113 let displayBox = this.displayBox(inlineBlockBox); 112 114 113 // TODO: auto width/height 115 // TODO: auto width/height and check if content actually at all. 114 116 this._adjustLineForInlineContainerStart(inlineBlockBox); 115 117 displayBox.setWidth(Utils.width(inlineBlockBox) + Utils.computedHorizontalBorderAndPadding(inlineBlockBox.node())); 116 118 this.layoutState().formattingContext(inlineBlockBox).layout(); 117 119 displayBox.setHeight(Utils.height(inlineBlockBox) + Utils.computedVerticalBorderAndPadding(inlineBlockBox.node())); 120 this._line().addInlineBox(displayBox.size()); 118 121 this._adjustLineForInlineContainerEnd(inlineBlockBox); 119 this._line().addInlineContainerBox(displayBox.size());120 122 } 121 123 … … 156 158 this._line().moveContentHorizontally(floatWidth); 157 159 } 160 161 _handleReplaced(replacedBox) { 162 // TODO: intrinsic size and check if content actually at all. 163 let displayBox = this.displayBox(replacedBox); 164 this._adjustLineForInlineContainerStart(replacedBox); 165 displayBox.setWidth(Utils.width(replacedBox) + Utils.computedHorizontalBorderAndPadding(replacedBox.node())); 166 167 displayBox.setHeight(Utils.height(replacedBox) + Utils.computedVerticalBorderAndPadding(replacedBox.node())); 168 this._line().addInlineBox(displayBox.size()); 169 displayBox.setTopLeft(this._line().lastLineBox().lineBoxRect.topLeft()); 170 this._adjustLineForInlineContainerEnd(replacedBox); 171 } 158 172 159 173 _adjustLineForInlineContainerStart(inlineContainer) { -
trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/Line.js
r230656 r230700 32 32 33 33 LayoutRect rect(); 34 lineBoxes();34 Vector<InlineDisplayBox> lineBoxes(); 35 35 36 shrink(float width);37 adjustWithOffset(LayoutUnit offset);38 moveContentHorizontally(LayoutUnit offset);39 addInlineContainerBox(LayoutSize);40 addTextLineBox(unsigned startPosition, unsigned endPosition, LayoutSize size);36 void shrink(float width); 37 void adjustWithOffset(LayoutUnit offset); 38 void moveContentHorizontally(LayoutUnit offset); 39 void addInlineContainerBox(LayoutSize); 40 void addTextLineBox(unsigned startPosition, unsigned endPosition, LayoutSize size); 41 41 }; 42 42 */ … … 64 64 } 65 65 66 lastLineBox() { 67 return this.m_lineBoxes[this.m_lineBoxes.length - 1]; 68 } 69 66 70 shrink(width) { 67 71 this.m_availableWidth -= width; … … 80 84 } 81 85 82 addInline ContainerBox(size) {86 addInlineBox(size) { 83 87 let width = size.width(); 84 88 ASSERT(width <= this.m_availableWidth); -
trunk/Tools/LayoutReloaded/TreeBuilder.js
r230655 r230700 55 55 if (name == "RenderBlock" || name == "RenderBody") 56 56 box = new Layout.BlockContainer(node, id); 57 else if (name == "RenderInline") {57 else if (name == "RenderInline") 58 58 box = new Layout.InlineContainer(node, id); 59 } else if (name == "RenderText") {59 else if (name == "RenderText") 60 60 text = new Text(node, id); 61 } else 61 else if (name == "RenderImage") 62 box = new Layout.InlineBox(node, id); 63 else 62 64 box = new Layout.Box(node, id); 63 65 -
trunk/Tools/LayoutReloaded/Utils.js
r230655 r230700 585 585 return indentation + box.node().tagName + " " + box.name() + "\n"; 586 586 } 587 if (box.name() == "RenderImage") { 588 let boxRect = layoutState.displayBox(box).rect(); 589 return indentation + box.node().tagName + " " + box.name() + " at (" + Utils.precisionRound(boxRect.left()) + "," + Utils.precisionRound(boxRect.top()) + ") size " + Utils.precisionRound(boxRect.width()) + "x" + Utils.precisionRound(boxRect.height()) + "\n"; 590 591 } 587 592 if (box.isAnonymous()) 588 593 return ""; -
trunk/Tools/LayoutReloaded/test/index.html
r230655 r230700 83 83 "inline-block-with-fixed-width-height.html", 84 84 "inline-with-relative-positioning.html", 85 "inline-with-out-of-flow-descendant.html" 85 "inline-with-out-of-flow-descendant.html", 86 "inline-simple-replaced.html" 86 87 ]; 87 88
Note: See TracChangeset
for help on using the changeset viewer.