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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1393673004: Factor out the actual break checking from apply{After,Before}Break(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 48d04802eb0c88421010c1dfa81c39d00c34cc77..7dd15498787ce8cc6a45bfd7a3df4fbea49e4c71 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -153,19 +153,6 @@ public:
void setLastChildIsSelfCollapsingBlockWithClearance(bool value) { m_lastChildIsSelfCollapsingBlockWithClearance = value; }
bool lastChildIsSelfCollapsingBlockWithClearance() const { return m_lastChildIsSelfCollapsingBlockWithClearance; }
};
-static bool inNormalFlow(LayoutBox* child)
-{
- LayoutBlock* curr = child->containingBlock();
- LayoutView* layoutView = child->view();
- while (curr && curr != layoutView) {
- if (curr->isLayoutFlowThread())
- return true;
- if (curr->isFloatingOrOutOfFlowPositioned())
- return false;
- curr = curr->containingBlock();
- }
- return true;
-}
LayoutBlockFlow::LayoutBlockFlow(ContainerNode* node)
: LayoutBlock(node)
@@ -1716,14 +1703,8 @@ bool LayoutBlockFlow::mustSeparateMarginAfterForChild(const LayoutBox& child) co
LayoutUnit LayoutBlockFlow::applyBeforeBreak(LayoutBox& child, LayoutUnit logicalOffset)
{
- // FIXME: Add page break checking here when we support printing.
- LayoutFlowThread* flowThread = flowThreadContainingBlock();
- bool checkColumnBreaks = flowThread;
- bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogicalHeight(); // FIXME: Once columns can print we have to check this.
- bool checkBeforeAlways = (checkColumnBreaks && child.style()->columnBreakBefore() == PBALWAYS)
- || (checkPageBreaks && child.style()->pageBreakBefore() == PBALWAYS);
- if (checkBeforeAlways && inNormalFlow(&child)) {
- if (checkColumnBreaks) {
+ if (child.hasForcedBreakBefore()) {
+ if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) {
LayoutUnit offsetBreakAdjustment = 0;
if (flowThread->addForcedColumnBreak(offsetFromLogicalTopOfFirstPage() + logicalOffset, &child, true, &offsetBreakAdjustment))
return logicalOffset + offsetBreakAdjustment;
@@ -1735,17 +1716,11 @@ LayoutUnit LayoutBlockFlow::applyBeforeBreak(LayoutBox& child, LayoutUnit logica
LayoutUnit LayoutBlockFlow::applyAfterBreak(LayoutBox& child, LayoutUnit logicalOffset, MarginInfo& marginInfo)
{
- // FIXME: Add page break checking here when we support printing.
- LayoutFlowThread* flowThread = flowThreadContainingBlock();
- bool checkColumnBreaks = flowThread;
- bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogicalHeight(); // FIXME: Once columns can print we have to check this.
- bool checkAfterAlways = (checkColumnBreaks && child.style()->columnBreakAfter() == PBALWAYS)
- || (checkPageBreaks && child.style()->pageBreakAfter() == PBALWAYS);
- if (checkAfterAlways && inNormalFlow(&child)) {
+ if (child.hasForcedBreakAfter()) {
// So our margin doesn't participate in the next collapsing steps.
marginInfo.clearMargin();
- if (checkColumnBreaks) {
+ if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) {
LayoutUnit offsetBreakAdjustment = 0;
if (flowThread->addForcedColumnBreak(offsetFromLogicalTopOfFirstPage() + logicalOffset, &child, false, &offsetBreakAdjustment))
return logicalOffset + offsetBreakAdjustment;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698