| Index: Source/core/layout/LayoutBox.cpp
|
| diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
|
| index 3fe7409b4b57cf3135ad63f77991de306704d548..4078c60bfc72311c15643dfbe65a027fa615cdcb 100644
|
| --- a/Source/core/layout/LayoutBox.cpp
|
| +++ b/Source/core/layout/LayoutBox.cpp
|
| @@ -4644,13 +4644,21 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
|
| LayoutUnit LayoutBox::offsetFromLogicalTopOfFirstPage() const
|
| {
|
| LayoutState* layoutState = view()->layoutState();
|
| - if (layoutState && !layoutState->isPaginated())
|
| + if (!layoutState || !layoutState->isPaginated())
|
| return LayoutUnit();
|
|
|
| - if (!layoutState && !flowThreadContainingBlock())
|
| - return LayoutUnit();
|
| + if (layoutState->layoutObject() == this) {
|
| + LayoutSize offsetDelta = layoutState->layoutOffset() - layoutState->pageOffset();
|
| + return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width();
|
| + }
|
| +
|
| + // A LayoutBlock always establishes a layout state, and this method is only meant to be called
|
| + // on the object currently being laid out.
|
| + ASSERT(!isLayoutBlock());
|
|
|
| + // In case this box doesn't establish a layout state, try the containing block.
|
| LayoutBlock* containerBlock = containingBlock();
|
| + ASSERT(layoutState->layoutObject() == containerBlock);
|
| return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
|
| }
|
|
|
|
|