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

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/rendering/InlineTextBox.h" 45 #include "core/rendering/InlineTextBox.h"
46 #include "core/rendering/LayoutRectRecorder.h" 46 #include "core/rendering/LayoutRectRecorder.h"
47 #include "core/rendering/LayoutRepainter.h" 47 #include "core/rendering/LayoutRepainter.h"
48 #include "core/rendering/PaintInfo.h" 48 #include "core/rendering/PaintInfo.h"
49 #include "core/rendering/RenderCombineText.h" 49 #include "core/rendering/RenderCombineText.h"
50 #include "core/rendering/RenderDeprecatedFlexibleBox.h" 50 #include "core/rendering/RenderDeprecatedFlexibleBox.h"
51 #include "core/rendering/RenderFlexibleBox.h" 51 #include "core/rendering/RenderFlexibleBox.h"
52 #include "core/rendering/RenderInline.h" 52 #include "core/rendering/RenderInline.h"
53 #include "core/rendering/RenderLayer.h" 53 #include "core/rendering/RenderLayer.h"
54 #include "core/rendering/RenderMarquee.h" 54 #include "core/rendering/RenderMarquee.h"
55 #include "core/rendering/RenderNamedFlowThread.h"
56 #include "core/rendering/RenderRegion.h"
57 #include "core/rendering/RenderTableCell.h" 55 #include "core/rendering/RenderTableCell.h"
58 #include "core/rendering/RenderTextControl.h" 56 #include "core/rendering/RenderTextControl.h"
59 #include "core/rendering/RenderTextFragment.h" 57 #include "core/rendering/RenderTextFragment.h"
60 #include "core/rendering/RenderTheme.h" 58 #include "core/rendering/RenderTheme.h"
61 #include "core/rendering/RenderView.h" 59 #include "core/rendering/RenderView.h"
62 #include "core/rendering/shapes/ShapeOutsideInfo.h" 60 #include "core/rendering/shapes/ShapeOutsideInfo.h"
63 #include "core/rendering/style/ContentData.h" 61 #include "core/rendering/style/ContentData.h"
64 #include "core/rendering/style/RenderStyle.h" 62 #include "core/rendering/style/RenderStyle.h"
65 #include "platform/geometry/FloatQuad.h" 63 #include "platform/geometry/FloatQuad.h"
66 #include "platform/geometry/TransformState.h" 64 #include "platform/geometry/TransformState.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 else { 497 else {
500 RenderObject* cloneRenderer = toElement(node())->createRenderer(style()) ; 498 RenderObject* cloneRenderer = toElement(node())->createRenderer(style()) ;
501 cloneBlock = toRenderBlock(cloneRenderer); 499 cloneBlock = toRenderBlock(cloneRenderer);
502 cloneBlock->setStyle(style()); 500 cloneBlock->setStyle(style());
503 501
504 // This takes care of setting the right value of childrenInline in case 502 // This takes care of setting the right value of childrenInline in case
505 // generated content is added to cloneBlock and 'this' does not have 503 // generated content is added to cloneBlock and 'this' does not have
506 // generated content added yet. 504 // generated content added yet.
507 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir stChild()->isInline() : childrenInline()); 505 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir stChild()->isInline() : childrenInline());
508 } 506 }
509 cloneBlock->setFlowThreadState(flowThreadState());
510 return cloneBlock; 507 return cloneBlock;
511 } 508 }
512 509
513 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, 510 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock,
514 RenderBlock* middleBlock, 511 RenderBlock* middleBlock,
515 RenderObject* beforeChild, RenderBoxModelObject* o ldCont) 512 RenderObject* beforeChild, RenderBoxModelObject* o ldCont)
516 { 513 {
517 // Create a clone of this inline. 514 // Create a clone of this inline.
518 RenderBlock* cloneBlock = clone(); 515 RenderBlock* cloneBlock = clone();
519 if (!isAnonymousBlock()) 516 if (!isAnonymousBlock())
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 756 }
760 757
761 // Check for a spanning element in columns. 758 // Check for a spanning element in columns.
762 if (gColumnFlowSplitEnabled) { 759 if (gColumnFlowSplitEnabled) {
763 RenderBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(n ewChild); 760 RenderBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(n ewChild);
764 if (columnsBlockAncestor) { 761 if (columnsBlockAncestor) {
765 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled , false); 762 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled , false);
766 // We are placing a column-span element inside a block. 763 // We are placing a column-span element inside a block.
767 RenderBlockFlow* newBox = createAnonymousColumnSpanBlock(); 764 RenderBlockFlow* newBox = createAnonymousColumnSpanBlock();
768 765
769 if (columnsBlockAncestor != this && !isRenderFlowThread()) { 766 if (columnsBlockAncestor != this) {
770 // We are nested inside a multi-column element and are being spl it by the span. We have to break up 767 // We are nested inside a multi-column element and are being spl it by the span. We have to break up
771 // our block into continuations. 768 // our block into continuations.
772 RenderBoxModelObject* oldContinuation = continuation(); 769 RenderBoxModelObject* oldContinuation = continuation();
773 770
774 // When we split an anonymous block, there's no need to do any c ontinuation hookup, 771 // When we split an anonymous block, there's no need to do any c ontinuation hookup,
775 // since we haven't actually split a real element. 772 // since we haven't actually split a real element.
776 if (!isAnonymousBlock()) 773 if (!isAnonymousBlock())
777 setContinuation(newBox); 774 setContinuation(newBox);
778 775
779 splitFlow(beforeChild, newBox, newChild, oldContinuation); 776 splitFlow(beforeChild, newBox, newChild, oldContinuation);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 968
972 if (child->previousSibling()) 969 if (child->previousSibling())
973 child->previousSibling()->setNextSibling(child->nextSibling()); 970 child->previousSibling()->setNextSibling(child->nextSibling());
974 if (child->nextSibling()) 971 if (child->nextSibling())
975 child->nextSibling()->setPreviousSibling(child->previousSibling()); 972 child->nextSibling()->setPreviousSibling(child->previousSibling());
976 } 973 }
977 974
978 child->children()->setFirstChild(0); 975 child->children()->setFirstChild(0);
979 child->m_next = 0; 976 child->m_next = 0;
980 977
981 // Remove all the information in the flow thread associated with the leftove r anonymous block.
982 child->removeFromRenderFlowThread();
983
984 child->setParent(0); 978 child->setParent(0);
985 child->setPreviousSibling(0); 979 child->setPreviousSibling(0);
986 child->setNextSibling(0); 980 child->setNextSibling(0);
987 981
988 child->destroy(); 982 child->destroy();
989 } 983 }
990 984
991 static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje ct* prev, RenderObject* next) 985 static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje ct* prev, RenderObject* next)
992 { 986 {
993 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild-> virtualContinuation()) 987 if (oldChild->documentBeingDestroyed() || oldChild->isInline() || oldChild-> virtualContinuation())
(...skipping 19 matching lines...) Expand all
1013 { 1007 {
1014 // It's possible that this block's destruction may have been triggered by th e 1008 // It's possible that this block's destruction may have been triggered by th e
1015 // child's removal. Just bail if the anonymous child block is already being 1009 // child's removal. Just bail if the anonymous child block is already being
1016 // destroyed. See crbug.com/282088 1010 // destroyed. See crbug.com/282088
1017 if (child->beingDestroyed()) 1011 if (child->beingDestroyed())
1018 return; 1012 return;
1019 parent->setNeedsLayoutAndPrefWidthsRecalc(); 1013 parent->setNeedsLayoutAndPrefWidthsRecalc();
1020 parent->setChildrenInline(child->childrenInline()); 1014 parent->setChildrenInline(child->childrenInline());
1021 RenderObject* nextSibling = child->nextSibling(); 1015 RenderObject* nextSibling = child->nextSibling();
1022 1016
1023 RenderFlowThread* childFlowThread = child->flowThreadContainingBlock();
1024 CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread);
1025
1026 parent->children()->removeChildNode(parent, child, child->hasLayer()); 1017 parent->children()->removeChildNode(parent, child, child->hasLayer());
1027 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); 1018 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer());
1028 // Explicitly delete the child's line box tree, or the special anonymous 1019 // Explicitly delete the child's line box tree, or the special anonymous
1029 // block handling in willBeDestroyed will cause problems. 1020 // block handling in willBeDestroyed will cause problems.
1030 child->deleteLineBoxTree(); 1021 child->deleteLineBoxTree();
1031 if (childFlowThread && childFlowThread->isRenderNamedFlowThread())
1032 toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(child);
1033 child->destroy(); 1022 child->destroy();
1034 } 1023 }
1035 1024
1036 void RenderBlock::removeChild(RenderObject* oldChild) 1025 void RenderBlock::removeChild(RenderObject* oldChild)
1037 { 1026 {
1038 // No need to waste time in merging or removing empty anonymous blocks. 1027 // No need to waste time in merging or removing empty anonymous blocks.
1039 // We can just bail out if our document is getting destroyed. 1028 // We can just bail out if our document is getting destroyed.
1040 if (documentBeingDestroyed()) { 1029 if (documentBeingDestroyed()) {
1041 RenderBox::removeChild(oldChild); 1030 RenderBox::removeChild(oldChild);
1042 return; 1031 return;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 // of a layout pass 1319 // of a layout pass
1331 child->setNormalChildNeedsLayout(true); 1320 child->setNormalChildNeedsLayout(true);
1332 child->markShapeInsideDescendantsForLayout(); 1321 child->markShapeInsideDescendantsForLayout();
1333 child->layoutIfNeeded(); 1322 child->layoutIfNeeded();
1334 } 1323 }
1335 1324
1336 ShapeInsideInfo* RenderBlock::layoutShapeInsideInfo() const 1325 ShapeInsideInfo* RenderBlock::layoutShapeInsideInfo() const
1337 { 1326 {
1338 if (ShapeInsideInfo* shapeInsideInfo = view()->layoutState()->shapeInsideInf o()) 1327 if (ShapeInsideInfo* shapeInsideInfo = view()->layoutState()->shapeInsideInf o())
1339 return shapeInsideInfo; 1328 return shapeInsideInfo;
1340
1341 RenderFlowThread* flowThread = flowThreadContainingBlock();
1342 if (allowsShapeInsideInfoSharing(flowThread)) {
1343 LayoutUnit lineHeight = this->lineHeight(false, isHorizontalWritingMode( ) ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
1344 // regionAtBlockOffset returns regions like an array first={0,N-1}, seco nd={N,M-1}, ...
1345 LayoutUnit offset = logicalHeight() + lineHeight - LayoutUnit(1);
1346 RenderRegion* region = regionAtBlockOffset(offset);
1347 if (region && region->logicalHeight())
1348 return region->shapeInsideInfo();
1349 }
1350
1351 return 0; 1329 return 0;
1352 } 1330 }
1353 1331
1354 LayoutSize RenderBlock::logicalOffsetFromShapeAncestorContainer(const RenderBloc k* container) const 1332 LayoutSize RenderBlock::logicalOffsetFromShapeAncestorContainer(const RenderBloc k* container) const
1355 { 1333 {
1356 const RenderBlock* currentBlock = this; 1334 const RenderBlock* currentBlock = this;
1357 LayoutRect blockRect(currentBlock->borderBoxRect()); 1335 LayoutRect blockRect(currentBlock->borderBoxRect());
1358 while (currentBlock && !currentBlock->isRenderFlowThread() && currentBlock ! = container) { 1336 while (currentBlock && currentBlock != container) {
1359 RenderBlock* containerBlock = currentBlock->containingBlock(); 1337 RenderBlock* containerBlock = currentBlock->containingBlock();
1360 ASSERT(containerBlock); 1338 ASSERT(containerBlock);
1361 if (!containerBlock) 1339 if (!containerBlock)
1362 return LayoutSize(); 1340 return LayoutSize();
1363 1341
1364 if (containerBlock->style()->writingMode() != currentBlock->style()->wri tingMode()) { 1342 if (containerBlock->style()->writingMode() != currentBlock->style()->wri tingMode()) {
1365 // We have to put the block rect in container coordinates 1343 // We have to put the block rect in container coordinates
1366 // and we have to take into account both the container and current b lock flipping modes 1344 // and we have to take into account both the container and current b lock flipping modes
1367 // Bug: Flipping inline and block directions at the same time will n ot work, 1345 // Bug: Flipping inline and block directions at the same time will n ot work,
1368 // as one of the flipped dimensions will not yet have been set to it s final size 1346 // as one of the flipped dimensions will not yet have been set to it s final size
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1388
1411 if (shapeInside) { 1389 if (shapeInside) {
1412 ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo(); 1390 ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo();
1413 shapeInsideInfo->dirtyShapeSize(); 1391 shapeInsideInfo->dirtyShapeSize();
1414 } else { 1392 } else {
1415 setShapeInsideInfo(nullptr); 1393 setShapeInsideInfo(nullptr);
1416 markShapeInsideDescendantsForLayout(); 1394 markShapeInsideDescendantsForLayout();
1417 } 1395 }
1418 } 1396 }
1419 1397
1420 static inline bool shapeInfoRequiresRelayout(const RenderBlock* block)
1421 {
1422 ShapeInsideInfo* info = block->shapeInsideInfo();
1423 if (info)
1424 info->setNeedsLayout(info->shapeSizeDirty());
1425 else
1426 info = block->layoutShapeInsideInfo();
1427 return info && info->needsLayout();
1428 }
1429
1430 bool RenderBlock::updateRegionsAndShapesLogicalSize(RenderFlowThread* flowThread )
1431 {
1432 if (!flowThread && !shapeInsideInfo())
1433 return shapeInfoRequiresRelayout(this);
1434
1435 LayoutUnit oldHeight = logicalHeight();
1436 LayoutUnit oldTop = logicalTop();
1437
1438 // Compute the maximum logical height content may cause this block to expand to
1439 // FIXME: These should eventually use the const computeLogicalHeight rather than updateLogicalHeight
1440 setLogicalHeight(RenderFlowThread::maxLogicalHeight());
1441 updateLogicalHeight();
1442
1443 computeShapeSize();
1444
1445 // Set our start and end regions. No regions above or below us will be consi dered by our children. They are
1446 // effectively clamped to our region range.
1447 computeRegionRangeForBlock(flowThread);
1448
1449 setLogicalHeight(oldHeight);
1450 setLogicalTop(oldTop);
1451
1452 return shapeInfoRequiresRelayout(this);
1453 }
1454
1455 void RenderBlock::computeShapeSize() 1398 void RenderBlock::computeShapeSize()
1456 { 1399 {
1457 ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo(); 1400 ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo();
1458 if (!shapeInsideInfo) 1401 if (!shapeInsideInfo)
1459 return; 1402 return;
1460 1403
1461 if (isRenderNamedFlowFragment()) { 1404 bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvable FromBlock(this, false);
1462 ShapeInsideInfo* parentShapeInsideInfo = toRenderBlock(parent())->shapeI nsideInfo(); 1405 shapeInsideInfo->setShapeSize(logicalWidth(), percentageLogicalHeightResolva ble ? logicalHeight() : LayoutUnit());
1463 ASSERT(parentShapeInsideInfo);
1464 shapeInsideInfo->setShapeSize(parentShapeInsideInfo->shapeSize().width() , parentShapeInsideInfo->shapeSize().height());
1465 } else {
1466 bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolv ableFromBlock(this, false);
1467 shapeInsideInfo->setShapeSize(logicalWidth(), percentageLogicalHeightRes olvable ? logicalHeight() : LayoutUnit());
1468 }
1469 }
1470
1471 void RenderBlock::updateRegionsAndShapesAfterChildLayout(RenderFlowThread* flowT hread, bool heightChanged)
1472 {
1473 // A previous sibling has changed dimension, so we need to relayout the shap e with the content
1474 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo();
1475 if (heightChanged && shapeInsideInfo)
1476 shapeInsideInfo->dirtyShapeSize();
1477
1478 computeRegionRangeForBlock(flowThread);
1479 }
1480
1481 void RenderBlock::computeRegionRangeForBlock(RenderFlowThread* flowThread)
1482 {
1483 if (flowThread)
1484 flowThread->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage() );
1485 } 1406 }
1486 1407
1487 bool RenderBlock::updateLogicalWidthAndColumnWidth() 1408 bool RenderBlock::updateLogicalWidthAndColumnWidth()
1488 { 1409 {
1489 LayoutUnit oldWidth = logicalWidth(); 1410 LayoutUnit oldWidth = logicalWidth();
1490 LayoutUnit oldColumnWidth = desiredColumnWidth(); 1411 LayoutUnit oldColumnWidth = desiredColumnWidth();
1491 1412
1492 updateLogicalWidth(); 1413 updateLogicalWidth();
1493 calcColumnWidth(); 1414 calcColumnWidth();
1494 1415
(...skipping 22 matching lines...) Expand all
1517 } 1438 }
1518 if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) { 1439 if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) {
1519 colInfo->setColumnHeight(pageLogicalHeight); 1440 colInfo->setColumnHeight(pageLogicalHeight);
1520 pageLogicalHeightChanged = true; 1441 pageLogicalHeightChanged = true;
1521 } 1442 }
1522 1443
1523 if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight) 1444 if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight)
1524 colInfo->clearForcedBreaks(); 1445 colInfo->clearForcedBreaks();
1525 1446
1526 colInfo->setPaginationUnit(paginationUnit()); 1447 colInfo->setPaginationUnit(paginationUnit());
1527 } else if (isRenderFlowThread()) {
1528 pageLogicalHeight = 1; // This is just a hack to always make sure we hav e a page logical height.
1529 pageLogicalHeightChanged = toRenderFlowThread(this)->pageLogicalSizeChan ged();
1530 } 1448 }
1531 } 1449 }
1532 1450
1533 void RenderBlock::layoutBlock(bool) 1451 void RenderBlock::layoutBlock(bool)
1534 { 1452 {
1535 ASSERT_NOT_REACHED(); 1453 ASSERT_NOT_REACHED();
1536 clearNeedsLayout(); 1454 clearNeedsLayout();
1537 } 1455 }
1538 1456
1539 void RenderBlock::addOverflowFromChildren() 1457 void RenderBlock::addOverflowFromChildren()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 addLayoutOverflow(rectToApply); 1494 addLayoutOverflow(rectToApply);
1577 if (hasRenderOverflow()) 1495 if (hasRenderOverflow())
1578 m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge); 1496 m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge);
1579 } 1497 }
1580 1498
1581 // Add visual overflow from box-shadow and border-image-outset. 1499 // Add visual overflow from box-shadow and border-image-outset.
1582 addVisualEffectOverflow(); 1500 addVisualEffectOverflow();
1583 1501
1584 // Add visual overflow from theme. 1502 // Add visual overflow from theme.
1585 addVisualOverflowFromTheme(); 1503 addVisualOverflowFromTheme();
1586
1587 if (isRenderNamedFlowThread())
1588 toRenderNamedFlowThread(this)->computeOversetStateForRegions(oldClientAf terEdge);
1589 } 1504 }
1590 1505
1591 void RenderBlock::addOverflowFromBlockChildren() 1506 void RenderBlock::addOverflowFromBlockChildren()
1592 { 1507 {
1593 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 1508 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
1594 if (!child->isFloatingOrOutOfFlowPositioned()) 1509 if (!child->isFloatingOrOutOfFlowPositioned())
1595 addOverflowFromChild(child); 1510 addOverflowFromChild(child);
1596 } 1511 }
1597 } 1512 }
1598 1513
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 1550 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1636 startPosition -= verticalScrollbarWidth(); 1551 startPosition -= verticalScrollbarWidth();
1637 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava ilableLogicalWidth(); 1552 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava ilableLogicalWidth();
1638 1553
1639 // Add in our start margin. 1554 // Add in our start margin.
1640 LayoutUnit childMarginStart = marginStartForChild(child); 1555 LayoutUnit childMarginStart = marginStartForChild(child);
1641 LayoutUnit newPosition = startPosition + childMarginStart; 1556 LayoutUnit newPosition = startPosition + childMarginStart;
1642 1557
1643 // Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats. They need 1558 // Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats. They need
1644 // to shift over as necessary to dodge any floats that might get in the way. 1559 // to shift over as necessary to dodge any floats that might get in the way.
1645 if (child->avoidsFloats() && containsFloats() && !flowThreadContainingBlock( )) 1560 if (child->avoidsFloats() && containsFloats())
1646 newPosition += toRenderBlockFlow(this)->computeStartPositionDeltaForChil dAvoidingFloats(child, marginStartForChild(child)); 1561 newPosition += toRenderBlockFlow(this)->computeStartPositionDeltaForChil dAvoidingFloats(child, marginStartForChild(child));
1647 1562
1648 setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPositio n : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child), appl yDelta); 1563 setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPositio n : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child), appl yDelta);
1649 } 1564 }
1650 1565
1651 void RenderBlock::setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLef t, ApplyLayoutDeltaMode applyDelta) 1566 void RenderBlock::setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLef t, ApplyLayoutDeltaMode applyDelta)
1652 { 1567 {
1653 if (isHorizontalWritingMode()) { 1568 if (isHorizontalWritingMode()) {
1654 if (applyDelta == ApplyLayoutDelta) 1569 if (applyDelta == ApplyLayoutDelta)
1655 view()->addLayoutDelta(LayoutSize(child->x() - logicalLeft, 0)); 1570 view()->addLayoutDelta(LayoutSize(child->x() - logicalLeft, 0));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 1639
1725 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasColumns () || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode() ); 1640 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasColumns () || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode() );
1726 1641
1727 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly ()) 1642 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly ())
1728 return false; 1643 return false;
1729 1644
1730 // Lay out positioned descendants or objects that just need to recompute ove rflow. 1645 // Lay out positioned descendants or objects that just need to recompute ove rflow.
1731 if (needsSimplifiedNormalFlowLayout()) 1646 if (needsSimplifiedNormalFlowLayout())
1732 simplifiedNormalFlowLayout(); 1647 simplifiedNormalFlowLayout();
1733 1648
1734 // Make sure a forced break is applied after the content if we are a flow th read in a simplified layout.
1735 // This ensures the size information is correctly computed for the last auto -height region receiving content.
1736 if (isRenderFlowThread())
1737 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom());
1738
1739 // Lay out our positioned objects if our positioned child bit is set. 1649 // Lay out our positioned objects if our positioned child bit is set.
1740 // Also, if an absolute position element inside a relative positioned contai ner moves, and the absolute element has a fixed position 1650 // Also, if an absolute position element inside a relative positioned contai ner moves, and the absolute element has a fixed position
1741 // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the 1651 // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the
1742 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them 1652 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
1743 // are statically positioned and thus need to move with their absolute ances tors. 1653 // are statically positioned and thus need to move with their absolute ances tors.
1744 bool canContainFixedPosObjects = canContainFixedPositionObjects(); 1654 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1745 if (posChildNeedsLayout() || canContainFixedPosObjects) 1655 if (posChildNeedsLayout() || canContainFixedPosObjects)
1746 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed PosObjects); 1656 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed PosObjects);
1747 1657
1748 // Recompute our overflow information. 1658 // Recompute our overflow information.
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 return false; 2266 return false;
2357 ASSERT(node() || isAnonymous()); 2267 ASSERT(node() || isAnonymous());
2358 2268
2359 // FIXME: Eventually tables should have to learn how to fill gaps between ce lls, at least in simple non-spanning cases. 2269 // FIXME: Eventually tables should have to learn how to fill gaps between ce lls, at least in simple non-spanning cases.
2360 if (isTable()) 2270 if (isTable())
2361 return false; 2271 return false;
2362 2272
2363 if (isBody() || isRoot() || hasOverflowClip() 2273 if (isBody() || isRoot() || hasOverflowClip()
2364 || isPositioned() || isFloating() 2274 || isPositioned() || isFloating()
2365 || isTableCell() || isInlineBlockOrInlineTable() 2275 || isTableCell() || isInlineBlockOrInlineTable()
2366 || hasTransform() || hasReflection() || hasMask() || isWritingModeRoot() 2276 || hasTransform() || hasReflection() || hasMask() || isWritingModeRoot() )
2367 || isRenderFlowThread())
2368 return true; 2277 return true;
2369 2278
2370 if (view() && view()->selectionStart()) { 2279 if (view() && view()->selectionStart()) {
2371 Node* startElement = view()->selectionStart()->node(); 2280 Node* startElement = view()->selectionStart()->node();
2372 if (startElement && startElement->rootEditableElement() == node()) 2281 if (startElement && startElement->rootEditableElement() == node())
2373 return true; 2282 return true;
2374 } 2283 }
2375 2284
2376 return false; 2285 return false;
2377 } 2286 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 { 2644 {
2736 if (gPositionedDescendantsMap) 2645 if (gPositionedDescendantsMap)
2737 return gPositionedDescendantsMap->get(this); 2646 return gPositionedDescendantsMap->get(this);
2738 return 0; 2647 return 0;
2739 } 2648 }
2740 2649
2741 void RenderBlock::insertPositionedObject(RenderBox* o) 2650 void RenderBlock::insertPositionedObject(RenderBox* o)
2742 { 2651 {
2743 ASSERT(!isAnonymousBlock()); 2652 ASSERT(!isAnonymousBlock());
2744 2653
2745 if (o->isRenderFlowThread())
2746 return;
2747
2748 insertIntoTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta inerMap); 2654 insertIntoTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta inerMap);
2749 } 2655 }
2750 2656
2751 void RenderBlock::removePositionedObject(RenderBox* o) 2657 void RenderBlock::removePositionedObject(RenderBox* o)
2752 { 2658 {
2753 removeFromTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta inerMap); 2659 removeFromTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta inerMap);
2754 } 2660 }
2755 2661
2756 void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState c ontainingBlockState) 2662 void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState c ontainingBlockState)
2757 { 2663 {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 } 2776 }
2871 2777
2872 LayoutUnit RenderBlock::textIndentOffset() const 2778 LayoutUnit RenderBlock::textIndentOffset() const
2873 { 2779 {
2874 LayoutUnit cw = 0; 2780 LayoutUnit cw = 0;
2875 if (style()->textIndent().isPercent()) 2781 if (style()->textIndent().isPercent())
2876 cw = containingBlock()->availableLogicalWidth(); 2782 cw = containingBlock()->availableLogicalWidth();
2877 return minimumValueForLength(style()->textIndent(), cw); 2783 return minimumValueForLength(style()->textIndent(), cw);
2878 } 2784 }
2879 2785
2880 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region) const
2881 {
2882 LayoutUnit logicalLeftOffset = style()->isHorizontalWritingMode() ? borderLe ft() + paddingLeft() : borderTop() + paddingTop();
2883 if (!region)
2884 return logicalLeftOffset;
2885 LayoutRect boxRect = borderBoxRectInRegion(region);
2886 return logicalLeftOffset + (isHorizontalWritingMode() ? boxRect.x() : boxRec t.y());
2887 }
2888
2889 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region) const
2890 {
2891 LayoutUnit logicalRightOffset = style()->isHorizontalWritingMode() ? borderL eft() + paddingLeft() : borderTop() + paddingTop();
2892 logicalRightOffset += availableLogicalWidth();
2893 if (!region)
2894 return logicalRightOffset;
2895 LayoutRect boxRect = borderBoxRectInRegion(region);
2896 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? b oxRect.maxX() : boxRect.maxY()));
2897 }
2898
2899 void RenderBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l ogicalBottom, RootInlineBox* highest) 2786 void RenderBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l ogicalBottom, RootInlineBox* highest)
2900 { 2787 {
2901 if (logicalTop >= logicalBottom) 2788 if (logicalTop >= logicalBottom)
2902 return; 2789 return;
2903 2790
2904 RootInlineBox* lowestDirtyLine = lastRootBox(); 2791 RootInlineBox* lowestDirtyLine = lastRootBox();
2905 RootInlineBox* afterLowest = lowestDirtyLine; 2792 RootInlineBox* afterLowest = lowestDirtyLine;
2906 while (lowestDirtyLine && lowestDirtyLine->lineBottomWithLeading() >= logica lBottom && logicalBottom < LayoutUnit::max()) { 2793 while (lowestDirtyLine && lowestDirtyLine->lineBottomWithLeading() >= logica lBottom && logicalBottom < LayoutUnit::max()) {
2907 afterLowest = lowestDirtyLine; 2794 afterLowest = lowestDirtyLine;
2908 lowestDirtyLine = lowestDirtyLine->prevRootBox(); 2795 lowestDirtyLine = lowestDirtyLine->prevRootBox();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) { 2858 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) {
2972 updateHitTestResult(result, locationInContainer.point() - localOffset); 2859 updateHitTestResult(result, locationInContainer.point() - localOffset);
2973 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet . 2860 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet .
2974 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request, loca tionInContainer)) 2861 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request, loca tionInContainer))
2975 return true; 2862 return true;
2976 } 2863 }
2977 2864
2978 // If we have clipping, then we can't have any spillout. 2865 // If we have clipping, then we can't have any spillout.
2979 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); 2866 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
2980 bool useClip = (hasControlClip() || useOverflowClip); 2867 bool useClip = (hasControlClip() || useOverflowClip);
2981 bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.int ersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(over flowClipRect(adjustedLocation, locationInContainer.region(), IncludeOverlayScrol lbarSize))); 2868 bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.int ersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(over flowClipRect(adjustedLocation, IncludeOverlayScrollbarSize)));
2982 if (checkChildren) { 2869 if (checkChildren) {
2983 // Hit test descendants first. 2870 // Hit test descendants first.
2984 LayoutSize scrolledOffset(localOffset); 2871 LayoutSize scrolledOffset(localOffset);
2985 if (hasOverflowClip()) 2872 if (hasOverflowClip())
2986 scrolledOffset -= scrolledContentOffset(); 2873 scrolledOffset -= scrolledContentOffset();
2987 2874
2988 // Hit test contents if we don't have columns. 2875 // Hit test contents if we don't have columns.
2989 if (!hasColumns()) { 2876 if (!hasColumns()) {
2990 if (hitTestContents(request, result, locationInContainer, toLayoutPo int(scrolledOffset), hitTestAction)) { 2877 if (hitTestContents(request, result, locationInContainer, toLayoutPo int(scrolledOffset), hitTestAction)) {
2991 updateHitTestResult(result, flipForWritingMode(locationInContain er.point() - localOffset)); 2878 updateHitTestResult(result, flipForWritingMode(locationInContain er.point() - localOffset));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 LayoutRect colRect = it.columnRect(); 2999 LayoutRect colRect = it.columnRect();
3113 if (colRect.contains(locationInContainer)) { 3000 if (colRect.contains(locationInContainer)) {
3114 it.adjust(offset); 3001 it.adjust(offset);
3115 return; 3002 return;
3116 } 3003 }
3117 } 3004 }
3118 } 3005 }
3119 3006
3120 bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulat edOffset, HitTestAction hitTestAction) 3007 bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulat edOffset, HitTestAction hitTestAction)
3121 { 3008 {
3122 if (isRenderRegion())
3123 return toRenderRegion(this)->hitTestFlowThreadContents(request, result, locationInContainer, accumulatedOffset, hitTestAction);
3124
3125 if (childrenInline() && !isTable()) { 3009 if (childrenInline() && !isTable()) {
3126 // We have to hit-test our line boxes. 3010 // We have to hit-test our line boxes.
3127 if (m_lineBoxes.hitTest(this, request, result, locationInContainer, accu mulatedOffset, hitTestAction)) 3011 if (m_lineBoxes.hitTest(this, request, result, locationInContainer, accu mulatedOffset, hitTestAction))
3128 return true; 3012 return true;
3129 } else { 3013 } else {
3130 // Hit test our children. 3014 // Hit test our children.
3131 HitTestAction childHitTest = hitTestAction; 3015 HitTestAction childHitTest = hitTestAction;
3132 if (hitTestAction == HitTestChildBlockBackgrounds) 3016 if (hitTestAction == HitTestChildBlockBackgrounds)
3133 childHitTest = HitTestChildBlockBackground; 3017 childHitTest = HitTestChildBlockBackground;
3134 for (RenderBox* child = lastChildBox(); child; child = child->previousSi blingBox()) { 3018 for (RenderBox* child = lastChildBox(); child; child = child->previousSi blingBox()) {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3369 3253
3370 int RenderBlock::columnGap() const 3254 int RenderBlock::columnGap() const
3371 { 3255 {
3372 if (style()->hasNormalColumnGap()) 3256 if (style()->hasNormalColumnGap())
3373 return style()->fontDescription().computedPixelSize(); // "1em" is recom mended as the normal gap setting. Matches <p> margins. 3257 return style()->fontDescription().computedPixelSize(); // "1em" is recom mended as the normal gap setting. Matches <p> margins.
3374 return static_cast<int>(style()->columnGap()); 3258 return static_cast<int>(style()->columnGap());
3375 } 3259 }
3376 3260
3377 void RenderBlock::calcColumnWidth() 3261 void RenderBlock::calcColumnWidth()
3378 { 3262 {
3379 if (document().regionBasedColumnsEnabled())
3380 return;
3381
3382 // Calculate our column width and column count. 3263 // Calculate our column width and column count.
3383 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 3264 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744
3384 unsigned desiredColumnCount = 1; 3265 unsigned desiredColumnCount = 1;
3385 LayoutUnit desiredColumnWidth = contentLogicalWidth(); 3266 LayoutUnit desiredColumnWidth = contentLogicalWidth();
3386 3267
3387 // For now, we don't support multi-column layouts when printing, since we ha ve to do a lot of work for proper pagination. 3268 // For now, we don't support multi-column layouts when printing, since we ha ve to do a lot of work for proper pagination.
3388 if (document().paginated() || (style()->hasAutoColumnCount() && style()->has AutoColumnWidth()) || !style()->hasInlineColumnAxis()) { 3269 if (document().paginated() || (style()->hasAutoColumnCount() && style()->has AutoColumnWidth()) || !style()->hasInlineColumnAxis()) {
3389 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); 3270 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth);
3390 return; 3271 return;
3391 } 3272 }
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 3691
3811 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 3692 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
3812 m_minPreferredLogicalWidth += borderAndPadding; 3693 m_minPreferredLogicalWidth += borderAndPadding;
3813 m_maxPreferredLogicalWidth += borderAndPadding; 3694 m_maxPreferredLogicalWidth += borderAndPadding;
3814 3695
3815 clearPreferredLogicalWidthsDirty(); 3696 clearPreferredLogicalWidthsDirty();
3816 } 3697 }
3817 3698
3818 void RenderBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW idth, LayoutUnit& maxLogicalWidth) const 3699 void RenderBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW idth, LayoutUnit& maxLogicalWidth) const
3819 { 3700 {
3820 // FIXME: make this method virtual and move the code to RenderMultiColumnBlo ck once the old
3821 // multicol code is gone.
3822
3823 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) { 3701 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) {
3824 // The min/max intrinsic widths calculated really tell how much space el ements need when 3702 // The min/max intrinsic widths calculated really tell how much space el ements need when
3825 // laid out inside the columns. In order to eventually end up with the d esired column width, 3703 // laid out inside the columns. In order to eventually end up with the d esired column width,
3826 // we need to convert them to values pertaining to the multicol containe r. 3704 // we need to convert them to values pertaining to the multicol containe r.
3827 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou nt(); 3705 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou nt();
3828 LayoutUnit columnWidth; 3706 LayoutUnit columnWidth;
3829 LayoutUnit gapExtra = (columnCount - 1) * columnGap(); 3707 LayoutUnit gapExtra = (columnCount - 1) * columnGap();
3830 if (style()->hasAutoColumnWidth()) { 3708 if (style()->hasAutoColumnWidth()) {
3831 minLogicalWidth = minLogicalWidth * columnCount + gapExtra; 3709 minLogicalWidth = minLogicalWidth * columnCount + gapExtra;
3832 } else { 3710 } else {
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
5192 if (isAnonymousColumnsBlock()) 5070 if (isAnonymousColumnsBlock())
5193 return createAnonymousColumnsWithParentRenderer(parent); 5071 return createAnonymousColumnsWithParentRenderer(parent);
5194 if (isAnonymousColumnSpanBlock()) 5072 if (isAnonymousColumnSpanBlock())
5195 return createAnonymousColumnSpanWithParentRenderer(parent); 5073 return createAnonymousColumnSpanWithParentRenderer(parent);
5196 return createAnonymousWithParentRendererAndDisplay(parent, style()->display( )); 5074 return createAnonymousWithParentRendererAndDisplay(parent, style()->display( ));
5197 } 5075 }
5198 5076
5199 bool RenderBlock::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pageBou ndaryRule) const 5077 bool RenderBlock::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pageBou ndaryRule) const
5200 { 5078 {
5201 ASSERT(view()->layoutState() && view()->layoutState()->isPaginated()); 5079 ASSERT(view()->layoutState() && view()->layoutState()->isPaginated());
5202 5080 return true; // Printing and multi-column both make new pages to accommodate content.
5203 RenderFlowThread* flowThread = flowThreadContainingBlock();
5204 if (!flowThread)
5205 return true; // Printing and multi-column both make new pages to accommo date content.
5206
5207 // See if we're in the last region.
5208 LayoutUnit pageOffset = offsetFromLogicalTopOfFirstPage() + logicalOffset;
5209 RenderRegion* region = flowThread->regionAtBlockOffset(pageOffset, this);
5210 if (!region)
5211 return false;
5212 if (region->isLastRegion())
5213 return region->isRenderRegionSet() || region->style()->regionFragment() == BreakRegionFragment
5214 || (pageBoundaryRule == IncludePageBoundary && pageOffset == region- >logicalTopForFlowThreadContent());
5215 return true;
5216 } 5081 }
5217 5082
5218 LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar yRule pageBoundaryRule) const 5083 LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar yRule pageBoundaryRule) const
5219 { 5084 {
5220 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 5085 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
5221 if (!pageLogicalHeight) 5086 if (!pageLogicalHeight)
5222 return logicalOffset; 5087 return logicalOffset;
5223 5088
5224 // The logicalOffset is in our coordinate space. We can add in our pushed o ffset. 5089 // The logicalOffset is in our coordinate space. We can add in our pushed o ffset.
5225 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset); 5090 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset);
5226 if (pageBoundaryRule == ExcludePageBoundary) 5091 if (pageBoundaryRule == ExcludePageBoundary)
5227 return logicalOffset + (remainingLogicalHeight ? remainingLogicalHeight : pageLogicalHeight); 5092 return logicalOffset + (remainingLogicalHeight ? remainingLogicalHeight : pageLogicalHeight);
5228 return logicalOffset + remainingLogicalHeight; 5093 return logicalOffset + remainingLogicalHeight;
5229 } 5094 }
5230 5095
5231 ColumnInfo::PaginationUnit RenderBlock::paginationUnit() const 5096 ColumnInfo::PaginationUnit RenderBlock::paginationUnit() const
5232 { 5097 {
5233 return ColumnInfo::Column; 5098 return ColumnInfo::Column;
5234 } 5099 }
5235 5100
5236 LayoutUnit RenderBlock::pageLogicalTopForOffset(LayoutUnit offset) const 5101 LayoutUnit RenderBlock::pageLogicalTopForOffset(LayoutUnit offset) const
5237 { 5102 {
5238 RenderView* renderView = view(); 5103 RenderView* renderView = view();
5239 LayoutUnit firstPageLogicalTop = isHorizontalWritingMode() ? renderView->lay outState()->m_pageOffset.height() : renderView->layoutState()->m_pageOffset.widt h(); 5104 LayoutUnit firstPageLogicalTop = isHorizontalWritingMode() ? renderView->lay outState()->m_pageOffset.height() : renderView->layoutState()->m_pageOffset.widt h();
5240 LayoutUnit blockLogicalTop = isHorizontalWritingMode() ? renderView->layoutS tate()->m_layoutOffset.height() : renderView->layoutState()->m_layoutOffset.widt h(); 5105 LayoutUnit blockLogicalTop = isHorizontalWritingMode() ? renderView->layoutS tate()->m_layoutOffset.height() : renderView->layoutState()->m_layoutOffset.widt h();
5241 5106
5242 LayoutUnit cumulativeOffset = offset + blockLogicalTop; 5107 LayoutUnit cumulativeOffset = offset + blockLogicalTop;
5243 RenderFlowThread* flowThread = flowThreadContainingBlock(); 5108 LayoutUnit pageLogicalHeight = renderView->layoutState()->pageLogicalHeight( );
5244 if (!flowThread) { 5109 if (!pageLogicalHeight)
5245 LayoutUnit pageLogicalHeight = renderView->layoutState()->pageLogicalHei ght(); 5110 return 0;
5246 if (!pageLogicalHeight) 5111 return cumulativeOffset - roundToInt(cumulativeOffset - firstPageLogicalTop) % roundToInt(pageLogicalHeight);
5247 return 0;
5248 return cumulativeOffset - roundToInt(cumulativeOffset - firstPageLogical Top) % roundToInt(pageLogicalHeight);
5249 }
5250 return flowThread->pageLogicalTopForOffset(cumulativeOffset);
5251 } 5112 }
5252 5113
5253 LayoutUnit RenderBlock::pageLogicalHeightForOffset(LayoutUnit offset) const 5114 LayoutUnit RenderBlock::pageLogicalHeightForOffset(LayoutUnit offset) const
5254 { 5115 {
5255 RenderView* renderView = view(); 5116 RenderView* renderView = view();
5256 RenderFlowThread* flowThread = flowThreadContainingBlock(); 5117 return renderView->layoutState()->m_pageLogicalHeight;
5257 if (!flowThread)
5258 return renderView->layoutState()->m_pageLogicalHeight;
5259 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO fFirstPage());
5260 } 5118 }
5261 5119
5262 LayoutUnit RenderBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P ageBoundaryRule pageBoundaryRule) const 5120 LayoutUnit RenderBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P ageBoundaryRule pageBoundaryRule) const
5263 { 5121 {
5264 RenderView* renderView = view(); 5122 RenderView* renderView = view();
5265 offset += offsetFromLogicalTopOfFirstPage(); 5123 offset += offsetFromLogicalTopOfFirstPage();
5266 5124
5267 RenderFlowThread* flowThread = flowThreadContainingBlock(); 5125 LayoutUnit pageLogicalHeight = renderView->layoutState()->m_pageLogicalHeigh t;
5268 if (!flowThread) { 5126 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogicalH eight);
5269 LayoutUnit pageLogicalHeight = renderView->layoutState()->m_pageLogicalH eight; 5127 if (pageBoundaryRule == IncludePageBoundary) {
5270 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi calHeight); 5128 // If includeBoundaryPoint is true the line exactly on the top edge of a
5271 if (pageBoundaryRule == IncludePageBoundary) { 5129 // column will act as being part of the previous column.
5272 // If includeBoundaryPoint is true the line exactly on the top edge of a 5130 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
5273 // column will act as being part of the previous column.
5274 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
5275 }
5276 return remainingHeight;
5277 } 5131 }
5278 5132 return remainingHeight;
5279 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule);
5280 } 5133 }
5281 5134
5282 LayoutUnit RenderBlock::adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOffset, bool includeMargins) 5135 LayoutUnit RenderBlock::adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOffset, bool includeMargins)
5283 { 5136 {
5284 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); 5137 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns();
5285 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo gicalHeight; 5138 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo gicalHeight;
5286 RenderFlowThread* flowThread = flowThreadContainingBlock();
5287 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread() ;
5288 bool isUnsplittable = child->isUnsplittableForPagination() || (checkColumnBr eaks && child->style()->columnBreakInside() == PBAVOID) 5139 bool isUnsplittable = child->isUnsplittableForPagination() || (checkColumnBr eaks && child->style()->columnBreakInside() == PBAVOID)
5289 || (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID) 5140 || (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID);
5290 || (checkRegionBreaks && child->style()->regionBreakInside() == PBAVOID) ;
5291 if (!isUnsplittable) 5141 if (!isUnsplittable)
5292 return logicalOffset; 5142 return logicalOffset;
5293 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit()); 5143 LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargi ns ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit());
5294 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 5144 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
5295 bool hasUniformPageLogicalHeight = !flowThread || flowThread->regionsHaveUni formLogicalHeight(); 5145 bool hasUniformPageLogicalHeight = true;
5296 updateMinimumPageHeight(logicalOffset, childLogicalHeight); 5146 updateMinimumPageHeight(logicalOffset, childLogicalHeight);
5297 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && childLogicalHeight > pageLogicalHeight) 5147 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && childLogicalHeight > pageLogicalHeight)
5298 || !hasNextPage(logicalOffset)) 5148 || !hasNextPage(logicalOffset))
5299 return logicalOffset; 5149 return logicalOffset;
5300 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary); 5150 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary);
5301 if (remainingLogicalHeight < childLogicalHeight) { 5151 if (remainingLogicalHeight < childLogicalHeight) {
5302 if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHei ght(remainingLogicalHeight, logicalOffset, childLogicalHeight)) 5152 if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHei ght(remainingLogicalHeight, logicalOffset, childLogicalHeight))
5303 return logicalOffset; 5153 return logicalOffset;
5304 return logicalOffset + remainingLogicalHeight; 5154 return logicalOffset + remainingLogicalHeight;
5305 } 5155 }
(...skipping 10 matching lines...) Expand all
5316 if (!hasNextPage(logicalOffset + adjustment)) 5166 if (!hasNextPage(logicalOffset + adjustment))
5317 return false; 5167 return false;
5318 adjustment += pageLogicalHeight; 5168 adjustment += pageLogicalHeight;
5319 checkRegion = true; 5169 checkRegion = true;
5320 } 5170 }
5321 return !checkRegion; 5171 return !checkRegion;
5322 } 5172 }
5323 5173
5324 void RenderBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) 5174 void RenderBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage)
5325 { 5175 {
5326 if (RenderFlowThread* flowThread = flowThreadContainingBlock())
5327 flowThread->setPageBreak(offsetFromLogicalTopOfFirstPage() + offset, spa ceShortage);
5328 } 5176 }
5329 5177
5330 void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh t) 5178 void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh t)
5331 { 5179 {
5332 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) 5180 if (ColumnInfo* colInfo = view()->layoutState()->m_columnInfo)
5333 flowThread->updateMinimumPageHeight(offsetFromLogicalTopOfFirstPage() + offset, minHeight);
5334 else if (ColumnInfo* colInfo = view()->layoutState()->m_columnInfo)
5335 colInfo->updateMinimumColumnHeight(minHeight); 5181 colInfo->updateMinimumColumnHeight(minHeight);
5336 } 5182 }
5337 5183
5338 static inline LayoutUnit calculateMinimumPageHeight(RenderStyle* renderStyle, Ro otInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom) 5184 static inline LayoutUnit calculateMinimumPageHeight(RenderStyle* renderStyle, Ro otInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom)
5339 { 5185 {
5340 // We may require a certain minimum number of lines per page in order to sat isfy 5186 // We may require a certain minimum number of lines per page in order to sat isfy
5341 // orphans and widows, and that may affect the minimum page height. 5187 // orphans and widows, and that may affect the minimum page height.
5342 unsigned lineCount = max<unsigned>(renderStyle->hasAutoOrphans() ? 1 : rende rStyle->orphans(), renderStyle->hasAutoWidows() ? 1 : renderStyle->widows()); 5188 unsigned lineCount = max<unsigned>(renderStyle->hasAutoOrphans() ? 1 : rende rStyle->orphans(), renderStyle->hasAutoWidows() ? 1 : renderStyle->widows());
5343 if (lineCount > 1) { 5189 if (lineCount > 1) {
5344 RootInlineBox* line = lastLine; 5190 RootInlineBox* line = lastLine;
5345 for (unsigned i = 1; i < lineCount && line->prevRootBox(); i++) 5191 for (unsigned i = 1; i < lineCount && line->prevRootBox(); i++)
5346 line = line->prevRootBox(); 5192 line = line->prevRootBox();
5347 5193
5348 // FIXME: Paginating using line overflow isn't all fine. See FIXME in 5194 // FIXME: Paginating using line overflow isn't all fine. See FIXME in
5349 // adjustLinePositionForPagination() for more details. 5195 // adjustLinePositionForPagination() for more details.
5350 LayoutRect overflow = line->logicalVisualOverflowRect(line->lineTop(), l ine->lineBottom()); 5196 LayoutRect overflow = line->logicalVisualOverflowRect(line->lineTop(), l ine->lineBottom());
5351 lineTop = min(line->lineTopWithLeading(), overflow.y()); 5197 lineTop = min(line->lineTopWithLeading(), overflow.y());
5352 } 5198 }
5353 return lineBottom - lineTop; 5199 return lineBottom - lineTop;
5354 } 5200 }
5355 5201
5356 void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, Layout Unit& delta, RenderFlowThread* flowThread) 5202 void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, Layout Unit& delta)
5357 { 5203 {
5358 // FIXME: For now we paginate using line overflow. This ensures that lines don't overlap at all when we 5204 // FIXME: For now we paginate using line overflow. This ensures that lines don't overlap at all when we
5359 // put a strut between them for pagination purposes. However, this really i sn't the desired rendering, since 5205 // put a strut between them for pagination purposes. However, this really i sn't the desired rendering, since
5360 // the line on the top of the next page will appear too far down relative to the same kind of line at the top 5206 // the line on the top of the next page will appear too far down relative to the same kind of line at the top
5361 // of the first column. 5207 // of the first column.
5362 // 5208 //
5363 // The rendering we would like to see is one where the lineTopWithLeading is at the top of the column, and any line overflow 5209 // The rendering we would like to see is one where the lineTopWithLeading is at the top of the column, and any line overflow
5364 // simply spills out above the top of the column. This effect would match w hat happens at the top of the first column. 5210 // simply spills out above the top of the column. This effect would match w hat happens at the top of the first column.
5365 // We can't achieve this rendering, however, until we stop columns from clip ping to the column bounds (thus allowing 5211 // We can't achieve this rendering, however, until we stop columns from clip ping to the column bounds (thus allowing
5366 // for overflow to occur), and then cache visible overflow for each column r ect. 5212 // for overflow to occur), and then cache visible overflow for each column r ect.
5367 // 5213 //
5368 // Furthermore, the paint we have to do when a column has overflow has to be special. We need to exclude 5214 // Furthermore, the paint we have to do when a column has overflow has to be special. We need to exclude
5369 // content that paints in a previous column (and content that paints in the following column). 5215 // content that paints in a previous column (and content that paints in the following column).
5370 // 5216 //
5371 // For now we'll at least honor the lineTopWithLeading when paginating if it is above the logical top overflow. This will 5217 // For now we'll at least honor the lineTopWithLeading when paginating if it is above the logical top overflow. This will
5372 // at least make positive leading work in typical cases. 5218 // at least make positive leading work in typical cases.
5373 // 5219 //
5374 // FIXME: Another problem with simply moving lines is that the available lin e width may change (because of floats). 5220 // FIXME: Another problem with simply moving lines is that the available lin e width may change (because of floats).
5375 // Technically if the location we move the line to has a different line widt h than our old position, then we need to dirty the 5221 // Technically if the location we move the line to has a different line widt h than our old position, then we need to dirty the
5376 // line and all following lines. 5222 // line and all following lines.
5377 LayoutRect logicalVisualOverflow = lineBox->logicalVisualOverflowRect(lineBo x->lineTop(), lineBox->lineBottom()); 5223 LayoutRect logicalVisualOverflow = lineBox->logicalVisualOverflowRect(lineBo x->lineTop(), lineBox->lineBottom());
5378 LayoutUnit logicalOffset = min(lineBox->lineTopWithLeading(), logicalVisualO verflow.y()); 5224 LayoutUnit logicalOffset = min(lineBox->lineTopWithLeading(), logicalVisualO verflow.y());
5379 LayoutUnit logicalBottom = max(lineBox->lineBottomWithLeading(), logicalVisu alOverflow.maxY()); 5225 LayoutUnit logicalBottom = max(lineBox->lineBottomWithLeading(), logicalVisu alOverflow.maxY());
5380 LayoutUnit lineHeight = logicalBottom - logicalOffset; 5226 LayoutUnit lineHeight = logicalBottom - logicalOffset;
5381 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(style(), l ineBox, logicalOffset, logicalBottom)); 5227 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(style(), l ineBox, logicalOffset, logicalBottom));
5382 logicalOffset += delta; 5228 logicalOffset += delta;
5383 lineBox->setPaginationStrut(0); 5229 lineBox->setPaginationStrut(0);
5384 lineBox->setIsFirstAfterPageBreak(false); 5230 lineBox->setIsFirstAfterPageBreak(false);
5385 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 5231 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
5386 bool hasUniformPageLogicalHeight = !flowThread || flowThread->regionsHaveUni formLogicalHeight(); 5232 bool hasUniformPageLogicalHeight = true;
5387 // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflo w.height() still fits, we are 5233 // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflo w.height() still fits, we are
5388 // still going to add a strut, so that the visible overflow fits on a single page. 5234 // still going to add a strut, so that the visible overflow fits on a single page.
5389 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverf low.height() > pageLogicalHeight) 5235 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverf low.height() > pageLogicalHeight)
5390 || !hasNextPage(logicalOffset)) 5236 || !hasNextPage(logicalOffset))
5391 // FIXME: In case the line aligns with the top of the page (or it's slig htly shifted downwards) it will not be marked as the first line in the page. 5237 // FIXME: In case the line aligns with the top of the page (or it's slig htly shifted downwards) it will not be marked as the first line in the page.
5392 // From here, the fix is not straightforward because it's not easy to al ways determine when the current line is the first in the page. 5238 // From here, the fix is not straightforward because it's not easy to al ways determine when the current line is the first in the page.
5393 return; 5239 return;
5394 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary); 5240 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary);
5395 5241
5396 int lineIndex = lineCount(lineBox); 5242 int lineIndex = lineCount(lineBox);
(...skipping 22 matching lines...) Expand all
5419 } 5265 }
5420 } else if (remainingLogicalHeight == pageLogicalHeight) { 5266 } else if (remainingLogicalHeight == pageLogicalHeight) {
5421 // We're at the very top of a page or column. 5267 // We're at the very top of a page or column.
5422 if (lineBox != firstRootBox()) 5268 if (lineBox != firstRootBox())
5423 lineBox->setIsFirstAfterPageBreak(true); 5269 lineBox->setIsFirstAfterPageBreak(true);
5424 if (lineBox != firstRootBox() || offsetFromLogicalTopOfFirstPage()) 5270 if (lineBox != firstRootBox() || offsetFromLogicalTopOfFirstPage())
5425 setPageBreak(logicalOffset, lineHeight); 5271 setPageBreak(logicalOffset, lineHeight);
5426 } 5272 }
5427 } 5273 }
5428 5274
5429 void RenderBlock::updateRegionForLine(RootInlineBox* lineBox) const 5275 bool RenderBlock::lineWidthForPaginatedLineChanged(RootInlineBox* rootBox, Layou tUnit lineDelta) const
5430 { 5276 {
5431 ASSERT(lineBox); 5277 return false;
5432 lineBox->setContainingRegion(regionAtBlockOffset(lineBox->lineTopWithLeading ()));
5433
5434 RootInlineBox* prevLineBox = lineBox->prevRootBox();
5435 if (!prevLineBox)
5436 return;
5437
5438 // This check is more accurate than the one in |adjustLinePositionForPaginat ion| because it takes into
5439 // account just the container changes between lines. The before mentioned fu nction doesn't set the flag
5440 // correctly if the line is positioned at the top of the last fragment conta iner.
5441 if (lineBox->containingRegion() != prevLineBox->containingRegion())
5442 lineBox->setIsFirstAfterPageBreak(true);
5443 }
5444
5445 bool RenderBlock::lineWidthForPaginatedLineChanged(RootInlineBox* rootBox, Layou tUnit lineDelta, RenderFlowThread* flowThread) const
5446 {
5447 if (!flowThread)
5448 return false;
5449
5450 RenderRegion* currentRegion = regionAtBlockOffset(rootBox->lineTopWithLeadin g() + lineDelta);
5451 // Just bail if the region didn't change.
5452 if (rootBox->containingRegion() == currentRegion)
5453 return false;
5454 return rootBox->paginatedLineWidth() != availableLogicalWidthForContent(curr entRegion);
5455 } 5278 }
5456 5279
5457 LayoutUnit RenderBlock::offsetFromLogicalTopOfFirstPage() const 5280 LayoutUnit RenderBlock::offsetFromLogicalTopOfFirstPage() const
5458 { 5281 {
5459 LayoutState* layoutState = view()->layoutState(); 5282 LayoutState* layoutState = view()->layoutState();
5460 if (layoutState && !layoutState->isPaginated()) 5283 if (layoutState && !layoutState->isPaginated())
5461 return 0; 5284 return 0;
5462 5285
5463 RenderFlowThread* flowThread = flowThreadContainingBlock();
5464 if (flowThread)
5465 return flowThread->offsetFromLogicalTopOfFirstRegion(this);
5466
5467 if (layoutState) { 5286 if (layoutState) {
5468 ASSERT(layoutState->renderer() == this); 5287 ASSERT(layoutState->renderer() == this);
5469 5288
5470 LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pa geOffset; 5289 LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pa geOffset;
5471 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.wi dth(); 5290 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.wi dth();
5472 } 5291 }
5473 5292
5474 ASSERT_NOT_REACHED(); 5293 ASSERT_NOT_REACHED();
5475 return 0; 5294 return 0;
5476 } 5295 }
5477 5296
5478 RenderRegion* RenderBlock::regionAtBlockOffset(LayoutUnit blockOffset) const
5479 {
5480 RenderFlowThread* flowThread = flowThreadContainingBlock();
5481 if (!flowThread || !flowThread->hasValidRegionInfo())
5482 return 0;
5483
5484 return flowThread->regionAtBlockOffset(offsetFromLogicalTopOfFirstPage() + b lockOffset, true);
5485 }
5486
5487 bool RenderBlock::logicalWidthChangedInRegions(RenderFlowThread* flowThread) con st
5488 {
5489 if (!flowThread || !flowThread->hasValidRegionInfo())
5490 return false;
5491
5492 return flowThread->logicalWidthChangedInRegionsForBlock(this);
5493 }
5494
5495 RenderRegion* RenderBlock::clampToStartAndEndRegions(RenderRegion* region) const
5496 {
5497 RenderFlowThread* flowThread = flowThreadContainingBlock();
5498
5499 ASSERT(isRenderView() || (region && flowThread));
5500 if (isRenderView())
5501 return region;
5502
5503 // We need to clamp to the block, since we want any lines or blocks that ove rflow out of the
5504 // logical top or logical bottom of the block to size as though the border b ox in the first and
5505 // last regions extended infinitely. Otherwise the lines are going to size a ccording to the regions
5506 // they overflow into, which makes no sense when this block doesn't exist in |region| at all.
5507 RenderRegion* startRegion;
5508 RenderRegion* endRegion;
5509 flowThread->getRegionRangeForBox(this, startRegion, endRegion);
5510
5511 if (startRegion && region->logicalTopForFlowThreadContent() < startRegion->l ogicalTopForFlowThreadContent())
5512 return startRegion;
5513 if (endRegion && region->logicalTopForFlowThreadContent() > endRegion->logic alTopForFlowThreadContent())
5514 return endRegion;
5515
5516 return region;
5517 }
5518
5519 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const RenderBox* child) co nst 5297 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const RenderBox* child) co nst
5520 { 5298 {
5521 // If the child has the same directionality as we do, then we can just retur n its 5299 // If the child has the same directionality as we do, then we can just retur n its
5522 // collapsed margin. 5300 // collapsed margin.
5523 if (!child->isWritingModeRoot()) 5301 if (!child->isWritingModeRoot())
5524 return child->collapsedMarginBefore(); 5302 return child->collapsedMarginBefore();
5525 5303
5526 // The child has a different directionality. If the child is parallel, then it's just 5304 // The child has a different directionality. If the child is parallel, then it's just
5527 // flipped relative to us. We can use the collapsed margin for the opposite edge. 5305 // flipped relative to us. We can use the collapsed margin for the opposite edge.
5528 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) 5306 if (child->isHorizontalWritingMode() == isHorizontalWritingMode())
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5449 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5672 { 5450 {
5673 showRenderObject(); 5451 showRenderObject();
5674 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5452 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5675 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5453 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5676 } 5454 }
5677 5455
5678 #endif 5456 #endif
5679 5457
5680 } // namespace WebCore 5458 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698