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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/MultiColumnFragmentainerGroup.cpp
diff --git a/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/Source/core/layout/MultiColumnFragmentainerGroup.cpp
index 12e4cb0f45a5f463fceb12c834dd0cce5e81a944..668ca251716199381f8c1a5f403b4e417ea6aacf 100644
--- a/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -175,6 +175,37 @@ LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const La
return LayoutPoint(localPoint.x(), localPoint.y() + logicalTopInFlowThreadAt(columnIndex));
}
+LayoutRect MultiColumnFragmentainerGroup::fragmentsBoundingBox(const LayoutRect& boundingBoxInFlowThread) const
+{
+ // Find the start and end column intersected by the bounding box.
+ LayoutRect flippedBoundingBoxInFlowThread(boundingBoxInFlowThread);
+ LayoutFlowThread* flowThread = m_columnSet.flowThread();
+ flowThread->flipForWritingMode(flippedBoundingBoxInFlowThread);
+ bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode();
+ LayoutUnit boundingBoxLogicalTop = isHorizontalWritingMode ? flippedBoundingBoxInFlowThread.y() : flippedBoundingBoxInFlowThread.x();
+ LayoutUnit boundingBoxLogicalBottom = isHorizontalWritingMode ? flippedBoundingBoxInFlowThread.maxY() : flippedBoundingBoxInFlowThread.maxX();
+ if (boundingBoxLogicalBottom <= logicalTopInFlowThread() || boundingBoxLogicalTop >= logicalBottomInFlowThread())
+ return LayoutRect(); // The bounding box doesn't intersect this fragmentainer group.
+ unsigned startColumn;
+ unsigned endColumn;
+ columnIntervalForBlockRangeInFlowThread(boundingBoxLogicalTop, boundingBoxLogicalBottom, startColumn, endColumn);
+
+ LayoutRect startColumnFlowThreadOverflowPortion = flowThreadPortionOverflowRectAt(startColumn);
+ flowThread->flipForWritingMode(startColumnFlowThreadOverflowPortion);
+ LayoutRect startColumnRect(boundingBoxInFlowThread);
+ startColumnRect.intersect(startColumnFlowThreadOverflowPortion);
+ startColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(startColumn)));
+ if (startColumn == endColumn)
+ return startColumnRect; // It all takes place in one column. We're done.
+
+ LayoutRect endColumnFlowThreadOverflowPortion = flowThreadPortionOverflowRectAt(endColumn);
+ flowThread->flipForWritingMode(endColumnFlowThreadOverflowPortion);
+ LayoutRect endColumnRect(boundingBoxInFlowThread);
+ endColumnRect.intersect(endColumnFlowThreadOverflowPortion);
+ endColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(endColumn)));
+ return unionRect(startColumnRect, endColumnRect);
+}
+
void MultiColumnFragmentainerGroup::collectLayerFragments(DeprecatedPaintLayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) const
{
// |layerBoundingBox| is in the flow thread coordinate space, relative to the top/left edge of
« 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