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

Unified Diff: Source/core/rendering/RenderMultiColumnSet.cpp

Issue 22577002: Clip region based columns properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase master Created 7 years, 3 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 | « LayoutTests/fast/multicol/newmulticol/clipping-top-overflow-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMultiColumnSet.cpp
diff --git a/Source/core/rendering/RenderMultiColumnSet.cpp b/Source/core/rendering/RenderMultiColumnSet.cpp
index e9687251ebba5c0bd55dea1a271d82d6e1c2e57c..61242cc9de03a80dc6bea55c81feb78209278c2e 100644
--- a/Source/core/rendering/RenderMultiColumnSet.cpp
+++ b/Source/core/rendering/RenderMultiColumnSet.cpp
@@ -282,39 +282,25 @@ LayoutRect RenderMultiColumnSet::flowThreadPortionOverflowRect(const LayoutRect&
bool isLastColumn = index == colCount - 1;
bool isLeftmostColumn = style()->isLeftToRightDirection() ? isFirstColumn : isLastColumn;
bool isRightmostColumn = style()->isLeftToRightDirection() ? isLastColumn : isFirstColumn;
- LayoutRect overflowRect(portionRect);
+
+ // Calculate the overflow rectangle, based on the flow thread's, clipped at column logical
+ // top/bottom unless it's the first/last column.
+ LayoutRect overflowRect = overflowRectForFlowThreadPortion(portionRect, isFirstColumn && isFirstRegion(), isLastColumn && isLastRegion());
+
+ // Avoid overflowing into neighboring columns, by clipping in the middle of adjacent column
+ // gaps. Also make sure that we avoid rounding errors.
if (isHorizontalWritingMode()) {
- if (isLeftmostColumn) {
- // Shift to the logical left overflow of the flow thread to make sure it's all covered.
- overflowRect.shiftXEdgeTo(min(flowThread()->visualOverflowRect().x(), portionRect.x()));
- } else {
- // Expand into half of the logical left column gap.
+ if (!isLeftmostColumn)
overflowRect.shiftXEdgeTo(portionRect.x() - colGap / 2);
- }
- if (isRightmostColumn) {
- // Shift to the logical right overflow of the flow thread to ensure content can spill out of the column.
- overflowRect.shiftMaxXEdgeTo(max(flowThread()->visualOverflowRect().maxX(), portionRect.maxX()));
- } else {
- // Expand into half of the logical right column gap.
- overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + colGap / 2);
- }
+ if (!isRightmostColumn)
+ overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + colGap - colGap / 2);
} else {
- if (isLeftmostColumn) {
- // Shift to the logical left overflow of the flow thread to make sure it's all covered.
- overflowRect.shiftYEdgeTo(min(flowThread()->visualOverflowRect().y(), portionRect.y()));
- } else {
- // Expand into half of the logical left column gap.
+ if (!isLeftmostColumn)
overflowRect.shiftYEdgeTo(portionRect.y() - colGap / 2);
- }
- if (isRightmostColumn) {
- // Shift to the logical right overflow of the flow thread to ensure content can spill out of the column.
- overflowRect.shiftMaxYEdgeTo(max(flowThread()->visualOverflowRect().maxY(), portionRect.maxY()));
- } else {
- // Expand into half of the logical right column gap.
- overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + colGap / 2);
- }
+ if (!isRightmostColumn)
+ overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + colGap - colGap / 2);
}
- return overflowRectForFlowThreadPortion(overflowRect, isFirstRegion() && isFirstColumn, isLastRegion() && isLastColumn);
+ return overflowRect;
}
void RenderMultiColumnSet::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
« no previous file with comments | « LayoutTests/fast/multicol/newmulticol/clipping-top-overflow-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698