| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() | 179 void RenderBlockFlow::willBeDestroyed() |
| 181 { | 180 { |
| 182 if (lineGridBox()) | 181 if (lineGridBox()) |
| 183 lineGridBox()->destroy(); | 182 lineGridBox()->destroy(); |
| 184 | 183 |
| 185 if (renderNamedFlowFragment()) | |
| 186 setRenderNamedFlowFragment(0); | |
| 187 | |
| 188 RenderBlock::willBeDestroyed(); | 184 RenderBlock::willBeDestroyed(); |
| 189 } | 185 } |
| 190 | 186 |
| 191 void RenderBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi
calHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) | 187 void RenderBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi
calHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) |
| 192 { | 188 { |
| 193 ColumnInfo* colInfo = columnInfo(); | 189 ColumnInfo* colInfo = columnInfo(); |
| 194 if (hasColumns()) { | 190 if (hasColumns()) { |
| 195 if (!pageLogicalHeight) { | 191 if (!pageLogicalHeight) { |
| 196 LayoutUnit oldLogicalHeight = logicalHeight(); | 192 LayoutUnit oldLogicalHeight = logicalHeight(); |
| 197 setLogicalHeight(0); | 193 setLogicalHeight(0); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 299 |
| 304 bool pageLogicalHeightChanged = false; | 300 bool pageLogicalHeightChanged = false; |
| 305 bool hasSpecifiedPageLogicalHeight = false; | 301 bool hasSpecifiedPageLogicalHeight = false; |
| 306 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh
anged, hasSpecifiedPageLogicalHeight); | 302 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh
anged, hasSpecifiedPageLogicalHeight); |
| 307 | 303 |
| 308 RenderView* renderView = view(); | 304 RenderView* renderView = view(); |
| 309 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasCol
umns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMo
de(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo()); | 305 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasCol
umns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMo
de(), pageLogicalHeight, pageLogicalHeightChanged, columnInfo()); |
| 310 | 306 |
| 311 // Regions changing widths can force us to relayout our children. | 307 // Regions changing widths can force us to relayout our children. |
| 312 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 308 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
| 313 if (logicalWidthChangedInRegions(flowThread)) | |
| 314 relayoutChildren = true; | |
| 315 if (updateRegionsAndShapesLogicalSize(flowThread)) | 309 if (updateRegionsAndShapesLogicalSize(flowThread)) |
| 316 relayoutChildren = true; | 310 relayoutChildren = true; |
| 317 if (!relayoutChildren && isRenderNamedFlowFragmentContainer()) | |
| 318 relayoutChildren = true; | |
| 319 | 311 |
| 320 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
to track | 312 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
to track |
| 321 // our current maximal positive and negative margins. These values are used
when we | 313 // our current maximal positive and negative margins. These values are used
when we |
| 322 // are collapsed with adjacent blocks, so for example, if you have block A a
nd B | 314 // are collapsed with adjacent blocks, so for example, if you have block A a
nd B |
| 323 // collapsing together, then you'd take the maximal positive margin from bot
h A and B | 315 // collapsing together, then you'd take the maximal positive margin from bot
h A and B |
| 324 // and subtract it from the maximal negative margin from both A and B to get
the | 316 // and subtract it from the maximal negative margin from both A and B to get
the |
| 325 // true collapsed margin. This algorithm is recursive, so when we finish lay
out() | 317 // true collapsed margin. This algorithm is recursive, so when we finish lay
out() |
| 326 // our block knows its current maximal positive/negative values. | 318 // our block knows its current maximal positive/negative values. |
| 327 // | 319 // |
| 328 // Start out by setting our margin values to our current margins. Table cell
s have | 320 // Start out by setting our margin values to our current margins. Table cell
s have |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (shouldBreakAtLineToAvoidWidow()) { | 382 if (shouldBreakAtLineToAvoidWidow()) { |
| 391 statePusher.pop(); | 383 statePusher.pop(); |
| 392 setEverHadLayout(true); | 384 setEverHadLayout(true); |
| 393 return false; | 385 return false; |
| 394 } | 386 } |
| 395 | 387 |
| 396 // Calculate our new height. | 388 // Calculate our new height. |
| 397 LayoutUnit oldHeight = logicalHeight(); | 389 LayoutUnit oldHeight = logicalHeight(); |
| 398 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); | 390 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); |
| 399 | 391 |
| 400 // Before updating the final size of the flow thread make sure a forced brea
k is applied after the content. | |
| 401 // This ensures the size information is correctly computed for the last auto
-height region receiving content. | |
| 402 if (isRenderFlowThread()) | 392 if (isRenderFlowThread()) |
| 403 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); | 393 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); |
| 404 | 394 |
| 405 updateLogicalHeight(); | 395 updateLogicalHeight(); |
| 406 LayoutUnit newHeight = logicalHeight(); | 396 LayoutUnit newHeight = logicalHeight(); |
| 407 if (oldHeight != newHeight) { | 397 if (oldHeight != newHeight) { |
| 408 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !child
renInline()) { | 398 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !child
renInline()) { |
| 409 // One of our children's floats may have become an overhanging float
for us. We need to look for it. | 399 // One of our children's floats may have become an overhanging float
for us. We need to look for it. |
| 410 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) { | 400 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) { |
| 411 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowP
ositioned()) { | 401 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowP
ositioned()) { |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 marginInfo.clearMargin(); | 1120 marginInfo.clearMargin(); |
| 1131 } | 1121 } |
| 1132 | 1122 |
| 1133 if (marginInfo.margin()) | 1123 if (marginInfo.margin()) |
| 1134 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); | 1124 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); |
| 1135 } | 1125 } |
| 1136 | 1126 |
| 1137 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins | 1127 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins |
| 1138 // collapsed into the page edge. | 1128 // collapsed into the page edge. |
| 1139 LayoutState* layoutState = view()->layoutState(); | 1129 LayoutState* layoutState = view()->layoutState(); |
| 1140 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop | 1130 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop) { |
| 1141 && hasNextPage(beforeCollapseLogicalTop)) { | |
| 1142 LayoutUnit oldLogicalTop = logicalTop; | 1131 LayoutUnit oldLogicalTop = logicalTop; |
| 1143 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop
)); | 1132 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop
)); |
| 1144 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); | 1133 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
| 1145 } | 1134 } |
| 1146 | 1135 |
| 1147 if (previousBlockFlow) { | 1136 if (previousBlockFlow) { |
| 1148 // 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 | 1137 // 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 |
| 1149 // any floats from the parent will now overhang. | 1138 // any floats from the parent will now overhang. |
| 1150 LayoutUnit oldLogicalHeight = logicalHeight(); | 1139 LayoutUnit oldLogicalHeight = logicalHeight(); |
| 1151 setLogicalHeight(logicalTop); | 1140 setLogicalHeight(logicalTop); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1181 } | 1170 } |
| 1182 | 1171 |
| 1183 RenderLayer* childLayer = child->layer(); | 1172 RenderLayer* childLayer = child->layer(); |
| 1184 if (childLayer->staticBlockPosition() != logicalTop) { | 1173 if (childLayer->staticBlockPosition() != logicalTop) { |
| 1185 childLayer->setStaticBlockPosition(logicalTop); | 1174 childLayer->setStaticBlockPosition(logicalTop); |
| 1186 if (hasStaticBlockPosition) | 1175 if (hasStaticBlockPosition) |
| 1187 child->setChildNeedsLayout(MarkOnlyThis); | 1176 child->setChildNeedsLayout(MarkOnlyThis); |
| 1188 } | 1177 } |
| 1189 } | 1178 } |
| 1190 | 1179 |
| 1191 LayoutUnit RenderBlockFlow::computeStartPositionDeltaForChildAvoidingFloats(cons
t RenderBox* child, LayoutUnit childMarginStart, RenderRegion* region) | 1180 LayoutUnit RenderBlockFlow::computeStartPositionDeltaForChildAvoidingFloats(cons
t RenderBox* child, LayoutUnit childMarginStart) |
| 1192 { | 1181 { |
| 1193 LayoutUnit startPosition = startOffsetForContent(region); | 1182 LayoutUnit startPosition = startOffsetForContent(); |
| 1194 | 1183 |
| 1195 // Add in our start margin. | 1184 // Add in our start margin. |
| 1196 LayoutUnit oldPosition = startPosition + childMarginStart; | 1185 LayoutUnit oldPosition = startPosition + childMarginStart; |
| 1197 LayoutUnit newPosition = oldPosition; | 1186 LayoutUnit newPosition = oldPosition; |
| 1198 | 1187 |
| 1199 LayoutUnit blockOffset = logicalTopForChild(child); | 1188 LayoutUnit blockOffset = logicalTopForChild(child); |
| 1200 if (region) | 1189 LayoutUnit startOff = startOffsetForLine(blockOffset, false, logicalHeightFo
rChild(child)); |
| 1201 blockOffset = max(blockOffset, blockOffset + (region->logicalTopForFlowT
hreadContent() - offsetFromLogicalTopOfFirstPage())); | |
| 1202 | |
| 1203 LayoutUnit startOff = startOffsetForLineInRegion(blockOffset, false, region,
logicalHeightForChild(child)); | |
| 1204 | 1190 |
| 1205 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsi
ng(style()).isAuto()) { | 1191 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsi
ng(style()).isAuto()) { |
| 1206 if (childMarginStart < 0) | 1192 if (childMarginStart < 0) |
| 1207 startOff += childMarginStart; | 1193 startOff += childMarginStart; |
| 1208 newPosition = max(newPosition, startOff); // Let the float sit in the ch
ild's margin if it can fit. | 1194 newPosition = max(newPosition, startOff); // Let the float sit in the ch
ild's margin if it can fit. |
| 1209 } else if (startOff != startPosition) { | 1195 } else if (startOff != startPosition) { |
| 1210 newPosition = startOff + childMarginStart; | 1196 newPosition = startOff + childMarginStart; |
| 1211 } | 1197 } |
| 1212 | 1198 |
| 1213 return newPosition - oldPosition; | 1199 return newPosition - oldPosition; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 } | 1361 } |
| 1376 | 1362 |
| 1377 // Collapse the result with our current margins. | 1363 // Collapse the result with our current margins. |
| 1378 if (!discardMarginBefore) | 1364 if (!discardMarginBefore) |
| 1379 logicalTopEstimate += max(marginInfo.positiveMargin(), positiveMargi
nBefore) - max(marginInfo.negativeMargin(), negativeMarginBefore); | 1365 logicalTopEstimate += max(marginInfo.positiveMargin(), positiveMargi
nBefore) - max(marginInfo.negativeMargin(), negativeMarginBefore); |
| 1380 } | 1366 } |
| 1381 | 1367 |
| 1382 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current | 1368 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current |
| 1383 // page. | 1369 // page. |
| 1384 LayoutState* layoutState = view()->layoutState(); | 1370 LayoutState* layoutState = view()->layoutState(); |
| 1385 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight() | 1371 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight()) |
| 1386 && hasNextPage(logicalHeight())) | |
| 1387 logicalTopEstimate = min(logicalTopEstimate, nextPageLogicalTop(logicalH
eight())); | 1372 logicalTopEstimate = min(logicalTopEstimate, nextPageLogicalTop(logicalH
eight())); |
| 1388 | 1373 |
| 1389 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); | 1374 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); |
| 1390 | 1375 |
| 1391 estimateWithoutPagination = logicalTopEstimate; | 1376 estimateWithoutPagination = logicalTopEstimate; |
| 1392 | 1377 |
| 1393 if (layoutState->isPaginated()) { | 1378 if (layoutState->isPaginated()) { |
| 1394 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. | 1379 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. |
| 1395 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); | 1380 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); |
| 1396 | 1381 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 | 1561 |
| 1577 // FIXME: See |mustDiscardMarginBeforeForChild| above. | 1562 // FIXME: See |mustDiscardMarginBeforeForChild| above. |
| 1578 return false; | 1563 return false; |
| 1579 } | 1564 } |
| 1580 | 1565 |
| 1581 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) | 1566 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) |
| 1582 { | 1567 { |
| 1583 // FIXME: Add page break checking here when we support printing. | 1568 // FIXME: Add page break checking here when we support printing. |
| 1584 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); | 1569 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); |
| 1585 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1570 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. |
| 1586 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 1571 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakBefore() ==
PBALWAYS); |
| 1587 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; | 1572 if (checkBeforeAlways && inNormalFlow(child)) { |
| 1588 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakBefore() ==
PBALWAYS) | |
| 1589 || (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS
); | |
| 1590 if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, I
ncludePageBoundary)) { | |
| 1591 if (checkColumnBreaks) | 1573 if (checkColumnBreaks) |
| 1592 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); | 1574 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); |
| 1593 if (checkRegionBreaks) { | |
| 1594 LayoutUnit offsetBreakAdjustment = 0; | |
| 1595 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset, child, true, &offsetBreakAdjustment)) | |
| 1596 return logicalOffset + offsetBreakAdjustment; | |
| 1597 } | |
| 1598 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1575 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
| 1599 } | 1576 } |
| 1600 return logicalOffset; | 1577 return logicalOffset; |
| 1601 } | 1578 } |
| 1602 | 1579 |
| 1603 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) | 1580 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) |
| 1604 { | 1581 { |
| 1605 // FIXME: Add page break checking here when we support printing. | 1582 // FIXME: Add page break checking here when we support printing. |
| 1606 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); | 1583 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); |
| 1607 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1584 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. |
| 1608 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 1585 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBA
LWAYS); |
| 1609 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; | 1586 if (checkAfterAlways && inNormalFlow(child)) { |
| 1610 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBA
LWAYS) | |
| 1611 || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS)
; | |
| 1612 if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, In
cludePageBoundary)) { | |
| 1613 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); | |
| 1614 | |
| 1615 // So our margin doesn't participate in the next collapsing steps. | 1587 // So our margin doesn't participate in the next collapsing steps. |
| 1616 marginInfo.clearMargin(); | 1588 marginInfo.clearMargin(); |
| 1617 | 1589 |
| 1618 if (checkColumnBreaks) | 1590 if (checkColumnBreaks) |
| 1619 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); | 1591 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); |
| 1620 if (checkRegionBreaks) { | |
| 1621 LayoutUnit offsetBreakAdjustment = 0; | |
| 1622 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment)) | |
| 1623 return logicalOffset + marginOffset + offsetBreakAdjustment; | |
| 1624 } | |
| 1625 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1592 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
| 1626 } | 1593 } |
| 1627 return logicalOffset; | 1594 return logicalOffset; |
| 1628 } | 1595 } |
| 1629 | 1596 |
| 1630 void RenderBlockFlow::addOverflowFromFloats() | 1597 void RenderBlockFlow::addOverflowFromFloats() |
| 1631 { | 1598 { |
| 1632 if (!m_floatingObjects) | 1599 if (!m_floatingObjects) |
| 1633 return; | 1600 return; |
| 1634 | 1601 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 logicalBottom = lowestFloatLogicalBottom(); | 1709 logicalBottom = lowestFloatLogicalBottom(); |
| 1743 break; | 1710 break; |
| 1744 } | 1711 } |
| 1745 | 1712 |
| 1746 // 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). | 1713 // 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). |
| 1747 LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop
) : LayoutUnit(); | 1714 LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop
) : LayoutUnit(); |
| 1748 if (!result && child->avoidsFloats()) { | 1715 if (!result && child->avoidsFloats()) { |
| 1749 LayoutUnit newLogicalTop = logicalTop; | 1716 LayoutUnit newLogicalTop = logicalTop; |
| 1750 while (true) { | 1717 while (true) { |
| 1751 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); | 1718 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); |
| 1752 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent(newLogicalTop)) | 1719 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent()) |
| 1753 return newLogicalTop - logicalTop; | 1720 return newLogicalTop - logicalTop; |
| 1754 | 1721 |
| 1755 RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)
); | 1722 LayoutRect borderBox = child->borderBoxRect(); |
| 1756 LayoutRect borderBox = child->borderBoxRectInRegion(region, DoNotCac
heRenderBoxRegionInfo); | |
| 1757 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); | 1723 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); |
| 1758 | 1724 |
| 1759 // FIXME: None of this is right for perpendicular writing-mode child
ren. | 1725 // FIXME: None of this is right for perpendicular writing-mode child
ren. |
| 1760 LayoutUnit childOldLogicalWidth = child->logicalWidth(); | 1726 LayoutUnit childOldLogicalWidth = child->logicalWidth(); |
| 1761 LayoutUnit childOldMarginLeft = child->marginLeft(); | 1727 LayoutUnit childOldMarginLeft = child->marginLeft(); |
| 1762 LayoutUnit childOldMarginRight = child->marginRight(); | 1728 LayoutUnit childOldMarginRight = child->marginRight(); |
| 1763 LayoutUnit childOldLogicalTop = child->logicalTop(); | 1729 LayoutUnit childOldLogicalTop = child->logicalTop(); |
| 1764 | 1730 |
| 1765 child->setLogicalTop(newLogicalTop); | 1731 child->setLogicalTop(newLogicalTop); |
| 1766 child->updateLogicalWidth(); | 1732 child->updateLogicalWidth(); |
| 1767 region = regionAtBlockOffset(logicalTopForChild(child)); | 1733 borderBox = child->borderBoxRect(); |
| 1768 borderBox = child->borderBoxRectInRegion(region, DoNotCacheRenderBox
RegionInfo); | |
| 1769 LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); | 1734 LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); |
| 1770 | 1735 |
| 1771 child->setLogicalTop(childOldLogicalTop); | 1736 child->setLogicalTop(childOldLogicalTop); |
| 1772 child->setLogicalWidth(childOldLogicalWidth); | 1737 child->setLogicalWidth(childOldLogicalWidth); |
| 1773 child->setMarginLeft(childOldMarginLeft); | 1738 child->setMarginLeft(childOldMarginLeft); |
| 1774 child->setMarginRight(childOldMarginRight); | 1739 child->setMarginRight(childOldMarginRight); |
| 1775 | 1740 |
| 1776 if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthA
tNewLogicalTopOffset) { | 1741 if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthA
tNewLogicalTopOffset) { |
| 1777 // Even though we may not be moving, if the logical width did sh
rink because of the presence of new floats, then | 1742 // Even though we may not be moving, if the logical width did sh
rink because of the presence of new floats, then |
| 1778 // we need to force a relayout as though we shifted. This happen
s because of the dynamic addition of overhanging floats | 1743 // 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... |
| 1834 break; | 1799 break; |
| 1835 } | 1800 } |
| 1836 } | 1801 } |
| 1837 } | 1802 } |
| 1838 } | 1803 } |
| 1839 } | 1804 } |
| 1840 | 1805 |
| 1841 parentBlockFlow->markAllDescendantsWithFloatsForLayout(); | 1806 parentBlockFlow->markAllDescendantsWithFloatsForLayout(); |
| 1842 parentBlockFlow->markSiblingsWithFloatsForLayout(); | 1807 parentBlockFlow->markSiblingsWithFloatsForLayout(); |
| 1843 } | 1808 } |
| 1844 | |
| 1845 if (renderNamedFlowFragment()) | |
| 1846 renderNamedFlowFragment()->setStyleForNamedFlowFragment(style()); | |
| 1847 } | 1809 } |
| 1848 | 1810 |
| 1849 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou
tUnit logicalTop) | 1811 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou
tUnit logicalTop) |
| 1850 { | 1812 { |
| 1851 if (child->style()->isOriginalDisplayInlineType()) | 1813 if (child->style()->isOriginalDisplayInlineType()) |
| 1852 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor
Line(logicalTop, false)); | 1814 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor
Line(logicalTop, false)); |
| 1853 else | 1815 else |
| 1854 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent
(logicalTop)); | 1816 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent
()); |
| 1855 } | 1817 } |
| 1856 | 1818 |
| 1857 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it blockOffset, LayoutUnit inlinePosition) | 1819 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn
it blockOffset, LayoutUnit inlinePosition) |
| 1858 { | 1820 { |
| 1859 if (flowThreadContainingBlock()) { | |
| 1860 // Shift the inline position to exclude the region offset. | |
| 1861 inlinePosition += startOffsetForContent() - startOffsetForContent(blockO
ffset); | |
| 1862 } | |
| 1863 child->layer()->setStaticInlinePosition(inlinePosition); | 1821 child->layer()->setStaticInlinePosition(inlinePosition); |
| 1864 } | 1822 } |
| 1865 | 1823 |
| 1866 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo
l fullRemoveInsert) | 1824 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo
l fullRemoveInsert) |
| 1867 { | 1825 { |
| 1868 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); | 1826 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); |
| 1869 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); | 1827 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); |
| 1870 | 1828 |
| 1871 // When a portion of the render tree is being detached, anonymous blocks | 1829 // When a portion of the render tree is being detached, anonymous blocks |
| 1872 // will be combined as their children are deleted. In this process, the | 1830 // will be combined as their children are deleted. In this process, the |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 // FIXME: Dynamic changes to the font or to the inline position need to resu
lt in a deep relayout. | 2122 // FIXME: Dynamic changes to the font or to the inline position need to resu
lt in a deep relayout. |
| 2165 // (https://bugs.webkit.org/show_bug.cgi?id=79944) | 2123 // (https://bugs.webkit.org/show_bug.cgi?id=79944) |
| 2166 float remainder = fmodf(fmodf(right + layoutOffset - lineGridOffset, maxChar
Width), maxCharWidth); | 2124 float remainder = fmodf(fmodf(right + layoutOffset - lineGridOffset, maxChar
Width), maxCharWidth); |
| 2167 right -= LayoutUnit::fromFloatCeil(remainder); | 2125 right -= LayoutUnit::fromFloatCeil(remainder); |
| 2168 return right; | 2126 return right; |
| 2169 } | 2127 } |
| 2170 | 2128 |
| 2171 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const | 2129 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const |
| 2172 { | 2130 { |
| 2173 RenderBox* childBox = floatingObject->renderer(); | 2131 RenderBox* childBox = floatingObject->renderer(); |
| 2174 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset)
; // Constant part of left offset. | 2132 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa
rt of left offset. |
| 2175 LayoutUnit logicalRightOffset; // Constant part of right offset. | 2133 LayoutUnit logicalRightOffset; // Constant part of right offset. |
| 2176 // FIXME Bug 102948: This only works for shape outside directly set on this
block. | 2134 // FIXME Bug 102948: This only works for shape outside directly set on this
block. |
| 2177 ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo(); | 2135 ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo(); |
| 2178 // FIXME: Implement behavior for right floats. | 2136 // FIXME: Implement behavior for right floats. |
| 2179 if (shapeInsideInfo) { | 2137 if (shapeInsideInfo) { |
| 2180 LayoutSize floatLogicalSize = logicalSizeForFloat(floatingObject); | 2138 LayoutSize floatLogicalSize = logicalSizeForFloat(floatingObject); |
| 2181 // floatingObject's logicalSize doesn't contain the actual height at thi
s point, so we need to calculate it | 2139 // floatingObject's logicalSize doesn't contain the actual height at thi
s point, so we need to calculate it |
| 2182 floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBefor
eForChild(childBox) + marginAfterForChild(childBox)); | 2140 floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBefor
eForChild(childBox) + marginAfterForChild(childBox)); |
| 2183 | 2141 |
| 2184 // FIXME: If the float doesn't fit in the shape we should push it under
the content box | 2142 // FIXME: If the float doesn't fit in the shape we should push it under
the content box |
| 2185 logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floa
tLogicalSize); | 2143 logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floa
tLogicalSize); |
| 2186 if (logicalHeight() > logicalTopOffset) | 2144 if (logicalHeight() > logicalTopOffset) |
| 2187 logicalTopOffset = logicalHeight(); | 2145 logicalTopOffset = logicalHeight(); |
| 2188 | 2146 |
| 2189 SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTo
pOffset, floatLogicalSize.height()); | 2147 SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTo
pOffset, floatLogicalSize.height()); |
| 2190 // FIXME: Add support for shapes with multiple segments. | 2148 // FIXME: Add support for shapes with multiple segments. |
| 2191 if (segments.size() == 1) { | 2149 if (segments.size() == 1) { |
| 2192 // The segment offsets are relative to the content box. | 2150 // The segment offsets are relative to the content box. |
| 2193 logicalRightOffset = logicalLeftOffset + segments[0].logicalRight; | 2151 logicalRightOffset = logicalLeftOffset + segments[0].logicalRight; |
| 2194 logicalLeftOffset += segments[0].logicalLeft; | 2152 logicalLeftOffset += segments[0].logicalLeft; |
| 2195 } | 2153 } |
| 2196 } else { | 2154 } else { |
| 2197 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); | 2155 logicalRightOffset = logicalRightOffsetForContent(); |
| 2198 } | 2156 } |
| 2199 | 2157 |
| 2200 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. | 2158 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. |
| 2201 | 2159 |
| 2202 LayoutUnit floatLogicalLeft; | 2160 LayoutUnit floatLogicalLeft; |
| 2203 | 2161 |
| 2204 bool insideFlowThread = flowThreadContainingBlock(); | 2162 bool insideFlowThread = flowThreadContainingBlock(); |
| 2205 | 2163 |
| 2206 if (childBox->style()->floating() == LeftFloat) { | 2164 if (childBox->style()->floating() == LeftFloat) { |
| 2207 LayoutUnit heightRemainingLeft = 1; | 2165 LayoutUnit heightRemainingLeft = 1; |
| 2208 LayoutUnit heightRemainingRight = 1; | 2166 LayoutUnit heightRemainingRight = 1; |
| 2209 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, false, &heightRemainingLeft); | 2167 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, false, &heightRemainingLeft); |
| 2210 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth)
{ | 2168 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth)
{ |
| 2211 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 2169 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
| 2212 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, false, &heightRemainingLeft); | 2170 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, false, &heightRemainingLeft); |
| 2213 if (insideFlowThread) { | 2171 if (insideFlowThread) { |
| 2214 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2172 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 2215 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. | 2173 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
| 2216 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. | 2174 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
| 2217 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 2175 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); |
| 2218 } | 2176 } |
| 2219 } | 2177 } |
| 2220 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); | 2178 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); |
| 2221 } else { | 2179 } else { |
| 2222 LayoutUnit heightRemainingLeft = 1; | 2180 LayoutUnit heightRemainingLeft = 1; |
| 2223 LayoutUnit heightRemainingRight = 1; | 2181 LayoutUnit heightRemainingRight = 1; |
| 2224 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, false, &heightRemainingRight); | 2182 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, false, &heightRemainingRight); |
| 2225 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { | 2183 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { |
| 2226 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 2184 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); |
| 2227 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, false, &heightRemainingRight); | 2185 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, false, &heightRemainingRight); |
| 2228 if (insideFlowThread) { | 2186 if (insideFlowThread) { |
| 2229 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2187 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 2230 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffs
et); // Constant part of right offset. | 2188 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
| 2231 logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset
); // Constant part of left offset. | 2189 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
| 2232 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 2190 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); |
| 2233 } | 2191 } |
| 2234 } | 2192 } |
| 2235 // Use the original width of the float here, since the local variable | 2193 // Use the original width of the float here, since the local variable |
| 2236 // |floatLogicalWidth| was capped to the available line width. See | 2194 // |floatLogicalWidth| was capped to the available line width. See |
| 2237 // fast/block/float/clamped-right-float.html. | 2195 // fast/block/float/clamped-right-float.html. |
| 2238 floatLogicalLeft -= logicalWidthForFloat(floatingObject); | 2196 floatLogicalLeft -= logicalWidthForFloat(floatingObject); |
| 2239 } | 2197 } |
| 2240 | 2198 |
| 2241 return LayoutPoint(floatLogicalLeft, logicalTopOffset); | 2199 return LayoutPoint(floatLogicalLeft, logicalTopOffset); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2817 return constructTextRun(context, font, string, style, | 2775 return constructTextRun(context, font, string, style, |
| 2818 determineDirectionality(string, hasStrongDirectionality), | 2776 determineDirectionality(string, hasStrongDirectionality), |
| 2819 expansion, flags); | 2777 expansion, flags); |
| 2820 } | 2778 } |
| 2821 | 2779 |
| 2822 RootInlineBox* RenderBlockFlow::createRootInlineBox() | 2780 RootInlineBox* RenderBlockFlow::createRootInlineBox() |
| 2823 { | 2781 { |
| 2824 return new RootInlineBox(this); | 2782 return new RootInlineBox(this); |
| 2825 } | 2783 } |
| 2826 | 2784 |
| 2827 void RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded() | |
| 2828 { | |
| 2829 if (!RuntimeEnabledFeatures::cssRegionsEnabled() | |
| 2830 || renderNamedFlowFragment() | |
| 2831 || isRenderNamedFlowFragment()) | |
| 2832 return; | |
| 2833 | |
| 2834 RenderStyle* styleToUse = style(); | |
| 2835 if (styleToUse->isDisplayRegionType() && styleToUse->hasFlowFrom() && docume
nt().renderView()) { | |
| 2836 RenderNamedFlowFragment* flowFragment = RenderNamedFlowFragment::createA
nonymous(&document()); | |
| 2837 flowFragment->setStyleForNamedFlowFragment(styleToUse); | |
| 2838 setRenderNamedFlowFragment(flowFragment); | |
| 2839 addChild(flowFragment); | |
| 2840 } | |
| 2841 } | |
| 2842 | |
| 2843 void RenderBlockFlow::insertedIntoTree() | |
| 2844 { | |
| 2845 RenderBlock::insertedIntoTree(); | |
| 2846 | |
| 2847 createRenderNamedFlowFragmentIfNeeded(); | |
| 2848 } | |
| 2849 | |
| 2850 bool RenderBlockFlow::canHaveChildren() const | |
| 2851 { | |
| 2852 return !renderNamedFlowFragment() ? RenderBlock::canHaveChildren() : renderN
amedFlowFragment()->canHaveChildren(); | |
| 2853 } | |
| 2854 | |
| 2855 bool RenderBlockFlow::canHaveGeneratedChildren() const | |
| 2856 { | |
| 2857 return !renderNamedFlowFragment() ? RenderBlock::canHaveGeneratedChildren()
: renderNamedFlowFragment()->canHaveGeneratedChildren(); | |
| 2858 } | |
| 2859 | |
| 2860 void RenderBlockFlow::updateLogicalHeight() | |
| 2861 { | |
| 2862 RenderBlock::updateLogicalHeight(); | |
| 2863 | |
| 2864 if (renderNamedFlowFragment()) | |
| 2865 renderNamedFlowFragment()->setLogicalHeight(max<LayoutUnit>(0, logicalHe
ight() - borderAndPaddingLogicalHeight())); | |
| 2866 } | |
| 2867 | |
| 2868 void RenderBlockFlow::setRenderNamedFlowFragment(RenderNamedFlowFragment* flowFr
agment) | |
| 2869 { | |
| 2870 RenderBlockFlow::RenderBlockFlowRareData& rareData = ensureRareData(); | |
| 2871 if (rareData.m_renderNamedFlowFragment) | |
| 2872 rareData.m_renderNamedFlowFragment->destroy(); | |
| 2873 rareData.m_renderNamedFlowFragment = flowFragment; | |
| 2874 } | |
| 2875 | |
| 2876 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2785 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 2877 { | 2786 { |
| 2878 if (m_rareData) | 2787 if (m_rareData) |
| 2879 return *m_rareData; | 2788 return *m_rareData; |
| 2880 | 2789 |
| 2881 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2790 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 2882 return *m_rareData; | 2791 return *m_rareData; |
| 2883 } | 2792 } |
| 2884 | 2793 |
| 2885 } // namespace WebCore | 2794 } // namespace WebCore |
| OLD | NEW |