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

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

Issue 2590463002: Make column snapping optional when translating to flow thread coordinates. (Closed)
Patch Set: Created 4 years 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 d2154a764a9e0673bd3fee9bff272e00f89e256d..ceba040700e23c28d2256d79b7bb1c2f2fc751b9 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -181,36 +181,34 @@ LayoutUnit MultiColumnFragmentainerGroup::columnLogicalTopForOffset(
}
LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(
- const LayoutPoint& visualPoint) const {
+ const LayoutPoint& visualPoint,
+ SnapToColumnPolicy snap) const {
unsigned columnIndex = columnIndexAtVisualPoint(visualPoint);
LayoutRect columnRect = columnRectAt(columnIndex);
LayoutPoint localPoint(visualPoint);
localPoint.moveBy(-columnRect.location());
- // Before converting to a flow thread position, if the block direction
- // coordinate is outside the column, snap to the bounds of the column, and
- // reset the inline direction coordinate to the start position in the column.
- // The effect of this is that if the block position is before the column
- // rectangle, we'll get to the beginning of this column, while if the block
- // position is after the column rectangle, we'll get to the beginning of the
- // next column.
if (!m_columnSet.isHorizontalWritingMode()) {
- LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection()
- ? LayoutUnit()
- : columnRect.height();
- if (localPoint.x() < 0)
- localPoint = LayoutPoint(LayoutUnit(), columnStart);
- else if (localPoint.x() > logicalHeight())
- localPoint = LayoutPoint(logicalHeight(), columnStart);
+ if (snap == SnapToColumn) {
+ LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection()
+ ? LayoutUnit()
+ : columnRect.height();
+ if (localPoint.x() < 0)
+ localPoint = LayoutPoint(LayoutUnit(), columnStart);
+ else if (localPoint.x() > logicalHeight())
+ localPoint = LayoutPoint(logicalHeight(), columnStart);
+ }
return LayoutPoint(localPoint.x() + logicalTopInFlowThreadAt(columnIndex),
localPoint.y());
}
- LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection()
- ? LayoutUnit()
- : columnRect.width();
- if (localPoint.y() < 0)
- localPoint = LayoutPoint(columnStart, LayoutUnit());
- else if (localPoint.y() > logicalHeight())
- localPoint = LayoutPoint(columnStart, logicalHeight());
+ if (snap == SnapToColumn) {
+ LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection()
+ ? LayoutUnit()
+ : columnRect.width();
+ if (localPoint.y() < 0)
+ localPoint = LayoutPoint(columnStart, LayoutUnit());
+ else if (localPoint.y() > logicalHeight())
+ localPoint = LayoutPoint(columnStart, logicalHeight());
+ }
return LayoutPoint(localPoint.x(),
localPoint.y() + logicalTopInFlowThreadAt(columnIndex));
}

Powered by Google App Engine
This is Rietveld 408576698