Skip to content
Permalink
Browse files
[IFC] Use the inline run list in showRenderTree to print inline level…
… box information

https://bugs.webkit.org/show_bug.cgi?id=228070

Reviewed by Antti Koivisto.

showInlineTreeAndRuns is the last client of the InlineFormattingState::lineBoxes.
Let's use the inline run list instead to print the inline level box geometry information. It provides slightly less
information than before but it is sufficient for now.

This is in preparation for keeping the inline box structure private to the layout code.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::showInlineTreeAndRuns):


Canonical link: https://commits.webkit.org/241001@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Aug 26, 2021
1 parent 22327ed commit a1fa4bdc8e330312ecc540ca04d5b2ca4cc19244
Showing 2 changed files with 33 additions and 23 deletions.
@@ -1,3 +1,19 @@
2021-08-26 Alan Bujtas <zalan@apple.com>

[IFC] Use the inline run list in showRenderTree to print inline level box information
https://bugs.webkit.org/show_bug.cgi?id=228070

Reviewed by Antti Koivisto.

showInlineTreeAndRuns is the last client of the InlineFormattingState::lineBoxes.
Let's use the inline run list instead to print the inline level box geometry information. It provides slightly less
information than before but it is sufficient for now.

This is in preparation for keeping the inline box structure private to the layout code.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::showInlineTreeAndRuns):

2021-08-26 Michael Catanzaro <mcatanzaro@gnome.org>

[FreeType] Avoid yucky strong alias computations in font fallback code
@@ -387,7 +387,7 @@ void showInlineTreeAndRuns(TextStream& stream, const LayoutState& layoutState, c
{
auto& inlineFormattingState = layoutState.establishedInlineFormattingState(inlineFormattingRoot);
auto& lines = inlineFormattingState.lines();
auto& lineBoxes = inlineFormattingState.lineBoxes();
auto& lineRuns = inlineFormattingState.lineRuns();

for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
auto addSpacing = [&] {
@@ -408,42 +408,36 @@ void showInlineTreeAndRuns(TextStream& stream, const LayoutState& layoutState, c
stream << " Inline level boxes:";
stream.nextLine();

auto& lineBox = lineBoxes[lineIndex];
auto outputInlineLevelBox = [&](const auto& inlineLevelBox) {
auto outputInlineLevelBox = [&](const auto& inlineLevelBoxRun) {
addSpacing();
stream << " ";
auto logicalRect = InlineRect { };
auto& layoutBox = inlineLevelBox.layoutBox();
if (inlineLevelBox.isRootInlineBox()) {
stream << "Root inline box";
logicalRect = lineBox.logicalRectForRootInlineBox();
} else if (inlineLevelBox.isAtomicInlineLevelBox()) {
auto logicalRect = inlineLevelBoxRun.logicalRect();
auto& layoutBox = inlineLevelBoxRun.layoutBox();
if (layoutBox.isAtomicInlineLevelBox())
stream << "Atomic inline level box";
logicalRect = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, layoutState.geometryForBox(layoutBox));
} else if (inlineLevelBox.isLineBreakBox()) {
else if (layoutBox.isLineBreakBox())
stream << "Line break box";
logicalRect = lineBox.logicalRectForLineBreakBox(layoutBox);
} else if (inlineLevelBox.isInlineBox()) {
else if (layoutBox.isInlineBox())
stream << "Inline box";
logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, layoutState.geometryForBox(layoutBox));
} else
else
stream << "Generic inline level box";
stream
<< " at (" << logicalRect.left() << "," << logicalRect.top() << ")"
<< " size (" << logicalRect.width() << "x" << logicalRect.height() << ")"
<< " baseline (" << logicalRect.top() + inlineLevelBox.baseline() << ")"
<< " ascent (" << inlineLevelBox.baseline() << "/" << inlineLevelBox.layoutBounds().ascent << ")"
<< " descent (" << inlineLevelBox.descent().value_or(0.0f) << "/" << inlineLevelBox.layoutBounds().descent << ")";
<< " size (" << logicalRect.width() << "x" << logicalRect.height() << ")";
stream.nextLine();
};
outputInlineLevelBox(lineBox.rootInlineBox());
for (auto& inlineLevelBox : lineBox.nonRootInlineLevelBoxes())
outputInlineLevelBox(inlineLevelBox);
for (auto& run : lineRuns) {
if (run.lineIndex() != lineIndex)
continue;
if (!run.layoutBox().isInlineLevelBox())
continue;
outputInlineLevelBox(run);
}

addSpacing();
stream << " Runs:";
stream.nextLine();
for (auto& run : inlineFormattingState.lineRuns()) {
for (auto& run : lineRuns) {
if (run.lineIndex() != lineIndex)
continue;
addSpacing();

0 comments on commit a1fa4bd

Please sign in to comment.