OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/layout/MultiColumnFragmentainerGroup.h" | 7 #include "core/layout/MultiColumnFragmentainerGroup.h" |
8 | 8 |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 | 10 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode(); | 196 bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode(); |
197 | 197 |
198 // Put the layer bounds into flow thread-local coordinates by flipping it fi
rst. Since we're in | 198 // Put the layer bounds into flow thread-local coordinates by flipping it fi
rst. Since we're in |
199 // a layoutObject, most rectangles are represented this way. | 199 // a layoutObject, most rectangles are represented this way. |
200 LayoutRect layerBoundsInFlowThread(layerBoundingBox); | 200 LayoutRect layerBoundsInFlowThread(layerBoundingBox); |
201 flowThread->flipForWritingMode(layerBoundsInFlowThread); | 201 flowThread->flipForWritingMode(layerBoundsInFlowThread); |
202 | 202 |
203 // Now we can compare with the flow thread portions owned by each column. Fi
rst let's | 203 // Now we can compare with the flow thread portions owned by each column. Fi
rst let's |
204 // see if the rect intersects our flow thread portion at all. | 204 // see if the rect intersects our flow thread portion at all. |
205 LayoutRect clippedRect(layerBoundsInFlowThread); | 205 LayoutRect clippedRect(layerBoundsInFlowThread); |
206 clippedRect.intersect(m_columnSet.LayoutRegion::flowThreadPortionOverflowRec
t()); // FIXME: clean up this mess. | 206 clippedRect.intersect(m_columnSet.flowThreadPortionOverflowRect()); |
207 if (clippedRect.isEmpty()) | 207 if (clippedRect.isEmpty()) |
208 return; | 208 return; |
209 | 209 |
210 // Now we know we intersect at least one column. Let's figure out the logica
l top and logical | 210 // Now we know we intersect at least one column. Let's figure out the logica
l top and logical |
211 // bottom of the area we're checking. | 211 // bottom of the area we're checking. |
212 LayoutUnit layerLogicalTop = isHorizontalWritingMode ? layerBoundsInFlowThre
ad.y() : layerBoundsInFlowThread.x(); | 212 LayoutUnit layerLogicalTop = isHorizontalWritingMode ? layerBoundsInFlowThre
ad.y() : layerBoundsInFlowThread.x(); |
213 LayoutUnit layerLogicalBottom = (isHorizontalWritingMode ? layerBoundsInFlow
Thread.maxY() : layerBoundsInFlowThread.maxX()) - 1; | 213 LayoutUnit layerLogicalBottom = (isHorizontalWritingMode ? layerBoundsInFlow
Thread.maxY() : layerBoundsInFlowThread.maxX()) - 1; |
214 | 214 |
215 // Figure out the start and end columns and only check within that range so
that we don't walk the | 215 // Figure out the start and end columns and only check within that range so
that we don't walk the |
216 // entire column row. | 216 // entire column row. |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 { | 490 { |
491 // This function determines the portion of the flow thread that paints for t
he column. Along the inline axis, columns are | 491 // This function determines the portion of the flow thread that paints for t
he column. Along the inline axis, columns are |
492 // unclipped at outside edges (i.e., the first and last column in the set),
and they clip to half the column | 492 // unclipped at outside edges (i.e., the first and last column in the set),
and they clip to half the column |
493 // gap along interior edges. | 493 // gap along interior edges. |
494 // | 494 // |
495 // In the block direction, we will not clip overflow out of the top of the f
irst column, or out of the bottom of | 495 // In the block direction, we will not clip overflow out of the top of the f
irst column, or out of the bottom of |
496 // the last column. This applies only to the true first column and last colu
mn across all column sets. | 496 // the last column. This applies only to the true first column and last colu
mn across all column sets. |
497 // | 497 // |
498 // FIXME: Eventually we will know overflow on a per-column basis, but we can
't do this until we have a painting | 498 // FIXME: Eventually we will know overflow on a per-column basis, but we can
't do this until we have a painting |
499 // mode that understands not to paint contents from a previous column in the
overflow area of a following column. | 499 // mode that understands not to paint contents from a previous column in the
overflow area of a following column. |
500 // This problem applies to regions and pages as well and is not unique to co
lumns. | |
501 bool isFirstColumn = !columnIndex; | 500 bool isFirstColumn = !columnIndex; |
502 bool isLastColumn = columnIndex == columnCount - 1; | 501 bool isLastColumn = columnIndex == columnCount - 1; |
503 bool isLTR = m_columnSet.style()->isLeftToRightDirection(); | 502 bool isLTR = m_columnSet.style()->isLeftToRightDirection(); |
504 bool isLeftmostColumn = isLTR ? isFirstColumn : isLastColumn; | 503 bool isLeftmostColumn = isLTR ? isFirstColumn : isLastColumn; |
505 bool isRightmostColumn = isLTR ? isLastColumn : isFirstColumn; | 504 bool isRightmostColumn = isLTR ? isLastColumn : isFirstColumn; |
506 | 505 |
507 // Calculate the overflow rectangle, based on the flow thread's, clipped at
column logical | 506 // Calculate the overflow rectangle, based on the flow thread's, clipped at
column logical |
508 // top/bottom unless it's the first/last column. | 507 // top/bottom unless it's the first/last column. |
509 LayoutRect overflowRect = m_columnSet.overflowRectForFlowThreadPortion(porti
onRect, isFirstColumn && m_columnSet.isFirstRegion(), isLastColumn && m_columnSe
t.isLastRegion()); | 508 LayoutRect overflowRect = m_columnSet.overflowRectForFlowThreadPortion(porti
onRect, isFirstColumn && !m_columnSet.previousSiblingMultiColumnSet(), isLastCol
umn && !m_columnSet.nextSiblingMultiColumnSet()); |
510 | 509 |
511 // Avoid overflowing into neighboring columns, by clipping in the middle of
adjacent column | 510 // Avoid overflowing into neighboring columns, by clipping in the middle of
adjacent column |
512 // gaps. Also make sure that we avoid rounding errors. | 511 // gaps. Also make sure that we avoid rounding errors. |
513 if (m_columnSet.isHorizontalWritingMode()) { | 512 if (m_columnSet.isHorizontalWritingMode()) { |
514 if (!isLeftmostColumn) | 513 if (!isLeftmostColumn) |
515 overflowRect.shiftXEdgeTo(portionRect.x() - columnGap / 2); | 514 overflowRect.shiftXEdgeTo(portionRect.x() - columnGap / 2); |
516 if (!isRightmostColumn) | 515 if (!isRightmostColumn) |
517 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + columnGap - column
Gap / 2); | 516 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + columnGap - column
Gap / 2); |
518 } else { | 517 } else { |
519 if (!isLeftmostColumn) | 518 if (!isLeftmostColumn) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 append(MultiColumnFragmentainerGroup(m_columnSet)); | 569 append(MultiColumnFragmentainerGroup(m_columnSet)); |
571 return last(); | 570 return last(); |
572 } | 571 } |
573 | 572 |
574 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 573 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
575 { | 574 { |
576 shrink(1); | 575 shrink(1); |
577 } | 576 } |
578 | 577 |
579 } // namespace blink | 578 } // namespace blink |
OLD | NEW |