Changeset 270143 in webkit
- Timestamp:
- Nov 21, 2020 4:56:46 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r270142 r270143 1 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][Integration] Add contentLogicalOffset and contentLogicalWidth to InlineLineGeometry(Line) 4 https://bugs.webkit.org/show_bug.cgi?id=219220 5 6 Reviewed by Antti Koivisto. 7 8 This helps to match the legacy root inline box's geometry where 9 line left + content offset == root inline box left edge 10 line left + content offset + content width = root inline box right edge 11 12 * layout/inlineformatting/InlineFormattingContext.cpp: 13 (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent): 14 * layout/inlineformatting/InlineLineGeometry.h: 15 (WebCore::Layout::InlineLineGeometry::contentOffset const): 16 (WebCore::Layout::InlineLineGeometry::contentWidth const): 17 (WebCore::Layout::InlineLineGeometry::InlineLineGeometry): 18 (WebCore::Layout::InlineLineGeometry::horizontalAlignmentOffset const): Deleted. 19 * layout/integration/LayoutIntegrationInlineContentBuilder.cpp: 20 (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const): 21 * layout/integration/LayoutIntegrationLine.h: 22 (WebCore::LayoutIntegration::Line::Line): 23 (WebCore::LayoutIntegration::Line::contentOffset const): 24 (WebCore::LayoutIntegration::Line::contentWidth const): 25 (WebCore::LayoutIntegration::Line::horizontalAlignmentOffset const): Deleted. 26 * layout/integration/LayoutIntegrationLineIteratorModernPath.h: 27 (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const): 28 (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const): 29 * layout/integration/LayoutIntegrationLineLayout.cpp: 30 (WebCore::LayoutIntegration::LineLayout::paint): 31 * layout/integration/LayoutIntegrationPagination.cpp: 32 (WebCore::LayoutIntegration::makeAdjustedContent): 33 * layout/integration/LayoutIntegrationRunIteratorModernPath.h: 34 (WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const): 35 1 36 2020-11-21 Jiewen Tan <jiewen_tan@apple.com> 2 37 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r269989 r270143 494 494 495 495 auto constructLineGeometry = [&] { 496 formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }) });496 formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }), lineContent.contentLogicalWidth }); 497 497 }; 498 498 constructLineGeometry(); -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
r270135 r270143 156 156 auto& runs = lineContent.runs; 157 157 auto lineLogicalWidth = lineContent.lineLogicalWidth; 158 auto contentLogicalWidth = lineContent. lineContentLogicalWidth;158 auto contentLogicalWidth = lineContent.contentLogicalWidth; 159 159 auto isLineConsideredEmpty = lineContent.isLineConsideredEmpty ? LineBox::IsLineConsideredEmpty::Yes : LineBox::IsLineConsideredEmpty::No; 160 160 auto lineBox = LineBox { lineContent.logicalTopLeft, contentLogicalWidth, isLineConsideredEmpty }; -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h
r270114 r270143 60 60 InlineLayoutPoint logicalTopLeft; 61 61 InlineLayoutUnit lineLogicalWidth; 62 InlineLayoutUnit lineContentLogicalWidth;62 InlineLayoutUnit contentLogicalWidth; 63 63 bool isLineConsideredEmpty { true }; 64 64 bool isLastLineWithInlineContent { true }; -
trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h
r269571 r270143 36 36 WTF_MAKE_FAST_ALLOCATED; 37 37 public: 38 InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit horizontalAlignmentOffset);38 InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth); 39 39 40 40 InlineLayoutUnit logicalLeft() const { return logicalRect().left(); }; … … 51 51 52 52 InlineLayoutUnit baseline() const { return m_aligmentBaseline; } 53 InlineLayoutUnit horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; } 53 54 InlineLayoutUnit contentLogicalLeftOffset() const { return m_contentLogicalLeftOffset; } 55 InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; } 54 56 55 57 void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); } … … 59 61 InlineLayoutSize m_lineBoxLogicalSize; 60 62 InlineLayoutUnit m_aligmentBaseline { 0 }; 61 InlineLayoutUnit m_horizontalAlignmentOffset { 0 }; 63 InlineLayoutUnit m_contentLogicalLeftOffset { 0 }; 64 InlineLayoutUnit m_contentLogicalWidth { 0 }; 62 65 }; 63 66 64 inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit horizontalAlignmentOffset)67 inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth) 65 68 : m_logicalRect(lineLogicalRect) 66 69 , m_lineBoxLogicalSize(lineBoxLogicalSize) 67 70 , m_aligmentBaseline(aligmentBaseline) 68 , m_horizontalAlignmentOffset(horizontalAlignmentOffset) 71 , m_contentLogicalLeftOffset(contentLogicalLeftOffset) 72 , m_contentLogicalWidth(contentLogicalWidth) 69 73 { 70 74 } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp
r269989 r270143 345 345 enclosingTopAndBottom.bottom = roundToInt(enclosingTopAndBottom.bottom); 346 346 } 347 inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line. horizontalAlignmentOffset() });347 inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeftOffset(), line.contentLogicalWidth() }); 348 348 } 349 349 } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h
r269989 r270143 41 41 float bottom { 0 }; 42 42 }; 43 Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float horizontalAlignmentOffset)43 Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeftOffset, float contentWidth) 44 44 : m_firstRunIndex(firstRunIndex) 45 45 , m_runCount(runCount) … … 50 50 , m_inkOverflow(inkOverflow) 51 51 , m_baseline(baseline) 52 , m_horizontalAlignmentOffset(horizontalAlignmentOffset) 52 , m_contentLeftOffset(contentLeftOffset) 53 , m_contentWidth(contentWidth) 53 54 { 54 55 } … … 63 64 const FloatRect& inkOverflow() const { return m_inkOverflow; } 64 65 float baseline() const { return m_baseline; } 65 float horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; } 66 float contentLeftOffset() const { return m_contentLeftOffset; } 67 float contentWidth() const { return m_contentWidth; } 66 68 67 69 private: … … 78 80 FloatRect m_inkOverflow; 79 81 float m_baseline { 0 }; 80 float m_horizontalAlignmentOffset { 0 }; 82 float m_contentLeftOffset { 0 }; 83 float m_contentWidth { 0 }; 81 84 }; 82 85 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h
r270128 r270143 60 60 LayoutUnit selectionBottom() const { return bottom(); } 61 61 62 float contentLogicalLeft() const { return line().rect().x() + line(). horizontalAlignmentOffset(); }63 float contentLogicalRight() const { return contentLogicalLeft() + line(). rect().width(); }62 float contentLogicalLeft() const { return line().rect().x() + line().contentLeftOffset(); } 63 float contentLogicalRight() const { return contentLogicalLeft() + line().contentWidth(); } 64 64 float y() const { return lineBoxTop(); } 65 65 float logicalHeight() const { return line().rect().height(); } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r270119 r270143 416 416 // TextRun expects the xPos to be adjusted with the aligment offset (e.g. when the line is center aligned 417 417 // and the run starts at 100px, due to the horizontal aligment, the xpos is supposed to be at 0px). 418 auto xPos = rect.x() - (line.rect().x() + line. horizontalAlignmentOffset());418 auto xPos = rect.x() - (line.rect().x() + line.contentLeftOffset()); 419 419 WebCore::TextRun textRun { textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior }; 420 420 textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); -
trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp
r269989 r270143 136 136 moveVertically(line.inkOverflow(), offset), 137 137 line.baseline(), 138 line.horizontalAlignmentOffset() 138 line.contentLeftOffset(), 139 line.contentWidth() 139 140 }; 140 141 }; -
trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h
r269989 r270143 222 222 auto expansion = run().expansion(); 223 223 auto rect = this->rect(); 224 auto xPos = rect.x() - (line().rect().x() + line(). horizontalAlignmentOffset());224 auto xPos = rect.x() - (line().rect().x() + line().contentLeftOffset()); 225 225 226 226 auto textForRun = [&] {
Note: See TracChangeset
for help on using the changeset viewer.