Changeset 269145 in webkit
- Timestamp:
- Oct 29, 2020, 6:17:05 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
layout/inlineformatting/InlineLineBox.h (modified) (3 diffs)
-
layout/integration/LayoutIntegrationLineLayout.cpp (modified) (1 diff)
-
layout/integration/LayoutIntegrationLineLayout.h (modified) (1 diff)
-
layout/layouttree/LayoutTreeBuilder.cpp (modified) (2 diffs)
-
layout/layouttree/LayoutTreeBuilder.h (modified) (1 diff)
-
rendering/RenderBlockFlow.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269144 r269145 1 2020-10-29 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][Integration] Implement outputLineTreeAndMark for IFC 4 https://bugs.webkit.org/show_bug.cgi?id=218310 5 6 Reviewed by Antti Koivisto. 7 8 Add a legacy like inline tree output. This helps when comparing legacy and modern line tree geometries. 9 10 "<div>before<img>after<div>" generates the following output: 11 12 DIV RenderBlock at (x, y) size width x height renderer->(address) node->(address) 13 line at (x, y) size (width x height) baseline (y) 14 Inline level boxes: 15 Root inline box at (x, y) size (width x height) baseline (y) ascent (ascent/layout bounds ascent) descent (descent/layout bounds descent) 16 Atomic inline level box at (x, y) size (width x height) baseline (y) ascent (ascent/layout bounds ascent) descent (descent/layout bounds descent) 17 Runs: 18 text run at (x, y) size (width x height) run(start, end) 19 box run at (x, y) size (width x height) 20 text run at (x, y) size (width x height) run(start, end) 21 22 23 * layout/inlineformatting/InlineLineBox.h: 24 (WebCore::Layout::LineBox::InlineLevelBox::LayoutBounds::height const): 25 (WebCore::Layout::LineBox::InlineLevelBox::layoutBounds const): 26 (WebCore::Layout::LineBox::InlineLevelBox::isRootInlineBox const): 27 * layout/integration/LayoutIntegrationCoverage.cpp: 28 * layout/integration/LayoutIntegrationLineLayout.cpp: 29 (WebCore::LayoutIntegration::LineLayout::outputLineTree const): 30 * layout/integration/LayoutIntegrationLineLayout.h: 31 * layout/layouttree/LayoutTreeBuilder.cpp: 32 (WebCore::Layout::showInlineTreeAndRuns): 33 (WebCore::Layout::outputLayoutTree): 34 (WebCore::Layout::outputInlineRuns): Deleted. 35 * layout/layouttree/LayoutTreeBuilder.h: 36 * rendering/RenderBlockFlow.cpp: 37 (WebCore::RenderBlockFlow::outputLineTreeAndMark const): 38 1 39 2020-10-29 Martin Robinson <mrobinson@igalia.com> 2 40 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h
r268864 r269145 76 76 InlineLayoutUnit baseline() const { return m_baseline; } 77 77 Optional<InlineLayoutUnit> descent() const { return m_descent; } 78 // See https://www.w3.org/TR/css-inline-3/#layout-bounds 79 struct LayoutBounds { 80 InlineLayoutUnit height() const { return ascent + descent; } 81 82 InlineLayoutUnit ascent { 0 }; 83 InlineLayoutUnit descent { 0 }; 84 }; 85 LayoutBounds layoutBounds() const { return m_layoutBounds; } 78 86 79 87 bool isEmpty() const { return m_isEmpty; } … … 85 93 86 94 bool isInlineBox() const { return m_type == Type::InlineBox || m_type == Type::RootInlineBox; } 95 bool isRootInlineBox() const { return m_type == Type::RootInlineBox; } 87 96 bool isAtomicInlineLevelBox() const { return m_type == Type::AtomicInlineLevelBox; } 88 97 bool isLineBreakBox() const { return m_type == Type::LineBreakBox; } … … 107 116 void setBaseline(InlineLayoutUnit); 108 117 void setDescent(InlineLayoutUnit); 109 110 // See https://www.w3.org/TR/css-inline-3/#layout-bounds111 struct LayoutBounds {112 InlineLayoutUnit height() const { return ascent + descent; }113 114 InlineLayoutUnit ascent { 0 };115 InlineLayoutUnit descent { 0 };116 };117 118 void setLayoutBounds(const LayoutBounds&); 118 LayoutBounds layoutBounds() const { return m_layoutBounds; }119 119 120 120 private: -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r269041 r269145 588 588 } 589 589 590 591 } 592 } 593 590 #if ENABLE(TREE_DEBUGGING) 591 void LineLayout::outputLineTree(WTF::TextStream& stream, size_t depth) const 592 { 593 showInlineTreeAndRuns(stream, m_layoutState, rootLayoutBox(), depth); 594 } 594 595 #endif 596 597 } 598 } 599 600 #endif -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h
r269041 r269145 93 93 static void releaseCaches(RenderView&); 94 94 95 #if ENABLE(TREE_DEBUGGING) 96 void outputLineTree(WTF::TextStream&, size_t depth) const; 97 #endif 98 95 99 private: 96 100 void prepareLayoutState(); -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r268948 r269145 379 379 380 380 #if ENABLE(TREE_DEBUGGING) 381 static void outputInlineRuns(TextStream& stream, const LayoutState& layoutState, const ContainerBox& inlineFormattingRoot, unsigneddepth)381 void showInlineTreeAndRuns(TextStream& stream, const LayoutState& layoutState, const ContainerBox& inlineFormattingRoot, size_t depth) 382 382 { 383 383 auto& inlineFormattingState = layoutState.establishedInlineFormattingState(inlineFormattingRoot); 384 384 auto& lines = inlineFormattingState.lines(); 385 auto& lineBoxes = inlineFormattingState.lineBoxes(); 385 386 386 387 for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) { 387 size_t printedCharacters = 0; 388 while (++printedCharacters <= depth * 2) 389 stream << " "; 388 auto addSpacing = [&] { 389 size_t printedCharacters = 0; 390 stream << "-------- --"; 391 while (++printedCharacters <= depth * 2) 392 stream << " "; 393 394 }; 395 addSpacing(); 390 396 auto& line = lines[lineIndex]; 391 stream << "line at (" << line.logicalLeft() << "," << line.logicalTop() << ") size " << line.logicalWidth() << "x" << line.logicalHeight() << " baseline at (" << line.baseline() << ")"; 397 stream << "line at (" << line.logicalLeft() << "," << line.logicalTop() << ") size (" << line.logicalWidth() << "x" << line.logicalHeight() << ") baseline (" << line.baseline() << ")"; 398 stream.nextLine(); 399 400 addSpacing(); 401 stream << " Inline level boxes:"; 402 stream.nextLine(); 403 auto& lineBox = lineBoxes[lineIndex]; 404 for (auto& inlineLevelBox : lineBox.inlineLevelBoxList()) { 405 addSpacing(); 406 stream << " "; 407 if (inlineLevelBox->isRootInlineBox()) 408 stream << "Root inline box"; 409 else if (inlineLevelBox->isAtomicInlineLevelBox()) 410 stream << "Atomic inline level box"; 411 else if (inlineLevelBox->isLineBreakBox()) 412 stream << "Line break box"; 413 else if (inlineLevelBox->isInlineBox()) 414 stream << "Generic inline box"; 415 else 416 stream << "Generic inline level box"; 417 auto logicalRect = lineBox.logicalRectForInlineLevelBox(inlineLevelBox->layoutBox()); 418 stream 419 << " at (" << logicalRect.left() << "," << logicalRect.top() << ")" 420 << " size (" << logicalRect.width() << "x" << logicalRect.height() << ")" 421 << " baseline (" << logicalRect.top() + inlineLevelBox->baseline() << ")" 422 << " ascent (" << inlineLevelBox->baseline() << "/" << inlineLevelBox->layoutBounds().ascent << ")" 423 << " descent (" << inlineLevelBox->descent().valueOr(0.0f) << "/" << inlineLevelBox->layoutBounds().descent << ")"; 424 stream.nextLine(); 425 } 426 427 addSpacing(); 428 stream << " Runs:"; 392 429 stream.nextLine(); 393 430 for (auto& run : inlineFormattingState.lineRuns()) { 394 431 if (run.lineIndex() != lineIndex) 395 432 continue; 396 unsigned printedCharacters = 0; 397 while (++printedCharacters <= depth * 2) 398 stream << " "; 433 addSpacing(); 399 434 stream << " "; 400 435 if (run.text()) … … 502 537 outputLayoutBox(stream, child, nullptr, depth); 503 538 if (child.establishesInlineFormattingContext()) 504 outputInlineRuns(stream, *layoutState, downcast<ContainerBox>(child), depth + 1);539 showInlineTreeAndRuns(stream, *layoutState, downcast<ContainerBox>(child), depth + 1); 505 540 } else 506 541 outputLayoutBox(stream, child, nullptr, depth); -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h
r268311 r269145 81 81 void showLayoutTree(const Box&, const LayoutState*); 82 82 void showLayoutTree(const Box&); 83 void showInlineTreeAndRuns(TextStream&, const LayoutState&, const ContainerBox& inlineFormattingRoot, size_t depth); 83 84 void printLayoutTreeForLiveDocuments(); 84 85 #endif -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r269053 r269145 3700 3700 void RenderBlockFlow::outputLineTreeAndMark(WTF::TextStream& stream, const InlineBox* markedBox, int depth) const 3701 3701 { 3702 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 3703 if (auto* modernLineLayout = this->modernLineLayout()) { 3704 modernLineLayout->outputLineTree(stream, depth); 3705 return; 3706 } 3707 #endif 3702 3708 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox()) 3703 3709 root->outputLineTreeAndMark(stream, markedBox, depth);
Note:
See TracChangeset
for help on using the changeset viewer.