Title: [237290] trunk/Source/WebCore
Revision
237290
Author
za...@apple.com
Date
2018-10-19 09:58:05 -0700 (Fri, 19 Oct 2018)

Log Message

[LFC][IFC] Add inline runs to showLayoutTree
https://bugs.webkit.org/show_bug.cgi?id=190718

Reviewed by Antti Koivisto.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputInlineRuns):
(WebCore::Layout::outputLayoutBox):
(WebCore::Layout::outputLayoutTree):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237289 => 237290)


--- trunk/Source/WebCore/ChangeLog	2018-10-19 16:51:44 UTC (rev 237289)
+++ trunk/Source/WebCore/ChangeLog	2018-10-19 16:58:05 UTC (rev 237290)
@@ -1,5 +1,17 @@
 2018-10-19  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][IFC] Add inline runs to showLayoutTree
+        https://bugs.webkit.org/show_bug.cgi?id=190718
+
+        Reviewed by Antti Koivisto.
+
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::outputInlineRuns):
+        (WebCore::Layout::outputLayoutBox):
+        (WebCore::Layout::outputLayoutTree):
+
+2018-10-19  Zalan Bujtas  <za...@apple.com>
+
         [LFC][IFC] Remove the previous version of inline content handling.
         https://bugs.webkit.org/show_bug.cgi?id=190716
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (237289 => 237290)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2018-10-19 16:51:44 UTC (rev 237289)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2018-10-19 16:58:05 UTC (rev 237290)
@@ -29,6 +29,7 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 #include "DisplayBox.h"
+#include "InlineFormattingState.h"
 #include "LayoutBlockContainer.h"
 #include "LayoutBox.h"
 #include "LayoutChildIterator.h"
@@ -128,6 +129,24 @@
 }
 
 #if ENABLE(TREE_DEBUGGING)
+static void outputInlineRuns(TextStream& stream, const LayoutContext& layoutContext, const Container& inlineFormattingRoot, unsigned depth)
+{
+    auto& inlineFormattingState = layoutContext.establishedFormattingState(inlineFormattingRoot);
+    ASSERT(is<InlineFormattingState>(inlineFormattingState));
+    auto& inlineRuns = downcast<InlineFormattingState>(inlineFormattingState).inlineRuns();
+
+    for (auto& inlineRun : inlineRuns) {
+        unsigned printedCharacters = 0;
+        while (++printedCharacters <= depth * 2)
+            stream << " ";
+        stream << "run";
+        if (inlineRun.textContext())
+            stream << "(" << inlineRun.textContext()->position() << ", " << inlineRun.textContext()->position() + inlineRun.textContext()->length() << ") ";
+        stream << "(" << inlineRun.logicalLeft() << ", " << inlineRun.logicalRight() << ")";
+        stream.nextLine();
+    }
+}
+
 static void outputLayoutBox(TextStream& stream, const Box& layoutBox, const Display::Box* displayBox, unsigned depth)
 {
     unsigned printedCharacters = 0;
@@ -145,8 +164,13 @@
     } else
         stream << "box";
     // FIXME: Inline text runs don't create display boxes yet.
-    if (displayBox)
-        stream << " at [" << displayBox->left() << " " << displayBox->top() << "] size [" << displayBox->width() << " " << displayBox->height() << "]";
+    if (displayBox) {
+        if (is<InlineBox>(layoutBox) || is<InlineContainer>(layoutBox)) {
+            // FIXME: display box is not completely set yet.
+            stream << " at [" << "." << " " << "." << "] size [" << displayBox->width() << " " << displayBox->height() << "]";
+        } else
+            stream << " at [" << displayBox->left() << " " << displayBox->top() << "] size [" << displayBox->width() << " " << displayBox->height() << "]";
+    }
     stream << " object [" << &layoutBox << "]";
 
     stream.nextLine();
@@ -155,7 +179,15 @@
 static void outputLayoutTree(const LayoutContext* layoutContext, TextStream& stream, const Container& rootContainer, unsigned depth)
 {
     for (auto& child : childrenOfType<Box>(rootContainer)) {
-        outputLayoutBox(stream, child, layoutContext ? &layoutContext->displayBoxForLayoutBox(child) : nullptr, depth);
+        Display::Box* displayBox = nullptr;
+        // Not all boxes generate display boxes.
+        if (layoutContext && layoutContext->hasDisplayBox(child))
+            displayBox = &layoutContext->displayBoxForLayoutBox(child);
+
+        outputLayoutBox(stream, child, displayBox, depth);
+        if (layoutContext && child.establishesInlineFormattingContext())
+            outputInlineRuns(stream, *layoutContext, downcast<Container>(child), depth + 1);
+
         if (is<Container>(child))
             outputLayoutTree(layoutContext, stream, downcast<Container>(child), depth + 1);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to