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

Unified Diff: third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp

Issue 1907443003: Translate flow thread coords to the nearest enclosing coord space when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a unit test too. Created 4 years, 8 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
Index: third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
index e2fae001494443f1b73553c66da12291d449c651..5af30a3bff4a1202b6c641892aa9fdaf2a86ff2d 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -98,7 +98,7 @@ bool MultiColumnFragmentainerGroup::recalculateColumnHeight()
return true; // Need another pass.
}
-LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUnit offsetInFlowThread) const
+LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUnit offsetInFlowThread, CoordinateSpaceConversion mode) const
{
LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread();
unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread);
@@ -107,6 +107,9 @@ LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn
LayoutRect columnRect(columnRectAt(columnIndex));
m_columnSet.flipForWritingMode(columnRect);
LayoutSize translationRelativeToGroup = columnRect.location() - portionRect.location();
+ LayoutSize translationRelativeToFlowThread = translationRelativeToGroup + offsetFromColumnSet() + m_columnSet.topLeftLocationOffset() - flowThread->topLeftLocationOffset();
+ if (mode == CoordinateSpaceConversion::Containing)
+ return translationRelativeToFlowThread;
LayoutSize enclosingTranslation;
if (LayoutMultiColumnFlowThread* enclosingFlowThread = flowThread->enclosingFlowThread()) {
@@ -114,11 +117,11 @@ LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn
// Translation that would map points in the coordinate space of the outermost flow thread to
// visual points in the first column in the first fragmentainer group (row) in our multicol
// container.
- LayoutSize enclosingTranslationOrigin = enclosingFlowThread->flowThreadTranslationAtOffset(firstRow.blockOffsetInEnclosingFragmentationContext());
+ LayoutSize enclosingTranslationOrigin = enclosingFlowThread->flowThreadTranslationAtOffset(firstRow.blockOffsetInEnclosingFragmentationContext(), mode);
// Translation that would map points in the coordinate space of the outermost flow thread to
// visual points in the first column in this fragmentainer group.
- enclosingTranslation = enclosingFlowThread->flowThreadTranslationAtOffset(blockOffsetInEnclosingFragmentationContext());
+ enclosingTranslation = enclosingFlowThread->flowThreadTranslationAtOffset(blockOffsetInEnclosingFragmentationContext(), mode);
// What we ultimately return from this method is a translation that maps points in the
// coordinate space of our flow thread to a visual point in a certain column in this
@@ -129,7 +132,7 @@ LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn
enclosingTranslation -= enclosingTranslationOrigin;
}
- return enclosingTranslation + translationRelativeToGroup + offsetFromColumnSet() + m_columnSet.topLeftLocationOffset() - flowThread->topLeftLocationOffset();
+ return enclosingTranslation + translationRelativeToFlowThread;
}
LayoutUnit MultiColumnFragmentainerGroup::columnLogicalTopForOffset(LayoutUnit offsetInFlowThread) const
@@ -184,7 +187,7 @@ LayoutRect MultiColumnFragmentainerGroup::fragmentsBoundingBox(const LayoutRect&
flowThread->flipForWritingMode(startColumnFlowThreadOverflowPortion);
LayoutRect startColumnRect(boundingBoxInFlowThread);
startColumnRect.intersect(startColumnFlowThreadOverflowPortion);
- startColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(startColumn)));
+ startColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(startColumn), CoordinateSpaceConversion::Containing));
if (startColumn == endColumn)
return startColumnRect; // It all takes place in one column. We're done.
@@ -192,7 +195,7 @@ LayoutRect MultiColumnFragmentainerGroup::fragmentsBoundingBox(const LayoutRect&
flowThread->flipForWritingMode(endColumnFlowThreadOverflowPortion);
LayoutRect endColumnRect(boundingBoxInFlowThread);
endColumnRect.intersect(endColumnFlowThreadOverflowPortion);
- endColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(endColumn)));
+ endColumnRect.move(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(endColumn), CoordinateSpaceConversion::Containing));
return unionRect(startColumnRect, endColumnRect);
}
@@ -251,7 +254,7 @@ void MultiColumnFragmentainerGroup::collectLayerFragments(PaintLayerFragments& f
PaintLayerFragment fragment;
// Set the physical translation offset.
- fragment.paginationOffset = toLayoutPoint(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(i)));
+ fragment.paginationOffset = toLayoutPoint(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(i), CoordinateSpaceConversion::Visual));
// Set the overflow clip rect that corresponds to the column.
fragment.paginationClip = flowThreadPortionOverflowRectAt(i);

Powered by Google App Engine
This is Rietveld 408576698