| OLD | NEW |
| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 401 |
| 402 LayoutAnalyzer::BlockScope analyzer(*this); | 402 LayoutAnalyzer::BlockScope analyzer(*this); |
| 403 SubtreeLayoutScope layoutScope(*this); | 403 SubtreeLayoutScope layoutScope(*this); |
| 404 | 404 |
| 405 LayoutUnit previousHeight = logicalHeight(); | 405 LayoutUnit previousHeight = logicalHeight(); |
| 406 LayoutUnit oldLeft = logicalLeft(); | 406 LayoutUnit oldLeft = logicalLeft(); |
| 407 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); | 407 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); |
| 408 relayoutChildren |= logicalWidthChanged; | 408 relayoutChildren |= logicalWidthChanged; |
| 409 | 409 |
| 410 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); | 410 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); |
| 411 LayoutState state(*this, logicalWidthChanged); | |
| 412 | 411 |
| 413 if (m_paginationStateChanged) { | 412 bool paginationStateChanged = m_paginationStateChanged; |
| 414 // We now need a deep layout to clean up struts after pagination, if we | |
| 415 // just ceased to be paginated, or, if we just became paginated on the | |
| 416 // other hand, we now need the deep layout, to insert pagination struts. | |
| 417 m_paginationStateChanged = false; | |
| 418 state.setPaginationStateChanged(); | |
| 419 } | |
| 420 | |
| 421 bool preferredLogicalWidthsWereDirty = preferredLogicalWidthsDirty(); | 413 bool preferredLogicalWidthsWereDirty = preferredLogicalWidthsDirty(); |
| 422 | 414 |
| 423 // Multiple passes might be required for column based layout. | 415 // Multiple passes might be required for column based layout. |
| 424 // The number of passes could be as high as the number of columns. | 416 // The number of passes could be as high as the number of columns. |
| 425 LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread(); | 417 LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread(); |
| 426 do { | 418 do { |
| 419 LayoutState state(*this, logicalWidthChanged); |
| 420 if (m_paginationStateChanged) { |
| 421 // We now need a deep layout to clean up struts after pagination, if we |
| 422 // just ceased to be paginated, or, if we just became paginated on the |
| 423 // other hand, we now need the deep layout, to insert pagination struts. |
| 424 m_paginationStateChanged = false; |
| 425 state.setPaginationStateChanged(); |
| 426 } |
| 427 |
| 427 layoutChildren(relayoutChildren, layoutScope); | 428 layoutChildren(relayoutChildren, layoutScope); |
| 428 | 429 |
| 429 if (!preferredLogicalWidthsWereDirty && preferredLogicalWidthsDirty()) { | 430 if (!preferredLogicalWidthsWereDirty && preferredLogicalWidthsDirty()) { |
| 430 // The only thing that should dirty preferred widths at this point is the | 431 // The only thing that should dirty preferred widths at this point is the |
| 431 // addition of overflow:auto scrollbars in a descendant. To avoid a | 432 // addition of overflow:auto scrollbars in a descendant. To avoid a |
| 432 // potential infinite loop, run layout again with auto scrollbars frozen | 433 // potential infinite loop, run layout again with auto scrollbars frozen |
| 433 // in their current state. | 434 // in their current state. |
| 434 PaintLayerScrollableArea::FreezeScrollbarsScope freezeScrollbars; | 435 PaintLayerScrollableArea::FreezeScrollbarsScope freezeScrollbars; |
| 435 relayoutChildren |= updateLogicalWidthAndColumnWidth(); | 436 relayoutChildren |= updateLogicalWidthAndColumnWidth(); |
| 436 layoutChildren(relayoutChildren, layoutScope); | 437 layoutChildren(relayoutChildren, layoutScope); |
| 437 } | 438 } |
| 438 | 439 |
| 439 if (flowThread && flowThread->columnHeightsChanged()) { | 440 if (flowThread && flowThread->columnHeightsChanged()) { |
| 440 setChildNeedsLayout(MarkOnlyThis); | 441 setChildNeedsLayout(MarkOnlyThis); |
| 441 continue; | 442 continue; |
| 442 } | 443 } |
| 443 | 444 |
| 444 if (shouldBreakAtLineToAvoidWidow()) { | 445 if (shouldBreakAtLineToAvoidWidow()) { |
| 445 setEverHadLayout(); | 446 setEverHadLayout(); |
| 446 continue; | 447 continue; |
| 447 } | 448 } |
| 448 break; | 449 break; |
| 449 } while (true); | 450 } while (true); |
| 450 | 451 |
| 452 LayoutState state(*this, logicalWidthChanged); |
| 453 if (paginationStateChanged) { |
| 454 // We still haven't laid out positioned descendants, and we need to perform |
| 455 // a deep layout on those too if pagination state changed. |
| 456 state.setPaginationStateChanged(); |
| 457 } |
| 458 |
| 451 // Remember the automatic logical height we got from laying out the children. | 459 // Remember the automatic logical height we got from laying out the children. |
| 452 LayoutUnit unconstrainedHeight = logicalHeight(); | 460 LayoutUnit unconstrainedHeight = logicalHeight(); |
| 453 LayoutUnit unconstrainedClientAfterEdge = clientLogicalBottom(); | 461 LayoutUnit unconstrainedClientAfterEdge = clientLogicalBottom(); |
| 454 | 462 |
| 455 // Adjust logical height to satisfy whatever computed style requires. | 463 // Adjust logical height to satisfy whatever computed style requires. |
| 456 updateLogicalHeight(); | 464 updateLogicalHeight(); |
| 457 | 465 |
| 458 if (!childrenInline()) | 466 if (!childrenInline()) |
| 459 addOverhangingFloatsFromChildren(unconstrainedHeight); | 467 addOverhangingFloatsFromChildren(unconstrainedHeight); |
| 460 | 468 |
| (...skipping 4107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4568 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 4576 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
| 4569 } | 4577 } |
| 4570 | 4578 |
| 4571 void LayoutBlockFlow::invalidateDisplayItemClients( | 4579 void LayoutBlockFlow::invalidateDisplayItemClients( |
| 4572 PaintInvalidationReason invalidationReason) const { | 4580 PaintInvalidationReason invalidationReason) const { |
| 4573 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( | 4581 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( |
| 4574 invalidationReason); | 4582 invalidationReason); |
| 4575 } | 4583 } |
| 4576 | 4584 |
| 4577 } // namespace blink | 4585 } // namespace blink |
| OLD | NEW |