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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "core/rendering/PaintInfo.h" | 29 #include "core/rendering/PaintInfo.h" |
30 #include "core/rendering/RenderLayer.h" | 30 #include "core/rendering/RenderLayer.h" |
31 #include "core/rendering/RenderMultiColumnFlowThread.h" | 31 #include "core/rendering/RenderMultiColumnFlowThread.h" |
32 | 32 |
33 using namespace std; | 33 using namespace std; |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 RenderMultiColumnSet::RenderMultiColumnSet(RenderFlowThread* flowThread) | 37 RenderMultiColumnSet::RenderMultiColumnSet(RenderFlowThread* flowThread) |
38 : RenderRegionSet(0, flowThread) | 38 : RenderRegion(0, flowThread) |
39 , m_computedColumnCount(1) | 39 , m_computedColumnCount(1) |
40 , m_computedColumnWidth(0) | 40 , m_computedColumnWidth(0) |
41 , m_computedColumnHeight(0) | 41 , m_computedColumnHeight(0) |
42 , m_maxColumnHeight(RenderFlowThread::maxLogicalHeight()) | 42 , m_maxColumnHeight(RenderFlowThread::maxLogicalHeight()) |
43 , m_minSpaceShortage(RenderFlowThread::maxLogicalHeight()) | 43 , m_minSpaceShortage(RenderFlowThread::maxLogicalHeight()) |
44 , m_minimumColumnHeight(0) | 44 , m_minimumColumnHeight(0) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 RenderMultiColumnSet* RenderMultiColumnSet::createAnonymous(RenderFlowThread* fl
owThread, RenderStyle* parentStyle) | 48 RenderMultiColumnSet* RenderMultiColumnSet::createAnonymous(RenderFlowThread* fl
owThread, RenderStyle* parentStyle) |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } else { | 279 } else { |
280 setAndConstrainColumnHeight(heightAdjustedForSetOffset(multiColumnFlowTh
read()->columnHeightAvailable())); | 280 setAndConstrainColumnHeight(heightAdjustedForSetOffset(multiColumnFlowTh
read()->columnHeightAvailable())); |
281 } | 281 } |
282 | 282 |
283 clearForcedBreaks(); | 283 clearForcedBreaks(); |
284 | 284 |
285 // Nuke previously stored minimum column height. Contents may have changed f
or all we know. | 285 // Nuke previously stored minimum column height. Contents may have changed f
or all we know. |
286 m_minimumColumnHeight = 0; | 286 m_minimumColumnHeight = 0; |
287 } | 287 } |
288 | 288 |
| 289 void RenderMultiColumnSet::expandToEncompassFlowThreadContentsIfNeeded() |
| 290 { |
| 291 ASSERT(multiColumnFlowThread()->lastMultiColumnSet() == this); |
| 292 LayoutRect rect(flowThreadPortionRect()); |
| 293 |
| 294 // Get the offset within the flow thread in its block progression direction.
Then get the |
| 295 // flow thread's remaining logical height including its overflow and expand
our rect |
| 296 // to encompass that remaining height and overflow. The idea is that we will
generate |
| 297 // additional columns and pages to hold that overflow, since people do write
bad |
| 298 // content like <body style="height:0px"> in multi-column layouts. |
| 299 bool isHorizontal = flowThread()->isHorizontalWritingMode(); |
| 300 LayoutUnit logicalTopOffset = isHorizontal ? rect.y() : rect.x(); |
| 301 LayoutRect layoutRect = flowThread()->layoutOverflowRect(); |
| 302 LayoutUnit logicalHeightWithOverflow = (isHorizontal ? layoutRect.maxY() : l
ayoutRect.maxX()) - logicalTopOffset; |
| 303 setFlowThreadPortionRect(LayoutRect(rect.x(), rect.y(), isHorizontal ? rect.
width() : logicalHeightWithOverflow, isHorizontal ? logicalHeightWithOverflow :
rect.height())); |
| 304 } |
| 305 |
289 void RenderMultiColumnSet::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTo
p, LogicalExtentComputedValues& computedValues) const | 306 void RenderMultiColumnSet::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTo
p, LogicalExtentComputedValues& computedValues) const |
290 { | 307 { |
291 computedValues.m_extent = m_computedColumnHeight; | 308 computedValues.m_extent = m_computedColumnHeight; |
292 computedValues.m_position = logicalTop; | 309 computedValues.m_position = logicalTop; |
293 } | 310 } |
294 | 311 |
295 LayoutUnit RenderMultiColumnSet::columnGap() const | 312 LayoutUnit RenderMultiColumnSet::columnGap() const |
296 { | 313 { |
297 RenderBlockFlow* parentBlock = multiColumnBlockFlow(); | 314 RenderBlockFlow* parentBlock = multiColumnBlockFlow(); |
298 if (parentBlock->style()->hasNormalColumnGap()) | 315 if (parentBlock->style()->hasNormalColumnGap()) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 fragments.append(fragment); | 621 fragments.append(fragment); |
605 } | 622 } |
606 } | 623 } |
607 | 624 |
608 const char* RenderMultiColumnSet::renderName() const | 625 const char* RenderMultiColumnSet::renderName() const |
609 { | 626 { |
610 return "RenderMultiColumnSet"; | 627 return "RenderMultiColumnSet"; |
611 } | 628 } |
612 | 629 |
613 } | 630 } |
OLD | NEW |