| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/layout/LayoutFlowThread.h" | 32 #include "core/layout/LayoutFlowThread.h" |
| 33 | 33 |
| 34 #include "core/layout/LayoutMultiColumnSet.h" | 34 #include "core/layout/LayoutMultiColumnSet.h" |
| 35 #include "core/layout/LayoutView.h" | 35 #include "core/layout/LayoutView.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 LayoutFlowThread::LayoutFlowThread() | 39 LayoutFlowThread::LayoutFlowThread() |
| 40 : LayoutBlockFlow(nullptr) | 40 : LayoutBlockFlow(nullptr) |
| 41 , m_columnSetsInvalidated(false) | 41 , m_columnSetsInvalidated(false) |
| 42 , m_columnSetsHaveUniformLogicalHeight(true) | |
| 43 , m_pageLogicalSizeChanged(false) | 42 , m_pageLogicalSizeChanged(false) |
| 44 { | 43 { |
| 45 } | 44 } |
| 46 | 45 |
| 47 void LayoutFlowThread::removeColumnSetFromThread(LayoutMultiColumnSet* columnSet
) | 46 void LayoutFlowThread::removeColumnSetFromThread(LayoutMultiColumnSet* columnSet
) |
| 48 { | 47 { |
| 49 ASSERT(columnSet); | 48 ASSERT(columnSet); |
| 50 m_multiColumnSetList.remove(columnSet); | 49 m_multiColumnSetList.remove(columnSet); |
| 51 invalidateColumnSets(); | 50 invalidateColumnSets(); |
| 52 // Clear the interval tree right away, instead of leaving it around with dea
d objects. Not that | 51 // Clear the interval tree right away, instead of leaving it around with dea
d objects. Not that |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 return; | 63 return; |
| 65 } | 64 } |
| 66 | 65 |
| 67 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::ColumnsChan
ged); | 66 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::ColumnsChan
ged); |
| 68 | 67 |
| 69 m_columnSetsInvalidated = true; | 68 m_columnSetsInvalidated = true; |
| 70 } | 69 } |
| 71 | 70 |
| 72 void LayoutFlowThread::validateColumnSets() | 71 void LayoutFlowThread::validateColumnSets() |
| 73 { | 72 { |
| 74 if (m_columnSetsInvalidated) { | 73 m_columnSetsInvalidated = false; |
| 75 m_columnSetsInvalidated = false; | |
| 76 m_columnSetsHaveUniformLogicalHeight = true; | |
| 77 | |
| 78 if (hasColumnSets()) { | |
| 79 LayoutUnit previousLogicalHeight = 0; | |
| 80 bool firstVisited = false; | |
| 81 | |
| 82 for (auto* columnSet : m_multiColumnSetList) { | |
| 83 LayoutUnit currentLogicalHeight = columnSet->pageLogicalHeight()
; | |
| 84 | |
| 85 if (!firstVisited) { | |
| 86 firstVisited = true; | |
| 87 } else { | |
| 88 if (m_columnSetsHaveUniformLogicalHeight && previousLogicalH
eight != currentLogicalHeight) | |
| 89 m_columnSetsHaveUniformLogicalHeight = false; | |
| 90 } | |
| 91 | |
| 92 previousLogicalHeight = currentLogicalHeight; | |
| 93 } | |
| 94 } | |
| 95 } | |
| 96 | |
| 97 updateLogicalWidth(); // Called to get the maximum logical width for the col
umnSet. | 74 updateLogicalWidth(); // Called to get the maximum logical width for the col
umnSet. |
| 98 generateColumnSetIntervalTree(); | 75 generateColumnSetIntervalTree(); |
| 99 } | 76 } |
| 100 | 77 |
| 101 void LayoutFlowThread::mapRectToPaintInvalidationBacking(const LayoutBoxModelObj
ect* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState*
paintInvalidationState) const | 78 void LayoutFlowThread::mapRectToPaintInvalidationBacking(const LayoutBoxModelObj
ect* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState*
paintInvalidationState) const |
| 102 { | 79 { |
| 103 ASSERT(paintInvalidationContainer != this); // A flow thread should never be
an invalidation container. | 80 ASSERT(paintInvalidationContainer != this); // A flow thread should never be
an invalidation container. |
| 104 // |rect| is a layout rectangle, where the block direction coordinate is fli
pped for writing | 81 // |rect| is a layout rectangle, where the block direction coordinate is fli
pped for writing |
| 105 // mode. fragmentsBoundingBox(), on the other hand, works on physical rectan
gles, so we need to | 82 // mode. fragmentsBoundingBox(), on the other hand, works on physical rectan
gles, so we need to |
| 106 // flip the rectangle before and after calling it. | 83 // flip the rectangle before and after calling it. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 179 |
| 203 void LayoutFlowThread::MultiColumnSetSearchAdapter::collectIfNeeded(const MultiC
olumnSetInterval& interval) | 180 void LayoutFlowThread::MultiColumnSetSearchAdapter::collectIfNeeded(const MultiC
olumnSetInterval& interval) |
| 204 { | 181 { |
| 205 if (m_result) | 182 if (m_result) |
| 206 return; | 183 return; |
| 207 if (interval.low() <= m_offset && interval.high() > m_offset) | 184 if (interval.low() <= m_offset && interval.high() > m_offset) |
| 208 m_result = interval.data(); | 185 m_result = interval.data(); |
| 209 } | 186 } |
| 210 | 187 |
| 211 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |