Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: Source/core/layout/MultiColumnFragmentainerGroup.cpp

Issue 1265933002: Make LayoutFlowThread::fragmentsBoundingBox() faster. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Code review. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 ? flippedBound ingBoxInFlowThread.maxY() : flippedBoundingBoxInFlowThread.maxX();
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
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
OLDNEW
« no previous file with comments | « Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698