Title: [282338] trunk/Source/WebCore
Revision
282338
Author
[email protected]
Date
2021-09-13 10:57:14 -0700 (Mon, 13 Sep 2021)

Log Message

Remove redundant copy of visibleToHitTesting function
https://bugs.webkit.org/show_bug.cgi?id=230212

Reviewed by Alan Bujtas.

Remove the LegacyInlineBox version.

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

Also use visibleToHitTesting here.

* rendering/LegacyEllipsisBox.cpp:
(WebCore::LegacyEllipsisBox::nodeAtPoint):
* rendering/LegacyInlineBox.h:
* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::nodeAtPoint):
* rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::nodeAtPoint):
* rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::nodeAtPoint):
* rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282337 => 282338)


--- trunk/Source/WebCore/ChangeLog	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/ChangeLog	2021-09-13 17:57:14 UTC (rev 282338)
@@ -1,5 +1,31 @@
 2021-09-13  Antti Koivisto  <[email protected]>
 
+        Remove redundant copy of visibleToHitTesting function
+        https://bugs.webkit.org/show_bug.cgi?id=230212
+
+        Reviewed by Alan Bujtas.
+
+        Remove the LegacyInlineBox version.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::hitTest):
+
+        Also use visibleToHitTesting here.
+
+        * rendering/LegacyEllipsisBox.cpp:
+        (WebCore::LegacyEllipsisBox::nodeAtPoint):
+        * rendering/LegacyInlineBox.h:
+        * rendering/LegacyInlineFlowBox.cpp:
+        (WebCore::LegacyInlineFlowBox::nodeAtPoint):
+        * rendering/LegacyInlineTextBox.cpp:
+        (WebCore::LegacyInlineTextBox::nodeAtPoint):
+        * rendering/LegacyRootInlineBox.cpp:
+        (WebCore::LegacyRootInlineBox::nodeAtPoint):
+        * rendering/TextBoxPainter.cpp:
+        (WebCore::TextBoxPainter::paint):
+
+2021-09-13  Antti Koivisto  <[email protected]>
+
         LegacyInlineTextBox::selectionState accessor mutates ellipsis selection state
         https://bugs.webkit.org/show_bug.cgi?id=205528
         <rdar://problem/58125978>

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (282337 => 282338)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-13 17:57:14 UTC (rev 282338)
@@ -519,8 +519,8 @@
         if (!locationInContainer.intersects(runRect))
             continue;
 
-        auto& style = run.style();
-        if (style.visibility() != Visibility::Visible || style.pointerEvents() == PointerEvents::None)
+        auto& elementRenderer = is<RenderElement>(renderer) ? downcast<RenderElement>(renderer) : *renderer.parent();
+        if (!elementRenderer.visibleToHitTesting(request))
             continue;
         
         renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));

Modified: trunk/Source/WebCore/rendering/LegacyEllipsisBox.cpp (282337 => 282338)


--- trunk/Source/WebCore/rendering/LegacyEllipsisBox.cpp	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/rendering/LegacyEllipsisBox.cpp	2021-09-13 17:57:14 UTC (rev 282338)
@@ -161,7 +161,7 @@
     }
 
     auto boundsRect = LayoutRect { adjustedLocation, LayoutSize(LayoutUnit(logicalWidth()), m_height) };
-    if (visibleToHitTesting(request) && locationInContainer.intersects(boundsRect)) {
+    if (renderer().visibleToHitTesting(request) && locationInContainer.intersects(boundsRect)) {
         blockFlow().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
         if (result.addNodeToListBasedTestResult(blockFlow().nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
             return true;

Modified: trunk/Source/WebCore/rendering/LegacyInlineBox.h (282337 => 282338)


--- trunk/Source/WebCore/rendering/LegacyInlineBox.h	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/rendering/LegacyInlineBox.h	2021-09-13 17:57:14 UTC (rev 282338)
@@ -230,17 +230,6 @@
     void invalidateParentChildList();
 #endif
 
-    bool visibleToHitTesting(std::optional<HitTestRequest> hitTestRequest = std::nullopt) const
-    {
-        if (renderer().style().visibility() != Visibility::Visible)
-            return false;
-
-        if ((!hitTestRequest || !hitTestRequest->ignoreCSSPointerEventsProperty()) && renderer().style().pointerEvents() == PointerEvents::None)
-            return false;
-
-        return true;
-    }
-
     const RenderStyle& lineStyle() const { return m_bitfields.firstLine() ? renderer().firstLineStyle() : renderer().style(); }
     
     VerticalAlign verticalAlign() const { return lineStyle().verticalAlign(); }

Modified: trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp (282337 => 282338)


--- trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp	2021-09-13 17:57:14 UTC (rev 282338)
@@ -1065,7 +1065,7 @@
     }
 
     // Now check ourselves. Pixel snap hit testing.
-    if (!visibleToHitTesting(request))
+    if (!renderer().visibleToHitTesting(request))
         return false;
 
     // Do not hittest content beyond the ellipsis box.

Modified: trunk/Source/WebCore/rendering/LegacyInlineTextBox.cpp (282337 => 282338)


--- trunk/Source/WebCore/rendering/LegacyInlineTextBox.cpp	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/rendering/LegacyInlineTextBox.cpp	2021-09-13 17:57:14 UTC (rev 282338)
@@ -312,7 +312,7 @@
 bool LegacyInlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/,
     HitTestAction /*hitTestAction*/)
 {
-    if (!visibleToHitTesting(request))
+    if (!renderer().parent()->visibleToHitTesting(request))
         return false;
 
     if (isLineBreak())

Modified: trunk/Source/WebCore/rendering/LegacyRootInlineBox.cpp (282337 => 282338)


--- trunk/Source/WebCore/rendering/LegacyRootInlineBox.cpp	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/rendering/LegacyRootInlineBox.cpp	2021-09-13 17:57:14 UTC (rev 282338)
@@ -175,7 +175,7 @@
 
 bool LegacyRootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction hitTestAction)
 {
-    if (hasEllipsisBox() && visibleToHitTesting(request)) {
+    if (hasEllipsisBox() && renderer().visibleToHitTesting(request)) {
         if (ellipsisBox()->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom, hitTestAction)) {
             renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
             return true;

Modified: trunk/Source/WebCore/rendering/TextBoxPainter.cpp (282337 => 282338)


--- trunk/Source/WebCore/rendering/TextBoxPainter.cpp	2021-09-13 17:47:56 UTC (rev 282337)
+++ trunk/Source/WebCore/rendering/TextBoxPainter.cpp	2021-09-13 17:57:14 UTC (rev 282338)
@@ -61,7 +61,7 @@
         return;
 
     if (m_paintInfo.phase == PaintPhase::EventRegion) {
-        if (m_textBox.visibleToHitTesting())
+        if (m_renderer.parent()->visibleToHitTesting())
             m_paintInfo.eventRegionContext->unite(enclosingIntRect(m_paintRect), m_renderer.style());
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to