Title: [282150] trunk
Revision
282150
Author
[email protected]
Date
2021-09-08 10:11:09 -0700 (Wed, 08 Sep 2021)

Log Message

[LFC][Integration] Hovering over link switches to legacy inline boxes
https://bugs.webkit.org/show_bug.cgi?id=226812
<rdar://problem/79394047>

Reviewed by Alan Bujtas.

LayoutTests/imported/w3c:

* web-platform-tests/css/cssom-view/getBoundingClientRect-empty-inline-expected.txt:

Source/WebCore:

Implement rect/quad collection functions in RenderInline by getting data from LFC.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::visualOverflowBoundingBoxRectFor const):

Some tests taking LFC path were affected by the missing implementation here.

(WebCore::LayoutIntegration::LineLayout::collectInlineBoxRects const):
* layout/integration/LayoutIntegrationLineLayout.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::generateLineBoxRects const):
(WebCore::RenderInline::absoluteRects const):
(WebCore::RenderInline::absoluteQuads const):
(WebCore::RenderInline::absoluteQuadsIgnoringContinuation const):
(WebCore::RenderInline::absoluteQuadsForSelection const):
(WebCore::RenderInline::addFocusRingRects):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282149 => 282150)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-08 17:08:29 UTC (rev 282149)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-08 17:11:09 UTC (rev 282150)
@@ -1,3 +1,13 @@
+2021-09-08  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Hovering over link switches to legacy inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=226812
+        <rdar://problem/79394047>
+
+        Reviewed by Alan Bujtas.
+
+        * web-platform-tests/css/cssom-view/getBoundingClientRect-empty-inline-expected.txt:
+
 2021-09-08  Simon Fraser  <[email protected]>
 
         Support percentages in the scale() transform functions, and the scale property

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/getBoundingClientRect-empty-inline-expected.txt (282149 => 282150)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/getBoundingClientRect-empty-inline-expected.txt	2021-09-08 17:08:29 UTC (rev 282149)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/getBoundingClientRect-empty-inline-expected.txt	2021-09-08 17:11:09 UTC (rev 282150)
@@ -1,3 +1,3 @@
 
-FAIL getBoundingClientRect-empty-inline assert_equals: y expected 92 but got 0
+PASS getBoundingClientRect-empty-inline
 

Modified: trunk/Source/WebCore/ChangeLog (282149 => 282150)


--- trunk/Source/WebCore/ChangeLog	2021-09-08 17:08:29 UTC (rev 282149)
+++ trunk/Source/WebCore/ChangeLog	2021-09-08 17:11:09 UTC (rev 282150)
@@ -1,3 +1,28 @@
+2021-09-08  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Hovering over link switches to legacy inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=226812
+        <rdar://problem/79394047>
+
+        Reviewed by Alan Bujtas.
+
+        Implement rect/quad collection functions in RenderInline by getting data from LFC.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::visualOverflowBoundingBoxRectFor const):
+
+        Some tests taking LFC path were affected by the missing implementation here.
+
+        (WebCore::LayoutIntegration::LineLayout::collectInlineBoxRects const):
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::generateLineBoxRects const):
+        (WebCore::RenderInline::absoluteRects const):
+        (WebCore::RenderInline::absoluteQuads const):
+        (WebCore::RenderInline::absoluteQuadsIgnoringContinuation const):
+        (WebCore::RenderInline::absoluteQuadsForSelection const):
+        (WebCore::RenderInline::addFocusRingRects):
+
 2021-09-08  Youenn Fablet  <[email protected]>
 
         webrtc/ephemeral-certificates-and-cnames.html needs to close its connections between two tests

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (282149 => 282150)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-08 17:08:29 UTC (rev 282149)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-08 17:11:09 UTC (rev 282150)
@@ -425,10 +425,35 @@
 
 LayoutRect LineLayout::visualOverflowBoundingBoxRectFor(const RenderInline& renderInline) const
 {
-    // FIXME: This doesn't contain overflow.
-    return enclosingBorderBoxRectFor(renderInline);
+    LayoutRect result;
+
+    auto& layoutBox = m_boxTree.layoutBoxForRenderer(renderInline);
+    for (auto& run : m_inlineContent->runs) {
+        if (&run.layoutBox() != &layoutBox)
+            continue;
+        result.unite(Layout::toLayoutRect(run.inkOverflow()));
+    }
+
+    return result;
 }
 
