Changeset 270146 in webkit
- Timestamp:
- Nov 21, 2020 7:15:20 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r270145 r270146 1 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][Integration] LayoutIntegration::Line::rect is way too ambiguous 4 https://bugs.webkit.org/show_bug.cgi?id=219230 5 6 Reviewed by Antti Koivisto. 7 8 Line::rect() is actually the line box (see https://www.w3.org/TR/css-inline-3/#line-box). 9 10 * layout/integration/LayoutIntegrationLine.h: 11 (WebCore::LayoutIntegration::Line::lineBoxTop const): 12 (WebCore::LayoutIntegration::Line::lineBoxBottom const): 13 (WebCore::LayoutIntegration::Line::lineBoxLeft const): 14 (WebCore::LayoutIntegration::Line::lineBoxRight const): 15 (WebCore::LayoutIntegration::Line::rect const): Deleted. 16 * layout/integration/LayoutIntegrationLineIteratorModernPath.h: 17 (WebCore::LayoutIntegration::LineIteratorModernPath::lineBoxTop const): 18 (WebCore::LayoutIntegration::LineIteratorModernPath::lineBoxBottom const): 19 (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const): 20 (WebCore::LayoutIntegration::LineIteratorModernPath::logicalHeight const): 21 * layout/integration/LayoutIntegrationLineLayout.cpp: 22 (WebCore::LayoutIntegration::LineLayout::contentLogicalHeight const): 23 (WebCore::LayoutIntegration::LineLayout::firstLineBaseline const): 24 (WebCore::LayoutIntegration::LineLayout::lastLineBaseline const): 25 (WebCore::LayoutIntegration::LineLayout::adjustForPagination): 26 (WebCore::LayoutIntegration::LineLayout::paint): 27 * layout/integration/LayoutIntegrationPagination.cpp: 28 (WebCore::LayoutIntegration::updateMinimumPageHeight): 29 (WebCore::LayoutIntegration::makeAdjustedContent): 30 * layout/integration/LayoutIntegrationRunIteratorModernPath.h: 31 (WebCore::LayoutIntegration::RunIteratorModernPath::createTextRun const): 32 1 33 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 34 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h
r270145 r270146 56 56 size_t firstRunIndex() const { return m_firstRunIndex; } 57 57 size_t runCount() const { return m_runCount; } 58 const FloatRect& rect() const { return m_lineBoxRect; } 58 59 float lineBoxTop() const { return m_lineBoxRect.y(); } 60 float lineBoxBottom() const { return m_lineBoxRect.maxY(); } 61 float lineBoxLeft() const { return m_lineBoxRect.x(); } 62 float lineBoxRight() const { return m_lineBoxRect.maxX(); } 63 59 64 float enclosingContentTop() const { return m_enclosingTopAndBottom.top; } 60 65 float enclosingContentBottom() const { return m_enclosingTopAndBottom.bottom; } 66 61 67 const FloatRect& scrollableOverflow() const { return m_scrollableOverflow; } 62 68 const FloatRect& inkOverflow() const { return m_inkOverflow; } 69 63 70 float baseline() const { return m_baseline; } 71 64 72 float contentLeftOffset() const { return m_contentLeftOffset; } 65 73 float contentWidth() const { return m_contentWidth; } … … 70 78 // This is line box geometry (see https://www.w3.org/TR/css-inline-3/#line-box). 71 79 FloatRect m_lineBoxRect; 72 // Enclosing top and bottom includes all inline level boxes (border box) vertically. In certain cases (see line-height property) 73 // the line (and the line box) is not as tall as the inline level boxes on the line. 80 // Enclosing top and bottom includes all inline level boxes (border box) vertically. 81 // While the line box usually enclose them as well, its vertical geometry is based on 82 // the layout bounds of the inline level boxes which may be different when line-height is present. 74 83 EnclosingTopAndBottom m_enclosingTopAndBottom; 75 84 FloatRect m_scrollableOverflow; -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h
r270143 r270146 52 52 LayoutUnit top() const { return LayoutUnit::fromFloatRound(line().enclosingContentTop()); } 53 53 LayoutUnit bottom() const { return LayoutUnit::fromFloatRound(line().enclosingContentBottom()); } 54 LayoutUnit lineBoxTop() const { return LayoutUnit::fromFloatRound(line(). rect().y()); }55 LayoutUnit lineBoxBottom() const { return LayoutUnit::fromFloatRound(line(). rect().maxY()); }54 LayoutUnit lineBoxTop() const { return LayoutUnit::fromFloatRound(line().lineBoxTop()); } 55 LayoutUnit lineBoxBottom() const { return LayoutUnit::fromFloatRound(line().lineBoxBottom()); } 56 56 57 57 // FIXME: What should these really be? … … 60 60 LayoutUnit selectionBottom() const { return bottom(); } 61 61 62 float contentLogicalLeft() const { return line(). rect().x() + line().contentLeftOffset(); }62 float contentLogicalLeft() const { return line().lineBoxLeft() + line().contentLeftOffset(); } 63 63 float contentLogicalRight() const { return contentLogicalLeft() + line().contentWidth(); } 64 64 float y() const { return lineBoxTop(); } 65 float logicalHeight() const { return line ().rect().height(); }65 float logicalHeight() const { return lineBoxBottom() - lineBoxTop(); } 66 66 bool isHorizontal() const { return true; } 67 67 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r270143 r270146 233 233 234 234 auto& lines = m_inlineContent->lines; 235 return LayoutUnit { lines.last(). rect().maxY() - lines.first().rect().y() + m_inlineContent->clearGapAfterLastLine };235 return LayoutUnit { lines.last().lineBoxBottom() - lines.first().lineBoxTop() + m_inlineContent->clearGapAfterLastLine }; 236 236 } 237 237 … … 254 254 255 255 auto& firstLine = m_inlineContent->lines.first(); 256 return LayoutUnit { firstLine. rect().y() + firstLine.baseline() };256 return LayoutUnit { firstLine.lineBoxTop() + firstLine.baseline() }; 257 257 } 258 258 … … 265 265 266 266 auto& lastLine = m_inlineContent->lines.last(); 267 return LayoutUnit { lastLine. rect().y() + lastLine.baseline() };267 return LayoutUnit { lastLine.lineBoxTop() + lastLine.baseline() }; 268 268 } 269 269 … … 277 277 278 278 auto& lines = paginedInlineContent->lines; 279 m_paginatedHeight = LayoutUnit { lines.last(). rect().maxY() - lines.first().rect().y() };279 m_paginatedHeight = LayoutUnit { lines.last().lineBoxBottom() - lines.first().lineBoxTop() }; 280 280 281 281 m_inlineContent = WTFMove(paginedInlineContent); … … 412 412 413 413 auto& line = inlineContent.lineForRun(run); 414 auto baseline = paintOffset.y() + line. rect().y() + line.baseline();414 auto baseline = paintOffset.y() + line.lineBoxTop() + line.baseline(); 415 415 auto expansion = run.expansion(); 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.contentLeftOffset());418 auto xPos = rect.x() - (line.lineBoxLeft() + 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
r270145 r270146 115 115 auto orphans = style.hasAutoOrphans() ? 1 : std::max<int>(style.orphans(), 1); 116 116 auto minimumLineCount = std::min<unsigned>(std::max(widows, orphans), lineCount); 117 flow.updateMinimumPageHeight(0, LayoutUnit(inlineContent.lines[minimumLineCount - 1]. rect().maxY()));117 flow.updateMinimumPageHeight(0, LayoutUnit(inlineContent.lines[minimumLineCount - 1].lineBoxBottom())); 118 118 } 119 119 … … 130 130 line.firstRunIndex(), 131 131 line.runCount(), 132 moveVertically( line.rect(), offset),132 moveVertically({ FloatPoint { line.lineBoxLeft(), line.lineBoxTop() }, FloatPoint { line.lineBoxRight(), line.lineBoxBottom() } }, offset), 133 133 { line.enclosingContentTop() + offset, line.enclosingContentBottom() + offset }, 134 134 moveVertically(line.scrollableOverflow(), offset), -
trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h
r270143 r270146 222 222 auto expansion = run().expansion(); 223 223 auto rect = this->rect(); 224 auto xPos = rect.x() - (line(). rect().x() + line().contentLeftOffset());224 auto xPos = rect.x() - (line().lineBoxLeft() + line().contentLeftOffset()); 225 225 226 226 auto textForRun = [&] {
Note: See TracChangeset
for help on using the changeset viewer.