Index: Source/core/rendering/RenderObject.cpp |
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
index ed9585fe0f2c3cdeaff5780f28c637af60d38eae..698b6879c460df3991aeb26f16b9d2a2f7cda007 100644 |
--- a/Source/core/rendering/RenderObject.cpp |
+++ b/Source/core/rendering/RenderObject.cpp |
@@ -57,7 +57,6 @@ |
#include "core/rendering/RenderCounter.h" |
#include "core/rendering/RenderDeprecatedFlexibleBox.h" |
#include "core/rendering/RenderFlexibleBox.h" |
-#include "core/rendering/RenderFlowThread.h" |
#include "core/rendering/RenderGeometryMap.h" |
#include "core/rendering/RenderGrid.h" |
#include "core/rendering/RenderImage.h" |
@@ -65,6 +64,7 @@ |
#include "core/rendering/RenderInline.h" |
#include "core/rendering/RenderLayer.h" |
#include "core/rendering/RenderListItem.h" |
+#include "core/rendering/RenderMultiColumnFlowThread.h" |
#include "core/rendering/RenderObjectInlines.h" |
#include "core/rendering/RenderPart.h" |
#include "core/rendering/RenderScrollbarPart.h" |
@@ -325,6 +325,13 @@ bool RenderObject::requiresAnonymousTableWrappers(const RenderObject* newChild) |
return false; |
} |
+bool RenderObject::isValidColumnSpanAll() const |
+{ |
+ ASSERT(style()->columnSpan() == ColumnSpanAll); |
+ RenderFlowThread* flowThread = flowThreadContainingBlock(); |
+ return flowThread && flowThread->isColumnSpanner(this); |
+} |
+ |
void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) |
{ |
ASSERT(isAllowedToModifyRenderTreeStructure(document())); |
@@ -634,7 +641,17 @@ RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const |
while (curr) { |
if (curr->isRenderFlowThread()) |
return toRenderFlowThread(curr); |
- curr = curr->containingBlock(); |
+ switch (curr->style()->position()) { |
+ case FixedPosition: |
+ curr = curr->containerForFixedPosition(); |
+ break; |
+ case AbsolutePosition: |
+ curr = curr->containerForAbsolutePosition(); |
+ break; |
+ default: |
+ curr = curr->parentBlock(); |
+ break; |
+ } |
} |
return 0; |
} |
@@ -801,50 +818,69 @@ RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec |
return toRenderBlock(ancestor); |
} |
-RenderBlock* RenderObject::containingBlock() const |
+RenderBlock* RenderObject::containerForAbsolutePosition() const |
{ |
RenderObject* o = parent(); |
- if (!o && isRenderScrollbarPart()) |
- o = toRenderScrollbarPart(this)->rendererOwningScrollbar(); |
- if (!isText() && m_style->position() == FixedPosition) { |
- return containerForFixedPosition(); |
- } else if (!isText() && m_style->position() == AbsolutePosition) { |
- while (o) { |
- // For relpositioned inlines, we return the nearest non-anonymous enclosing block. We don't try |
- // to return the inline itself. This allows us to avoid having a positioned objects |
- // list in all RenderInlines and lets us return a strongly-typed RenderBlock* result |
- // from this method. The container() method can actually be used to obtain the |
- // inline directly. |
- if (o->style()->position() != StaticPosition && (!o->isInline() || o->isReplaced())) |
- break; |
- |
- if (o->canContainFixedPositionObjects()) |
- break; |
+ while (o) { |
+ // For relpositioned inlines, we return the nearest non-anonymous enclosing block. We don't try |
+ // to return the inline itself. This allows us to avoid having a positioned objects |
+ // list in all RenderInlines and lets us return a strongly-typed RenderBlock* result |
+ // from this method. The container() method can actually be used to obtain the |
+ // inline directly. |
+ if (o->style()->position() != StaticPosition && (!o->isInline() || o->isReplaced())) |
+ break; |
- if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplaced()) { |
- o = o->containingBlock(); |
- break; |
- } |
+ if (o->canContainFixedPositionObjects()) |
+ break; |
- o = o->parent(); |
+ if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplaced()) { |
+ o = o->parentBlock(); |
+ break; |
} |
- if (o && !o->isRenderBlock()) |
- o = o->containingBlock(); |
- |
- while (o && o->isAnonymousBlock()) |
- o = o->containingBlock(); |
- } else { |
- while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock())) |
- o = o->parent(); |
+ o = o->parent(); |
} |
+ if (o && !o->isRenderBlock()) |
+ o = o->parentBlock(); |
+ |
+ while (o && o->isAnonymousBlock()) |
+ o = o->parentBlock(); |
+ |
+ return toRenderBlock(o); |
+} |
+ |
+RenderBlock* RenderObject::parentBlock() const |
+{ |
+ RenderObject* o = parent(); |
+ while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock())) |
+ o = o->parent(); |
+ |
if (!o || !o->isRenderBlock()) |
return 0; // This can still happen in case of an orphaned tree |
return toRenderBlock(o); |
} |
+RenderBlock* RenderObject::containingBlock() const |
+{ |
+ if (!parent() && isRenderScrollbarPart()) { |
+ RenderObject* o = toRenderScrollbarPart(this)->rendererOwningScrollbar(); |
+ if (o && !o->isRenderBlock()) |
+ o = o->parentBlock(); |
+ return toRenderBlock(o); |
+ } |
+ if (!isText()) { |
+ if (m_style->position() == FixedPosition) |
+ return containerForFixedPosition(); |
+ if (m_style->position() == AbsolutePosition) |
+ return containerForAbsolutePosition(); |
+ } |
+ if (isColumnSpanAll()) |
+ return toRenderMultiColumnFlowThread(flowThreadContainingBlock())->multiColumnBlockFlow(); |
+ return parentBlock(); |
+} |
Julien - ping for review
2014/11/26 21:09:01
A lot of this containing-block related change is o
mstensho (USE GERRIT)
2014/11/27 21:20:29
Yeah, as long as you think this is a good change o
Julien - ping for review
2014/12/03 23:02:22
Anything that shrinks this patch should be split o
mstensho (USE GERRIT)
2014/12/10 13:48:19
I found a way around making this big change. The c
|
+ |
bool RenderObject::canRenderBorderImage() const |
{ |
if (!style()->hasBorder()) |
@@ -2418,6 +2454,9 @@ void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF |
for (RenderObject* child = children->firstChild(); child; child = child->nextSibling()) |
child->removeFromRenderFlowThreadRecursive(renderFlowThread); |
} |
+ |
+ if (renderFlowThread && renderFlowThread != this) |
+ renderFlowThread->flowThreadDescendantWillBeRemoved(this); |
setFlowThreadState(NotInsideFlowThread); |
} |