OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // In the block direction, we will not clip overflow out of the top of the f
irst column, or out of the bottom of | 275 // In the block direction, we will not clip overflow out of the top of the f
irst column, or out of the bottom of |
276 // the last column. This applies only to the true first column and last colu
mn across all column sets. | 276 // the last column. This applies only to the true first column and last colu
mn across all column sets. |
277 // | 277 // |
278 // FIXME: Eventually we will know overflow on a per-column basis, but we can
't do this until we have a painting | 278 // FIXME: Eventually we will know overflow on a per-column basis, but we can
't do this until we have a painting |
279 // mode that understands not to paint contents from a previous column in the
overflow area of a following column. | 279 // mode that understands not to paint contents from a previous column in the
overflow area of a following column. |
280 // This problem applies to regions and pages as well and is not unique to co
lumns. | 280 // This problem applies to regions and pages as well and is not unique to co
lumns. |
281 bool isFirstColumn = !index; | 281 bool isFirstColumn = !index; |
282 bool isLastColumn = index == colCount - 1; | 282 bool isLastColumn = index == colCount - 1; |
283 bool isLeftmostColumn = style()->isLeftToRightDirection() ? isFirstColumn :
isLastColumn; | 283 bool isLeftmostColumn = style()->isLeftToRightDirection() ? isFirstColumn :
isLastColumn; |
284 bool isRightmostColumn = style()->isLeftToRightDirection() ? isLastColumn :
isFirstColumn; | 284 bool isRightmostColumn = style()->isLeftToRightDirection() ? isLastColumn :
isFirstColumn; |
285 LayoutRect overflowRect(portionRect); | 285 |
| 286 // Calculate the overflow rectangle, based on the flow thread's, clipped at
column logical |
| 287 // top/bottom unless it's the first/last column. |
| 288 LayoutRect overflowRect = overflowRectForFlowThreadPortion(portionRect, isFi
rstColumn && isFirstRegion(), isLastColumn && isLastRegion()); |
| 289 |
| 290 // Avoid overflowing into neighboring columns, by clipping in the middle of
adjacent column |
| 291 // gaps. Also make sure that we avoid rounding errors. |
286 if (isHorizontalWritingMode()) { | 292 if (isHorizontalWritingMode()) { |
287 if (isLeftmostColumn) { | 293 if (!isLeftmostColumn) |
288 // Shift to the logical left overflow of the flow thread to make sur
e it's all covered. | |
289 overflowRect.shiftXEdgeTo(min(flowThread()->visualOverflowRect().x()
, portionRect.x())); | |
290 } else { | |
291 // Expand into half of the logical left column gap. | |
292 overflowRect.shiftXEdgeTo(portionRect.x() - colGap / 2); | 294 overflowRect.shiftXEdgeTo(portionRect.x() - colGap / 2); |
293 } | 295 if (!isRightmostColumn) |
294 if (isRightmostColumn) { | 296 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + colGap - colGap /
2); |
295 // Shift to the logical right overflow of the flow thread to ensure
content can spill out of the column. | |
296 overflowRect.shiftMaxXEdgeTo(max(flowThread()->visualOverflowRect().
maxX(), portionRect.maxX())); | |
297 } else { | |
298 // Expand into half of the logical right column gap. | |
299 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + colGap / 2); | |
300 } | |
301 } else { | 297 } else { |
302 if (isLeftmostColumn) { | 298 if (!isLeftmostColumn) |
303 // Shift to the logical left overflow of the flow thread to make sur
e it's all covered. | |
304 overflowRect.shiftYEdgeTo(min(flowThread()->visualOverflowRect().y()
, portionRect.y())); | |
305 } else { | |
306 // Expand into half of the logical left column gap. | |
307 overflowRect.shiftYEdgeTo(portionRect.y() - colGap / 2); | 299 overflowRect.shiftYEdgeTo(portionRect.y() - colGap / 2); |
308 } | 300 if (!isRightmostColumn) |
309 if (isRightmostColumn) { | 301 overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + colGap - colGap /
2); |
310 // Shift to the logical right overflow of the flow thread to ensure
content can spill out of the column. | |
311 overflowRect.shiftMaxYEdgeTo(max(flowThread()->visualOverflowRect().
maxY(), portionRect.maxY())); | |
312 } else { | |
313 // Expand into half of the logical right column gap. | |
314 overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + colGap / 2); | |
315 } | |
316 } | 302 } |
317 return overflowRectForFlowThreadPortion(overflowRect, isFirstRegion() && isF
irstColumn, isLastRegion() && isLastColumn); | 303 return overflowRect; |
318 } | 304 } |
319 | 305 |
320 void RenderMultiColumnSet::paintObject(PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 306 void RenderMultiColumnSet::paintObject(PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
321 { | 307 { |
322 if (style()->visibility() != VISIBLE) | 308 if (style()->visibility() != VISIBLE) |
323 return; | 309 return; |
324 | 310 |
325 RenderBlock::paintObject(paintInfo, paintOffset); | 311 RenderBlock::paintObject(paintInfo, paintOffset); |
326 | 312 |
327 // FIXME: Right now we're only painting in the foreground phase. | 313 // FIXME: Right now we're only painting in the foreground phase. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 fragments.append(fragment); | 494 fragments.append(fragment); |
509 } | 495 } |
510 } | 496 } |
511 | 497 |
512 const char* RenderMultiColumnSet::renderName() const | 498 const char* RenderMultiColumnSet::renderName() const |
513 { | 499 { |
514 return "RenderMultiColumnSet"; | 500 return "RenderMultiColumnSet"; |
515 } | 501 } |
516 | 502 |
517 } | 503 } |
OLD | NEW |