Title: [288060] trunk/Source/WebCore
Revision
288060
Author
[email protected]
Date
2022-01-15 10:58:31 -0800 (Sat, 15 Jan 2022)

Log Message

Share some code that looks at visibility in order to short-circuit repaint rect computation
https://bugs.webkit.org/show_bug.cgi?id=235242

Reviewed by Dean Jackson.

There were five instances of this common code pattern that short-circuited clippedOverflowRect()
when we know that the renderer is hidden with visibility:hidden, so factor it into a common
function on RenderElement.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::clippedOverflowRect const):
* rendering/RenderBox.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::isInsideEntirelyHiddenLayer const):
* rendering/RenderElement.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::clippedOverflowRect const):
* rendering/svg/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::clippedOverflowRect const):
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::clippedOverflowRect const):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::clippedOverflowRect const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288059 => 288060)


--- trunk/Source/WebCore/ChangeLog	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/ChangeLog	2022-01-15 18:58:31 UTC (rev 288060)
@@ -1,5 +1,31 @@
 2022-01-15  Simon Fraser  <[email protected]>
 
+        Share some code that looks at visibility in order to short-circuit repaint rect computation
+        https://bugs.webkit.org/show_bug.cgi?id=235242
+
+        Reviewed by Dean Jackson.
+
+        There were five instances of this common code pattern that short-circuited clippedOverflowRect()
+        when we know that the renderer is hidden with visibility:hidden, so factor it into a common
+        function on RenderElement.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::clippedOverflowRect const):
+        * rendering/RenderBox.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::isInsideEntirelyHiddenLayer const):
+        * rendering/RenderElement.h:
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::clippedOverflowRect const):
+        * rendering/svg/LegacyRenderSVGRoot.cpp:
+        (WebCore::LegacyRenderSVGRoot::clippedOverflowRect const):
+        * rendering/svg/RenderSVGModelObject.cpp:
+        (WebCore::RenderSVGModelObject::clippedOverflowRect const):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::clippedOverflowRect const):
+
+2022-01-15  Simon Fraser  <[email protected]>
+
         Make a function that returns the ordered list of top layer RenderLayers
         https://bugs.webkit.org/show_bug.cgi?id=235251
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (288059 => 288060)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2022-01-15 18:58:31 UTC (rev 288060)
@@ -2476,8 +2476,9 @@
 
 LayoutRect RenderBox::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
 {
-    if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
-        return LayoutRect();
+    if (isInsideEntirelyHiddenLayer())
+        return { };
+
     LayoutRect r = visualOverflowRect();
     // FIXME: layoutDelta needs to be applied in parts before/after transforms and
     // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308

Modified: trunk/Source/WebCore/rendering/RenderBox.h (288059 => 288060)


--- trunk/Source/WebCore/rendering/RenderBox.h	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2022-01-15 18:58:31 UTC (rev 288060)
@@ -217,7 +217,7 @@
     LayoutRect applyVisualEffectOverflow(const LayoutRect&) const;
     void addOverflowFromChild(const RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
     void addOverflowFromChild(const RenderBox* child, const LayoutSize& delta);
-    
+
     void updateLayerTransform();
 
     LayoutSize contentSize() const { return { contentWidth(), contentHeight() }; }

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (288059 => 288060)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2022-01-15 18:58:31 UTC (rev 288060)
@@ -1366,6 +1366,11 @@
     return true;
 }
 
+bool RenderElement::isInsideEntirelyHiddenLayer() const
+{
+    return style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent();
+}
+
 void RenderElement::registerForVisibleInViewportCallback()
 {
     if (m_isRegisteredForVisibleInViewportCallback)

Modified: trunk/Source/WebCore/rendering/RenderElement.h (288059 => 288060)


--- trunk/Source/WebCore/rendering/RenderElement.h	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/RenderElement.h	2022-01-15 18:58:31 UTC (rev 288060)
@@ -147,6 +147,7 @@
     bool isVisibleIgnoringGeometry() const;
     bool mayCauseRepaintInsideViewport(const IntRect* visibleRect = nullptr) const;
     bool isVisibleInDocumentRect(const IntRect& documentRect) const;
+    bool isInsideEntirelyHiddenLayer() const;
 
     // Returns true if this renderer requires a new stacking context.
     static bool createsGroupForStyle(const RenderStyle&);

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (288059 => 288060)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2022-01-15 18:58:31 UTC (rev 288060)
@@ -788,8 +788,8 @@
 
 LayoutRect RenderReplaced::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
 {
-    if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
-        return LayoutRect();
+    if (isInsideEntirelyHiddenLayer())
+        return { };
 
     // The selectionRect can project outside of the overflowRect, so take their union
     // for repainting to avoid selection painting glitches.

Modified: trunk/Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp (288059 => 288060)


--- trunk/Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp	2022-01-15 18:58:31 UTC (rev 288060)
@@ -357,8 +357,8 @@
 
 LayoutRect LegacyRenderSVGRoot::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
 {
-    if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
-        return LayoutRect();
+    if (isInsideEntirelyHiddenLayer())
+        return { };
 
     FloatRect contentRepaintRect = m_localToBorderBoxTransform.mapRect(repaintRectInLocalCoordinates());
     contentRepaintRect.intersect(snappedIntRect(borderBoxRect()));

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp (288059 => 288060)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2022-01-15 18:58:31 UTC (rev 288060)
@@ -83,8 +83,8 @@
 
 LayoutRect RenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
 {
-    if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
-        return LayoutRect();
+    if (isInsideEntirelyHiddenLayer())
+        return { };
 
     ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled());
     return computeRect(visualOverflowRectEquivalent(), repaintContainer, context);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (288059 => 288060)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2022-01-15 18:51:38 UTC (rev 288059)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2022-01-15 18:58:31 UTC (rev 288060)
@@ -407,8 +407,8 @@
 
 LayoutRect RenderSVGRoot::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
 {
-    if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
-        return LayoutRect();
+    if (isInsideEntirelyHiddenLayer())
+        return { };
 
     auto repaintRect = LayoutRect(valueOrDefault(m_viewBoxTransform.inverse()).mapRect(borderBoxRect()));
     return computeRect(repaintRect, repaintContainer, context);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to