+Vector<FloatRect> LineLayout::collectInlineBoxRects(const RenderInline& renderInline) const
+{
+    if (!m_inlineContent)
+        return { };
+
+    Vector<FloatRect> result;
+
+    auto& layoutBox = m_boxTree.layoutBoxForRenderer(renderInline);
+    for (auto& run : m_inlineContent->runs) {
+        if (&run.layoutBox() != &layoutBox)
+            continue;
+        result.append(run.logicalRect());
+    }
+
+    return result;
+}
+
 const RenderObject& LineLayout::rendererForLayoutBox(const Layout::Box& layoutBox) const
 {
     return m_boxTree.rendererForLayoutBox(layoutBox);

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (282149 => 282150)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2021-09-08 17:08:29 UTC (rev 282149)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2021-09-08 17:11:09 UTC (rev 282150)
@@ -27,6 +27,7 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
+#include "FloatRect.h"
 #include "LayoutIntegrationBoxTree.h"
 #include "LayoutIntegrationLineIterator.h"
 #include "LayoutIntegrationRunIterator.h"
@@ -97,6 +98,7 @@
 
     LayoutRect enclosingBorderBoxRectFor(const RenderInline&) const;
     LayoutRect visualOverflowBoundingBoxRectFor(const RenderInline&) const;
+    Vector<FloatRect> collectInlineBoxRects(const RenderInline&) const;
 
     const RenderObject& rendererForLayoutBox(const Layout::Box&) const;
     const RenderBlockFlow& flow() const { return m_boxTree.flow(); }

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (282149 => 282150)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2021-09-08 17:08:29 UTC (rev 282149)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2021-09-08 17:11:09 UTC (rev 282150)
@@ -253,6 +253,18 @@
 template<typename GeneratorContext>
 void RenderInline::generateLineBoxRects(GeneratorContext& context) const
 {
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this)) {
+        auto inlineBoxRects = lineLayout->collectInlineBoxRects(*this);
+        if (inlineBoxRects.isEmpty()) {
+            context.addRect({ });
+            return;
+        }
+        for (auto inlineBoxRect : inlineBoxRects)
+            context.addRect(inlineBoxRect);
+        return;
+    }
+#endif
     if (!alwaysCreateLineBoxes())
         generateCulledLineBoxRects(context, this);
     else if (LegacyInlineFlowBox* curr = firstLineBox()) {
@@ -342,8 +354,6 @@
     }
 }
 
-namespace {
-
 class AbsoluteRectsGeneratorContext {
 public:
     AbsoluteRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
@@ -361,14 +371,8 @@
     const LayoutPoint& m_accumulatedOffset;
 };
 
-} // unnamed namespace
-
 void RenderInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
 {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)))
-        lineLayout->flow().ensureLineBoxes();
-#endif
     Vector<LayoutRect> lineboxRects;
     AbsoluteRectsGeneratorContext context(lineboxRects, accumulatedOffset);
     generateLineBoxRects(context);
@@ -384,7 +388,6 @@
     }
 }
 
-
 namespace {
 
 class AbsoluteQuadsGeneratorContext {
@@ -409,10 +412,6 @@
 
 void RenderInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
 {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)))
-        lineLayout->flow().ensureLineBoxes();
-#endif
     absoluteQuadsIgnoringContinuation({ }, quads, wasFixed);
     if (continuation())
         collectAbsoluteQuadsForContinuation(quads, wasFixed);
@@ -420,10 +419,6 @@
 
 void RenderInline::absoluteQuadsIgnoringContinuation(const FloatRect&, Vector<FloatQuad>& quads, bool*) const
 {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)))
-        lineLayout->flow().ensureLineBoxes();
-#endif
     AbsoluteQuadsGeneratorContext context(this, quads);
     generateLineBoxRects(context);
 }
@@ -431,10 +426,6 @@
 #if PLATFORM(IOS_FAMILY)
 void RenderInline::absoluteQuadsForSelection(Vector<FloatQuad>& quads) const
 {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)))
-        lineLayout->flow().ensureLineBoxes();
-#endif
     AbsoluteQuadsGeneratorContext context(this, quads);
     generateLineBoxRects(context);
 }
@@ -610,8 +601,6 @@
     return RenderBoxModelObject::positionForPoint(point, fragment);
 }
 
-namespace {
-
 class LinesBoundingBoxGeneratorContext {
 public:
     LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) { }
@@ -624,8 +613,6 @@
     FloatRect& m_rect;
 };
 
-} // unnamed namespace
-
 IntRect RenderInline::linesBoundingBox() const
 {
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
@@ -1218,10 +1205,6 @@
 
 void RenderInline::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
 {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* lineLayout = LayoutIntegration::LineLayout::containing(const_cast<RenderInline&>(*this)))
-        lineLayout->flow().ensureLineBoxes();
-#endif
     AbsoluteRectsGeneratorContext context(rects, additionalOffset);
     generateLineBoxRects(context);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to