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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 } | 911 } |
912 } | 912 } |
913 m_lastSetWorkedOn = nullptr; | 913 m_lastSetWorkedOn = nullptr; |
914 } | 914 } |
915 | 915 |
916 void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalTopInFlowT
hreadAfterPagination) | 916 void LayoutMultiColumnFlowThread::contentWasLaidOut(LayoutUnit logicalTopInFlowT
hreadAfterPagination) |
917 { | 917 { |
918 // Check if we need another fragmentainer group. If we've run out of columns
in the last | 918 // Check if we need another fragmentainer group. If we've run out of columns
in the last |
919 // fragmentainer group (column row), we need to insert another fragmentainer
group to hold more | 919 // fragmentainer group (column row), we need to insert another fragmentainer
group to hold more |
920 // columns. | 920 // columns. |
921 if (!multiColumnBlockFlow()->isInsideFlowThread()) | 921 |
922 return; // Early bail. We're not nested, so waste no more time on this. | 922 // First figure out if there's any chance that we're nested at all. If we ca
n be sure that |
| 923 // we're not, bail early. This code is run very often, and since locating a
containing flow |
| 924 // thread has some cost (depending on tree depth), avoid calling enclosingFl
owThread() right |
| 925 // away. This test may give some false positives (hence the "mayBe"), if we'
re in an |
| 926 // out-of-flow subtree and have an outer multicol container that doesn't aff
ect us, but that's |
| 927 // okay. We'll discover that further down the road when trying to locate our
enclosing flow |
| 928 // thread for real. |
| 929 bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread(); |
| 930 if (!mayBeNested) |
| 931 return; |
923 if (!isInInitialLayoutPass()) { | 932 if (!isInInitialLayoutPass()) { |
924 // We only insert additional fragmentainer groups in the initial layout
pass. We only want | 933 // We only insert additional fragmentainer groups in the initial layout
pass. We only want |
925 // to balance columns in the last fragmentainer group (if we need to bal
ance at all), so we | 934 // to balance columns in the last fragmentainer group (if we need to bal
ance at all), so we |
926 // want that last fragmentainer group to be the same one in all layout p
asses that follow. | 935 // want that last fragmentainer group to be the same one in all layout p
asses that follow. |
927 return; | 936 return; |
928 } | 937 } |
929 LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(logicalTopInFlowThr
eadAfterPagination); | 938 LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(logicalTopInFlowThr
eadAfterPagination); |
930 if (!columnSet) | 939 if (!columnSet) |
931 return; | 940 return; |
932 MultiColumnFragmentainerGroup& row = columnSet->fragmentainerGroupAtFlowThre
adOffset(logicalTopInFlowThreadAfterPagination); | 941 MultiColumnFragmentainerGroup& row = columnSet->fragmentainerGroupAtFlowThre
adOffset(logicalTopInFlowThreadAfterPagination); |
933 if (!row.isLastGroup()) | 942 if (!row.isLastGroup()) |
934 return; | 943 return; |
935 appendNewFragmentainerGroupIfNeeded(logicalTopInFlowThreadAfterPagination); | 944 appendNewFragmentainerGroupIfNeeded(logicalTopInFlowThreadAfterPagination); |
936 } | 945 } |
937 | 946 |
938 } | 947 } |
OLD | NEW |