Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1067)

Unified Diff: Source/core/layout/LayoutBox.cpp

Issue 1154493002: Cleanup: Get rid of LayoutBlock::offsetFromLogicalTopOfFirstPage(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698