Index: Source/core/rendering/RenderBlock.cpp |
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
index 00ef04a0ed287f73c5c61df3fc2e2053c2e7d072..48eb0eb89831e9b44b093c85b3210f0dd36f2fa0 100644 |
--- a/Source/core/rendering/RenderBlock.cpp |
+++ b/Source/core/rendering/RenderBlock.cpp |
@@ -93,9 +93,6 @@ struct SameSizeAsRenderBlockRareData { |
COMPILE_ASSERT(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), RenderBlock_should_stay_small); |
COMPILE_ASSERT(sizeof(RenderBlock::RenderBlockRareData) == sizeof(SameSizeAsRenderBlockRareData), RenderBlockRareData_should_stay_small); |
-typedef WTF::HashMap<const RenderBox*, OwnPtr<ColumnInfo> > ColumnInfoMap; |
-static ColumnInfoMap* gColumnInfoMap = 0; |
- |
static TrackedDescendantsMap* gPositionedDescendantsMap = 0; |
static TrackedDescendantsMap* gPercentHeightDescendantsMap = 0; |
@@ -108,8 +105,6 @@ typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; |
static int gDelayUpdateScrollInfo = 0; |
static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; |
-static bool gColumnFlowSplitEnabled = true; |
- |
// This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code |
// only works on RenderBlocks. If this changes, this class should be shared with other RenderBoxes. |
class OverflowEventDispatcher { |
@@ -218,8 +213,6 @@ static void appendImagesFromStyle(Vector<ImageResource*>& images, RenderStyle& b |
RenderBlock::~RenderBlock() |
{ |
ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRenderObject(this); |
- if (hasColumns()) |
- gColumnInfoMap->take(this); |
if (gPercentHeightDescendantsMap) |
removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendantsMap, gPercentHeightContainerMap); |
if (gPositionedDescendantsMap) |
@@ -388,7 +381,7 @@ RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild) |
void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild) |
{ |
RenderBlock* flow = continuationBefore(beforeChild); |
- ASSERT(!beforeChild || beforeChild->parent()->isAnonymousColumnSpanBlock() || beforeChild->parent()->isRenderBlock()); |
+ ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock()); |
RenderBoxModelObject* beforeChildParent = 0; |
if (beforeChild) |
beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); |
@@ -405,120 +398,14 @@ void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* b |
return; |
} |
- // A continuation always consists of two potential candidates: a block or an anonymous |
- // column span box holding column span children. |
- bool childIsNormal = newChild->isInline() || !newChild->style()->columnSpan(); |
- bool bcpIsNormal = beforeChildParent->isInline() || !beforeChildParent->style()->columnSpan(); |
- bool flowIsNormal = flow->isInline() || !flow->style()->columnSpan(); |
- |
if (flow == beforeChildParent) { |
flow->addChildIgnoringContinuation(newChild, beforeChild); |
return; |
} |
- // The goal here is to match up if we can, so that we can coalesce and create the |
- // minimal # of continuations needed for the inline. |
- if (childIsNormal == bcpIsNormal) { |
- beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); |
- return; |
- } |
- if (flowIsNormal == childIsNormal) { |
- flow->addChildIgnoringContinuation(newChild, 0); // Just treat like an append. |
- return; |
- } |
beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); |
} |
- |
-void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild) |
-{ |
- ASSERT(!continuation()); // We don't yet support column spans that aren't immediate children of the multi-column block. |
- |
- // The goal is to locate a suitable box in which to place our child. |
- RenderBlock* beforeChildParent = 0; |
- if (beforeChild) { |
- RenderObject* curr = beforeChild; |
- while (curr && curr->parent() != this) |
- curr = curr->parent(); |
- beforeChildParent = toRenderBlock(curr); |
- ASSERT(beforeChildParent); |
- ASSERT(beforeChildParent->isAnonymousColumnsBlock() || beforeChildParent->isAnonymousColumnSpanBlock()); |
- } else |
- beforeChildParent = toRenderBlock(lastChild()); |
- |
- // If the new child is floating or positioned it can just go in that block. |
- if (newChild->isFloatingOrOutOfFlowPositioned()) { |
- beforeChildParent->addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); |
- return; |
- } |
- |
- // See if the child can be placed in the box. |
- bool newChildHasColumnSpan = newChild->style()->columnSpan() && !newChild->isInline(); |
- bool beforeChildParentHoldsColumnSpans = beforeChildParent->isAnonymousColumnSpanBlock(); |
- |
- if (newChildHasColumnSpan == beforeChildParentHoldsColumnSpans) { |
- beforeChildParent->addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); |
- return; |
- } |
- |
- if (!beforeChild) { |
- // Create a new block of the correct type. |
- RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock() : createAnonymousColumnsBlock(); |
- children()->appendChildNode(this, newBox); |
- newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); |
- return; |
- } |
- |
- RenderObject* immediateChild = beforeChild; |
- bool isPreviousBlockViable = true; |
- while (immediateChild->parent() != this) { |
- if (isPreviousBlockViable) |
- isPreviousBlockViable = !immediateChild->previousSibling(); |
- immediateChild = immediateChild->parent(); |
- } |
- if (isPreviousBlockViable && immediateChild->previousSibling()) { |
- toRenderBlock(immediateChild->previousSibling())->addChildIgnoringAnonymousColumnBlocks(newChild, 0); // Treat like an append. |
- return; |
- } |
- |
- // Split our anonymous blocks. |
- RenderObject* newBeforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
- |
- |
- // Create a new anonymous box of the appropriate type. |
- RenderBlock* newBox = newChildHasColumnSpan ? createAnonymousColumnSpanBlock() : createAnonymousColumnsBlock(); |
- children()->insertChildNode(this, newBox, newBeforeChild); |
- newBox->addChildIgnoringAnonymousColumnBlocks(newChild, 0); |
- return; |
-} |
- |
-RenderBlockFlow* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBlock) |
-{ |
- RenderBlock* firstChildIgnoringAnonymousWrappers = 0; |
- for (RenderObject* curr = this; curr; curr = curr->parent()) { |
- if (!curr->isRenderBlock() || curr->isFloatingOrOutOfFlowPositioned() || curr->isTableCell() || curr->isRoot() || curr->isRenderView() || curr->hasOverflowClip() |
- || curr->isInlineBlockOrInlineTable()) |
- return 0; |
- |
- // FIXME: Renderers that do special management of their children (tables, buttons, |
- // lists, flexboxes, etc.) breaks when the flow is split through them. Disabling |
- // multi-column for them to avoid this problem.) |
- if (!curr->isRenderBlockFlow() || curr->isListItem()) |
- return 0; |
- |
- RenderBlockFlow* currBlock = toRenderBlockFlow(curr); |
- if (!currBlock->createsAnonymousWrapper()) |
- firstChildIgnoringAnonymousWrappers = currBlock; |
- |
- if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock || !currBlock->isAnonymousColumnsBlock())) |
- return toRenderBlockFlow(firstChildIgnoringAnonymousWrappers); |
- |
- if (currBlock->isAnonymousColumnSpanBlock()) |
- return 0; |
- } |
- return 0; |
-} |
- |
RenderBlock* RenderBlock::clone() const |
{ |
RenderBlock* cloneBlock; |
@@ -540,211 +427,6 @@ RenderBlock* RenderBlock::clone() const |
return cloneBlock; |
} |
-void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, |
- RenderBlock* middleBlock, |
- RenderObject* beforeChild, RenderBoxModelObject* oldCont) |
-{ |
- // Create a clone of this inline. |
- RenderBlock* cloneBlock = clone(); |
- if (!isAnonymousBlock()) |
- cloneBlock->setContinuation(oldCont); |
- |
- if (!beforeChild && isAfterContent(lastChild())) |
- beforeChild = lastChild(); |
- |
- // If we are moving inline children from |this| to cloneBlock, then we need |
- // to clear our line box tree. |
- if (beforeChild && childrenInline()) |
- deleteLineBoxTree(); |
- |
- // Now take all of the children from beforeChild to the end and remove |
- // them from |this| and place them in the clone. |
- moveChildrenTo(cloneBlock, beforeChild, 0, true); |
- |
- // Hook |clone| up as the continuation of the middle block. |
- if (!cloneBlock->isAnonymousBlock()) |
- middleBlock->setContinuation(cloneBlock); |
- |
- // We have been reparented and are now under the fromBlock. We need |
- // to walk up our block parent chain until we hit the containing anonymous columns block. |
- // Once we hit the anonymous columns block we're done. |
- RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); |
- RenderBoxModelObject* currChild = this; |
- RenderObject* currChildNextSibling = currChild->nextSibling(); |
- |
- while (curr && curr->isDescendantOf(fromBlock) && curr != fromBlock) { |
- ASSERT_WITH_SECURITY_IMPLICATION(curr->isRenderBlock()); |
- |
- RenderBlock* blockCurr = toRenderBlock(curr); |
- |
- // Create a new clone. |
- RenderBlock* cloneChild = cloneBlock; |
- cloneBlock = blockCurr->clone(); |
- |
- // Insert our child clone as the first child. |
- cloneBlock->addChildIgnoringContinuation(cloneChild, 0); |
- |
- // Hook the clone up as a continuation of |curr|. Note we do encounter |
- // anonymous blocks possibly as we walk up the block chain. When we split an |
- // anonymous block, there's no need to do any continuation hookup, since we haven't |
- // actually split a real element. |
- if (!blockCurr->isAnonymousBlock()) { |
- oldCont = blockCurr->continuation(); |
- blockCurr->setContinuation(cloneBlock); |
- cloneBlock->setContinuation(oldCont); |
- } |
- |
- // Now we need to take all of the children starting from the first child |
- // *after* currChild and append them all to the clone. |
- blockCurr->moveChildrenTo(cloneBlock, currChildNextSibling, 0, true); |
- |
- // Keep walking up the chain. |
- currChild = curr; |
- currChildNextSibling = currChild->nextSibling(); |
- curr = toRenderBoxModelObject(curr->parent()); |
- } |
- |
- // Now we are at the columns block level. We need to put the clone into the toBlock. |
- toBlock->children()->appendChildNode(toBlock, cloneBlock); |
- |
- // Now take all the children after currChild and remove them from the fromBlock |
- // and put them in the toBlock. |
- fromBlock->moveChildrenTo(toBlock, currChildNextSibling, 0, true); |
-} |
- |
-void RenderBlock::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, |
- RenderObject* newChild, RenderBoxModelObject* oldCont) |
-{ |
- RenderBlock* pre = 0; |
- RenderBlock* block = containingColumnsBlock(); |
- |
- // Delete our line boxes before we do the inline split into continuations. |
- block->deleteLineBoxTree(); |
- |
- bool madeNewBeforeBlock = false; |
- if (block->isAnonymousColumnsBlock()) { |
- // We can reuse this block and make it the preBlock of the next continuation. |
- pre = block; |
- pre->removePositionedObjects(0); |
- if (block->isRenderBlockFlow()) |
- toRenderBlockFlow(pre)->removeFloatingObjects(); |
- block = toRenderBlock(block->parent()); |
- } else { |
- // No anonymous block available for use. Make one. |
- pre = block->createAnonymousColumnsBlock(); |
- pre->setChildrenInline(false); |
- madeNewBeforeBlock = true; |
- } |
- |
- RenderBlock* post = block->createAnonymousColumnsBlock(); |
- post->setChildrenInline(false); |
- |
- RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling(); |
- if (madeNewBeforeBlock) |
- block->children()->insertChildNode(block, pre, boxFirst); |
- block->children()->insertChildNode(block, newBlockBox, boxFirst); |
- block->children()->insertChildNode(block, post, boxFirst); |
- block->setChildrenInline(false); |
- |
- if (madeNewBeforeBlock) |
- block->moveChildrenTo(pre, boxFirst, 0, true); |
- |
- splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); |
- |
- // We already know the newBlockBox isn't going to contain inline kids, so avoid wasting |
- // time in makeChildrenNonInline by just setting this explicitly up front. |
- newBlockBox->setChildrenInline(false); |
- |
- newBlockBox->addChild(newChild); |
- |
- // Always just do a full layout in order to ensure that line boxes (especially wrappers for images) |
- // get deleted properly. Because objects moves from the pre block into the post block, we want to |
- // make new line boxes instead of leaving the old line boxes around. |
- pre->setNeedsLayoutAndPrefWidthsRecalc(); |
- block->setNeedsLayoutAndPrefWidthsRecalc(); |
- post->setNeedsLayoutAndPrefWidthsRecalc(); |
-} |
- |
-void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlockFlow* newBlockBox, RenderObject* newChild) |
-{ |
- RenderBlockFlow* pre = 0; |
- RenderBlockFlow* post = 0; |
- RenderBlock* block = this; // Eventually block will not just be |this|, but will also be a block nested inside |this|. Assign to a variable |
- // so that we don't have to patch all of the rest of the code later on. |
- |
- // Delete the block's line boxes before we do the split. |
- block->deleteLineBoxTree(); |
- |
- if (beforeChild && beforeChild->parent() != this) |
- beforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
- |
- if (beforeChild != firstChild()) { |
- pre = block->createAnonymousColumnsBlock(); |
- pre->setChildrenInline(block->childrenInline()); |
- } |
- |
- if (beforeChild) { |
- post = block->createAnonymousColumnsBlock(); |
- post->setChildrenInline(block->childrenInline()); |
- } |
- |
- RenderObject* boxFirst = block->firstChild(); |
- if (pre) |
- block->children()->insertChildNode(block, pre, boxFirst); |
- block->children()->insertChildNode(block, newBlockBox, boxFirst); |
- if (post) |
- block->children()->insertChildNode(block, post, boxFirst); |
- block->setChildrenInline(false); |
- |
- // The pre/post blocks always have layers, so we know to always do a full insert/remove (so we pass true as the last argument). |
- block->moveChildrenTo(pre, boxFirst, beforeChild, true); |
- block->moveChildrenTo(post, beforeChild, 0, true); |
- |
- // We already know the newBlockBox isn't going to contain inline kids, so avoid wasting |
- // time in makeChildrenNonInline by just setting this explicitly up front. |
- newBlockBox->setChildrenInline(false); |
- |
- newBlockBox->addChild(newChild); |
- |
- // Always just do a full layout in order to ensure that line boxes (especially wrappers for images) |
- // get deleted properly. Because objects moved from the pre block into the post block, we want to |
- // make new line boxes instead of leaving the old line boxes around. |
- if (pre) |
- pre->setNeedsLayoutAndPrefWidthsRecalc(); |
- block->setNeedsLayoutAndPrefWidthsRecalc(); |
- if (post) |
- post->setNeedsLayoutAndPrefWidthsRecalc(); |
-} |
- |
-RenderBlockFlow* RenderBlock::columnsBlockForSpanningElement(RenderObject* newChild) |
-{ |
- // FIXME: This function is the gateway for the addition of column-span support. It will |
- // be added to in three stages: |
- // (1) Immediate children of a multi-column block can span. |
- // (2) Nested block-level children with only block-level ancestors between them and the multi-column block can span. |
- // (3) Nested children with block or inline ancestors between them and the multi-column block can span (this is when we |
- // cross the streams and have to cope with both types of continuations mixed together). |
- // This function currently supports (1) and (2). |
- RenderBlockFlow* columnsBlockAncestor = 0; |
- if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isBeforeOrAfterContent() |
- && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isInline() && !isAnonymousColumnSpanBlock()) { |
- columnsBlockAncestor = containingColumnsBlock(false); |
- if (columnsBlockAncestor) { |
- // Make sure that none of the parent ancestors have a continuation. |
- // If yes, we do not want split the block into continuations. |
- RenderObject* curr = this; |
- while (curr && curr != columnsBlockAncestor) { |
- if (curr->isRenderBlock() && toRenderBlock(curr)->continuation()) { |
- columnsBlockAncestor = 0; |
- break; |
- } |
- curr = curr->parent(); |
- } |
- } |
- } |
- return columnsBlockAncestor; |
-} |
- |
void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild) |
{ |
if (beforeChild && beforeChild->parent() != this) { |
@@ -788,36 +470,6 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, |
} |
} |
- // Check for a spanning element in columns. |
- if (gColumnFlowSplitEnabled) { |
- RenderBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(newChild); |
- if (columnsBlockAncestor) { |
- TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false); |
- // We are placing a column-span element inside a block. |
- RenderBlockFlow* newBox = createAnonymousColumnSpanBlock(); |
- |
- if (columnsBlockAncestor != this && !isRenderFlowThread()) { |
- // We are nested inside a multi-column element and are being split by the span. We have to break up |
- // our block into continuations. |
- RenderBoxModelObject* oldContinuation = continuation(); |
- |
- // When we split an anonymous block, there's no need to do any continuation hookup, |
- // since we haven't actually split a real element. |
- if (!isAnonymousBlock()) |
- setContinuation(newBox); |
- |
- splitFlow(beforeChild, newBox, newChild, oldContinuation); |
- return; |
- } |
- |
- // We have to perform a split of this block's children. This involves creating an anonymous block box to hold |
- // the column-spanning |newChild|. We take all of the children from before |newChild| and put them into |
- // one anonymous columns block, and all of the children after |newChild| go into another anonymous block. |
- makeChildrenAnonymousColumnBlocks(beforeChild, newBox, newChild); |
- return; |
- } |
- } |
- |
bool madeBoxesNonInline = false; |
// A block has to either have all of its children inline, or all of its children as blocks. |
@@ -870,10 +522,7 @@ void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) |
void RenderBlock::addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) |
{ |
- if (!isAnonymousBlock() && firstChild() && (firstChild()->isAnonymousColumnsBlock() || firstChild()->isAnonymousColumnSpanBlock())) |
- addChildToAnonymousColumnBlocks(newChild, beforeChild); |
- else |
- addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); |
+ addChildIgnoringAnonymousColumnBlocks(newChild, beforeChild); |
} |
static void getInlineRun(RenderObject* start, RenderObject* boundary, |
@@ -971,7 +620,7 @@ void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child) |
ASSERT(child->isAnonymousBlock()); |
ASSERT(!child->childrenInline()); |
- if (child->continuation() || (child->firstChild() && (child->isAnonymousColumnSpanBlock() || child->isAnonymousColumnsBlock()))) |
+ if (child->continuation()) |
return; |
RenderObject* firstAnChild = child->m_children.firstChild(); |
@@ -1031,12 +680,7 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje |
|| (next && (next->isRubyRun() || next->isRubyBase()))) |
return false; |
- if (!prev || !next) |
- return true; |
- |
- // Make sure the types of the anonymous blocks match up. |
- return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() |
- && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); |
+ return true; |
} |
void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) |
@@ -1072,9 +716,6 @@ void RenderBlock::removeChild(RenderObject* oldChild) |
return; |
} |
- // This protects against column split flows when anonymous blocks are getting merged. |
- TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false); |
- |
// If this child is a block, and if our previous and next siblings are |
// both anonymous blocks with inline content, then we can go ahead and |
// fold the inline content back together. |
@@ -1490,44 +1131,18 @@ void RenderBlock::computeRegionRangeForBlock(RenderFlowThread* flowThread) |
bool RenderBlock::updateLogicalWidthAndColumnWidth() |
{ |
LayoutUnit oldWidth = logicalWidth(); |
- LayoutUnit oldColumnWidth = desiredColumnWidth(); |
updateLogicalWidth(); |
- calcColumnWidth(); |
bool hasBorderOrPaddingLogicalWidthChanged = m_hasBorderOrPaddingLogicalWidthChanged; |
m_hasBorderOrPaddingLogicalWidthChanged = false; |
- return oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth() || hasBorderOrPaddingLogicalWidthChanged; |
+ return oldWidth != logicalWidth() || hasBorderOrPaddingLogicalWidthChanged; |
} |
void RenderBlock::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) |
{ |
- ColumnInfo* colInfo = columnInfo(); |
- if (hasColumns()) { |
- if (!pageLogicalHeight) { |
- LayoutUnit oldLogicalHeight = logicalHeight(); |
- setLogicalHeight(0); |
- // We need to go ahead and set our explicit page height if one exists, so that we can |
- // avoid doing two layout passes. |
- updateLogicalHeight(); |
- LayoutUnit columnHeight = contentLogicalHeight(); |
- if (columnHeight > 0) { |
- pageLogicalHeight = columnHeight; |
- hasSpecifiedPageLogicalHeight = true; |
- } |
- setLogicalHeight(oldLogicalHeight); |
- } |
- if (colInfo->columnHeight() != pageLogicalHeight && everHadLayout()) { |
- colInfo->setColumnHeight(pageLogicalHeight); |
- pageLogicalHeightChanged = true; |
- } |
- |
- if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight) |
- colInfo->clearForcedBreaks(); |
- |
- colInfo->setPaginationUnit(paginationUnit()); |
- } else if (isRenderFlowThread()) { |
+ if (isRenderFlowThread()) { |
pageLogicalHeight = 1; // This is just a hack to always make sure we have a page logical height. |
pageLogicalHeightChanged = toRenderFlowThread(this)->pageLogicalSizeChanged(); |
} |
@@ -1541,19 +1156,10 @@ void RenderBlock::layoutBlock(bool) |
void RenderBlock::addOverflowFromChildren() |
{ |
- if (!hasColumns()) { |
- if (childrenInline()) |
- toRenderBlockFlow(this)->addOverflowFromInlineChildren(); |
- else |
- addOverflowFromBlockChildren(); |
- } else { |
- ColumnInfo* colInfo = columnInfo(); |
- if (columnCount(colInfo)) { |
- LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1); |
- addLayoutOverflow(lastRect); |
- addContentsVisualOverflow(lastRect); |
- } |
- } |
+ if (childrenInline()) |
+ toRenderBlockFlow(this)->addOverflowFromInlineChildren(); |
+ else |
+ addOverflowFromBlockChildren(); |
} |
void RenderBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool) |
@@ -1629,7 +1235,7 @@ void RenderBlock::addVisualOverflowFromTheme() |
bool RenderBlock::expandsToEncloseOverhangingFloats() const |
{ |
return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBoxIncludingDeprecated()) |
- || hasColumns() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot(); |
+ || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot(); |
} |
void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child, ApplyLayoutDeltaMode applyDelta) |
@@ -1725,7 +1331,7 @@ bool RenderBlock::simplifiedLayout() |
if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normalChildNeedsLayout() || selfNeedsLayout()) |
return false; |
- LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); |
+ LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); |
if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly()) |
return false; |
@@ -1819,9 +1425,6 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPosit |
if (!positionedDescendants) |
return; |
- if (hasColumns()) |
- view()->layoutState()->clearPaginationInformation(); // Positioned objects are not part of the column flow, so they don't paginate with the columns. |
- |
RenderBox* r; |
TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) { |
@@ -1874,9 +1477,6 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPosit |
if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop) |
r->forceChildLayout(); |
} |
- |
- if (hasColumns()) |
- view()->layoutState()->m_columnInfo = columnInfo(); // FIXME: Kind of gross. We just put this back into the layout state so that pop() will work. |
} |
void RenderBlock::markPositionedObjectsForLayout() |
@@ -1940,152 +1540,6 @@ void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayControls */); |
} |
-void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
-{ |
- if (paintInfo.context->paintingDisabled()) |
- return; |
- |
- const Color& ruleColor = resolveColor(CSSPropertyWebkitColumnRuleColor); |
- bool ruleTransparent = style()->columnRuleIsTransparent(); |
- EBorderStyle ruleStyle = style()->columnRuleStyle(); |
- LayoutUnit ruleThickness = style()->columnRuleWidth(); |
- LayoutUnit colGap = columnGap(); |
- bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent; |
- if (!renderRule) |
- return; |
- |
- ColumnInfo* colInfo = columnInfo(); |
- unsigned colCount = columnCount(colInfo); |
- |
- bool antialias = shouldAntialiasLines(paintInfo.context); |
- |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { |
- bool leftToRight = style()->isLeftToRightDirection() ^ colInfo->progressionIsReversed(); |
- LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogicalWidth(); |
- LayoutUnit ruleAdd = logicalLeftOffsetForContent(); |
- LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidth(); |
- LayoutUnit inlineDirectionSize = colInfo->desiredColumnWidth(); |
- BoxSide boxSide = isHorizontalWritingMode() |
- ? leftToRight ? BSLeft : BSRight |
- : leftToRight ? BSTop : BSBottom; |
- |
- for (unsigned i = 0; i < colCount; i++) { |
- // Move to the next position. |
- if (leftToRight) { |
- ruleLogicalLeft += inlineDirectionSize + colGap / 2; |
- currLogicalLeftOffset += inlineDirectionSize + colGap; |
- } else { |
- ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); |
- currLogicalLeftOffset -= (inlineDirectionSize + colGap); |
- } |
- |
- // Now paint the column rule. |
- if (i < colCount - 1) { |
- LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft(); |
- LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth(); |
- LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; |
- LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness; |
- IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom); |
- drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); |
- } |
- |
- ruleLogicalLeft = currLogicalLeftOffset; |
- } |
- } else { |
- bool topToBottom = !style()->isFlippedBlocksWritingMode() ^ colInfo->progressionIsReversed(); |
- LayoutUnit ruleLeft = isHorizontalWritingMode() |
- ? borderLeft() + paddingLeft() |
- : colGap / 2 - colGap - ruleThickness / 2 + (!colInfo->progressionIsReversed() ? borderBefore() + paddingBefore() : borderAfter() + paddingAfter()); |
- LayoutUnit ruleWidth = isHorizontalWritingMode() ? contentWidth() : ruleThickness; |
- LayoutUnit ruleTop = isHorizontalWritingMode() |
- ? colGap / 2 - colGap - ruleThickness / 2 + (!colInfo->progressionIsReversed() ? borderBefore() + paddingBefore() : borderAfter() + paddingAfter()) |
- : borderStart() + paddingStart(); |
- LayoutUnit ruleHeight = isHorizontalWritingMode() ? ruleThickness : contentHeight(); |
- LayoutRect ruleRect(ruleLeft, ruleTop, ruleWidth, ruleHeight); |
- |
- if (!topToBottom) { |
- if (isHorizontalWritingMode()) |
- ruleRect.setY(height() - ruleRect.maxY()); |
- else |
- ruleRect.setX(width() - ruleRect.maxX()); |
- } |
- |
- ruleRect.moveBy(paintOffset); |
- |
- BoxSide boxSide = isHorizontalWritingMode() |
- ? topToBottom ? BSTop : BSBottom |
- : topToBottom ? BSLeft : BSRight; |
- |
- LayoutSize step(0, topToBottom ? colInfo->columnHeight() + colGap : -(colInfo->columnHeight() + colGap)); |
- if (!isHorizontalWritingMode()) |
- step = step.transposedSize(); |
- |
- for (unsigned i = 1; i < colCount; i++) { |
- ruleRect.move(step); |
- IntRect pixelSnappedRuleRect = pixelSnappedIntRect(ruleRect); |
- drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); |
- } |
- } |
-} |
- |
-void RenderBlock::paintColumnContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset, bool paintingFloats) |
-{ |
- // We need to do multiple passes, breaking up our child painting into strips. |
- GraphicsContext* context = paintInfo.context; |
- ColumnInfo* colInfo = columnInfo(); |
- unsigned colCount = columnCount(colInfo); |
- if (!colCount) |
- return; |
- LayoutUnit currLogicalTopOffset = 0; |
- LayoutUnit colGap = columnGap(); |
- for (unsigned i = 0; i < colCount; i++) { |
- // For each rect, we clip to the rect, and then we adjust our coords. |
- LayoutRect colRect = columnRectAt(colInfo, i); |
- flipForWritingMode(colRect); |
- LayoutUnit logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x() : colRect.y()) - logicalLeftOffsetForContent(); |
- LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOffset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, logicalLeftOffset); |
- if (colInfo->progressionAxis() == ColumnInfo::BlockAxis) { |
- if (isHorizontalWritingMode()) |
- offset.expand(0, colRect.y() - borderTop() - paddingTop()); |
- else |
- offset.expand(colRect.x() - borderLeft() - paddingLeft(), 0); |
- } |
- colRect.moveBy(paintOffset); |
- PaintInfo info(paintInfo); |
- info.rect.intersect(pixelSnappedIntRect(colRect)); |
- |
- if (!info.rect.isEmpty()) { |
- GraphicsContextStateSaver stateSaver(*context); |
- LayoutRect clipRect(colRect); |
- |
- if (i < colCount - 1) { |
- if (isHorizontalWritingMode()) |
- clipRect.expand(colGap / 2, 0); |
- else |
- clipRect.expand(0, colGap / 2); |
- } |
- // Each strip pushes a clip, since column boxes are specified as being |
- // like overflow:hidden. |
- // FIXME: Content and column rules that extend outside column boxes at the edges of the multi-column element |
- // are clipped according to the 'overflow' property. |
- context->clip(pixelSnappedIntRect(clipRect)); |
- |
- // Adjust our x and y when painting. |
- LayoutPoint adjustedPaintOffset = paintOffset + offset; |
- if (paintingFloats) |
- paintFloats(info, adjustedPaintOffset, paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip); |
- else |
- paintContents(info, adjustedPaintOffset); |
- } |
- |
- LayoutUnit blockDelta = (isHorizontalWritingMode() ? colRect.height() : colRect.width()); |
- if (style()->isFlippedBlocksWritingMode()) |
- currLogicalTopOffset += blockDelta; |
- else |
- currLogicalTopOffset -= blockDelta; |
- } |
-} |
- |
void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
// Avoid painting descendants of the root element when stylesheets haven't loaded. This eliminates FOUC. |
@@ -2193,8 +1647,6 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs |
if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && style()->visibility() == VISIBLE) { |
if (hasBoxDecorations()) |
paintBoxDecorations(paintInfo, paintOffset); |
- if (hasColumns() && !paintInfo.paintRootBackgroundOnly()) |
- paintColumnRules(paintInfo, scrolledOffset); |
} |
if (paintPhase == PaintPhaseMask && style()->visibility() == VISIBLE) { |
@@ -2212,26 +1664,18 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs |
return; |
// 2. paint contents |
- if (paintPhase != PaintPhaseSelfOutline) { |
- if (hasColumns()) |
- paintColumnContents(paintInfo, scrolledOffset); |
- else |
- paintContents(paintInfo, scrolledOffset); |
- } |
+ if (paintPhase != PaintPhaseSelfOutline) |
+ paintContents(paintInfo, scrolledOffset); |
// 3. paint selection |
// FIXME: Make this work with multi column layouts. For now don't fill gaps. |
bool isPrinting = document().printing(); |
- if (!isPrinting && !hasColumns()) |
+ if (!isPrinting) |
paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on lines and between blocks. |
// 4. paint floats. |
- if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip) { |
- if (hasColumns()) |
- paintColumnContents(paintInfo, scrolledOffset, true); |
- else |
- paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip); |
- } |
+ if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip) |
+ paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip); |
// 5. paint outline. |
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && hasOutline() && style()->visibility() == VISIBLE) |
@@ -2482,7 +1926,7 @@ GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& r |
if (!isRenderBlockFlow() && !isFlexibleBoxIncludingDeprecated()) // FIXME: Make multi-column selection gap filling work someday. |
return result; |
- if (hasColumns() || hasTransform() || style()->columnSpan()) { |
+ if (hasTransform() || style()->columnSpan()) { |
// FIXME: We should learn how to gap fill multiple columns and transforms eventually. |
lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) + logicalHeight(); |
lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, logicalHeight()); |
@@ -2917,12 +2361,6 @@ void RenderBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l |
} |
} |
-bool RenderBlock::avoidsFloats() const |
-{ |
- // Floats can't intrude into our box if we have a non-auto column count or width. |
- return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth(); |
-} |
- |
void RenderBlock::markShapeInsideDescendantsForLayout() |
{ |
if (!everHadLayout()) |
@@ -2988,18 +2426,12 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu |
if (hasOverflowClip()) |
scrolledOffset -= scrolledContentOffset(); |
- // Hit test contents if we don't have columns. |
- if (!hasColumns()) { |
- if (hitTestContents(request, result, locationInContainer, toLayoutPoint(scrolledOffset), hitTestAction)) { |
- updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - localOffset)); |
- return true; |
- } |
- if (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, toLayoutPoint(scrolledOffset))) |
- return true; |
- } else if (hitTestColumns(request, result, locationInContainer, toLayoutPoint(scrolledOffset), hitTestAction)) { |
+ if (hitTestContents(request, result, locationInContainer, toLayoutPoint(scrolledOffset), hitTestAction)) { |
updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - localOffset)); |
return true; |
} |
+ if (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, toLayoutPoint(scrolledOffset))) |
+ return true; |
} |
// Check if the point is outside radii. |
@@ -3024,102 +2456,6 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu |
return false; |
} |
-class ColumnRectIterator { |
- WTF_MAKE_NONCOPYABLE(ColumnRectIterator); |
-public: |
- ColumnRectIterator(const RenderBlock& block) |
- : m_block(block) |
- , m_colInfo(block.columnInfo()) |
- , m_direction(m_block.style()->isFlippedBlocksWritingMode() ? 1 : -1) |
- , m_isHorizontal(block.isHorizontalWritingMode()) |
- , m_logicalLeft(block.logicalLeftOffsetForContent()) |
- { |
- int colCount = m_colInfo->columnCount(); |
- m_colIndex = colCount - 1; |
- m_currLogicalTopOffset = colCount * m_colInfo->columnHeight() * m_direction; |
- update(); |
- } |
- |
- void advance() |
- { |
- ASSERT(hasMore()); |
- m_colIndex--; |
- update(); |
- } |
- |
- LayoutRect columnRect() const { return m_colRect; } |
- bool hasMore() const { return m_colIndex >= 0; } |
- |
- void adjust(LayoutSize& offset) const |
- { |
- LayoutUnit currLogicalLeftOffset = (m_isHorizontal ? m_colRect.x() : m_colRect.y()) - m_logicalLeft; |
- offset += m_isHorizontal ? LayoutSize(currLogicalLeftOffset, m_currLogicalTopOffset) : LayoutSize(m_currLogicalTopOffset, currLogicalLeftOffset); |
- if (m_colInfo->progressionAxis() == ColumnInfo::BlockAxis) { |
- if (m_isHorizontal) |
- offset.expand(0, m_colRect.y() - m_block.borderTop() - m_block.paddingTop()); |
- else |
- offset.expand(m_colRect.x() - m_block.borderLeft() - m_block.paddingLeft(), 0); |
- } |
- } |
- |
-private: |
- void update() |
- { |
- if (m_colIndex < 0) |
- return; |
- |
- m_colRect = m_block.columnRectAt(const_cast<ColumnInfo*>(m_colInfo), m_colIndex); |
- m_block.flipForWritingMode(m_colRect); |
- m_currLogicalTopOffset -= (m_isHorizontal ? m_colRect.height() : m_colRect.width()) * m_direction; |
- } |
- |
- const RenderBlock& m_block; |
- const ColumnInfo* const m_colInfo; |
- const int m_direction; |
- const bool m_isHorizontal; |
- const LayoutUnit m_logicalLeft; |
- int m_colIndex; |
- LayoutUnit m_currLogicalTopOffset; |
- LayoutRect m_colRect; |
-}; |
- |
-bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |
-{ |
- // We need to do multiple passes, breaking up our hit testing into strips. |
- if (!hasColumns()) |
- return false; |
- |
- for (ColumnRectIterator it(*this); it.hasMore(); it.advance()) { |
- LayoutRect hitRect = locationInContainer.boundingBox(); |
- LayoutRect colRect = it.columnRect(); |
- colRect.moveBy(accumulatedOffset); |
- if (locationInContainer.intersects(colRect)) { |
- // The point is inside this column. |
- // Adjust accumulatedOffset to change where we hit test. |
- LayoutSize offset; |
- it.adjust(offset); |
- LayoutPoint finalLocation = accumulatedOffset + offset; |
- if (!result.isRectBasedTest() || colRect.contains(hitRect)) |
- return hitTestContents(request, result, locationInContainer, finalLocation, hitTestAction) || (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, finalLocation)); |
- |
- hitTestContents(request, result, locationInContainer, finalLocation, hitTestAction); |
- } |
- } |
- |
- return false; |
-} |
- |
-void RenderBlock::adjustForColumnRect(LayoutSize& offset, const LayoutPoint& locationInContainer) const |
-{ |
- for (ColumnRectIterator it(*this); it.hasMore(); it.advance()) { |
- LayoutRect colRect = it.columnRect(); |
- if (colRect.contains(locationInContainer)) { |
- it.adjust(offset); |
- return; |
- } |
- } |
-} |
- |
bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |
{ |
if (isRenderRegion()) |
@@ -3356,20 +2692,9 @@ void RenderBlock::offsetForContents(LayoutPoint& offset) const |
if (hasOverflowClip()) |
offset += scrolledContentOffset(); |
- if (hasColumns()) |
- adjustPointToColumnContents(offset); |
- |
offset = flipForWritingMode(offset); |
} |
-LayoutUnit RenderBlock::availableLogicalWidth() const |
-{ |
- // If we have multiple columns, then the available logical width is reduced to our column width. |
- if (hasColumns()) |
- return desiredColumnWidth(); |
- return RenderBox::availableLogicalWidth(); |
-} |
- |
int RenderBlock::columnGap() const |
{ |
if (style()->hasNormalColumnGap()) |
@@ -3377,40 +2702,6 @@ int RenderBlock::columnGap() const |
return static_cast<int>(style()->columnGap()); |
} |
-void RenderBlock::calcColumnWidth() |
-{ |
- if (document().regionBasedColumnsEnabled()) |
- return; |
- |
- // Calculate our column width and column count. |
- // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibling4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 |
- unsigned desiredColumnCount = 1; |
- LayoutUnit desiredColumnWidth = contentLogicalWidth(); |
- |
- // For now, we don't support multi-column layouts when printing, since we have to do a lot of work for proper pagination. |
- if (document().paginated() || (style()->hasAutoColumnCount() && style()->hasAutoColumnWidth()) || !style()->hasInlineColumnAxis()) { |
- setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); |
- return; |
- } |
- |
- LayoutUnit availWidth = desiredColumnWidth; |
- LayoutUnit colGap = columnGap(); |
- LayoutUnit colWidth = max<LayoutUnit>(1, LayoutUnit(style()->columnWidth())); |
- int colCount = max<int>(1, style()->columnCount()); |
- |
- if (style()->hasAutoColumnWidth() && !style()->hasAutoColumnCount()) { |
- desiredColumnCount = colCount; |
- desiredColumnWidth = max<LayoutUnit>(0, (availWidth - ((desiredColumnCount - 1) * colGap)) / desiredColumnCount); |
- } else if (!style()->hasAutoColumnWidth() && style()->hasAutoColumnCount()) { |
- desiredColumnCount = max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + colGap)); |
- desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colGap; |
- } else { |
- desiredColumnCount = max<LayoutUnit>(min<LayoutUnit>(colCount, (availWidth + colGap) / (colWidth + colGap)), 1); |
- desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colGap; |
- } |
- setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); |
-} |
- |
bool RenderBlock::requiresColumns(int desiredColumnCount) const |
{ |
// If overflow-y is set to paged-x or paged-y on the body or html element, we'll handle the paginating |
@@ -3418,109 +2709,7 @@ bool RenderBlock::requiresColumns(int desiredColumnCount) const |
bool isPaginated = (style()->overflowY() == OPAGEDX || style()->overflowY() == OPAGEDY) && !(isRoot() || isBody()); |
return firstChild() |
- && (desiredColumnCount != 1 || !style()->hasAutoColumnWidth() || !style()->hasInlineColumnAxis() || isPaginated) |
- && !firstChild()->isAnonymousColumnsBlock() |
- && !firstChild()->isAnonymousColumnSpanBlock(); |
-} |
- |
-void RenderBlock::setDesiredColumnCountAndWidth(int count, LayoutUnit width) |
-{ |
- bool destroyColumns = !requiresColumns(count); |
- if (destroyColumns) { |
- if (hasColumns()) { |
- gColumnInfoMap->take(this); |
- setHasColumns(false); |
- } |
- } else { |
- ColumnInfo* info; |
- if (hasColumns()) |
- info = gColumnInfoMap->get(this); |
- else { |
- if (!gColumnInfoMap) |
- gColumnInfoMap = new ColumnInfoMap; |
- info = new ColumnInfo; |
- gColumnInfoMap->add(this, adoptPtr(info)); |
- setHasColumns(true); |
- } |
- info->setDesiredColumnCount(count); |
- info->setDesiredColumnWidth(width); |
- info->setProgressionAxis(style()->hasInlineColumnAxis() ? ColumnInfo::InlineAxis : ColumnInfo::BlockAxis); |
- info->setProgressionIsReversed(style()->columnProgression() == ReverseColumnProgression); |
- } |
-} |
- |
-void RenderBlock::updateColumnInfoFromStyle(RenderStyle* style) |
-{ |
- if (!hasColumns()) |
- return; |
- |
- ColumnInfo* info = gColumnInfoMap->get(this); |
- |
- bool needsLayout = false; |
- ColumnInfo::Axis oldAxis = info->progressionAxis(); |
- ColumnInfo::Axis newAxis = style->hasInlineColumnAxis() ? ColumnInfo::InlineAxis : ColumnInfo::BlockAxis; |
- if (oldAxis != newAxis) { |
- info->setProgressionAxis(newAxis); |
- needsLayout = true; |
- } |
- |
- bool oldProgressionIsReversed = info->progressionIsReversed(); |
- bool newProgressionIsReversed = style->columnProgression() == ReverseColumnProgression; |
- if (oldProgressionIsReversed != newProgressionIsReversed) { |
- info->setProgressionIsReversed(newProgressionIsReversed); |
- needsLayout = true; |
- } |
- |
- if (needsLayout) |
- setNeedsLayoutAndPrefWidthsRecalc(); |
-} |
- |
-LayoutUnit RenderBlock::desiredColumnWidth() const |
-{ |
- if (!hasColumns()) |
- return contentLogicalWidth(); |
- return gColumnInfoMap->get(this)->desiredColumnWidth(); |
-} |
- |
-ColumnInfo* RenderBlock::columnInfo() const |
-{ |
- if (!hasColumns()) |
- return 0; |
- return gColumnInfoMap->get(this); |
-} |
- |
-unsigned RenderBlock::columnCount(ColumnInfo* colInfo) const |
-{ |
- ASSERT(hasColumns()); |
- ASSERT(gColumnInfoMap->get(this) == colInfo); |
- return colInfo->columnCount(); |
-} |
- |
-LayoutRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const |
-{ |
- ASSERT(hasColumns() && gColumnInfoMap->get(this) == colInfo); |
- |
- // Compute the appropriate rect based off our information. |
- LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth(); |
- LayoutUnit colLogicalHeight = colInfo->columnHeight(); |
- LayoutUnit colLogicalTop = borderBefore() + paddingBefore(); |
- LayoutUnit colLogicalLeft = logicalLeftOffsetForContent(); |
- LayoutUnit colGap = columnGap(); |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { |
- if (style()->isLeftToRightDirection() ^ colInfo->progressionIsReversed()) |
- colLogicalLeft += index * (colLogicalWidth + colGap); |
- else |
- colLogicalLeft += contentLogicalWidth() - colLogicalWidth - index * (colLogicalWidth + colGap); |
- } else { |
- if (!colInfo->progressionIsReversed()) |
- colLogicalTop += index * (colLogicalHeight + colGap); |
- else |
- colLogicalTop += contentLogicalHeight() - colLogicalHeight - index * (colLogicalHeight + colGap); |
- } |
- |
- if (isHorizontalWritingMode()) |
- return LayoutRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight); |
- return LayoutRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth); |
+ && (desiredColumnCount != 1 || !style()->hasAutoColumnWidth() || !style()->hasInlineColumnAxis() || isPaginated); |
} |
bool RenderBlock::relayoutToAvoidWidows(LayoutStateMaintainer& statePusher) |
@@ -3534,222 +2723,6 @@ bool RenderBlock::relayoutToAvoidWidows(LayoutStateMaintainer& statePusher) |
return true; |
} |
-void RenderBlock::adjustPointToColumnContents(LayoutPoint& point) const |
-{ |
- // Just bail if we have no columns. |
- if (!hasColumns()) |
- return; |
- |
- ColumnInfo* colInfo = columnInfo(); |
- if (!columnCount(colInfo)) |
- return; |
- |
- // Determine which columns we intersect. |
- LayoutUnit colGap = columnGap(); |
- LayoutUnit halfColGap = colGap / 2; |
- LayoutPoint columnPoint(columnRectAt(colInfo, 0).location()); |
- LayoutUnit logicalOffset = 0; |
- for (unsigned i = 0; i < colInfo->columnCount(); i++) { |
- // Add in half the column gap to the left and right of the rect. |
- LayoutRect colRect = columnRectAt(colInfo, i); |
- flipForWritingMode(colRect); |
- if (isHorizontalWritingMode() == (colInfo->progressionAxis() == ColumnInfo::InlineAxis)) { |
- LayoutRect gapAndColumnRect(colRect.x() - halfColGap, colRect.y(), colRect.width() + colGap, colRect.height()); |
- if (point.x() >= gapAndColumnRect.x() && point.x() < gapAndColumnRect.maxX()) { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { |
- // FIXME: The clamping that follows is not completely right for right-to-left |
- // content. |
- // Clamp everything above the column to its top left. |
- if (point.y() < gapAndColumnRect.y()) |
- point = gapAndColumnRect.location(); |
- // Clamp everything below the column to the next column's top left. If there is |
- // no next column, this still maps to just after this column. |
- else if (point.y() >= gapAndColumnRect.maxY()) { |
- point = gapAndColumnRect.location(); |
- point.move(0, gapAndColumnRect.height()); |
- } |
- } else { |
- if (point.x() < colRect.x()) |
- point.setX(colRect.x()); |
- else if (point.x() >= colRect.maxX()) |
- point.setX(colRect.maxX() - 1); |
- } |
- |
- // We're inside the column. Translate the x and y into our column coordinate space. |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- point.move(columnPoint.x() - colRect.x(), (!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset)); |
- else |
- point.move((!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.x() + borderLeft() + paddingLeft(), 0); |
- return; |
- } |
- |
- // Move to the next position. |
- logicalOffset += colInfo->progressionAxis() == ColumnInfo::InlineAxis ? colRect.height() : colRect.width(); |
- } else { |
- LayoutRect gapAndColumnRect(colRect.x(), colRect.y() - halfColGap, colRect.width(), colRect.height() + colGap); |
- if (point.y() >= gapAndColumnRect.y() && point.y() < gapAndColumnRect.maxY()) { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { |
- // FIXME: The clamping that follows is not completely right for right-to-left |
- // content. |
- // Clamp everything above the column to its top left. |
- if (point.x() < gapAndColumnRect.x()) |
- point = gapAndColumnRect.location(); |
- // Clamp everything below the column to the next column's top left. If there is |
- // no next column, this still maps to just after this column. |
- else if (point.x() >= gapAndColumnRect.maxX()) { |
- point = gapAndColumnRect.location(); |
- point.move(gapAndColumnRect.width(), 0); |
- } |
- } else { |
- if (point.y() < colRect.y()) |
- point.setY(colRect.y()); |
- else if (point.y() >= colRect.maxY()) |
- point.setY(colRect.maxY() - 1); |
- } |
- |
- // We're inside the column. Translate the x and y into our column coordinate space. |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- point.move((!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset), columnPoint.y() - colRect.y()); |
- else |
- point.move(0, (!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.y() + borderTop() + paddingTop()); |
- return; |
- } |
- |
- // Move to the next position. |
- logicalOffset += colInfo->progressionAxis() == ColumnInfo::InlineAxis ? colRect.width() : colRect.height(); |
- } |
- } |
-} |
- |
-void RenderBlock::adjustRectForColumns(LayoutRect& r) const |
-{ |
- // Just bail if we have no columns. |
- if (!hasColumns()) |
- return; |
- |
- ColumnInfo* colInfo = columnInfo(); |
- |
- // Determine which columns we intersect. |
- unsigned colCount = columnCount(colInfo); |
- if (!colCount) |
- return; |
- |
- // Begin with a result rect that is empty. |
- LayoutRect result; |
- |
- bool isHorizontal = isHorizontalWritingMode(); |
- LayoutUnit beforeBorderPadding = borderBefore() + paddingBefore(); |
- LayoutUnit colHeight = colInfo->columnHeight(); |
- if (!colHeight) |
- return; |
- |
- LayoutUnit startOffset = max(isHorizontal ? r.y() : r.x(), beforeBorderPadding); |
- LayoutUnit endOffset = max(min<LayoutUnit>(isHorizontal ? r.maxY() : r.maxX(), beforeBorderPadding + colCount * colHeight), beforeBorderPadding); |
- |
- // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibling4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 |
- unsigned startColumn = (startOffset - beforeBorderPadding) / colHeight; |
- unsigned endColumn = (endOffset - beforeBorderPadding) / colHeight; |
- |
- if (startColumn == endColumn) { |
- // The rect is fully contained within one column. Adjust for our offsets |
- // and repaint only that portion. |
- LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); |
- LayoutRect colRect = columnRectAt(colInfo, startColumn); |
- LayoutRect repaintRect = r; |
- |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { |
- if (isHorizontal) |
- repaintRect.move(colRect.x() - logicalLeftOffset, - static_cast<int>(startColumn) * colHeight); |
- else |
- repaintRect.move(- static_cast<int>(startColumn) * colHeight, colRect.y() - logicalLeftOffset); |
- } else { |
- if (isHorizontal) |
- repaintRect.move(0, colRect.y() - startColumn * colHeight - beforeBorderPadding); |
- else |
- repaintRect.move(colRect.x() - startColumn * colHeight - beforeBorderPadding, 0); |
- } |
- repaintRect.intersect(colRect); |
- result.unite(repaintRect); |
- } else { |
- // We span multiple columns. We can just unite the start and end column to get the final |
- // repaint rect. |
- result.unite(columnRectAt(colInfo, startColumn)); |
- result.unite(columnRectAt(colInfo, endColumn)); |
- } |
- |
- r = result; |
-} |
- |
-LayoutPoint RenderBlock::flipForWritingModeIncludingColumns(const LayoutPoint& point) const |
-{ |
- ASSERT(hasColumns()); |
- if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) |
- return point; |
- ColumnInfo* colInfo = columnInfo(); |
- LayoutUnit columnLogicalHeight = colInfo->columnHeight(); |
- LayoutUnit expandedLogicalHeight = borderBefore() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight(); |
- if (isHorizontalWritingMode()) |
- return LayoutPoint(point.x(), expandedLogicalHeight - point.y()); |
- return LayoutPoint(expandedLogicalHeight - point.x(), point.y()); |
-} |
- |
-void RenderBlock::adjustStartEdgeForWritingModeIncludingColumns(LayoutRect& rect) const |
-{ |
- ASSERT(hasColumns()); |
- if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) |
- return; |
- |
- ColumnInfo* colInfo = columnInfo(); |
- LayoutUnit columnLogicalHeight = colInfo->columnHeight(); |
- LayoutUnit expandedLogicalHeight = borderBefore() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight(); |
- |
- if (isHorizontalWritingMode()) |
- rect.setY(expandedLogicalHeight - rect.maxY()); |
- else |
- rect.setX(expandedLogicalHeight - rect.maxX()); |
-} |
- |
-void RenderBlock::adjustForColumns(LayoutSize& offset, const LayoutPoint& point) const |
-{ |
- if (!hasColumns()) |
- return; |
- |
- ColumnInfo* colInfo = columnInfo(); |
- |
- LayoutUnit logicalLeft = logicalLeftOffsetForContent(); |
- unsigned colCount = columnCount(colInfo); |
- LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth(); |
- LayoutUnit colLogicalHeight = colInfo->columnHeight(); |
- |
- for (unsigned i = 0; i < colCount; ++i) { |
- // Compute the edges for a given column in the block progression direction. |
- LayoutRect sliceRect = LayoutRect(logicalLeft, borderBefore() + paddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight); |
- if (!isHorizontalWritingMode()) |
- sliceRect = sliceRect.transposedRect(); |
- |
- LayoutUnit logicalOffset = i * colLogicalHeight; |
- |
- // Now we're in the same coordinate space as the point. See if it is inside the rectangle. |
- if (isHorizontalWritingMode()) { |
- if (point.y() >= sliceRect.y() && point.y() < sliceRect.maxY()) { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- offset.expand(columnRectAt(colInfo, i).x() - logicalLeft, -logicalOffset); |
- else |
- offset.expand(0, columnRectAt(colInfo, i).y() - logicalOffset - borderBefore() - paddingBefore()); |
- return; |
- } |
- } else { |
- if (point.x() >= sliceRect.x() && point.x() < sliceRect.maxX()) { |
- if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) |
- offset.expand(-logicalOffset, columnRectAt(colInfo, i).y() - logicalLeft); |
- else |
- offset.expand(columnRectAt(colInfo, i).x() - logicalOffset - borderBefore() - paddingBefore(), 0); |
- return; |
- } |
- } |
- } |
-} |
- |
void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const |
{ |
if (childrenInline()) { |
@@ -5197,10 +4170,6 @@ void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou |
RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const |
{ |
- if (isAnonymousColumnsBlock()) |
- return createAnonymousColumnsWithParentRenderer(parent); |
- if (isAnonymousColumnSpanBlock()) |
- return createAnonymousColumnSpanWithParentRenderer(parent); |
return createAnonymousWithParentRendererAndDisplay(parent, style()->display()); |
} |
@@ -5236,11 +4205,6 @@ LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar |
return logicalOffset + remainingLogicalHeight; |
} |
-ColumnInfo::PaginationUnit RenderBlock::paginationUnit() const |
-{ |
- return ColumnInfo::Column; |
-} |
- |
LayoutUnit RenderBlock::pageLogicalTopForOffset(LayoutUnit offset) const |
{ |
RenderView* renderView = view(); |
@@ -5289,11 +4253,10 @@ LayoutUnit RenderBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P |
LayoutUnit RenderBlock::adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOffset, bool includeMargins) |
{ |
- bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); |
- bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLogicalHeight; |
+ bool checkPageBreaks = view()->layoutState()->m_pageLogicalHeight; |
RenderFlowThread* flowThread = flowThreadContainingBlock(); |
bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread(); |
- bool isUnsplittable = child->isUnsplittableForPagination() || (checkColumnBreaks && child->style()->columnBreakInside() == PBAVOID) |
+ bool isUnsplittable = child->isUnsplittableForPagination() |
|| (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID) |
|| (checkRegionBreaks && child->style()->regionBreakInside() == PBAVOID); |
if (!isUnsplittable) |
@@ -5339,8 +4302,6 @@ void RenderBlock::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeigh |
{ |
if (RenderFlowThread* flowThread = flowThreadContainingBlock()) |
flowThread->updateMinimumPageHeight(offsetFromLogicalTopOfFirstPage() + offset, minHeight); |
- else if (ColumnInfo* colInfo = view()->layoutState()->m_columnInfo) |
- colInfo->updateMinimumColumnHeight(minHeight); |
} |
static inline LayoutUnit calculateMinimumPageHeight(RenderStyle* renderStyle, RootInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom) |
@@ -5601,10 +4562,6 @@ const char* RenderBlock::renderName() const |
return "RenderBlock (floating)"; |
if (isOutOfFlowPositioned()) |
return "RenderBlock (positioned)"; |
- if (isAnonymousColumnsBlock()) |
- return "RenderBlock (anonymous multi-column)"; |
- if (isAnonymousColumnSpanBlock()) |
- return "RenderBlock (anonymous multi-column span)"; |
if (isAnonymousBlock()) |
return "RenderBlock (anonymous)"; |
// FIXME: Temporary hack while the new generated content system is being implemented. |
@@ -5641,26 +4598,6 @@ RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend |
return newBox; |
} |
-RenderBlockFlow* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderObject* parent) |
-{ |
- RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), BLOCK); |
- newStyle->inheritColumnPropertiesFrom(parent->style()); |
- |
- RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document()); |
- newBox->setStyle(newStyle.release()); |
- return newBox; |
-} |
- |
-RenderBlockFlow* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const RenderObject* parent) |
-{ |
- RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), BLOCK); |
- newStyle->setColumnSpan(ColumnSpanAll); |
- |
- RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document()); |
- newBox->setStyle(newStyle.release()); |
- return newBox; |
-} |
- |
#ifndef NDEBUG |
void RenderBlock::checkPositionedObjectsNeedLayout() |
{ |