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

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

Issue 209863003: [New Multicolumn] balancer confused by content with top margins. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Add test that would fail without these changes. Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/LayoutState.cpp ('k') | Source/core/rendering/RenderFlowThread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 setLogicalHeight(oldLogicalHeight); 221 setLogicalHeight(oldLogicalHeight);
222 } 222 }
223 if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) { 223 if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) {
224 colInfo->setColumnHeight(pageLogicalHeight); 224 colInfo->setColumnHeight(pageLogicalHeight);
225 pageLogicalHeightChanged = true; 225 pageLogicalHeightChanged = true;
226 } 226 }
227 227
228 if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight) 228 if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight)
229 colInfo->clearForcedBreaks(); 229 colInfo->clearForcedBreaks();
230 } else if (isRenderFlowThread()) { 230 } else if (isRenderFlowThread()) {
231 pageLogicalHeight = 1; // This is just a hack to always make sure we hav e a page logical height. 231 RenderFlowThread* flowThread = toRenderFlowThread(this);
232 pageLogicalHeightChanged = toRenderFlowThread(this)->pageLogicalSizeChan ged(); 232
233 // This is a hack to always make sure we have a page logical height, if said height is
ojan 2014/03/27 23:31:31 This should be a FIXME.
234 // known. The page logical height thing in LayoutState is meaningless fo r flow thread-based
235 // pagination (page height isn't necessarily uniform throughout the flow thread), but as
236 // long as it is used universally as a means to determine whether page h eight is known or
237 // not, we need this. Page height is unknown when column balancing is en abled and flow
238 // thread height is still unknown (i.e. during the first layout pass). W hen it's unknown, we
239 // need to prevent the pagination code from assuming page breaks everywh ere and thereby
240 // eating every top margin. It should be trivial to clean up and get rid of this hack once
241 // the old multicol implementation is gone.
242 pageLogicalHeight = flowThread->isPageLogicalHeightKnown() ? LayoutUnit( 1) : LayoutUnit(0);
243
244 pageLogicalHeightChanged = flowThread->pageLogicalSizeChanged();
233 } 245 }
234 } 246 }
235 247
236 bool RenderBlockFlow::shouldRelayoutForPagination(LayoutUnit& pageLogicalHeight, LayoutUnit layoutOverflowLogicalBottom) const 248 bool RenderBlockFlow::shouldRelayoutForPagination(LayoutUnit& pageLogicalHeight, LayoutUnit layoutOverflowLogicalBottom) const
237 { 249 {
238 // FIXME: We don't balance properly at all in the presence of forced page br eaks. We need to understand what 250 // FIXME: We don't balance properly at all in the presence of forced page br eaks. We need to understand what
239 // the distance between forced page breaks is so that we can avoid making th e minimum column height too tall. 251 // the distance between forced page breaks is so that we can avoid making th e minimum column height too tall.
240 ColumnInfo* colInfo = columnInfo(); 252 ColumnInfo* colInfo = columnInfo();
241 LayoutUnit columnHeight = pageLogicalHeight; 253 LayoutUnit columnHeight = pageLogicalHeight;
242 const int minColumnCount = colInfo->forcedBreaks() + 1; 254 const int minColumnCount = colInfo->forcedBreaks() + 1;
(...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2825 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2814 { 2826 {
2815 if (m_rareData) 2827 if (m_rareData)
2816 return *m_rareData; 2828 return *m_rareData;
2817 2829
2818 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2830 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2819 return *m_rareData; 2831 return *m_rareData;
2820 } 2832 }
2821 2833
2822 } // namespace WebCore 2834 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/LayoutState.cpp ('k') | Source/core/rendering/RenderFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698