OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/rendering/RenderBlockFlow.h" | 32 #include "core/rendering/RenderBlockFlow.h" |
33 | 33 |
34 #include "core/accessibility/AXObjectCache.h" | 34 #include "core/accessibility/AXObjectCache.h" |
35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
36 #include "core/rendering/FastTextAutosizer.h" | 36 #include "core/rendering/FastTextAutosizer.h" |
37 #include "core/rendering/HitTestLocation.h" | 37 #include "core/rendering/HitTestLocation.h" |
38 #include "core/rendering/LayoutRectRecorder.h" | 38 #include "core/rendering/LayoutRectRecorder.h" |
39 #include "core/rendering/LayoutRepainter.h" | 39 #include "core/rendering/LayoutRepainter.h" |
| 40 #include "core/rendering/RenderFlowThread.h" |
40 #include "core/rendering/RenderLayer.h" | 41 #include "core/rendering/RenderLayer.h" |
41 #include "core/rendering/RenderMultiColumnBlock.h" | 42 #include "core/rendering/RenderMultiColumnBlock.h" |
42 #include "core/rendering/RenderNamedFlowFragment.h" | |
43 #include "core/rendering/RenderNamedFlowThread.h" | |
44 #include "core/rendering/RenderText.h" | 43 #include "core/rendering/RenderText.h" |
45 #include "core/rendering/RenderView.h" | 44 #include "core/rendering/RenderView.h" |
46 #include "core/rendering/line/LineWidth.h" | 45 #include "core/rendering/line/LineWidth.h" |
47 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 46 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
48 #include "platform/text/BidiTextRun.h" | 47 #include "platform/text/BidiTextRun.h" |
49 | 48 |
50 using namespace std; | 49 using namespace std; |
51 | 50 |
52 namespace WebCore { | 51 namespace WebCore { |
53 | 52 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 RenderBlockFlow* renderer = new RenderBlockFlow(0); | 169 RenderBlockFlow* renderer = new RenderBlockFlow(0); |
171 renderer->setDocumentForAnonymous(document); | 170 renderer->setDocumentForAnonymous(document); |
172 return renderer; | 171 return renderer; |
173 } | 172 } |
174 | 173 |
175 RenderBlockFlow* RenderBlockFlow::createAnonymousBlockFlow() const | 174 RenderBlockFlow* RenderBlockFlow::createAnonymousBlockFlow() const |
176 { | 175 { |
177 return toRenderBlockFlow(createAnonymousWithParentRendererAndDisplay(this, B
LOCK)); | 176 return toRenderBlockFlow(createAnonymousWithParentRendererAndDisplay(this, B
LOCK)); |
178 } | 177 } |
179 | 178 |
180 void RenderBlockFlow::willBeDestroyed() | |
181 { | |
182 if (renderNamedFlowFragment()) | |
183 setRenderNamedFlowFragment(0); | |
184 | |
185 RenderBlock::willBeDestroyed(); | |
186 } | |
187 | |
188 void RenderBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi
calHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) | 179 void RenderBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi
calHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) |
189 { | 180 { |
190 ColumnInfo* colInfo = columnInfo(); | 181 ColumnInfo* colInfo = columnInfo(); |
191 if (hasColumns()) { | 182 if (hasColumns()) { |
192 if (!pageLogicalHeight) { | 183 if (!pageLogicalHeight) { |
193 LayoutUnit oldLogicalHeight = logicalHeight(); | 184 LayoutUnit oldLogicalHeight = logicalHeight(); |
194 setLogicalHeight(0); | 185 setLogicalHeight(0); |
195 // We need to go ahead and set our explicit page height if one exist
s, so that we can | 186 // We need to go ahead and set our explicit page height if one exist
s, so that we can |
196 // avoid doing two layout passes. | 187 // avoid doing two layout passes. |
197 updateLogicalHeight(); | 188 updateLogicalHeight(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 289 |
299 bool pageLogicalHeightChanged = false; | 290 bool pageLogicalHeightChanged = false; |
300 bool hasSpecifiedPageLogicalHeight = false; | 291 bool hasSpecifiedPageLogicalHeight = false; |
301 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh
anged, hasSpecifiedPageLogicalHeight); | 292 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh
anged, hasSpecifiedPageLogicalHeight); |
302 | 293 |
303 RenderView* renderView = view(); | 294 RenderView* renderView = view(); |
304 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasCol
umns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMo
de(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo()); | 295 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasCol
umns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMo
de(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo()); |
305 | 296 |
306 // Regions changing widths can force us to relayout our children. | 297 // Regions changing widths can force us to relayout our children. |
307 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 298 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
308 if (logicalWidthChangedInRegions(flowThread)) | |
309 relayoutChildren = true; | |
310 if (updateRegionsAndShapesLogicalSize(flowThread)) | 299 if (updateRegionsAndShapesLogicalSize(flowThread)) |
311 relayoutChildren = true; | 300 relayoutChildren = true; |
312 if (!relayoutChildren && isRenderNamedFlowFragmentContainer()) | |
313 relayoutChildren = true; | |
314 | 301 |
315 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
to track | 302 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
to track |
316 // our current maximal positive and negative margins. These values are used
when we | 303 // our current maximal positive and negative margins. These values are used
when we |
317 // are collapsed with adjacent blocks, so for example, if you have block A a
nd B | 304 // are collapsed with adjacent blocks, so for example, if you have block A a
nd B |
318 // collapsing together, then you'd take the maximal positive margin from bot
h A and B | 305 // collapsing together, then you'd take the maximal positive margin from bot
h A and B |
319 // and subtract it from the maximal negative margin from both A and B to get
the | 306 // and subtract it from the maximal negative margin from both A and B to get
the |
320 // true collapsed margin. This algorithm is recursive, so when we finish lay
out() | 307 // true collapsed margin. This algorithm is recursive, so when we finish lay
out() |
321 // our block knows its current maximal positive/negative values. | 308 // our block knows its current maximal positive/negative values. |
322 // | 309 // |
323 // Start out by setting our margin values to our current margins. Table cell
s have | 310 // Start out by setting our margin values to our current margins. Table cell
s have |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 if (shouldBreakAtLineToAvoidWidow()) { | 370 if (shouldBreakAtLineToAvoidWidow()) { |
384 statePusher.pop(); | 371 statePusher.pop(); |
385 setEverHadLayout(true); | 372 setEverHadLayout(true); |
386 return false; | 373 return false; |
387 } | 374 } |
388 | 375 |
389 // Calculate our new height. | 376 // Calculate our new height. |
390 LayoutUnit oldHeight = logicalHeight(); | 377 LayoutUnit oldHeight = logicalHeight(); |
391 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); | 378 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); |
392 | 379 |
393 // Before updating the final size of the flow thread make sure a forced brea
k is applied after the content. | |
394 // This ensures the size information is correctly computed for the last auto
-height region receiving content. | |
395 if (isRenderFlowThread()) | 380 if (isRenderFlowThread()) |
396 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); | 381 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); |
397 | 382 |
398 updateLogicalHeight(); | 383 updateLogicalHeight(); |
399 LayoutUnit newHeight = logicalHeight(); | 384 LayoutUnit newHeight = logicalHeight(); |
400 if (oldHeight != newHeight) { | 385 if (oldHeight != newHeight) { |
401 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !child
renInline()) { | 386 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !child
renInline()) { |
402 // One of our children's floats may have become an overhanging float
for us. We need to look for it. | 387 // One of our children's floats may have become an overhanging float
for us. We need to look for it. |
403 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) { | 388 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) { |
404 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowP
ositioned()) { | 389 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowP
ositioned()) { |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 marginInfo.clearMargin(); | 1101 marginInfo.clearMargin(); |
1117 } | 1102 } |
1118 | 1103 |
1119 if (marginInfo.margin()) | 1104 if (marginInfo.margin()) |
1120 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); | 1105 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); |
1121 } | 1106 } |
1122 | 1107 |
1123 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins | 1108 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins |
1124 // collapsed into the page edge. | 1109 // collapsed into the page edge. |
1125 LayoutState* layoutState = view()->layoutState(); | 1110 LayoutState* layoutState = view()->layoutState(); |
1126 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop | 1111 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop) { |
1127 && hasNextPage(beforeCollapseLogicalTop)) { | |
1128 LayoutUnit oldLogicalTop = logicalTop; | 1112 LayoutUnit oldLogicalTop = logicalTop; |
1129 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop
)); | 1113 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop
)); |
1130 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); | 1114 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
1131 } | 1115 } |
1132 | 1116 |
1133 if (previousBlockFlow) { | 1117 if (previousBlockFlow) { |
1134 // If |child| is a self-collapsing block it may have collapsed into a pr
evious sibling and although it hasn't reduced the height of the parent yet | 1118 // If |child| is a self-collapsing block it may have collapsed into a pr
evious sibling and although it hasn't reduced the height of the parent yet |
1135 // any floats from the parent will now overhang. | 1119 // any floats from the parent will now overhang. |
1136 LayoutUnit oldLogicalHeight = logicalHeight(); | 1120 LayoutUnit oldLogicalHeight = logicalHeight(); |
1137 setLogicalHeight(logicalTop); | 1121 setLogicalHeight(logicalTop); |
(...skipping 29 matching lines...) Expand all Loading... |
1167 } | 1151 } |
1168 | 1152 |
1169 RenderLayer* childLayer = child->layer(); | 1153 RenderLayer* childLayer = child->layer(); |
1170 if (childLayer->staticBlockPosition() != logicalTop) { | 1154 if (childLayer->staticBlockPosition() != logicalTop) { |
1171 childLayer->setStaticBlockPosition(logicalTop); | 1155 childLayer->setStaticBlockPosition(logicalTop); |
1172 if (hasStaticBlockPosition) | 1156 if (hasStaticBlockPosition) |
1173 child->setChildNeedsLayout(MarkOnlyThis); | 1157 child->setChildNeedsLayout(MarkOnlyThis); |
1174 } | 1158 } |
1175 } | 1159 } |
1176 | 1160 |
1177 LayoutUnit RenderBlockFlow::computeStartPositionDeltaForChildAvoidingFloats(cons
t RenderBox* child, LayoutUnit childMarginStart, RenderRegion* region) | 1161 LayoutUnit RenderBlockFlow::computeStartPositionDeltaForChildAvoidingFloats(cons
t RenderBox* child, LayoutUnit childMarginStart) |
1178 { | 1162 { |
1179 LayoutUnit startPosition = startOffsetForContent(region); | 1163 LayoutUnit startPosition = startOffsetForContent(); |
1180 | 1164 |
1181 // Add in our start margin. | 1165 // Add in our start margin. |
1182 LayoutUnit oldPosition = startPosition + childMarginStart; | 1166 LayoutUnit oldPosition = startPosition + childMarginStart; |
1183 LayoutUnit newPosition = oldPosition; | 1167 LayoutUnit newPosition = oldPosition; |
1184 | 1168 |
1185 LayoutUnit blockOffset = logicalTopForChild(child); | 1169 LayoutUnit blockOffset = logicalTopForChild(child); |
1186 if (region) | 1170 LayoutUnit startOff = startOffsetForLine(blockOffset, false, logicalHeightFo
rChild(child)); |
1187 blockOffset = max(blockOffset, blockOffset + (region->logicalTopForFlowT
hreadContent() - offsetFromLogicalTopOfFirstPage())); | |
1188 | |
1189 LayoutUnit startOff = startOffsetForLineInRegion(blockOffset, false, region,
logicalHeightForChild(child)); | |
1190 | 1171 |
1191 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsi
ng(style()).isAuto()) { | 1172 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsi
ng(style()).isAuto()) { |
1192 if (childMarginStart < 0) | 1173 if (childMarginStart < 0) |
1193 startOff += childMarginStart; | 1174 startOff += childMarginStart; |
1194 newPosition = max(newPosition, startOff); // Let the float sit in the ch
ild's margin if it can fit. | 1175 newPosition = max(newPosition, startOff); // Let the float sit in the ch
ild's margin if it can fit. |
1195 } else if (startOff != startPosition) { | 1176 } else if (startOff != startPosition) { |
1196 newPosition = startOff + childMarginStart; | 1177 newPosition = startOff + childMarginStart; |
1197 } | 1178 } |
1198 | 1179 |
1199 return newPosition - oldPosition; | 1180 return newPosition - oldPosition; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 } | 1342 } |
1362 | 1343 |
1363 // Collapse the result with our current margins. | 1344 // Collapse the result with our current margins. |
1364 if (!discardMarginBefore) | 1345 if (!discardMarginBefore) |
1365 logicalTopEstimate += max(marginInfo.positiveMargin(), positiveMargi
nBefore) - max(marginInfo.negativeMargin(), negativeMarginBefore); | 1346 logicalTopEstimate += max(marginInfo.positiveMargin(), positiveMargi
nBefore) - max(marginInfo.negativeMargin(), negativeMarginBefore); |
1366 } | 1347 } |
1367 | 1348 |
1368 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current | 1349 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current |
1369 // page. | 1350 // page. |
1370 LayoutState* layoutState = view()->layoutState(); | 1351 LayoutState* layoutState = view()->layoutState(); |
1371 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight() | 1352 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight()) |
1372 && hasNextPage(logicalHeight())) | |
1373 logicalTopEstimate = min(logicalTopEstimate, nextPageLogicalTop(logicalH
eight())); | 1353 logicalTopEstimate = min(logicalTopEstimate, nextPageLogicalTop(logicalH
eight())); |
1374 | 1354 |
1375 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); | 1355 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); |
1376 | 1356 |
1377 estimateWithoutPagination = logicalTopEstimate; | 1357 estimateWithoutPagination = logicalTopEstimate; |
1378 | 1358 |
1379 if (layoutState->isPaginated()) { | 1359 if (layoutState->isPaginated()) { |
1380 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. | 1360 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. |
1381 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); | 1361 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); |
1382 | 1362 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 return childStyle->marginBeforeCollapse() == MSEPARATE; | 1541 return childStyle->marginBeforeCollapse() == MSEPARATE; |
1562 | 1542 |
1563 // FIXME: See |mustDiscardMarginBeforeForChild| above. | 1543 // FIXME: See |mustDiscardMarginBeforeForChild| above. |
1564 return false; | 1544 return false; |
1565 } | 1545 } |
1566 | 1546 |
1567 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) | 1547 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) |
1568 { | 1548 { |
1569 // FIXME: Add page break checking here when we support printing. | 1549 // FIXME: Add page break checking here when we support printing. |
1570 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 1550 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
1571 bool isInsideMulticolFlowThread = flowThread && !flowThread->isRenderNamedFl
owThread(); | 1551 bool isInsideMulticolFlowThread = flowThread; |
1572 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); | 1552 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); |
1573 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1553 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. |
1574 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; | |
1575 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) | 1554 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) |
1576 || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS) | 1555 || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS); |
1577 || (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS
); | 1556 if (checkBeforeAlways && inNormalFlow(child)) { |
1578 if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, I
ncludePageBoundary)) { | |
1579 if (checkColumnBreaks) { | 1557 if (checkColumnBreaks) { |
1580 if (isInsideMulticolFlowThread) | 1558 if (isInsideMulticolFlowThread) { |
1581 checkRegionBreaks = true; | 1559 LayoutUnit offsetBreakAdjustment = 0; |
1582 else | 1560 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirst
Page() + logicalOffset, child, true, &offsetBreakAdjustment)) |
| 1561 return logicalOffset + offsetBreakAdjustment; |
| 1562 } else { |
1583 view()->layoutState()->addForcedColumnBreak(child, logicalOffset
); | 1563 view()->layoutState()->addForcedColumnBreak(child, logicalOffset
); |
1584 } | 1564 } |
1585 if (checkRegionBreaks) { | |
1586 LayoutUnit offsetBreakAdjustment = 0; | |
1587 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset, child, true, &offsetBreakAdjustment)) | |
1588 return logicalOffset + offsetBreakAdjustment; | |
1589 } | 1565 } |
1590 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1566 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
1591 } | 1567 } |
1592 return logicalOffset; | 1568 return logicalOffset; |
1593 } | 1569 } |
1594 | 1570 |
1595 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) | 1571 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) |
1596 { | 1572 { |
1597 // FIXME: Add page break checking here when we support printing. | 1573 // FIXME: Add page break checking here when we support printing. |
1598 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 1574 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
1599 bool isInsideMulticolFlowThread = flowThread && !flowThread->isRenderNamedFl
owThread(); | 1575 bool isInsideMulticolFlowThread = flowThread; |
1600 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); | 1576 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); |
1601 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1577 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. |
1602 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; | |
1603 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) | 1578 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) |
1604 || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS) | 1579 || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS); |
1605 || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS)
; | 1580 if (checkAfterAlways && inNormalFlow(child)) { |
1606 if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, In
cludePageBoundary)) { | |
1607 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); | 1581 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); |
1608 | 1582 |
1609 // So our margin doesn't participate in the next collapsing steps. | 1583 // So our margin doesn't participate in the next collapsing steps. |
1610 marginInfo.clearMargin(); | 1584 marginInfo.clearMargin(); |
1611 | 1585 |
1612 if (checkColumnBreaks) { | 1586 if (checkColumnBreaks) { |
1613 if (isInsideMulticolFlowThread) | 1587 if (isInsideMulticolFlowThread) { |
1614 checkRegionBreaks = true; | 1588 LayoutUnit offsetBreakAdjustment = 0; |
1615 else | 1589 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirst
Page() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment)) |
| 1590 return logicalOffset + marginOffset + offsetBreakAdjustment; |
| 1591 } else { |
1616 view()->layoutState()->addForcedColumnBreak(child, logicalOffset
); | 1592 view()->layoutState()->addForcedColumnBreak(child, logicalOffset
); |
1617 } | 1593 } |
1618 if (checkRegionBreaks) { | |
1619 LayoutUnit offsetBreakAdjustment = 0; | |
1620 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment)) | |
1621 return logicalOffset + marginOffset + offsetBreakAdjustment; | |
1622 } | 1594 } |
1623 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1595 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
1624 } | 1596 } |
1625 return logicalOffset; | 1597 return logicalOffset; |
1626 } | 1598 } |
1627 | 1599 |
1628 void RenderBlockFlow::addOverflowFromFloats() | 1600 void RenderBlockFlow::addOverflowFromFloats() |
1629 { | 1601 { |
1630 if (!m_floatingObjects) | 1602 if (!m_floatingObjects) |
1631 return; | 1603 return; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 logicalBottom = lowestFloatLogicalBottom(); | 1712 logicalBottom = lowestFloatLogicalBottom(); |
1741 break; | 1713 break; |
1742 } | 1714 } |
1743 | 1715 |
1744 // We also clear floats if we are too big to sit on the same line as a float
(and wish to avoid floats by default). | 1716 // We also clear floats if we are too big to sit on the same line as a float
(and wish to avoid floats by default). |
1745 LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop
) : LayoutUnit(); | 1717 LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop
) : LayoutUnit(); |
1746 if (!result && child->avoidsFloats()) { | 1718 if (!result && child->avoidsFloats()) { |
1747 LayoutUnit newLogicalTop = logicalTop; | 1719 LayoutUnit newLogicalTop = logicalTop; |
1748 while (true) { | 1720 while (true) { |
1749 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); | 1721 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); |
1750 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent(newLogicalTop)) | 1722 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent()) |
1751 return newLogicalTop - logicalTop; | 1723 return newLogicalTop - logicalTop; |
1752 | 1724 |
1753 RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)
); | 1725 LayoutRect borderBox = child->borderBoxRect(); |
1754 LayoutRect borderBox = child->borderBoxRectInRegion(region, DoNotCac
heRenderBoxRegionInfo); | |
1755 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); | 1726 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); |
1756 | 1727 |
1757 // FIXME: None of this is right for perpendicular writing-mode child
ren. | 1728 // FIXME: None of this is right for perpendicular writing-mode child
ren. |
1758 LayoutUnit childOldLogicalWidth = child->logicalWidth(); | 1729 LayoutUnit childOldLogicalWidth = child->logicalWidth(); |
1759 LayoutUnit childOldMarginLeft = child->marginLeft(); | 1730 LayoutUnit childOldMarginLeft = child->marginLeft(); |
1760 LayoutUnit childOldMarginRight = child->marginRight(); | 1731 LayoutUnit childOldMarginRight = child->marginRight(); |
1761 LayoutUnit childOldLogicalTop = child->logicalTop(); | 1732 LayoutUnit childOldLogicalTop = child->logicalTop(); |
1762 | 1733 |
1763 child->setLogicalTop(newLogicalTop); | 1734 child->setLogicalTop(newLogicalTop); |
1764 child->updateLogicalWidth(); | 1735 child->updateLogicalWidth(); |
1765 region = regionAtBlockOffset(logicalTopForChild(child)); | 1736 borderBox = child->borderBoxRect(); |
1766 borderBox = child->borderBoxRectInRegion(region, DoNotCacheRenderBox
RegionInfo); | |
1767 LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); | 1737 LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); |
1768 | 1738 |
1769 child->setLogicalTop(childOldLogicalTop); | 1739 child->setLogicalTop(childOldLogicalTop); |
1770 child->setLogicalWidth(childOldLogicalWidth); | 1740 child->setLogicalWidth(childOldLogicalWidth); |
1771 child->setMarginLeft(childOldMarginLeft); | 1741 child->setMarginLeft(childOldMarginLeft); |
1772 child->setMarginRight(childOldMarginRight); | 1742 child->setMarginRight(childOldMarginRight); |
1773 | 1743 |
1774 if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthA
tNewLogicalTopOffset) { | 1744 if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthA
tNewLogicalTopOffset) { |
1775 // Even though we may not be moving, if the logical width did sh
rink because of the presence of new floats, then | 1745 // Even though we may not be moving, if the logical width did sh
rink because of the presence of new floats, then |
1776 // we need to force a relayout as though we shifted. This happen
s because of the dynamic addition of overhanging floats | 1746 // we need to force a relayout as though we shifted. This happen
s because of the dynamic addition of overhanging floats |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 break; | 1802 break; |
1833 } | 1803 } |
1834 } | 1804 } |
1835 } | 1805 } |
1836 } | 1806 } |
1837 } | 1807 } |
1838 | 1808 |
1839 parentBlockFlow->markAllDescendantsWithFloatsForLayout(); | 1809 parentBlockFlow->markAllDescendantsWithFloatsForLayout(); |
1840 parentBlockFlow->markSiblingsWithFloatsForLayout(); | 1810 parentBlockFlow->markSiblingsWithFloatsForLayout(); |
1841 } | 1811 } |
1842 | |
1843 if (renderNamedFlowFragment()) | |
1844 renderNamedFlowFragment()->setStyleForNamedFlowFragment(style()); | |
1845 } | 1812 } |
1846 | 1813 |
1847 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou
tUnit logicalTop) | 1814 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou
tUnit logicalTop) |
1848 { | 1815 { |
1849 if (child->style()->isOriginalDisplayInlineType()) | 1816 if (child->style()->isOriginalDisplayInlineType()) |
1850 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor
Line(logicalTop, false)); | 1817 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor
Line(logicalTop, false)); |
1851 else | 1818 else |
1852 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent
(logicalTop)); | 1819 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent
()); |
1853 } | 1820 } |
1854 | 1821 |
1855 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it blockOffset, LayoutUnit inlinePosition) | 1822 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it blockOffset, LayoutUnit inlinePosition) |
1856 { | 1823 { |
1857 if (flowThreadContainingBlock()) { | |
1858 // Shift the inline position to exclude the region offset. | |
1859 inlinePosition += startOffsetForContent() - startOffsetForContent(blockO
ffset); | |
1860 } | |
1861 child->layer()->setStaticInlinePosition(inlinePosition); | 1824 child->layer()->setStaticInlinePosition(inlinePosition); |
1862 } | 1825 } |
1863 | 1826 |
1864 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo
l fullRemoveInsert) | 1827 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo
l fullRemoveInsert) |
1865 { | 1828 { |
1866 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); | 1829 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); |
1867 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); | 1830 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); |
1868 | 1831 |
1869 // When a portion of the render tree is being detached, anonymous blocks | 1832 // When a portion of the render tree is being detached, anonymous blocks |
1870 // will be combined as their children are deleted. In this process, the | 1833 // will be combined as their children are deleted. In this process, the |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 | 2069 |
2107 if (applyTextIndent && !style()->isLeftToRightDirection()) | 2070 if (applyTextIndent && !style()->isLeftToRightDirection()) |
2108 right -= textIndentOffset(); | 2071 right -= textIndentOffset(); |
2109 | 2072 |
2110 return right; | 2073 return right; |
2111 } | 2074 } |
2112 | 2075 |
2113 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const | 2076 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const |
2114 { | 2077 { |
2115 RenderBox* childBox = floatingObject->renderer(); | 2078 RenderBox* childBox = floatingObject->renderer(); |
2116 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset)
; // Constant part of left offset. | 2079 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa
rt of left offset. |
2117 LayoutUnit logicalRightOffset; // Constant part of right offset. | 2080 LayoutUnit logicalRightOffset; // Constant part of right offset. |
2118 // FIXME Bug 102948: This only works for shape outside directly set on this
block. | 2081 // FIXME Bug 102948: This only works for shape outside directly set on this
block. |
2119 ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo(); | 2082 ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo(); |
2120 // FIXME: Implement behavior for right floats. | 2083 // FIXME: Implement behavior for right floats. |
2121 if (shapeInsideInfo) { | 2084 if (shapeInsideInfo) { |
2122 LayoutSize floatLogicalSize = logicalSizeForFloat(floatingObject); | 2085 LayoutSize floatLogicalSize = logicalSizeForFloat(floatingObject); |
2123 // floatingObject's logicalSize doesn't contain the actual height at thi
s point, so we need to calculate it | 2086 // floatingObject's logicalSize doesn't contain the actual height at thi
s point, so we need to calculate it |
2124 floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBefor
eForChild(childBox) + marginAfterForChild(childBox)); | 2087 floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBefor
eForChild(childBox) + marginAfterForChild(childBox)); |
2125 | 2088 |
2126 // FIXME: If the float doesn't fit in the shape we should push it under
the content box | 2089 // FIXME: If the float doesn't fit in the shape we should push it under
the content box |
2127 logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floa
tLogicalSize); | 2090 logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floa
tLogicalSize); |
2128 if (logicalHeight() > logicalTopOffset) | 2091 if (logicalHeight() > logicalTopOffset) |
2129 logicalTopOffset = logicalHeight(); | 2092 logicalTopOffset = logicalHeight(); |
2130 | 2093 |
2131 SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTo
pOffset, floatLogicalSize.height()); | 2094 SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTo
pOffset, floatLogicalSize.height()); |
2132 // FIXME: Add support for shapes with multiple segments. | 2095 // FIXME: Add support for shapes with multiple segments. |
2133 if (segments.size() == 1) { | 2096 if (segments.size() == 1) { |
2134 // The segment offsets are relative to the content box. | 2097 // The segment offsets are relative to the content box. |
2135 logicalRightOffset = logicalLeftOffset + segments[0].logicalRight; | 2098 logicalRightOffset = logicalLeftOffset + segments[0].logicalRight; |
2136 logicalLeftOffset += segments[0].logicalLeft; | 2099 logicalLeftOffset += segments[0].logicalLeft; |
2137 } | 2100 } |
2138 } else { | 2101 } else { |
2139 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); | 2102 logicalRightOffset = logicalRightOffsetForContent(); |
2140 } | 2103 } |
2141 | 2104 |
2142 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. | 2105 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. |
2143 | 2106 |
2144 LayoutUnit floatLogicalLeft; | 2107 LayoutUnit floatLogicalLeft; |
2145 | 2108 |
2146 bool insideFlowThread = flowThreadContainingBlock(); | 2109 bool insideFlowThread = flowThreadContainingBlock(); |
2147 | 2110 |
2148 if (childBox->style()->floating() == LeftFloat) { | 2111 if (childBox->style()->floating() == LeftFloat) { |
2149 LayoutUnit heightRemainingLeft = 1; | 2112 LayoutUnit heightRemainingLeft = 1; |
2150 LayoutUnit heightRemainingRight = 1; | 2113 LayoutUnit heightRemainingRight = 1; |
2151 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, false, &heightRemainingLeft); | 2114 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, false, &heightRemainingLeft); |
2152 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth)
{ | 2115 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth)
{ |
2153 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 2116 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
2154 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, false, &heightRemainingLeft); | 2117 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, false, &heightRemainingLeft); |
2155 if (insideFlowThread) { | 2118 if (insideFlowThread) { |
2156 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2119 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
2157 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. | 2120 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
2158 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. | 2121 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
2159 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 2122 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); |
2160 } | 2123 } |
2161 } | 2124 } |
2162 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); | 2125 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); |
2163 } else { | 2126 } else { |
2164 LayoutUnit heightRemainingLeft = 1; | 2127 LayoutUnit heightRemainingLeft = 1; |
2165 LayoutUnit heightRemainingRight = 1; | 2128 LayoutUnit heightRemainingRight = 1; |
2166 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, false, &heightRemainingRight); | 2129 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, false, &heightRemainingRight); |
2167 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { | 2130 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { |
2168 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 2131 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
2169 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, false, &heightRemainingRight); | 2132 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, false, &heightRemainingRight); |
2170 if (insideFlowThread) { | 2133 if (insideFlowThread) { |
2171 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2134 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
2172 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. | 2135 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
2173 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. | 2136 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
2174 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 2137 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); |
2175 } | 2138 } |
2176 } | 2139 } |
2177 // Use the original width of the float here, since the local variable | 2140 // Use the original width of the float here, since the local variable |
2178 // |floatLogicalWidth| was capped to the available line width. See | 2141 // |floatLogicalWidth| was capped to the available line width. See |
2179 // fast/block/float/clamped-right-float.html. | 2142 // fast/block/float/clamped-right-float.html. |
2180 floatLogicalLeft -= logicalWidthForFloat(floatingObject); | 2143 floatLogicalLeft -= logicalWidthForFloat(floatingObject); |
2181 } | 2144 } |
2182 | 2145 |
2183 return LayoutPoint(floatLogicalLeft, logicalTopOffset); | 2146 return LayoutPoint(floatLogicalLeft, logicalTopOffset); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2759 return constructTextRun(context, font, string, style, | 2722 return constructTextRun(context, font, string, style, |
2760 determineDirectionality(string, hasStrongDirectionality), | 2723 determineDirectionality(string, hasStrongDirectionality), |
2761 expansion, flags); | 2724 expansion, flags); |
2762 } | 2725 } |
2763 | 2726 |
2764 RootInlineBox* RenderBlockFlow::createRootInlineBox() | 2727 RootInlineBox* RenderBlockFlow::createRootInlineBox() |
2765 { | 2728 { |
2766 return new RootInlineBox(this); | 2729 return new RootInlineBox(this); |
2767 } | 2730 } |
2768 | 2731 |
2769 void RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded() | |
2770 { | |
2771 if (!RuntimeEnabledFeatures::cssRegionsEnabled() | |
2772 || renderNamedFlowFragment() | |
2773 || isRenderNamedFlowFragment()) | |
2774 return; | |
2775 | |
2776 RenderStyle* styleToUse = style(); | |
2777 if (styleToUse->isDisplayRegionType() && styleToUse->hasFlowFrom() && docume
nt().renderView()) { | |
2778 RenderNamedFlowFragment* flowFragment = RenderNamedFlowFragment::createA
nonymous(&document()); | |
2779 flowFragment->setStyleForNamedFlowFragment(styleToUse); | |
2780 setRenderNamedFlowFragment(flowFragment); | |
2781 addChild(flowFragment); | |
2782 } | |
2783 } | |
2784 | |
2785 void RenderBlockFlow::insertedIntoTree() | |
2786 { | |
2787 RenderBlock::insertedIntoTree(); | |
2788 | |
2789 createRenderNamedFlowFragmentIfNeeded(); | |
2790 } | |
2791 | |
2792 bool RenderBlockFlow::canHaveChildren() const | |
2793 { | |
2794 return !renderNamedFlowFragment() ? RenderBlock::canHaveChildren() : renderN
amedFlowFragment()->canHaveChildren(); | |
2795 } | |
2796 | |
2797 bool RenderBlockFlow::canHaveGeneratedChildren() const | |
2798 { | |
2799 return !renderNamedFlowFragment() ? RenderBlock::canHaveGeneratedChildren()
: renderNamedFlowFragment()->canHaveGeneratedChildren(); | |
2800 } | |
2801 | |
2802 void RenderBlockFlow::updateLogicalHeight() | |
2803 { | |
2804 RenderBlock::updateLogicalHeight(); | |
2805 | |
2806 if (renderNamedFlowFragment()) | |
2807 renderNamedFlowFragment()->setLogicalHeight(max<LayoutUnit>(0, logicalHe
ight() - borderAndPaddingLogicalHeight())); | |
2808 } | |
2809 | |
2810 void RenderBlockFlow::setRenderNamedFlowFragment(RenderNamedFlowFragment* flowFr
agment) | |
2811 { | |
2812 RenderBlockFlow::RenderBlockFlowRareData& rareData = ensureRareData(); | |
2813 if (rareData.m_renderNamedFlowFragment) | |
2814 rareData.m_renderNamedFlowFragment->destroy(); | |
2815 rareData.m_renderNamedFlowFragment = flowFragment; | |
2816 } | |
2817 | |
2818 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2732 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2819 { | 2733 { |
2820 if (m_rareData) | 2734 if (m_rareData) |
2821 return *m_rareData; | 2735 return *m_rareData; |
2822 | 2736 |
2823 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2737 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
2824 return *m_rareData; | 2738 return *m_rareData; |
2825 } | 2739 } |
2826 | 2740 |
2827 } // namespace WebCore | 2741 } // namespace WebCore |
OLD | NEW |