Title: [283615] trunk/Source/WebCore
Revision
283615
Author
[email protected]
Date
2021-10-06 07:25:50 -0700 (Wed, 06 Oct 2021)

Log Message

Make containerForElement logic more explicit
https://bugs.webkit.org/show_bug.cgi?id=231275

Reviewed by Simon Fraser.

1. Non-RenderElement renderers (e.g. text content) should return their parents. They are always in-flow, static positioned.
2. Have the explicit list of position types where the parent is the containing block.

* rendering/RenderObject.cpp:
(WebCore::containerForElement):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283614 => 283615)


--- trunk/Source/WebCore/ChangeLog	2021-10-06 13:40:59 UTC (rev 283614)
+++ trunk/Source/WebCore/ChangeLog	2021-10-06 14:25:50 UTC (rev 283615)
@@ -1,5 +1,18 @@
 2021-10-06  Alan Bujtas  <[email protected]>
 
+        Make containerForElement logic more explicit
+        https://bugs.webkit.org/show_bug.cgi?id=231275
+
+        Reviewed by Simon Fraser.
+
+        1. Non-RenderElement renderers (e.g. text content) should return their parents. They are always in-flow, static positioned.  
+        2. Have the explicit list of position types where the parent is the containing block.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::containerForElement):
+
+2021-10-06  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] word-break: break-all only allows mid-word arbitrary breaking positions
         https://bugs.webkit.org/show_bug.cgi?id=231247
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (283614 => 283615)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2021-10-06 13:40:59 UTC (rev 283614)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2021-10-06 14:25:50 UTC (rev 283615)
@@ -1466,11 +1466,13 @@
     // (2) For absolute positioned elements, it will return a relative positioned inline, while
     // containingBlock() skips to the non-anonymous containing block.
     // This does mean that computePositionedLogicalWidth and computePositionedLogicalHeight have to use container().
-    auto pos = renderer.style().position();
+    if (!is<RenderElement>(renderer))
+        return renderer.parent();
+    auto position = renderer.style().position();
+    if (position == PositionType::Static || position == PositionType::Relative || position == PositionType::Sticky)
+        return renderer.parent();
     auto* parent = renderer.parent();
-    if (is<RenderText>(renderer) || (pos != PositionType::Fixed && pos != PositionType::Absolute))
-        return parent;
-    for (; parent && (pos == PositionType::Absolute ? !parent->canContainAbsolutelyPositionedObjects() : !parent->canContainFixedPositionObjects()); parent = parent->parent()) {
+    for (; parent && (position == PositionType::Absolute ? !parent->canContainAbsolutelyPositionedObjects() : !parent->canContainFixedPositionObjects()); parent = parent->parent()) {
         if (repaintContainerSkipped && repaintContainer == parent)
             *repaintContainerSkipped = true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to