Changeset 270144 in webkit
- Timestamp:
- Nov 21, 2020 5:13:29 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r270143 r270144 1 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Remove InlineLineGeometry::logicalLeft/top/bottom/right/width/height helper functions 4 https://bugs.webkit.org/show_bug.cgi?id=219226 5 6 Reviewed by Antti Koivisto. 7 8 This is in preparation for having lineBoxLogicalRect() on InlineLineGeometry. It makes it absolutely clear 9 of what type of logical rect we have here. 10 11 * layout/FormattingContextGeometry.cpp: 12 (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const): 13 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 14 (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedContentHeightAndMargin): 15 * layout/inlineformatting/InlineFormattingContextGeometry.cpp: 16 (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes): 17 * layout/inlineformatting/InlineLineGeometry.h: 18 (WebCore::Layout::InlineLineGeometry::logicalLeft const): Deleted. 19 (WebCore::Layout::InlineLineGeometry::logicalRight const): Deleted. 20 (WebCore::Layout::InlineLineGeometry::logicalTop const): Deleted. 21 (WebCore::Layout::InlineLineGeometry::logicalBottom const): Deleted. 22 (WebCore::Layout::InlineLineGeometry::logicalWidth const): Deleted. 23 (WebCore::Layout::InlineLineGeometry::logicalHeight const): Deleted. 24 * layout/integration/LayoutIntegrationInlineContentBuilder.cpp: 25 (WebCore::LayoutIntegration::InlineContentBuilder::computeLineLevelVisualAdjustmentsForRuns const): 26 (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const): 27 (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const): 28 * layout/layouttree/LayoutTreeBuilder.cpp: 29 (WebCore::Layout::showInlineTreeAndRuns): 30 1 31 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 32 -
trunk/Source/WebCore/layout/FormattingContextGeometry.cpp
r269826 r270144 198 198 // Even empty containers generate one line. 199 199 ASSERT(!lines.isEmpty()); 200 top = lines.first().logical Top();201 bottom = lines.last().logical Bottom() + inlineFormattingState.clearGapAfterLastLine();200 top = lines.first().logicalRect().top(); 201 bottom = lines.last().logicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine(); 202 202 } else if (formattingContextRoot.establishesFlexFormattingContext()) { 203 203 auto& lines = layoutState.establishedFlexFormattingState(formattingContextRoot).lines(); -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r268974 r270144 82 82 // Even empty containers generate one line. 83 83 ASSERT(!lines.isEmpty()); 84 return { toLayoutUnit(lines.last().logical Bottom() + inlineFormattingState.clearGapAfterLastLine()) - borderAndPaddingTop, nonCollapsedMargin };84 return { toLayoutUnit(lines.last().logicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine()) - borderAndPaddingTop, nonCollapsedMargin }; 85 85 } 86 86 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
r270143 r270144 260 260 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox)); 261 261 auto& lastLine = formattingState.lines().last(); 262 auto inlineBlockBaseline = lastLine.logical Top() + lastLine.baseline();262 auto inlineBlockBaseline = lastLine.logicalRect().top() + lastLine.baseline(); 263 263 ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline; 264 264 } else if (layoutBox.isReplacedBox()) -
trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h
r270143 r270144 38 38 InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth); 39 39 40 InlineLayoutUnit logicalLeft() const { return logicalRect().left(); };41 InlineLayoutUnit logicalRight() const { return logicalRect().right(); };42 43 InlineLayoutUnit logicalTop() const { return logicalRect().top(); };44 InlineLayoutUnit logicalBottom() const { return logicalRect().bottom(); };45 46 InlineLayoutUnit logicalWidth() const { return logicalRect().width(); };47 InlineLayoutUnit logicalHeight() const { return logicalRect().height(); };48 49 40 const InlineRect& logicalRect() const { return m_logicalRect; } 50 41 const InlineLayoutSize& lineBoxLogicalSize() const { return m_lineBoxLogicalSize; } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp
r270143 r270144 187 187 if (shouldCheckHorizontalOverflowForContentReplacement) { 188 188 auto& line = lines[lineIndex]; 189 auto overflowWidth = lineOverflowWidth(m_blockFlow, line.logicalWidth(), line.lineBoxLogicalSize().width()); 190 lineLevelVisualAdjustmentsForRuns[lineIndex].needsTrailingContentReplacement = overflowWidth > line.logicalWidth(); 189 auto& lineLogicalRect = line.logicalRect(); 190 auto overflowWidth = lineOverflowWidth(m_blockFlow, lineLogicalRect.width(), line.lineBoxLogicalSize().width()); 191 lineLevelVisualAdjustmentsForRuns[lineIndex].needsTrailingContentReplacement = overflowWidth > lineLogicalRect.width(); 191 192 } 192 193 } … … 213 214 auto& layoutBox = lineRun.layoutBox(); 214 215 auto lineIndex = lineRun.lineIndex(); 215 auto& line = lines[lineIndex];216 auto& lineLogicalRect = lines[lineIndex].logicalRect(); 216 217 // Inline boxes are relative to the line box while final Runs need to be relative to the parent Box 217 218 // FIXME: Shouldn't we just leave them be relative to the line box? … … 219 220 // Line runs are margin box based, let's convert them to border box. 220 221 auto& geometry = m_layoutState.geometryForBox(layoutBox); 221 runRect.moveBy({ line .logicalLeft() + std::max(geometry.marginStart(), 0_lu), line.logicalTop() + geometry.marginBefore() });222 runRect.moveBy({ lineLogicalRect.left() + std::max(geometry.marginStart(), 0_lu), lineLogicalRect.top() + geometry.marginBefore() }); 222 223 runRect.setSize({ geometry.borderBoxWidth(), geometry.borderBoxHeight() }); 223 224 if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition) … … 232 233 auto& layoutBox = lineRun.layoutBox(); 233 234 auto lineIndex = lineRun.lineIndex(); 234 auto& line = lines[lineIndex];235 auto& lineLogicalRect = lines[lineIndex].logicalRect(); 235 236 auto runRect = FloatRect { lineRun.logicalRect() }; 236 237 // Inline boxes are relative to the line box while final Runs need to be relative to the parent Box 237 238 // FIXME: Shouldn't we just leave them be relative to the line box? 238 runRect.moveBy({ line .logicalLeft(), line.logicalTop() });239 runRect.moveBy({ lineLogicalRect.left(), lineLogicalRect.top() }); 239 240 if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition) 240 241 runRect.setY(roundToInt(runRect.y())); … … 253 254 } 254 255 auto runLogicalRect = lineRun.logicalRect(); 255 auto lineLogicalRight = line.logicalRight();256 256 auto ellipsisWidth = style.fontCascade().width(WebCore::TextRun { &horizontalEllipsis }); 257 if (runLogicalRect.right() + ellipsisWidth > lineLogicalR ight) {257 if (runLogicalRect.right() + ellipsisWidth > lineLogicalRect.right()) { 258 258 // The next run with ellipsis would surely overflow. So let's just add it to this run even if 259 259 // it makes the run wider than it originally was. 260 260 hasAdjustedTrailingLineList[lineIndex] = true; 261 261 float resultWidth = 0; 262 auto maxWidth = line .logicalWidth() - runLogicalRect.left();262 auto maxWidth = lineLogicalRect.width() - runLogicalRect.left(); 263 263 return StringTruncator::rightTruncate(originalContent, maxWidth, style.fontCascade(), resultWidth, true); 264 264 } … … 308 308 for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) { 309 309 auto& line = lines[lineIndex]; 310 auto& lineLogicalRect = line.logicalRect(); 310 311 auto lineBoxLogicalSize = line.lineBoxLogicalSize(); 311 312 // FIXME: This is where the logical to physical translate should happen. 312 auto scrollableOverflowRect = FloatRect { line .logicalLeft(), line.logicalTop(), lineOverflowWidth(m_blockFlow, line.logicalWidth(), lineBoxLogicalSize.width()), line.logicalHeight() };313 auto scrollableOverflowRect = FloatRect { lineLogicalRect.left(), lineLogicalRect.top(), lineOverflowWidth(m_blockFlow, lineLogicalRect.width(), lineBoxLogicalSize.width()), lineLogicalRect.height() }; 313 314 314 315 auto firstRunIndex = runIndex; … … 317 318 lineInkOverflowRect.unite(runs[runIndex++].inkOverflow()); 318 319 auto runCount = runIndex - firstRunIndex; 319 auto lineRect = FloatRect { line .logicalRect()};320 auto lineRect = FloatRect { lineLogicalRect }; 320 321 auto enclosingTopAndBottom = [&] { 321 322 // Let's (vertically)enclose all the inline level boxes. -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r269989 r270144 395 395 addSpacing(); 396 396 auto& line = lines[lineIndex]; 397 stream << "line at (" << line.logicalLeft() << "," << line.logicalTop() << ") size (" << line.logicalWidth() << "x" << line.logicalHeight() << ") baseline (" << line.baseline() << ")"; 397 auto& lineLogicalRect = line.logicalRect(); 398 stream << "line at (" << lineLogicalRect.left() << "," << lineLogicalRect.top() << ") size (" << lineLogicalRect.width() << "x" << lineLogicalRect.height() << ") baseline (" << line.baseline() << ")"; 398 399 stream.nextLine(); 399 400
Note: See TracChangeset
for help on using the changeset viewer.