Title: [273219] trunk/Source/WebCore
Revision
273219
Author
[email protected]
Date
2021-02-21 09:20:47 -0800 (Sun, 21 Feb 2021)

Log Message

Small improvements to r273073
https://bugs.webkit.org/show_bug.cgi?id=222179

Patch by Martin Robinson <[email protected]> on 2021-02-21
Reviewed by Darin Adler.

No new tests, because this should not change behavior.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Replace
a while loop with a for loop and prefer downcast<> to static_cast<>.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273218 => 273219)


--- trunk/Source/WebCore/ChangeLog	2021-02-21 12:51:17 UTC (rev 273218)
+++ trunk/Source/WebCore/ChangeLog	2021-02-21 17:20:47 UTC (rev 273219)
@@ -1,3 +1,16 @@
+2021-02-21  Martin Robinson  <[email protected]>
+
+        Small improvements to r273073
+        https://bugs.webkit.org/show_bug.cgi?id=222179
+
+        Reviewed by Darin Adler.
+
+        No new tests, because this should not change behavior.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Replace
+        a while loop with a for loop and prefer downcast<> to static_cast<>.
+
 2021-02-20  Chris Fleizach  <[email protected]>
 
         AX: Image should report the embedded accessibility description if available

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (273218 => 273219)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2021-02-21 12:51:17 UTC (rev 273218)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2021-02-21 17:20:47 UTC (rev 273219)
@@ -459,15 +459,13 @@
     // this RenderObject. The important thing here is that `container()` respects
     // the containing block chain for positioned elements. This is important because
     // scrollable overflow does not establish a new containing block for children.
-    auto* candidate = container();
-    while (candidate) {
+    for (auto* candidate = container(); candidate; candidate = candidate->container()) {
         // Currently the RenderView can look like it has scrollable overflow, but we never
         // want to return this as our container. Instead we should use the root element.
         if (candidate->isRenderView())
             break;
         if (candidate->hasOverflowClip())
-            return static_cast<RenderBox*>(candidate);
-        candidate = candidate->container();
+            return downcast<RenderBox>(candidate);
     }
 
     // If we reach the root, then the root element is the scrolling container.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to