Changeset 230386 in webkit
- Timestamp:
- Apr 8, 2018 8:59:10 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r230373 r230386 1 2018-04-08 Zalan Bujtas <zalan@apple.com> 2 3 [LayoutReloaded] Adjust line with inline container's margin border and padding 4 https://bugs.webkit.org/show_bug.cgi?id=184409 5 6 Reviewed by Antti Koivisto. 7 8 * LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js: 9 (InlineFormattingContext.prototype.layout): 10 (InlineFormattingContext.prototype._handleFloatingBox): 11 (InlineFormattingContext.prototype._adjustLineForInlineContainerStart): 12 (InlineFormattingContext.prototype._adjustLineForInlineContainerEnd): 13 * LayoutReloaded/FormattingContext/InlineFormatting/Line.js: 14 (Line.prototype.shrink): 15 (Line.prototype.adjustWithOffset): 16 (Line.prototype.moveContentHorizontally): 17 (Line.prototype.addTextLineBox): 18 (Line): 19 (Line.prototype.addFloatingBox): Deleted. 20 * LayoutReloaded/misc/LayoutReloadedWebKit.patch: 21 * LayoutReloaded/test/index.html: 22 * LayoutReloaded/test/inline-with-padding-border-margin-offsets.html: Added. 23 1 24 2018-04-07 Zalan Bujtas <zalan@apple.com> 2 25 -
trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/InlineFormattingContext.js
r230373 r230386 43 43 if (inlineContainerStack.indexOf(layoutBox) == -1) { 44 44 inlineContainerStack.push(layoutBox); 45 this._adjustLineForInlineContainerStart( );45 this._adjustLineForInlineContainerStart(layoutBox); 46 46 if (layoutBox.establishesFormattingContext()) 47 47 this.layoutState().layout(layoutBox); … … 50 50 } else { 51 51 inlineContainerStack.pop(layoutBox); 52 this._adjustLineForInlineContainerEnd( );52 this._adjustLineForInlineContainerEnd(layoutBox); 53 53 this._removeFromLayoutQueue(layoutBox); 54 54 this._addToLayoutQueue(layoutBox.nextInFlowOrFloatSibling()); … … 117 117 if (displayBox.top() >= this._line().rect().bottom()) 118 118 return; 119 this._line().addFloatingBox(displayBox, Utils.isFloatingLeft(floatingBox)); 119 let floatWidth = displayBox.width(); 120 this._line().shrink(floatWidth); 121 if (Utils.isFloatingLeft(floatingBox)) 122 this._line().moveContentHorizontally(floatWidth); 120 123 } 121 124 122 125 _adjustLineForInlineContainerStart(inlineContainer) { 123 126 let offset = this.marginLeft(inlineContainer) + Utils.computedBorderAndPaddingLeft(inlineContainer.node()); 127 this._line().adjustWithOffset(offset); 124 128 } 125 129 126 130 _adjustLineForInlineContainerEnd(inlineContainer) { 127 131 let offset = this.marginRight(inlineContainer) + Utils.computedBorderAndPaddingRight(inlineContainer.node()); 132 this._line().adjustWithOffset(offset); 128 133 } 129 134 -
trunk/Tools/LayoutReloaded/FormattingContext/InlineFormatting/Line.js
r230324 r230386 47 47 } 48 48 49 shrink(width) { 50 this.m_availableWidth -= width; 51 } 52 53 adjustWithOffset(offset) { 54 this.m_availableWidth -= offset; 55 this.m_lineRect.growBy(new LayoutSize(offset, 0)); 56 } 57 58 moveContentHorizontally(offset) { 59 // Push non-floating boxes to the right. 60 for (let lineBox of this.m_lineBoxes) 61 lineBox.lineBoxRect.moveHorizontally(offset); 62 this.m_lineRect.moveHorizontally(offset); 63 } 64 49 65 addTextLineBox(startPosition, endPosition, size) { 50 66 ASSERT(size.width() <= this.m_availableWidth); … … 55 71 this.m_lineRect.growBy(new LayoutSize(size.width(), 0)); 56 72 } 57 58 addFloatingBox(floatingDisplayBox, isFloatingLeft) {59 let width = floatingDisplayBox.width();60 ASSERT(width <= this.m_availableWidth);61 this.m_availableWidth -= width;62 if (!isFloatingLeft)63 return;64 // Push non-floating boxes to the right.65 for (let lineBox of this.m_lineBoxes)66 lineBox.lineBoxRect.moveHorizontally(width);67 this.m_lineRect.moveHorizontally(width);68 }69 73 } -
trunk/Tools/LayoutReloaded/misc/LayoutReloadedWebKit.patch
r230366 r230386 39 39 rendering/LayoutState.cpp 40 40 diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj 41 index 690b9e941bd..3ffc440690710064441 index 2ae0c8a22d5..edcd82aa95a 100644 42 42 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj 43 43 +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj … … 579 579 580 580 diff --git a/Source/WebCore/rendering/InlineBox.cpp b/Source/WebCore/rendering/InlineBox.cpp 581 index cd23ae0b97c.. da072efdfa9100644581 index cd23ae0b97c..7cfd4bb2d42 100644 582 582 --- a/Source/WebCore/rendering/InlineBox.cpp 583 583 +++ b/Source/WebCore/rendering/InlineBox.cpp 584 @@ -123,6 +123,1 5@@ void InlineBox::outputLineBox(TextStream& stream, bool mark, int depth) const584 @@ -123,6 +123,18 @@ void InlineBox::outputLineBox(TextStream& stream, bool mark, int depth) const 585 585 stream.nextLine(); 586 586 } … … 588 588 +void InlineBox::outputSimplifiedLineTree(TextStream& stream, int depth) const 589 589 +{ 590 + // Ignore inline flows for now. LayoutReloaded does not have the concept of flow boxes. 591 + if (is<InlineFlowBox>(*this) && !is<RootInlineBox>(*this)) 592 + return; 590 593 + int printedCharacters = 0; 591 594 + while (++printedCharacters <= depth) … … 611 614 #endif 612 615 diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp 613 index 063f3b64189.. 5494aabe546100644616 index 063f3b64189..ee32b981371 100644 614 617 --- a/Source/WebCore/rendering/InlineFlowBox.cpp 615 618 +++ b/Source/WebCore/rendering/InlineFlowBox.cpp 616 @@ -1720,6 +1720,1 3@@ void InlineFlowBox::outputLineTreeAndMark(WTF::TextStream& stream, const InlineB619 @@ -1720,6 +1720,18 @@ void InlineFlowBox::outputLineTreeAndMark(WTF::TextStream& stream, const InlineB 617 620 box->outputLineTreeAndMark(stream, markedBox, depth + 1); 618 621 } … … 621 624 +{ 622 625 + InlineBox::outputSimplifiedLineTree(stream, depth); 623 + for (auto* box = firstChild(); box; box = box->nextOnLine()) 624 + box->outputSimplifiedLineTree(stream, depth + 1); 626 + for (auto* box = firstChild(); box; box = box->nextOnLine()) { 627 + // DO not increment depth for flow boxes. LayoutReloaded does not have the concept of them. 628 + if (is<InlineFlowBox>(*box) && !is<RootInlineBox>(*box)) 629 + box->outputSimplifiedLineTree(stream, depth); 630 + else 631 + box->outputSimplifiedLineTree(stream, depth + 1); 632 + } 625 633 +} 626 634 + -
trunk/Tools/LayoutReloaded/test/index.html
r230373 r230386 78 78 "inline-floating1.html", 79 79 "inline-formatting-context-floats1.html", 80 "inline-formatting-context-floats2.html" 80 "inline-formatting-context-floats2.html", 81 "inline-with-padding-border-margin-offsets.html" 81 82 ]; 82 83
Note: See TracChangeset
for help on using the changeset viewer.