Title: [281564] trunk/Source/WebCore
Revision
281564
Author
za...@apple.com
Date
2021-08-25 10:46:34 -0700 (Wed, 25 Aug 2021)

Log Message

[IFC][Integration] Non-empty inline boxes may affect overflow scroll
https://bugs.webkit.org/show_bug.cgi?id=229436

Reviewed by Antti Koivisto.

Use a more focused check whether an inline box (<span>) should contribute to scroll overflow.

* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
* layout/integration/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::NonRootInlineBox::NonRootInlineBox):
(WebCore::LayoutIntegration::NonRootInlineBox::hasScrollableContent const):
(WebCore::LayoutIntegration::NonRootInlineBox::canContributeToLineOverflow const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281563 => 281564)


--- trunk/Source/WebCore/ChangeLog	2021-08-25 17:43:19 UTC (rev 281563)
+++ trunk/Source/WebCore/ChangeLog	2021-08-25 17:46:34 UTC (rev 281564)
@@ -1,3 +1,20 @@
+2021-08-25  Alan Bujtas  <za...@apple.com>
+
+        [IFC][Integration] Non-empty inline boxes may affect overflow scroll
+        https://bugs.webkit.org/show_bug.cgi?id=229436
+
+        Reviewed by Antti Koivisto.
+
+        Use a more focused check whether an inline box (<span>) should contribute to scroll overflow.
+
+        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
+        * layout/integration/LayoutIntegrationLine.h:
+        (WebCore::LayoutIntegration::NonRootInlineBox::NonRootInlineBox):
+        (WebCore::LayoutIntegration::NonRootInlineBox::hasScrollableContent const):
+        (WebCore::LayoutIntegration::NonRootInlineBox::canContributeToLineOverflow const): Deleted.
+
 2021-08-25  Peng Liu  <peng.l...@apple.com>
 
         [Monterey] LayoutTest media/element-containing-pip-video-going-into-fullscreen.html is flaky timeout/crash

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (281563 => 281564)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2021-08-25 17:43:19 UTC (rev 281563)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2021-08-25 17:46:34 UTC (rev 281564)
@@ -29,8 +29,6 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 #include "BidiResolver.h"
-#include "InlineFormattingContext.h"
-#include "InlineFormattingGeometry.h"
 #include "InlineFormattingState.h"
 #include "LayoutBoxGeometry.h"
 #include "LayoutIntegrationBoxTree.h"
@@ -353,7 +351,7 @@
         // Collect scrollable overflow from inline boxes. All other inline level boxes (e.g atomic inline level boxes) stretch the line.
         while (inlineBoxIndex < nonRootInlineBoxes.size() && nonRootInlineBoxes[inlineBoxIndex].lineIndex() == lineIndex) {
             auto& inlineBox = nonRootInlineBoxes[inlineBoxIndex++];
-            if (inlineBox.canContributeToLineOverflow())
+            if (inlineBox.hasScrollableContent())
                 scrollableOverflowRect.unite(inlineBox.rect());
         }
 
@@ -372,8 +370,6 @@
 
 void InlineContentBuilder::createDisplayNonRootInlineBoxes(const Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
 {
-    auto inlineFormattingContext = Layout::InlineFormattingContext { m_boxTree.rootLayoutBox(), const_cast<Layout::InlineFormattingState&>(inlineFormattingState) };
-    auto& inlineFormattingGeometry = inlineFormattingContext.formattingGeometry();
     for (size_t lineIndex = 0; lineIndex < inlineFormattingState.lineBoxes().size(); ++lineIndex) {
         auto& lineBox = inlineFormattingState.lineBoxes()[lineIndex];
         if (!lineBox.hasInlineBox())
@@ -388,7 +384,11 @@
             auto inlineBoxRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
             inlineBoxRect.moveBy(lineBoxLogicalRect.topLeft());
 
-            inlineContent.nonRootInlineBoxes.append({ lineIndex, layoutBox, inlineBoxRect, inlineFormattingGeometry.inlineLevelBoxAffectsLineBox(inlineLevelBox, lineBox) });
+            auto hasScrollableContent = [&] {
+                // In standards mode, inline boxes always start with an imaginary strut.
+                return m_layoutState.inStandardsMode() || inlineLevelBox.hasContent() || boxGeometry.horizontalBorder() || (boxGeometry.horizontalPadding() && boxGeometry.horizontalPadding().value());
+            };
+            inlineContent.nonRootInlineBoxes.append({ lineIndex, layoutBox, inlineBoxRect, hasScrollableContent() });
         }
     }
 }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (281563 => 281564)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2021-08-25 17:43:19 UTC (rev 281563)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2021-08-25 17:46:34 UTC (rev 281564)
@@ -88,11 +88,11 @@
 
 class NonRootInlineBox {
 public:
-    NonRootInlineBox(size_t lineIndex, const Layout::Box& layoutBox, const FloatRect& rect, bool canContributeToLineOverflow)
+    NonRootInlineBox(size_t lineIndex, const Layout::Box& layoutBox, const FloatRect& rect, bool hasScrollableContent)
         : m_lineIndex(lineIndex)
         , m_layoutBox(makeWeakPtr(layoutBox))
         , m_rect(rect)
-        , m_canContributeToLineOverflow(canContributeToLineOverflow)
+        , m_hasScrollableContent(hasScrollableContent)
     {
     }
 
@@ -103,13 +103,13 @@
 
     FloatRect rect() const { return m_rect; }
 
-    bool canContributeToLineOverflow() const { return m_canContributeToLineOverflow; }
+    bool hasScrollableContent() const { return m_hasScrollableContent; }
 
 private:
     const size_t m_lineIndex;
     WeakPtr<const Layout::Box> m_layoutBox;
     FloatRect m_rect;
-    bool m_canContributeToLineOverflow { false };
+    bool m_hasScrollableContent { false };
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to