Title: [286789] trunk/Source/WebCore
Revision
286789
Author
[email protected]
Date
2021-12-09 11:01:10 -0800 (Thu, 09 Dec 2021)

Log Message

[LFC][IFC] Add support for ink overflow on bidi inline boxes
https://bugs.webkit.org/show_bug.cgi?id=233968

Reviewed by Antti Koivisto.

* layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary):
(WebCore::Layout::InlineDisplayContentBuilder::ensureDisplayBoxForContainer):
(WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForChildNode):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
* layout/formattingContexts/inline/InlineDisplayContentBuilder.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286788 => 286789)


--- trunk/Source/WebCore/ChangeLog	2021-12-09 18:58:34 UTC (rev 286788)
+++ trunk/Source/WebCore/ChangeLog	2021-12-09 19:01:10 UTC (rev 286789)
@@ -1,5 +1,19 @@
 2021-12-09  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Add support for ink overflow on bidi inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=233968
+
+        Reviewed by Antti Koivisto.
+
+        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary):
+        (WebCore::Layout::InlineDisplayContentBuilder::ensureDisplayBoxForContainer):
+        (WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForChildNode):
+        (WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
+        * layout/formattingContexts/inline/InlineDisplayContentBuilder.h:
+
+2021-12-09  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Add support for empty bidi inline boxes
         https://bugs.webkit.org/show_bug.cgi?id=233896
 

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (286788 => 286789)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-12-09 18:58:34 UTC (rev 286788)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-12-09 19:01:10 UTC (rev 286789)
@@ -128,7 +128,8 @@
         , lineRun.expansion()
         , InlineDisplay::Box::Text { text->start, text->length, content, adjustedContentToRender(), text->needsHyphen }
         , true
-        , { } });
+        , { }
+    });
 }
 
 void InlineDisplayContentBuilder::appendSoftLineBreakDisplayBox(const Line::Run& lineRun, const InlineRect& softLineBreakRunRect, DisplayBoxes& boxes)
@@ -145,7 +146,8 @@
         , softLineBreakRunRect
         , softLineBreakRunRect
         , lineRun.expansion()
-        , InlineDisplay::Box::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() } });
+        , InlineDisplay::Box::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() }
+    });
 }
 
 void InlineDisplayContentBuilder::appendHardLineBreakDisplayBox(const Line::Run& lineRun, const InlineRect& lineBreakBoxRect, DisplayBoxes& boxes)
@@ -159,7 +161,8 @@
         , lineBreakBoxRect
         , lineBreakBoxRect
         , lineRun.expansion()
-        , { } });
+        , { }
+    });
 
     auto& boxGeometry = formattingState().boxGeometry(layoutBox);
     boxGeometry.setLogicalTopLeft(toLayoutPoint(lineBreakBoxRect.topLeft()));
@@ -185,7 +188,8 @@
         , borderBoxRect
         , inkOverflow()
         , lineRun.expansion()
-        , { } });
+        , { }
+    });
     // Note that inline boxes are relative to the line and their top position can be negative.
     // Atomic inline boxes are all set. Their margin/border/content box geometries are already computed. We just have to position them here.
     formattingState().boxGeometry(layoutBox).setLogicalTopLeft(toLayoutPoint(borderBoxRect.topLeft()));
@@ -236,7 +240,8 @@
         , { }
         , { }
         , inlineBox.hasContent()
-        , isFirstLastBox(inlineBox) });
+        , isFirstLastBox(inlineBox)
+    });
     // This inline box showed up first on this line.
     setInlineBoxGeometry(layoutBox, inlineBoxBorderBox, true);
 }
@@ -261,11 +266,26 @@
         , { }
         , { }
         , inlineBox.hasContent()
-        , isFirstLastBox(inlineBox) });
+        , isFirstLastBox(inlineBox)
+    });
     // Middle or end of the inline box. Let's stretch the box as needed.
     setInlineBoxGeometry(layoutBox, inlineBoxBorderBox, false);
 }
 
