Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 return LayoutPoint(localPoint.x() + logicalTopInFlowThreadAt(columnIndex ), localPoint.y()); | 168 return LayoutPoint(localPoint.x() + logicalTopInFlowThreadAt(columnIndex ), localPoint.y()); |
| 169 } | 169 } |
| 170 LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection() ? Lay outUnit() : columnRect.width(); | 170 LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection() ? Lay outUnit() : columnRect.width(); |
| 171 if (localPoint.y() < 0) | 171 if (localPoint.y() < 0) |
| 172 localPoint = LayoutPoint(columnStart, LayoutUnit()); | 172 localPoint = LayoutPoint(columnStart, LayoutUnit()); |
| 173 else if (localPoint.y() > logicalHeight()) | 173 else if (localPoint.y() > logicalHeight()) |
| 174 localPoint = LayoutPoint(columnStart, logicalHeight()); | 174 localPoint = LayoutPoint(columnStart, logicalHeight()); |
| 175 return LayoutPoint(localPoint.x(), localPoint.y() + logicalTopInFlowThreadAt (columnIndex)); | 175 return LayoutPoint(localPoint.x(), localPoint.y() + logicalTopInFlowThreadAt (columnIndex)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 LayoutRect MultiColumnFragmentainerGroup::fragmentsBoundingBox(const LayoutRect& boundingBoxInFlowThread) const | |
|
leviw_travelin_and_unemployed
2015/08/03 21:32:59
It's difficult for me to be 100% certain of this c
| |
| 179 { | |
| 180 // Find the start and end column intersected by the bounding box. | |
| 181 LayoutRect flippedBoundingBoxInFlowThread(boundingBoxInFlowThread); | |
| 182 LayoutFlowThread* flowThread = m_columnSet.flowThread(); | |
| 183 flowThread->flipForWritingMode(flippedBoundingBoxInFlowThread); | |
| 184 bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode(); | |
| 185 LayoutUnit boundingBoxLogicalTop = isHorizontalWritingMode ? flippedBounding BoxInFlowThread.y() : flippedBoundingBoxInFlowThread.x(); | |
| 186 LayoutUnit boundingBoxLogicalBottom = (isHorizontalWritingMode ? flippedBoun dingBoxInFlowThread.maxY() : flippedBoundingBoxInFlowThread.maxX()); | |
|
leviw_travelin_and_unemployed
2015/08/03 21:33:00
Nit: inconsistent parenthesis usage. Perhaps you s
mstensho (USE GERRIT)
2015/08/04 10:48:11
No idea where those extraneous parentheses came fr
| |
| 187 if (boundingBoxLogicalBottom <= logicalTopInFlowThread() || boundingBoxLogic alTop >= logicalBottomInFlowThread()) | |
| 188 return LayoutRect(); // The bounding box doesn't intersect this fragment ainer group. | |
| 189 unsigned startColumn; | |
| 190 unsigned endColumn; | |
| 191 columnIntervalForBlockRangeInFlowThread(boundingBoxLogicalTop, boundingBoxLo gicalBottom, startColumn, endColumn); | |
| 192 | |
| 193 LayoutRect startColumnFlowThreadOverflowPortion = flowThreadPortionOverflowR ectAt(startColumn); | |
| 194 flowThread->flipForWritingMode(startColumnFlowThreadOverflowPortion); | |
| 195 LayoutRect startColumnRect(boundingBoxInFlowThread); | |
| 196 startColumnRect.intersect(startColumnFlowThreadOverflowPortion); | |
| 197 startColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt( startColumn))); | |
| 198 if (startColumn == endColumn) | |
| 199 return startColumnRect; // It all takes place in one column. We're done. | |
| 200 | |
| 201 LayoutRect endColumnFlowThreadOverflowPortion = flowThreadPortionOverflowRec tAt(endColumn); | |
| 202 flowThread->flipForWritingMode(endColumnFlowThreadOverflowPortion); | |
| 203 LayoutRect endColumnRect(boundingBoxInFlowThread); | |
| 204 endColumnRect.intersect(endColumnFlowThreadOverflowPortion); | |
| 205 endColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(en dColumn))); | |
| 206 return unionRect(startColumnRect, endColumnRect); | |
| 207 } | |
| 208 | |
| 178 void MultiColumnFragmentainerGroup::collectLayerFragments(DeprecatedPaintLayerFr agments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyR ect) const | 209 void MultiColumnFragmentainerGroup::collectLayerFragments(DeprecatedPaintLayerFr agments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyR ect) const |
| 179 { | 210 { |
| 180 // |layerBoundingBox| is in the flow thread coordinate space, relative to th e top/left edge of | 211 // |layerBoundingBox| is in the flow thread coordinate space, relative to th e top/left edge of |
| 181 // the flow thread, but note that it has been converted with respect to writ ing mode (so that | 212 // the flow thread, but note that it has been converted with respect to writ ing mode (so that |
| 182 // it's visual/physical in that sense). | 213 // it's visual/physical in that sense). |
| 183 // | 214 // |
| 184 // |dirtyRect| is visual, relative to the multicol container. | 215 // |dirtyRect| is visual, relative to the multicol container. |
| 185 // | 216 // |
| 186 // Then there's the output from this method - the stuff we put into the list of fragments. The | 217 // Then there's the output from this method - the stuff we put into the list of fragments. The |
| 187 // fragment.paginationOffset point is the actual visual translation required to get from a | 218 // fragment.paginationOffset point is the actual visual translation required to get from a |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 append(MultiColumnFragmentainerGroup(m_columnSet)); | 599 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 569 return last(); | 600 return last(); |
| 570 } | 601 } |
| 571 | 602 |
| 572 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 603 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
| 573 { | 604 { |
| 574 shrink(1); | 605 shrink(1); |
| 575 } | 606 } |
| 576 | 607 |
| 577 } // namespace blink | 608 } // namespace blink |
| OLD | NEW |