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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2454083002: Need a deep layout pass when becoming (un)fragmented. (Closed)
Patch Set: Created 4 years, 1 month 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) 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 bool hasSpecifiedPageLogicalHeight = false; 485 bool hasSpecifiedPageLogicalHeight = false;
486 checkForPaginationLogicalHeightChange(pageLogicalHeight, 486 checkForPaginationLogicalHeightChange(pageLogicalHeight,
487 pageLogicalHeightChanged, 487 pageLogicalHeightChanged,
488 hasSpecifiedPageLogicalHeight); 488 hasSpecifiedPageLogicalHeight);
489 if (pageLogicalHeightChanged) 489 if (pageLogicalHeightChanged)
490 relayoutChildren = true; 490 relayoutChildren = true;
491 491
492 LayoutState state(*this, locationOffset(), pageLogicalHeight, 492 LayoutState state(*this, locationOffset(), pageLogicalHeight,
493 pageLogicalHeightChanged, logicalWidthChanged); 493 pageLogicalHeightChanged, logicalWidthChanged);
494 494
495 if (m_paginationStateChanged) {
496 // We now need a deep layout to clean up struts after pagination, if we
497 // just ceased to be paginated, or, if we just became paginated on the
498 // other hand, we now need the deep layout, to insert pagination struts.
499 m_paginationStateChanged = false;
500 state.setPaginationStateChanged();
501 }
502
495 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, 503 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
496 // to track our current maximal positive and negative margins. These values 504 // to track our current maximal positive and negative margins. These values
497 // are used when we are collapsed with adjacent blocks, so for example, if you 505 // are used when we are collapsed with adjacent blocks, so for example, if you
498 // have block A and B collapsing together, then you'd take the maximal 506 // have block A and B collapsing together, then you'd take the maximal
499 // positive margin from both A and B and subtract it from the maximal negative 507 // positive margin from both A and B and subtract it from the maximal negative
500 // margin from both A and B to get the true collapsed margin. This algorithm 508 // margin from both A and B to get the true collapsed margin. This algorithm
501 // is recursive, so when we finish layout() our block knows its current 509 // is recursive, so when we finish layout() our block knows its current
502 // maximal positive/negative values. 510 // maximal positive/negative values.
503 // 511 //
504 // Start out by setting our margin values to our current margins. Table cells 512 // Start out by setting our margin values to our current margins. Table cells
(...skipping 3694 matching lines...) Expand 10 before | Expand all | Expand 10 after
4199 4207
4200 if (multiColumnFlowThread()) { 4208 if (multiColumnFlowThread()) {
4201 ASSERT(oldStyle); 4209 ASSERT(oldStyle);
4202 if (type != getFlowThreadType(*oldStyle)) { 4210 if (type != getFlowThreadType(*oldStyle)) {
4203 // If we're no longer to be multicol/paged, destroy the flow thread. Also 4211 // If we're no longer to be multicol/paged, destroy the flow thread. Also
4204 // destroy it when switching between multicol and paged, since that 4212 // destroy it when switching between multicol and paged, since that
4205 // affects the column set structure (multicol containers may have 4213 // affects the column set structure (multicol containers may have
4206 // spanners, paged containers may not). 4214 // spanners, paged containers may not).
4207 multiColumnFlowThread()->evacuateAndDestroy(); 4215 multiColumnFlowThread()->evacuateAndDestroy();
4208 ASSERT(!multiColumnFlowThread()); 4216 ASSERT(!multiColumnFlowThread());
4217 m_paginationStateChanged = true;
4209 } 4218 }
4210 } 4219 }
4211 4220
4212 if (type == NoFlowThread || multiColumnFlowThread()) 4221 if (type == NoFlowThread || multiColumnFlowThread())
4213 return; 4222 return;
4214 4223
4215 // Ruby elements manage child insertion in a special way, and would mess up 4224 // Ruby elements manage child insertion in a special way, and would mess up
4216 // insertion of the flow thread. The flow thread needs to be a direct child of 4225 // insertion of the flow thread. The flow thread needs to be a direct child of
4217 // the multicol block (|this|). 4226 // the multicol block (|this|).
4218 if (isRuby()) 4227 if (isRuby())
4219 return; 4228 return;
4220 4229
4221 // Form controls are replaced content, and are therefore not supposed to 4230 // Form controls are replaced content, and are therefore not supposed to
4222 // support multicol. 4231 // support multicol.
4223 if (isFileUploadControl() || isTextControl() || isListBox()) 4232 if (isFileUploadControl() || isTextControl() || isListBox())
4224 return; 4233 return;
4225 4234
4226 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); 4235 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type);
4227 addChild(flowThread); 4236 addChild(flowThread);
4237 m_paginationStateChanged = true;
4228 4238
4229 // Check that addChild() put the flow thread as a direct child, and didn't do 4239 // Check that addChild() put the flow thread as a direct child, and didn't do
4230 // fancy things. 4240 // fancy things.
4231 ASSERT(flowThread->parent() == this); 4241 ASSERT(flowThread->parent() == this);
4232 4242
4233 flowThread->populate(); 4243 flowThread->populate();
4234 LayoutBlockFlowRareData& rareData = ensureRareData(); 4244 LayoutBlockFlowRareData& rareData = ensureRareData();
4235 ASSERT(!rareData.m_multiColumnFlowThread); 4245 ASSERT(!rareData.m_multiColumnFlowThread);
4236 rareData.m_multiColumnFlowThread = flowThread; 4246 rareData.m_multiColumnFlowThread = flowThread;
4237 } 4247 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4547 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4538 } 4548 }
4539 4549
4540 void LayoutBlockFlow::invalidateDisplayItemClients( 4550 void LayoutBlockFlow::invalidateDisplayItemClients(
4541 PaintInvalidationReason invalidationReason) const { 4551 PaintInvalidationReason invalidationReason) const {
4542 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4552 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4543 invalidationReason); 4553 invalidationReason);
4544 } 4554 }
4545 4555
4546 } // namespace blink 4556 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698