Title: [200781] trunk/Source/WebCore
Revision
200781
Author
[email protected]
Date
2016-05-12 11:44:24 -0700 (Thu, 12 May 2016)

Log Message

Cleanup RenderObject::containingBlock.
https://bugs.webkit.org/show_bug.cgi?id=157628

Reviewed by Chris Dumez.

No change in functionality.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200780 => 200781)


--- trunk/Source/WebCore/ChangeLog	2016-05-12 18:09:16 UTC (rev 200780)
+++ trunk/Source/WebCore/ChangeLog	2016-05-12 18:44:24 UTC (rev 200781)
@@ -1,3 +1,15 @@
+2016-05-12  Zalan Bujtas  <[email protected]>
+
+        Cleanup RenderObject::containingBlock.
+        https://bugs.webkit.org/show_bug.cgi?id=157628
+
+        Reviewed by Chris Dumez.
+
+        No change in functionality.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::containingBlock):
+
 2016-05-12  Eric Carlson  <[email protected]>
 
         Adjust "main content" video heuristic

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (200780 => 200781)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2016-05-12 18:09:16 UTC (rev 200780)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2016-05-12 18:44:24 UTC (rev 200781)
@@ -622,22 +622,19 @@
 
 RenderBlock* RenderObject::containingBlock() const
 {
-    auto parent = this->parent();
+    auto* parent = this->parent();
+    if (is<RenderText>(*this))
+        return containingBlockForObjectInFlow(parent);
+
     if (!parent && is<RenderScrollbarPart>(*this))
         parent = downcast<RenderScrollbarPart>(*this).rendererOwningScrollbar();
 
-    const RenderStyle& style = this->style();
-    if (!is<RenderText>(*this) && style.position() == FixedPosition)
-        parent = containingBlockForFixedPosition(parent);
-    else if (!is<RenderText>(*this) && style.position() == AbsolutePosition)
-        parent = containingBlockForAbsolutePosition(parent);
-    else
-        parent = containingBlockForObjectInFlow(parent);
-
-    // This can still happen in case of an detached tree
-    if (!parent)
-        return nullptr;
-    return downcast<RenderBlock>(parent);
+    auto& style = this->style();
+    if (style.position() == AbsolutePosition)
+        return containingBlockForAbsolutePosition(parent);
+    if (style.position() == FixedPosition)
+        return containingBlockForFixedPosition(parent);
+    return containingBlockForObjectInFlow(parent);
 }
 
 void RenderObject::addPDFURLRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to