summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderBlock.cpp')
-rwxr-xr-xSource/WebCore/rendering/RenderBlock.cpp307
1 files changed, 165 insertions, 142 deletions
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 0e4a77a78..c2509065e 100755
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -71,7 +71,7 @@ namespace WebCore {
using namespace HTMLNames;
struct SameSizeAsRenderBlock : public RenderBox {
- void* pointers[3];
+ void* pointers[2];
RenderObjectChildList children;
RenderLineBoxList lineBoxes;
uint32_t bitfields;
@@ -96,11 +96,11 @@ struct SameSizeAsMarginInfo {
typedef WTF::HashMap<const RenderBox*, ColumnInfo*> ColumnInfoMap;
static ColumnInfoMap* gColumnInfoMap = 0;
-typedef WTF::HashMap<const RenderBlock*, HashSet<RenderBox*>*> PercentHeightDescendantsMap;
-static PercentHeightDescendantsMap* gPercentHeightDescendantsMap = 0;
+static TrackedDescendantsMap* gPositionedDescendantsMap = 0;
+static TrackedDescendantsMap* gPercentHeightDescendantsMap = 0;
-typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightContainerMap;
-static PercentHeightContainerMap* gPercentHeightContainerMap = 0;
+static TrackedContainerMap* gPositionedContainerMap = 0;
+static TrackedContainerMap* gPercentHeightContainerMap = 0;
typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutlineTableMap;
@@ -196,6 +196,26 @@ RenderBlock::RenderBlock(Node* node)
COMPILE_ASSERT(sizeof(RenderBlock::MarginInfo) == sizeof(SameSizeAsMarginInfo), MarginInfo_should_stay_small);
}
+static void removeBlockFromDescendantAndContainerMaps(RenderBlock* block, TrackedDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap)
+{
+ if (TrackedRendererListHashSet* descendantSet = descendantMap->take(block)) {
+ TrackedRendererListHashSet::iterator end = descendantSet->end();
+ for (TrackedRendererListHashSet::iterator descendant = descendantSet->begin(); descendant != end; ++descendant) {
+ HashSet<RenderBlock*>* containerSet = containerMap->get(*descendant);
+ ASSERT(containerSet);
+ if (!containerSet)
+ continue;
+ ASSERT(containerSet->contains(block));
+ containerSet->remove(block);
+ if (containerSet->isEmpty()) {
+ containerMap->remove(*descendant);
+ delete containerSet;
+ }
+ }
+ delete descendantSet;
+ }
+}
+
RenderBlock::~RenderBlock()
{
if (m_floatingObjects)
@@ -204,24 +224,10 @@ RenderBlock::~RenderBlock()
if (hasColumns())
delete gColumnInfoMap->take(this);
- if (gPercentHeightDescendantsMap) {
- if (HashSet<RenderBox*>* descendantSet = gPercentHeightDescendantsMap->take(this)) {
- HashSet<RenderBox*>::iterator end = descendantSet->end();
- for (HashSet<RenderBox*>::iterator descendant = descendantSet->begin(); descendant != end; ++descendant) {
- HashSet<RenderBlock*>* containerSet = gPercentHeightContainerMap->get(*descendant);
- ASSERT(containerSet);
- if (!containerSet)
- continue;
- ASSERT(containerSet->contains(this));
- containerSet->remove(this);
- if (containerSet->isEmpty()) {
- gPercentHeightContainerMap->remove(*descendant);
- delete containerSet;
- }
- }
- delete descendantSet;
- }
- }
+ if (gPercentHeightDescendantsMap)
+ removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendantsMap, gPercentHeightContainerMap);
+ if (gPositionedDescendantsMap)
+ removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMap, gPositionedContainerMap);
}
void RenderBlock::willBeDestroyed()
@@ -1139,15 +1145,21 @@ void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c
RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(parent, child, child->hasLayer()));
anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer());
// Delete the now-empty block's lines and nuke it.
- if (!parent->documentBeingDestroyed())
- anonBlock->deleteLineBoxTree();
- if (!parent->documentBeingDestroyed() && childFlowThread && childFlowThread->isRenderNamedFlowThread())
+ anonBlock->deleteLineBoxTree();
+ if (childFlowThread && childFlowThread->isRenderNamedFlowThread())
toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(anonBlock);
anonBlock->destroy();
}
void RenderBlock::removeChild(RenderObject* oldChild)
{
+ // No need to waste time in merging or removing empty anonymous blocks.
+ // We can just bail out if our document is getting destroyed.
+ if (documentBeingDestroyed()) {
+ RenderBox::removeChild(oldChild);
+ return;
+ }
+
// 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.
@@ -1169,12 +1181,14 @@ void RenderBlock::removeChild(RenderObject* oldChild)
// column span flag if it is set.
ASSERT(!inlineChildrenBlock->continuation());
RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK);
- children()->removeChildNode(this, inlineChildrenBlock, inlineChildrenBlock->hasLayer());
+ // Cache this value as it might get changed in setStyle() call.
+ bool inlineChildrenBlockHasLayer = inlineChildrenBlock->hasLayer();
inlineChildrenBlock->setStyle(newStyle);
+ children()->removeChildNode(this, inlineChildrenBlock, inlineChildrenBlockHasLayer);
// Now just put the inlineChildrenBlock inside the blockChildrenBlock.
blockChildrenBlock->children()->insertChildNode(blockChildrenBlock, inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChild() : 0,
- inlineChildrenBlock->hasLayer() || blockChildrenBlock->hasLayer());
+ inlineChildrenBlockHasLayer || blockChildrenBlock->hasLayer());
next->setNeedsLayoutAndPrefWidthsRecalc();
// inlineChildrenBlock got reparented to blockChildrenBlock, so it is no longer a child
@@ -1215,14 +1229,14 @@ void RenderBlock::removeChild(RenderObject* oldChild)
}
}
- if (!firstChild() && !documentBeingDestroyed()) {
+ if (!firstChild()) {
// If this was our last child be sure to clear out our line boxes.
if (childrenInline())
deleteLineBoxTree();
// If we are an empty anonymous block in the continuation chain,
// we need to remove ourself and fix the continuation chain.
- if (!beingDestroyed() && isAnonymousBlockContinuation()) {
+ if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->isListMarker()) {
RenderObject* containingBlockIgnoringAnonymous = containingBlock();
while (containingBlockIgnoringAnonymous && containingBlockIgnoringAnonymous->isAnonymousBlock())
containingBlockIgnoringAnonymous = containingBlockIgnoringAnonymous->containingBlock();
@@ -1418,7 +1432,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
if (!relayoutChildren && simplifiedLayout())
return;
- LayoutRepainter repainter(*this, everHadLayout() && checkForRepaintDuringLayout());
+ LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
if (recomputeLogicalWidth())
relayoutChildren = true;
@@ -1472,14 +1486,6 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
setPaginationStrut(0);
}
- // For overflow:scroll blocks, ensure we have both scrollbars in place always.
- if (scrollsOverflow() && style()->appearance() != ListboxPart) {
- if (styleToUse->overflowX() == OSCROLL)
- layer()->setHasHorizontalScrollbar(true);
- if (styleToUse->overflowY() == OSCROLL)
- layer()->setHasVerticalScrollbar(true);
- }
-
LayoutUnit repaintLogicalTop = ZERO_LAYOUT_UNIT;
LayoutUnit repaintLogicalBottom = ZERO_LAYOUT_UNIT;
LayoutUnit maxFloatLogicalBottom = ZERO_LAYOUT_UNIT;
@@ -1660,17 +1666,22 @@ void RenderBlock::addOverflowFromFloats()
void RenderBlock::addOverflowFromPositionedObjects()
{
- if (!m_positionedObjects)
+ TrackedRendererListHashSet* positionedDescendants = positionedObjects();
+ if (!positionedDescendants)
return;
RenderBox* positionedObject;
- Iterator end = m_positionedObjects->end();
- for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
+ TrackedRendererListHashSet::iterator end = positionedDescendants->end();
+ for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
positionedObject = *it;
// Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
- if (positionedObject->style()->position() != FixedPosition)
- addOverflowFromChild(positionedObject, IntSize(positionedObject->x(), positionedObject->y()));
+ if (positionedObject->style()->position() != FixedPosition) {
+ LayoutUnit x = positionedObject->x();
+ if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+ x -= verticalScrollbarWidth();
+ addOverflowFromChild(positionedObject, LayoutSize(x, positionedObject->y()));
+ }
}
}
@@ -1699,18 +1710,11 @@ void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marg
setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent(logicalTop));
if (!marginInfo.canCollapseWithMarginBefore()) {
- child->computeBlockDirectionMargins(this);
- LayoutUnit marginBefore = marginBeforeForChild(child);
+ // Positioned blocks don't collapse margins, so add the margin provided by
+ // the container now. The child's own margin is added later when calculating its logical top.
LayoutUnit collapsedBeforePos = marginInfo.positiveMargin();
LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin();
- if (marginBefore > 0) {
- if (marginBefore > collapsedBeforePos)
- collapsedBeforePos = marginBefore;
- } else {
- if (-marginBefore > collapsedBeforeNeg)
- collapsedBeforeNeg = -marginBefore;
- }
- logicalTop += (collapsedBeforePos - collapsedBeforeNeg) - marginBefore;
+ logicalTop += collapsedBeforePos - collapsedBeforeNeg;
}
RenderLayer* childLayer = child->layer();
@@ -1849,11 +1853,7 @@ void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn)
// Check if this node is allowed to run-in. E.g. <select> expects its renderer to
// be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline run-in.
- Node* runInNode = runIn->node();
- if (runInNode && runInNode->hasTagName(selectTag))
- return;
-
- if (runInNode && runInNode->hasTagName(progressTag))
+ if (!runIn->canBeReplacedWithInlineRunIn())
return;
RenderObject* curr = runIn->nextSibling();
@@ -2204,6 +2204,8 @@ LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const Re
void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
{
LayoutUnit startPosition = borderStart() + paddingStart();
+ if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+ startPosition -= verticalScrollbarWidth();
LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();
// Add in our start margin.
@@ -2285,9 +2287,9 @@ void RenderBlock::setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop,
void RenderBlock::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom)
{
if (gPercentHeightDescendantsMap) {
- if (HashSet<RenderBox*>* descendants = gPercentHeightDescendantsMap->get(this)) {
- HashSet<RenderBox*>::iterator end = descendants->end();
- for (HashSet<RenderBox*>::iterator it = descendants->begin(); it != end; ++it) {
+ if (TrackedRendererListHashSet* descendants = gPercentHeightDescendantsMap->get(this)) {
+ TrackedRendererListHashSet::iterator end = descendants->end();
+ for (TrackedRendererListHashSet::iterator it = descendants->begin(); it != end; ++it) {
RenderBox* box = *it;
while (box != this) {
if (box->normalChildNeedsLayout())
@@ -2566,15 +2568,16 @@ bool RenderBlock::simplifiedLayout()
void RenderBlock::layoutPositionedObjects(bool relayoutChildren)
{
- if (!m_positionedObjects)
+ TrackedRendererListHashSet* positionedDescendants = positionedObjects();
+ 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;
- Iterator end = m_positionedObjects->end();
- for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
+ TrackedRendererListHashSet::iterator end = positionedDescendants->end();
+ for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
r = *it;
// When a non-positioned block element moves, it may have positioned children that are implicitly positioned relative to the
// non-positioned block. Rather than trying to detect all of these movement cases, we just always lay out positioned
@@ -2630,10 +2633,11 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren)
void RenderBlock::markPositionedObjectsForLayout()
{
- if (m_positionedObjects) {
+ TrackedRendererListHashSet* positionedDescendants = positionedObjects();
+ if (positionedDescendants) {
RenderBox* r;
- Iterator end = m_positionedObjects->end();
- for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
+ TrackedRendererListHashSet::iterator end = positionedDescendants->end();
+ for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
r = *it;
r->setChildNeedsLayout(true);
}
@@ -2969,11 +2973,8 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
// Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div).
LayoutPoint scrolledOffset = paintOffset;
- if (hasOverflowClip()) {
+ if (hasOverflowClip())
scrolledOffset.move(-scrolledContentOffset());
- if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
- scrolledOffset.move(verticalScrollbarWidth(), 0);
- }
// 2. paint contents
if (paintPhase != PaintPhaseSelfOutline) {
@@ -3220,7 +3221,7 @@ GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* repaintC
// FIXME: this is broken with transforms
TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
- mapLocalToContainer(repaintContainer, false, false, transformState);
+ mapLocalToContainer(repaintContainer, transformState);
LayoutPoint offsetFromRepaintContainer = roundedLayoutPoint(transformState.mappedPoint());
if (hasOverflowClip())
@@ -3258,13 +3259,13 @@ void RenderBlock::paintSelection(PaintInfo& paintInfo, const LayoutPoint& paintO
}
}
-static void clipOutPositionedObjects(const PaintInfo* paintInfo, const LayoutPoint& offset, RenderBlock::PositionedObjectsListHashSet* positionedObjects)
+static void clipOutPositionedObjects(const PaintInfo* paintInfo, const LayoutPoint& offset, TrackedRendererListHashSet* positionedObjects)
{
if (!positionedObjects)
return;
- RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
- for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ TrackedRendererListHashSet::const_iterator end = positionedObjects->end();
+ for (TrackedRendererListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
RenderBox* r = *it;
paintInfo->context->clipOut(IntRect(offset.x() + r->x(), offset.y() + r->y(), r->width(), r->height()));
}
@@ -3302,10 +3303,10 @@ GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& r
LayoutRect flippedBlockRect(offsetFromRootBlock.width(), offsetFromRootBlock.height(), width(), height());
rootBlock->flipForWritingMode(flippedBlockRect);
flippedBlockRect.moveBy(rootBlockPhysicalPosition);
- clipOutPositionedObjects(paintInfo, flippedBlockRect.location(), m_positionedObjects.get());
+ clipOutPositionedObjects(paintInfo, flippedBlockRect.location(), positionedObjects());
if (isBody() || isRoot()) // The <body> must make sure to examine its containingBlock's positioned objects.
for (RenderBlock* cb = containingBlock(); cb && !cb->isRenderView(); cb = cb->containingBlock())
- clipOutPositionedObjects(paintInfo, LayoutPoint(cb->x(), cb->y()), cb->m_positionedObjects.get()); // FIXME: Not right for flipped writing modes.
+ clipOutPositionedObjects(paintInfo, LayoutPoint(cb->x(), cb->y()), cb->positionedObjects()); // FIXME: Not right for flipped writing modes.
if (m_floatingObjects) {
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
FloatingObjectSetIterator end = floatingObjectSet.end();
@@ -3596,6 +3597,74 @@ RenderBlock* RenderBlock::blockBeforeWithinSelectionRoot(LayoutSize& offset) con
return beforeBlock;
}
+void RenderBlock::insertIntoTrackedRendererMaps(RenderBox* descendant, TrackedDescendantsMap*& descendantsMap, TrackedContainerMap*& containerMap)
+{
+ if (!descendantsMap) {
+ descendantsMap = new TrackedDescendantsMap;
+ containerMap = new TrackedContainerMap;
+ }
+
+ TrackedRendererListHashSet* descendantSet = descendantsMap->get(this);
+ if (!descendantSet) {
+ descendantSet = new TrackedRendererListHashSet;
+ descendantsMap->set(this, descendantSet);
+ }
+ bool added = descendantSet->add(descendant).isNewEntry;
+ if (!added) {
+ ASSERT(containerMap->get(descendant));
+ ASSERT(containerMap->get(descendant)->contains(this));
+ return;
+ }
+
+ HashSet<RenderBlock*>* containerSet = containerMap->get(descendant);
+ if (!containerSet) {
+ containerSet = new HashSet<RenderBlock*>;
+ containerMap->set(descendant, containerSet);
+ }
+ ASSERT(!containerSet->contains(this));
+ containerSet->add(this);
+}
+
+void RenderBlock::removeFromTrackedRendererMaps(RenderBox* descendant, TrackedDescendantsMap*& descendantsMap, TrackedContainerMap*& containerMap)
+{
+ if (!descendantsMap)
+ return;
+
+ HashSet<RenderBlock*>* containerSet = containerMap->take(descendant);
+ if (!containerSet)
+ return;
+
+ HashSet<RenderBlock*>::iterator end = containerSet->end();
+ for (HashSet<RenderBlock*>::iterator it = containerSet->begin(); it != end; ++it) {
+ RenderBlock* container = *it;
+
+ // FIXME: Disabling this assert temporarily until we fix the layout
+ // bugs associated with positioned objects not properly cleared from
+ // their ancestor chain before being moved. See webkit bug 93766.
+ // ASSERT(descendant->isDescendantOf(container));
+
+ TrackedRendererListHashSet* descendantSet = descendantsMap->get(container);
+ ASSERT(descendantSet);
+ if (!descendantSet)
+ continue;
+ ASSERT(descendantSet->contains(descendant));
+ descendantSet->remove(descendant);
+ if (descendantSet->isEmpty()) {
+ descendantsMap->remove(container);
+ delete descendantSet;
+ }
+ }
+
+ delete containerSet;
+}
+
+TrackedRendererListHashSet* RenderBlock::positionedObjects() const
+{
+ if (gPositionedDescendantsMap)
+ return gPositionedDescendantsMap->get(this);
+ return 0;
+}
+
void RenderBlock::insertPositionedObject(RenderBox* o)
{
ASSERT(!isAnonymousBlock());
@@ -3603,31 +3672,27 @@ void RenderBlock::insertPositionedObject(RenderBox* o)
if (o->isRenderFlowThread())
return;
- // Create the list of special objects if we don't aleady have one
- if (!m_positionedObjects)
- m_positionedObjects = adoptPtr(new PositionedObjectsListHashSet);
-
- m_positionedObjects->add(o);
+ insertIntoTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedContainerMap);
}
void RenderBlock::removePositionedObject(RenderBox* o)
{
- if (m_positionedObjects)
- m_positionedObjects->remove(o);
+ removeFromTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedContainerMap);
}
void RenderBlock::removePositionedObjects(RenderBlock* o)
{
- if (!m_positionedObjects)
+ TrackedRendererListHashSet* positionedDescendants = positionedObjects();
+ if (!positionedDescendants)
return;
RenderBox* r;
- Iterator end = m_positionedObjects->end();
+ TrackedRendererListHashSet::iterator end = positionedDescendants->end();
Vector<RenderBox*, 16> deadObjects;
- for (Iterator it = m_positionedObjects->begin(); it != end; ++it) {
+ for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
r = *it;
if (!o || r->isDescendantOf(o)) {
if (o)
@@ -3646,7 +3711,7 @@ void RenderBlock::removePositionedObjects(RenderBlock* o)
}
for (unsigned i = 0; i < deadObjects.size(); i++)
- m_positionedObjects->remove(deadObjects.at(i));
+ removePositionedObject(deadObjects.at(i));
}
RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o)
@@ -3924,60 +3989,15 @@ void RenderBlock::newLine(EClear clear)
void RenderBlock::addPercentHeightDescendant(RenderBox* descendant)
{
- if (!gPercentHeightDescendantsMap) {
- gPercentHeightDescendantsMap = new PercentHeightDescendantsMap;
- gPercentHeightContainerMap = new PercentHeightContainerMap;
- }
-
- HashSet<RenderBox*>* descendantSet = gPercentHeightDescendantsMap->get(this);
- if (!descendantSet) {
- descendantSet = new HashSet<RenderBox*>;
- gPercentHeightDescendantsMap->set(this, descendantSet);
- }
- bool added = descendantSet->add(descendant).isNewEntry;
- if (!added) {
- ASSERT(gPercentHeightContainerMap->get(descendant));
- ASSERT(gPercentHeightContainerMap->get(descendant)->contains(this));
- return;
- }
-
- HashSet<RenderBlock*>* containerSet = gPercentHeightContainerMap->get(descendant);
- if (!containerSet) {
- containerSet = new HashSet<RenderBlock*>;
- gPercentHeightContainerMap->set(descendant, containerSet);
- }
- ASSERT(!containerSet->contains(this));
- containerSet->add(this);
+ insertIntoTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPercentHeightContainerMap);
}
void RenderBlock::removePercentHeightDescendant(RenderBox* descendant)
{
- if (!gPercentHeightContainerMap)
- return;
-
- HashSet<RenderBlock*>* containerSet = gPercentHeightContainerMap->take(descendant);
- if (!containerSet)
- return;
-
- HashSet<RenderBlock*>::iterator end = containerSet->end();
- for (HashSet<RenderBlock*>::iterator it = containerSet->begin(); it != end; ++it) {
- RenderBlock* container = *it;
- HashSet<RenderBox*>* descendantSet = gPercentHeightDescendantsMap->get(container);
- ASSERT(descendantSet);
- if (!descendantSet)
- continue;
- ASSERT(descendantSet->contains(descendant));
- descendantSet->remove(descendant);
- if (descendantSet->isEmpty()) {
- gPercentHeightDescendantsMap->remove(container);
- delete descendantSet;
- }
- }
-
- delete containerSet;
+ removeFromTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPercentHeightContainerMap);
}
-HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const
+TrackedRendererListHashSet* RenderBlock::percentHeightDescendants() const
{
return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this) : 0;
}
@@ -6902,11 +6922,11 @@ LayoutUnit RenderBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P
if (!inRenderFlowThread()) {
LayoutUnit pageLogicalHeight = renderView->layoutState()->m_pageLogicalHeight;
- LayoutUnit remainingHeight = pageLogicalHeight - layoutMod(offset, pageLogicalHeight);
+ LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogicalHeight);
if (pageBoundaryRule == IncludePageBoundary) {
// If includeBoundaryPoint is true the line exactly on the top edge of a
// column will act as being part of the previous column.
- remainingHeight = layoutMod(remainingHeight, pageLogicalHeight);
+ remainingHeight = intMod(remainingHeight, pageLogicalHeight);
}
return remainingHeight;
}
@@ -7438,9 +7458,12 @@ RenderBlock* RenderBlock::createAnonymousColumnSpanWithParentRenderer(const Rend
#ifndef NDEBUG
void RenderBlock::checkPositionedObjectsNeedLayout()
{
- if (PositionedObjectsListHashSet* positionedObjects = this->positionedObjects()) {
- PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
- for (PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ if (!gPositionedDescendantsMap)
+ return;
+
+ if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects()) {
+ TrackedRendererListHashSet::const_iterator end = positionedDescendantSet->end();
+ for (TrackedRendererListHashSet::const_iterator it = positionedDescendantSet->begin(); it != end; ++it) {
RenderBox* currBox = *it;
ASSERT(!currBox->needsLayout());
}