+void InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary(const Box& layoutBox, DisplayBoxes& boxes)
+{
+    // Geometries for inline boxes at bidi boundaries are computed at a post-process step.
+    boxes.append({ m_lineIndex
+        , InlineDisplay::Box::Type::NonRootInlineBox
+        , layoutBox
+        , UBIDI_DEFAULT_LTR
+        , { }
+        , { }
+        , { }
+        , { }
+    });
+}
+
 void InlineDisplayContentBuilder::processNonBidiContent(const LineBuilder::LineContent& lineContent, const LineBox& lineBox, const InlineLayoutPoint& lineBoxLogicalTopLeft, DisplayBoxes& boxes)
 {
     // Create the inline boxes on the current line. This is mostly text and atomic inline boxes.
@@ -377,7 +397,7 @@
     if (auto* lowestCommonAncestor = ancestorStack.unwind(containerBox))
         return *lowestCommonAncestor;
     auto& enclosingDisplayBoxNodeForContainer = ensureDisplayBoxForContainer(containerBox.parent(), ancestorStack, boxes);
-    boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, containerBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
+    appendInlineDisplayBoxAtBidiBoundary(containerBox, boxes);
     return createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(containerBox, boxes.size() - 1, enclosingDisplayBoxNodeForContainer, ancestorStack);
 }
 
@@ -403,7 +423,6 @@
     auto beforeInlineBoxContent = [&] {
         auto logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
         auto visualRect = InlineRect { lineBoxLogicalTop + logicalRect.top(), contentRightInVisualOrder, { }, logicalRect.height() };
-        // FIXME: Add support for ink overflow.
         if (!displayBox.isFirstForLayoutBox())
             return displayBox.setLogicalRect(visualRect, visualRect);
 
@@ -427,6 +446,13 @@
     };
     afterInlineBoxContent();
 
+    auto computeInkOverflow = [&] {
+        auto inkOverflow = displayBox.logicalRect();
+        m_contentHasInkOverflow = computeBoxShadowInkOverflow(!m_lineIndex ? layoutBox.firstLineStyle() : layoutBox.style(), inkOverflow) || m_contentHasInkOverflow;
+        displayBox.adjustInkOverflow(inkOverflow);
+    };
+    computeInkOverflow();
+
     setInlineBoxGeometry(layoutBox, displayBox.logicalRect(), displayBox.isFirstForLayoutBox());
     if (lineBox.inlineLevelBoxForLayoutBox(layoutBox).hasContent())
         displayBox.setHasContent();
@@ -498,7 +524,7 @@
                 continue;
             }
             if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()) {
-                boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
+                appendInlineDisplayBoxAtBidiBoundary(layoutBox, boxes);
                 createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(downcast<ContainerBox>(layoutBox), boxes.size() - 1, parentDisplayBoxNode, ancestorStack);
                 continue;
             }

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h (286788 => 286789)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h	2021-12-09 18:58:34 UTC (rev 286788)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h	2021-12-09 19:01:10 UTC (rev 286789)
@@ -59,6 +59,7 @@
     void appendAtomicInlineLevelDisplayBox(const Line::Run&, const InlineRect& , DisplayBoxes&);
     void appendInlineBoxDisplayBox(const Line::Run&, const InlineLevelBox&, const InlineRect&, bool linehasContent, DisplayBoxes&);
     void appendSpanningInlineBoxDisplayBox(const Line::Run&, const InlineLevelBox&, const InlineRect&, DisplayBoxes&);
+    void appendInlineDisplayBoxAtBidiBoundary(const Box&, DisplayBoxes&);
 
     void setInlineBoxGeometry(const Box&, const InlineRect&, bool isFirstInlineBoxFragment);
     void adjustVisualGeometryForChildNode(const DisplayBoxNode&, InlineLayoutUnit& accumulatedOffset, InlineLayoutUnit lineBoxLogicalTop, DisplayBoxes&, const LineBox&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to