| Index: Source/core/rendering/RenderObject.cpp
|
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
|
| index ed9585fe0f2c3cdeaff5780f28c637af60d38eae..47beabdd7b8d58be6ac9f803f5bf758a41122de6 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();
|
| +}
|
| +
|
| bool RenderObject::canRenderBorderImage() const
|
| {
|
| if (!style()->hasBorder())
|
| @@ -2394,6 +2430,7 @@ void RenderObject::willBeRemovedFromTree()
|
| parent()->dirtyLinesFromChangedChild(this);
|
|
|
| removeFromRenderFlowThread();
|
| + RELEASE_ASSERT(!isColumnSpanAll()); // Former spanners should have been removed from the flow thread map by now.
|
|
|
| // Update cached boundaries in SVG renderers if a child is removed.
|
| if (parent()->isSVG())
|
| @@ -2418,6 +2455,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);
|
| }
|
|
|
|
|