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

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 567463004: Move adjustForUnsplittableChild() from RenderBlock to RenderBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 4496 matching lines...) Expand 10 before | Expand all | Expand 10 after
4507 // If includeBoundaryPoint is true the line exactly on the top edge of a 4507 // If includeBoundaryPoint is true the line exactly on the top edge of a
4508 // column will act as being part of the previous column. 4508 // column will act as being part of the previous column.
4509 remainingHeight = intMod(remainingHeight, pageLogicalHeight); 4509 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
4510 } 4510 }
4511 return remainingHeight; 4511 return remainingHeight;
4512 } 4512 }
4513 4513
4514 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule); 4514 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule);
4515 } 4515 }
4516 4516
4517 LayoutUnit RenderBlock::adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOffset, bool includeMargins)
4518 {
4519 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns() || flo wThreadContainingBlock();
4520 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight();
4521 bool isUnsplittable = child->isUnsplittableForPagination() || (checkColumnBr eaks && child->style()->columnBreakInside() == PBAVOID)
4522 || (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID);
4523 if (!isUnsplittable)
4524 return logicalOffset;
4525 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit());
4526 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
4527 updateMinimumPageHeight(logicalOffset, childLogicalHeight);
4528 if (!pageLogicalHeight || childLogicalHeight > pageLogicalHeight)
4529 return logicalOffset;
4530 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary);
4531 if (remainingLogicalHeight < childLogicalHeight)
4532 return logicalOffset + remainingLogicalHeight;
4533 return logicalOffset;
4534 }
4535
4536 void RenderBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) 4517 void RenderBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage)
4537 { 4518 {
4538 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) 4519 if (RenderFlowThread* flowThread = flowThreadContainingBlock())
4539 flowThread->setPageBreak(offsetFromLogicalTopOfFirstPage() + offset, spa ceShortage); 4520 flowThread->setPageBreak(offsetFromLogicalTopOfFirstPage() + offset, spa ceShortage);
4540 } 4521 }
4541 4522
4542 void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh t) 4523 void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh t)
4543 { 4524 {
4544 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) 4525 if (RenderFlowThread* flowThread = flowThreadContainingBlock())
4545 flowThread->updateMinimumPageHeight(offsetFromLogicalTopOfFirstPage() + offset, minHeight); 4526 flowThread->updateMinimumPageHeight(offsetFromLogicalTopOfFirstPage() + offset, minHeight);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
4809 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 4790 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4810 { 4791 {
4811 showRenderObject(); 4792 showRenderObject();
4812 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 4793 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
4813 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 4794 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
4814 } 4795 }
4815 4796
4816 #endif 4797 #endif
4817 4798
4818 } // namespace blink 4799 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698