| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 columnSet = previousSet; | 488 columnSet = previousSet; |
| 489 } | 489 } |
| 490 // Avoid returning zero-height column sets, if possible. We found a column set | 490 // Avoid returning zero-height column sets, if possible. We found a column set |
| 491 // based on a flow thread coordinate. If multiple column sets share that | 491 // based on a flow thread coordinate. If multiple column sets share that |
| 492 // coordinate (because we have zero-height column sets between column | 492 // coordinate (because we have zero-height column sets between column |
| 493 // spanners, for instance), look for one that has a height. | 493 // spanners, for instance), look for one that has a height. |
| 494 for (LayoutMultiColumnSet* walker = columnSet; walker; | 494 for (LayoutMultiColumnSet* walker = columnSet; walker; |
| 495 walker = walker->nextSiblingMultiColumnSet()) { | 495 walker = walker->nextSiblingMultiColumnSet()) { |
| 496 if (!walker->isPageLogicalHeightKnown()) | 496 if (!walker->isPageLogicalHeightKnown()) |
| 497 continue; | 497 continue; |
| 498 if (walker->logicalTopInFlowThread() == offset) | 498 if (pageBoundaryRule == AssociateWithFormerPage) { |
| 499 if (walker->logicalTopInFlowThread() < offset && |
| 500 walker->logicalBottomInFlowThread() >= offset) |
| 501 return walker; |
| 502 } |
| 503 if (walker->logicalTopInFlowThread() <= offset && |
| 504 walker->logicalBottomInFlowThread() > offset) |
| 499 return walker; | 505 return walker; |
| 500 break; | 506 break; |
| 501 } | 507 } |
| 502 return columnSet; | 508 return columnSet; |
| 503 } | 509 } |
| 504 | 510 |
| 505 void LayoutMultiColumnFlowThread::layoutColumns( | 511 void LayoutMultiColumnFlowThread::layoutColumns( |
| 506 SubtreeLayoutScope& layoutScope) { | 512 SubtreeLayoutScope& layoutScope) { |
| 507 // Since we ended up here, it means that the multicol container (our parent) | 513 // Since we ended up here, it means that the multicol container (our parent) |
| 508 // needed layout. Since contents of the multicol container are diverted to the | 514 // needed layout. Since contents of the multicol container are diverted to the |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 LayoutFlowThread::willBeRemovedFromTree(); | 895 LayoutFlowThread::willBeRemovedFromTree(); |
| 890 } | 896 } |
| 891 | 897 |
| 892 void LayoutMultiColumnFlowThread::skipColumnSpanner( | 898 void LayoutMultiColumnFlowThread::skipColumnSpanner( |
| 893 LayoutBox* layoutObject, | 899 LayoutBox* layoutObject, |
| 894 LayoutUnit logicalTopInFlowThread) { | 900 LayoutUnit logicalTopInFlowThread) { |
| 895 ASSERT(layoutObject->isColumnSpanAll()); | 901 ASSERT(layoutObject->isColumnSpanAll()); |
| 896 LayoutMultiColumnSpannerPlaceholder* placeholder = | 902 LayoutMultiColumnSpannerPlaceholder* placeholder = |
| 897 layoutObject->spannerPlaceholder(); | 903 layoutObject->spannerPlaceholder(); |
| 898 LayoutBox* previousColumnBox = placeholder->previousSiblingMultiColumnBox(); | 904 LayoutBox* previousColumnBox = placeholder->previousSiblingMultiColumnBox(); |
| 899 if (previousColumnBox && previousColumnBox->isLayoutMultiColumnSet()) { | 905 if (previousColumnBox && previousColumnBox->isLayoutMultiColumnSet()) |
| 900 LayoutMultiColumnSet* columnSet = toLayoutMultiColumnSet(previousColumnBox); | 906 toLayoutMultiColumnSet(previousColumnBox)->endFlow(logicalTopInFlowThread); |
| 901 // Negative margins may cause this. | |
| 902 if (logicalTopInFlowThread < columnSet->logicalTopInFlowThread()) | |
| 903 logicalTopInFlowThread = columnSet->logicalTopInFlowThread(); | |
| 904 columnSet->endFlow(logicalTopInFlowThread); | |
| 905 } | |
| 906 LayoutBox* nextColumnBox = placeholder->nextSiblingMultiColumnBox(); | 907 LayoutBox* nextColumnBox = placeholder->nextSiblingMultiColumnBox(); |
| 907 if (nextColumnBox && nextColumnBox->isLayoutMultiColumnSet()) { | 908 if (nextColumnBox && nextColumnBox->isLayoutMultiColumnSet()) { |
| 908 LayoutMultiColumnSet* nextSet = toLayoutMultiColumnSet(nextColumnBox); | 909 LayoutMultiColumnSet* nextSet = toLayoutMultiColumnSet(nextColumnBox); |
| 909 m_lastSetWorkedOn = nextSet; | 910 m_lastSetWorkedOn = nextSet; |
| 910 nextSet->beginFlow(logicalTopInFlowThread); | 911 nextSet->beginFlow(logicalTopInFlowThread); |
| 911 } | 912 } |
| 912 | 913 |
| 913 // We'll lay out of spanners after flow thread layout has finished (during | 914 // We'll lay out of spanners after flow thread layout has finished (during |
| 914 // layout of the spanner placeholders). There may be containing blocks for | 915 // layout of the spanner placeholders). There may be containing blocks for |
| 915 // out-of-flow positioned descendants of the spanner in the flow thread, so | 916 // out-of-flow positioned descendants of the spanner in the flow thread, so |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 const { | 1370 const { |
| 1370 return MultiColumnLayoutState(m_lastSetWorkedOn); | 1371 return MultiColumnLayoutState(m_lastSetWorkedOn); |
| 1371 } | 1372 } |
| 1372 | 1373 |
| 1373 void LayoutMultiColumnFlowThread::restoreMultiColumnLayoutState( | 1374 void LayoutMultiColumnFlowThread::restoreMultiColumnLayoutState( |
| 1374 const MultiColumnLayoutState& state) { | 1375 const MultiColumnLayoutState& state) { |
| 1375 m_lastSetWorkedOn = state.columnSet(); | 1376 m_lastSetWorkedOn = state.columnSet(); |
| 1376 } | 1377 } |
| 1377 | 1378 |
| 1378 } // namespace blink | 1379 } // namespace blink |
| OLD | NEW |