Title: [232045] trunk/Source/WebCore
Revision
232045
Author
[email protected]
Date
2018-05-21 20:43:31 -0700 (Mon, 21 May 2018)

Log Message

[LFC] Box::isDescendantOf() should work with out-of-flow elements.
https://bugs.webkit.org/show_bug.cgi?id=185812

Reviewed by Antti Koivisto.

Use the containing block chain instead of the parent chain to check for isDescendantOf().
(containing block is not always the direct parent)

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isDescendantOf const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232044 => 232045)


--- trunk/Source/WebCore/ChangeLog	2018-05-22 03:11:30 UTC (rev 232044)
+++ trunk/Source/WebCore/ChangeLog	2018-05-22 03:43:31 UTC (rev 232045)
@@ -1,3 +1,16 @@
+2018-05-21  Zalan Bujtas  <[email protected]>
+
+        [LFC] Box::isDescendantOf() should work with out-of-flow elements.
+        https://bugs.webkit.org/show_bug.cgi?id=185812
+
+        Reviewed by Antti Koivisto.
+
+        Use the containing block chain instead of the parent chain to check for isDescendantOf().
+        (containing block is not always the direct parent)
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::isDescendantOf const):
+
 2018-05-21  Chris Nardi  <[email protected]>
 
         Remove dead exception in MediaList.appendMedium

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (232044 => 232045)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2018-05-22 03:11:30 UTC (rev 232044)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2018-05-22 03:43:31 UTC (rev 232045)
@@ -142,10 +142,12 @@
 }
 
 bool Box::isDescendantOf(Container& container) const
-{
-    auto* ancestor = parent();
-    for (; ancestor && ancestor != &container; ancestor = ancestor->parent()) { }
-    return ancestor;
+{ 
+    for (auto* ancestor = containingBlock(); ancestor; ancestor = ancestor->containingBlock()) {
+        if (ancestor == &container)
+            return true;
+    }
+    return false;
 }
 
 bool Box::isInlineBlockBox() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to