Diff
Modified: trunk/Source/WebCore/ChangeLog (174713 => 174714)
--- trunk/Source/WebCore/ChangeLog 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/ChangeLog 2014-10-15 00:29:51 UTC (rev 174714)
@@ -1,3 +1,96 @@
+2014-10-14 Chris Dumez <[email protected]>
+
+ Use is<>() / downcast<>() for RenderInline
+ https://bugs.webkit.org/show_bug.cgi?id=137704
+
+ Reviewed by Darin Adler.
+
+ Use is<>() / downcast<>() for RenderInline and clean up the surrounding
+ code.
+
+ No new tests, no behavior change.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::firstChildInContinuation):
+ * editing/SimplifyMarkupCommand.cpp:
+ (WebCore::SimplifyMarkupCommand::doApply):
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::buildRendererHighlight):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::paintContents):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::removeLineBoxFromRenderObject):
+ (WebCore::InlineFlowBox::extractLineBoxFromRenderObject):
+ (WebCore::InlineFlowBox::attachLineBoxToRenderObject):
+ (WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
+ (WebCore::InlineFlowBox::nodeAtPoint):
+ (WebCore::InlineFlowBox::paint):
+ * rendering/InlineIterator.h:
+ (WebCore::bidiFirstSkippingEmptyInlines):
+ * rendering/LayoutState.cpp:
+ (WebCore::LayoutState::LayoutState):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::willBeDestroyed):
+ (WebCore::RenderBlock::paintObject):
+ (WebCore::RenderBlock::inlineElementContinuation):
+ (WebCore::RenderBlock::addFocusRingRects):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::willBeDestroyed):
+ (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::constructBidiRunsForSegment):
+ (WebCore::RenderBlockFlow::layoutLineBoxes):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::offsetFromContainer):
+ (WebCore::RenderBox::computeRectForRepaint):
+ (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
+ (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
+ (WebCore::RenderBox::computePositionedLogicalWidthUsing):
+ (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
+ (WebCore::RenderBox::layoutOverflowRectForPropagation):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::accumulateInFlowPositionOffsets):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::willBeRemovedFromTree):
+ * rendering/RenderElement.h:
+ (WebCore::RenderElement::dirtyLinesFromChangedChild):
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::addRegionsOverflowFromChild):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::willBeDestroyed):
+ (WebCore::RenderInline::updateAlwaysCreateLineBoxes):
+ (WebCore::RenderInline::clippedOverflowRectForRepaint):
+ * rendering/RenderInline.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPosition):
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLineBoxList.cpp:
+ (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
+ * rendering/RenderLineBoxList.h:
+ * rendering/RenderNamedFlowThread.cpp:
+ (WebCore::RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::insertedIntoTree):
+ * rendering/RenderRegion.cpp:
+ (WebCore::RenderRegion::overflowRectForFlowThreadPortion):
+ (WebCore::RenderRegion::visualOverflowRectForBox):
+ (WebCore::RenderRegion::visualOverflowRectForBoxForPropagation):
+ * rendering/RenderRegion.h:
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::willBeDestroyed):
+ * rendering/RenderTextLineBoxes.cpp:
+ (WebCore::RenderTextLineBoxes::removeAllFromParent):
+ (WebCore::RenderTextLineBoxes::dirtyRange):
+ * rendering/line/BreakingContextInlineHeaders.h:
+ (WebCore::inlineLogicalWidth):
+ (WebCore::BreakingContext::handleEmptyInline):
+ * rendering/line/LineInlineHeaders.h:
+ (WebCore::requiresLineBox):
+ (WebCore::setStaticPositions):
+ * rendering/svg/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::paint):
+
2014-10-14 Brent Fulgham <[email protected]>
[Win] Unreviewed build fix after r174710.
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (174713 => 174714)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -170,11 +170,11 @@
auto continuation = renderer.continuation();
while (continuation) {
- if (continuation->isRenderBlock())
+ if (is<RenderBlock>(*continuation))
return continuation;
if (RenderObject* child = continuation->firstChild())
return child;
- continuation = toRenderInline(continuation)->continuation();
+ continuation = downcast<RenderInline>(*continuation).continuation();
}
return nullptr;
Modified: trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp (174713 => 174714)
--- trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -61,7 +61,7 @@
if (!startingStyle)
continue;
Node* currentNode = startingNode;
- Node* topNodeWithStartingStyle = 0;
+ Node* topNodeWithStartingStyle = nullptr;
while (currentNode != rootNode) {
if (currentNode->parentNode() != rootNode && isRemovableBlock(currentNode))
nodesToRemove.append(currentNode);
@@ -70,11 +70,11 @@
if (!currentNode)
break;
- if (!currentNode->renderer() || !currentNode->renderer()->isRenderInline() || toRenderInline(currentNode->renderer())->alwaysCreateLineBoxes())
+ if (!is<RenderInline>(currentNode->renderer()) || downcast<RenderInline>(*currentNode->renderer()).alwaysCreateLineBoxes())
continue;
if (currentNode->firstChild() != currentNode->lastChild()) {
- topNodeWithStartingStyle = 0;
+ topNodeWithStartingStyle = nullptr;
break;
}
Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (174713 => 174714)
--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -97,43 +97,43 @@
renderer->absoluteQuads(highlight->quads);
for (size_t i = 0; i < highlight->quads.size(); ++i)
contentsQuadToCoordinateSystem(mainView, containingView, highlight->quads[i], coordinateSystem);
- } else if (renderer->isBox() || renderer->isRenderInline()) {
+ } else if (is<RenderBox>(*renderer) || is<RenderInline>(*renderer)) {
LayoutRect contentBox;
LayoutRect paddingBox;
LayoutRect borderBox;
LayoutRect marginBox;
- if (renderer->isBox()) {
- RenderBox* renderBox = toRenderBox(renderer);
+ if (is<RenderBox>(*renderer)) {
+ auto& renderBox = downcast<RenderBox>(*renderer);
- LayoutBoxExtent margins(renderBox->marginTop(), renderBox->marginRight(), renderBox->marginBottom(), renderBox->marginLeft());
+ LayoutBoxExtent margins(renderBox.marginTop(), renderBox.marginRight(), renderBox.marginBottom(), renderBox.marginLeft());
- if (!renderBox->isOutOfFlowPositioned() && region) {
+ if (!renderBox.isOutOfFlowPositioned() && region) {
RenderBox::LogicalExtentComputedValues computedValues;
- renderBox->computeLogicalWidthInRegion(computedValues, region);
- margins.mutableLogicalLeft(renderBox->style().writingMode()) = computedValues.m_margins.m_start;
- margins.mutableLogicalRight(renderBox->style().writingMode()) = computedValues.m_margins.m_end;
+ renderBox.computeLogicalWidthInRegion(computedValues, region);
+ margins.mutableLogicalLeft(renderBox.style().writingMode()) = computedValues.m_margins.m_start;
+ margins.mutableLogicalRight(renderBox.style().writingMode()) = computedValues.m_margins.m_end;
}
- paddingBox = renderBox->clientBoxRectInRegion(region);
- contentBox = LayoutRect(paddingBox.x() + renderBox->paddingLeft(), paddingBox.y() + renderBox->paddingTop(),
- paddingBox.width() - renderBox->paddingLeft() - renderBox->paddingRight(), paddingBox.height() - renderBox->paddingTop() - renderBox->paddingBottom());
- borderBox = LayoutRect(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
- paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
+ paddingBox = renderBox.clientBoxRectInRegion(region);
+ contentBox = LayoutRect(paddingBox.x() + renderBox.paddingLeft(), paddingBox.y() + renderBox.paddingTop(),
+ paddingBox.width() - renderBox.paddingLeft() - renderBox.paddingRight(), paddingBox.height() - renderBox.paddingTop() - renderBox.paddingBottom());
+ borderBox = LayoutRect(paddingBox.x() - renderBox.borderLeft(), paddingBox.y() - renderBox.borderTop(),
+ paddingBox.width() + renderBox.borderLeft() + renderBox.borderRight(), paddingBox.height() + renderBox.borderTop() + renderBox.borderBottom());
marginBox = LayoutRect(borderBox.x() - margins.left(), borderBox.y() - margins.top(),
borderBox.width() + margins.left() + margins.right(), borderBox.height() + margins.top() + margins.bottom());
} else {
- RenderInline* renderInline = toRenderInline(renderer);
+ auto& renderInline = downcast<RenderInline>(*renderer);
// RenderInline's bounding box includes paddings and borders, excludes margins.
- borderBox = renderInline->linesBoundingBox();
- paddingBox = LayoutRect(borderBox.x() + renderInline->borderLeft(), borderBox.y() + renderInline->borderTop(),
- borderBox.width() - renderInline->borderLeft() - renderInline->borderRight(), borderBox.height() - renderInline->borderTop() - renderInline->borderBottom());
- contentBox = LayoutRect(paddingBox.x() + renderInline->paddingLeft(), paddingBox.y() + renderInline->paddingTop(),
- paddingBox.width() - renderInline->paddingLeft() - renderInline->paddingRight(), paddingBox.height() - renderInline->paddingTop() - renderInline->paddingBottom());
+ borderBox = renderInline.linesBoundingBox();
+ paddingBox = LayoutRect(borderBox.x() + renderInline.borderLeft(), borderBox.y() + renderInline.borderTop(),
+ borderBox.width() - renderInline.borderLeft() - renderInline.borderRight(), borderBox.height() - renderInline.borderTop() - renderInline.borderBottom());
+ contentBox = LayoutRect(paddingBox.x() + renderInline.paddingLeft(), paddingBox.y() + renderInline.paddingTop(),
+ paddingBox.width() - renderInline.paddingLeft() - renderInline.paddingRight(), paddingBox.height() - renderInline.paddingTop() - renderInline.paddingBottom());
// Ignore marginTop and marginBottom for inlines.
- marginBox = LayoutRect(borderBox.x() - renderInline->marginLeft(), borderBox.y(),
- borderBox.width() + renderInline->horizontalMarginExtent(), borderBox.height());
+ marginBox = LayoutRect(borderBox.x() - renderInline.marginLeft(), borderBox.y(),
+ borderBox.width() + renderInline.horizontalMarginExtent(), borderBox.height());
}
FloatQuad absContentQuad;
Modified: trunk/Source/WebCore/page/FrameView.cpp (174713 => 174714)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -3795,7 +3795,7 @@
FontCachePurgePreventer fontCachePurgePreventer;
// m_nodeToDraw is used to draw only one element (and its descendants)
- RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
+ RenderObject* renderer = m_nodeToDraw ? m_nodeToDraw->renderer() : nullptr;
RenderLayer* rootLayer = renderView->layer();
#ifndef NDEBUG
@@ -3804,12 +3804,12 @@
// To work around http://webkit.org/b/135106, ensure that the paint root isn't an inline with culled line boxes.
// FIXME: This can cause additional content to be included in the snapshot, so remove this once that bug is fixed.
- while (eltRenderer && eltRenderer->isRenderInline() && !toRenderInline(eltRenderer)->firstLineBox())
- eltRenderer = eltRenderer->parent();
+ while (is<RenderInline>(renderer) && !downcast<RenderInline>(*renderer).firstLineBox())
+ renderer = renderer->parent();
- rootLayer->paint(context, dirtyRect, LayoutSize(), m_paintBehavior, eltRenderer);
+ rootLayer->paint(context, dirtyRect, LayoutSize(), m_paintBehavior, renderer);
if (rootLayer->containsDirtyOverlayScrollbars())
- rootLayer->paintOverlayScrollbars(context, dirtyRect, m_paintBehavior, eltRenderer);
+ rootLayer->paintOverlayScrollbars(context, dirtyRect, m_paintBehavior, renderer);
didPaintContents(context, dirtyRect, paintingState);
}
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -219,7 +219,7 @@
void InlineFlowBox::removeLineBoxFromRenderObject()
{
- toRenderInline(renderer()).lineBoxes().removeLineBox(this);
+ downcast<RenderInline>(renderer()).lineBoxes().removeLineBox(this);
}
void InlineFlowBox::extractLine()
@@ -232,7 +232,7 @@
void InlineFlowBox::extractLineBoxFromRenderObject()
{
- toRenderInline(renderer()).lineBoxes().extractLineBox(this);
+ downcast<RenderInline>(renderer()).lineBoxes().extractLineBox(this);
}
void InlineFlowBox::attachLine()
@@ -245,7 +245,7 @@
void InlineFlowBox::attachLineBoxToRenderObject()
{
- toRenderInline(renderer()).lineBoxes().attachLineBox(this);
+ downcast<RenderInline>(renderer()).lineBoxes().attachLineBox(this);
}
void InlineFlowBox::adjustPosition(float dx, float dy)
@@ -300,7 +300,7 @@
// The root inline box never has borders/margins/padding.
if (parent()) {
- const auto& inlineFlow = toRenderInline(renderer());
+ const auto& inlineFlow = downcast<RenderInline>(renderer());
bool ltr = renderer().style().isLeftToRightDirection();
@@ -1007,29 +1007,29 @@
// Check children first.
// We need to account for culled inline parents of the hit-tested nodes, so that they may also get included in area-based hit-tests.
- RenderElement* culledParent = 0;
- for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) {
- if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintingLayer()) {
- RenderElement* newParent = 0;
+ RenderElement* culledParent = nullptr;
+ for (InlineBox* child = lastChild(); child; child = child->prevOnLine()) {
+ if (is<RenderText>(child->renderer()) || !child->boxModelObject()->hasSelfPaintingLayer()) {
+ RenderElement* newParent = nullptr;
// Culled parents are only relevant for area-based hit-tests, so ignore it in point-based ones.
if (locationInContainer.isRectBasedTest()) {
- newParent = curr->renderer().parent();
+ newParent = child->renderer().parent();
if (newParent == &renderer())
- newParent = 0;
+ newParent = nullptr;
}
// Check the culled parent after all its children have been checked, to do this we wait until
// we are about to test an element with a different parent.
if (newParent != culledParent) {
if (!newParent || !newParent->isDescendantOf(culledParent)) {
while (culledParent && culledParent != &renderer() && culledParent != newParent) {
- if (culledParent->isRenderInline() && toRenderInline(culledParent)->hitTestCulledInline(request, result, locationInContainer, accumulatedOffset))
+ if (is<RenderInline>(*culledParent) && downcast<RenderInline>(*culledParent).hitTestCulledInline(request, result, locationInContainer, accumulatedOffset))
return true;
culledParent = culledParent->parent();
}
}
culledParent = newParent;
}
- if (curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
+ if (child->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
return true;
}
@@ -1037,7 +1037,7 @@
}
// Check any culled ancestor of the final children tested.
while (culledParent && culledParent != &renderer()) {
- if (culledParent->isRenderInline() && toRenderInline(culledParent)->hitTestCulledInline(request, result, locationInContainer, accumulatedOffset))
+ if (is<RenderInline>(*culledParent) && downcast<RenderInline>(*culledParent).hitTestCulledInline(request, result, locationInContainer, accumulatedOffset))
return true;
culledParent = culledParent->parent();
}
@@ -1103,9 +1103,9 @@
// Add ourselves to the paint info struct's list of inlines that need to paint their
// outlines.
if (renderer().style().visibility() == VISIBLE && renderer().hasOutline() && !isRootInlineBox()) {
- RenderInline& inlineFlow = toRenderInline(renderer());
+ RenderInline& inlineFlow = downcast<RenderInline>(renderer());
- RenderBlock* cb = 0;
+ RenderBlock* containingBlock = nullptr;
bool containingBlockPaintsContinuationOutline = inlineFlow.continuation() || inlineFlow.isInlineElementContinuation();
if (containingBlockPaintsContinuationOutline) {
// FIXME: See https://bugs.webkit.org/show_bug.cgi?id=54690. We currently don't reconnect inline continuations
@@ -1115,8 +1115,8 @@
if (!enclosingAnonymousBlock->isAnonymousBlock())
containingBlockPaintsContinuationOutline = false;
else {
- cb = enclosingAnonymousBlock->containingBlock();
- for (auto box = &renderer(); box != cb; box = &box->parent()->enclosingBoxModelObject()) {
+ containingBlock = enclosingAnonymousBlock->containingBlock();
+ for (auto box = &renderer(); box != containingBlock; box = &box->parent()->enclosingBoxModelObject()) {
if (box->hasSelfPaintingLayer()) {
containingBlockPaintsContinuationOutline = false;
break;
@@ -1128,7 +1128,7 @@
if (containingBlockPaintsContinuationOutline) {
// Add ourselves to the containing block of the entire continuation so that it can
// paint us atomically.
- cb->addContinuationWithOutline(toRenderInline(renderer().element()->renderer()));
+ containingBlock->addContinuationWithOutline(downcast<RenderInline>(renderer().element()->renderer()));
} else if (!inlineFlow.isInlineElementContinuation())
paintInfo.outlineObjects->add(&inlineFlow);
}
Modified: trunk/Source/WebCore/rendering/InlineIterator.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/InlineIterator.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/InlineIterator.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -288,31 +288,31 @@
return bidiNextShared(root, current, observer, IncludeEmptyInlines, endOfInlinePtr);
}
-static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderElement& root, InlineBidiResolver* resolver = 0)
+static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderElement& root, InlineBidiResolver* resolver = nullptr)
{
- RenderObject* o = root.firstChild();
- if (!o)
+ RenderObject* renderer = root.firstChild();
+ if (!renderer)
return nullptr;
- if (o->isRenderInline()) {
- notifyObserverEnteredObject(resolver, o);
- if (!isEmptyInline(toRenderInline(*o)))
- o = bidiNextSkippingEmptyInlines(root, o, resolver);
+ if (is<RenderInline>(*renderer)) {
+ notifyObserverEnteredObject(resolver, renderer);
+ if (!isEmptyInline(downcast<RenderInline>(*renderer)))
+ renderer = bidiNextSkippingEmptyInlines(root, renderer, resolver);
else {
// Never skip empty inlines.
if (resolver)
resolver->commitExplicitEmbedding();
- return o;
+ return renderer;
}
}
// FIXME: Unify this with the bidiNext call above.
- if (o && !isIteratorTarget(o))
- o = bidiNextSkippingEmptyInlines(root, o, resolver);
+ if (renderer && !isIteratorTarget(renderer))
+ renderer = bidiNextSkippingEmptyInlines(root, renderer, resolver);
if (resolver)
resolver->commitExplicitEmbedding();
- return o;
+ return renderer;
}
// FIXME: This method needs to be renamed when bidiNext finds a good name.
Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -53,8 +53,8 @@
if (renderer->isOutOfFlowPositioned() && !fixed) {
if (RenderElement* container = renderer->container()) {
- if (container->isInFlowPositioned() && container->isRenderInline())
- m_paintOffset += toRenderInline(container)->offsetForInFlowPositionedInline(renderer);
+ if (container->isInFlowPositioned() && is<RenderInline>(*container))
+ m_paintOffset += downcast<RenderInline>(*container).offsetForInFlowPositionedInline(renderer);
}
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -253,7 +253,7 @@
if (!documentBeingDestroyed()) {
if (parent())
- parent()->dirtyLinesFromChangedChild(this);
+ parent()->dirtyLinesFromChangedChild(*this);
}
removeFromUpdateScrollInfoAfterLayoutTransaction();
@@ -1630,11 +1630,11 @@
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines)) {
RenderInline* inlineCont = inlineElementContinuation();
if (inlineCont && inlineCont->hasOutline() && inlineCont->style().visibility() == VISIBLE) {
- RenderInline* inlineRenderer = toRenderInline(inlineCont->element()->renderer());
- RenderBlock* cb = containingBlock();
+ RenderInline* inlineRenderer = downcast<RenderInline>(inlineCont->element()->renderer());
+ RenderBlock* containingBlock = this->containingBlock();
bool inlineEnclosedInSelfPaintingLayer = false;
- for (RenderBoxModelObject* box = inlineRenderer; box != cb; box = &box->parent()->enclosingBoxModelObject()) {
+ for (RenderBoxModelObject* box = inlineRenderer; box != containingBlock; box = &box->parent()->enclosingBoxModelObject()) {
if (box->hasSelfPaintingLayer()) {
inlineEnclosedInSelfPaintingLayer = true;
break;
@@ -1645,7 +1645,7 @@
// anonymous block (i.e. have our own layer), paint them straightaway instead. This is because a block depends on renderers in its continuation table being
// in the same layer.
if (!inlineEnclosedInSelfPaintingLayer && !hasLayer())
- cb->addContinuationWithOutline(inlineRenderer);
+ containingBlock->addContinuationWithOutline(inlineRenderer);
else if (!inlineRenderer->firstLineBox() || (!inlineEnclosedInSelfPaintingLayer && hasLayer()))
inlineRenderer->paintOutline(paintInfo, paintOffset - locationOffset() + inlineRenderer->containingBlock()->location());
}
@@ -1664,7 +1664,7 @@
RenderInline* RenderBlock::inlineElementContinuation() const
{
RenderBoxModelObject* continuation = this->continuation();
- return continuation && continuation->isRenderInline() ? toRenderInline(continuation) : 0;
+ return is<RenderInline>(continuation) ? downcast<RenderInline>(continuation) : nullptr;
}
RenderBlock* RenderBlock::blockElementContinuation() const
@@ -3400,7 +3400,7 @@
// FIXME: This is wrong. The principal renderer may not be the continuation preceding this block.
// FIXME: This is wrong for block-flows that are horizontal.
// https://bugs.webkit.org/show_bug.cgi?id=46781
- bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->element()->renderer())->firstLineBox();
+ bool prevInlineHasLineBox = downcast<RenderInline>(*inlineElementContinuation()->element()->renderer()).firstLineBox();
float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit();
float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -179,7 +179,7 @@
}
}
} else if (parent())
- parent()->dirtyLinesFromChangedChild(this);
+ parent()->dirtyLinesFromChangedChild(*this);
}
m_lineBoxes.deleteLineBoxes();
@@ -4032,10 +4032,10 @@
continue;
}
// Case (1) and (2). Inline replaced and inline flow elements.
- if (child->isRenderInline()) {
+ if (is<RenderInline>(*child)) {
// Add in padding/border/margin from the appropriate side of
// the element.
- float bpm = getBorderPaddingMargin(*toRenderInline(child), childIterator.endOfInline);
+ float bpm = getBorderPaddingMargin(downcast<RenderInline>(*child), childIterator.endOfInline);
childMin += bpm;
childMax += bpm;
@@ -4057,7 +4057,7 @@
}
}
- if (!child->isRenderInline() && !child->isText()) {
+ if (!is<RenderInline>(*child) && !is<RenderText>(*child)) {
// Case (2). Inline replaced elements and floats.
// Go ahead and terminate the current line as far as
// minwidth is concerned.
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -79,7 +79,7 @@
virtual LayoutUnit collapsedMarginBefore() const override final { return maxPositiveMarginBefore() - maxNegativeMarginBefore(); }
virtual LayoutUnit collapsedMarginAfter() const override final { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); }
- virtual void dirtyLinesFromChangedChild(RenderObject* child) override final { lineBoxes().dirtyLinesFromChangedChild(this, child); }
+ virtual void dirtyLinesFromChangedChild(RenderObject& child) override final { lineBoxes().dirtyLinesFromChangedChild(*this, child); }
virtual void updateLogicalHeight() override;
virtual void paintColumnRules(PaintInfo&, const LayoutPoint&) override;
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -925,7 +925,7 @@
// tree to see which parent inline is the isolate. We could change enterIsolate
// to take a RenderObject and do this logic there, but that would be a layering
// violation for BidiResolver (which knows nothing about RenderObject).
- RenderInline* isolatedInline = toRenderInline(highestContainingIsolateWithinRoot(startObject, currentRoot));
+ RenderInline* isolatedInline = downcast<RenderInline>(highestContainingIsolateWithinRoot(startObject, currentRoot));
ASSERT(isolatedInline);
InlineBidiResolver isolatedResolver;
@@ -1487,9 +1487,9 @@
else
box.layoutIfNeeded();
}
- } else if (o.isTextOrLineBreak() || (o.isRenderInline() && !walker.atEndOfInline())) {
- if (o.isRenderInline())
- toRenderInline(o).updateAlwaysCreateLineBoxes(layoutState.isFullLayout());
+ } else if (o.isTextOrLineBreak() || (is<RenderInline>(o) && !walker.atEndOfInline())) {
+ if (is<RenderInline>(o))
+ downcast<RenderInline>(o).updateAlwaysCreateLineBoxes(layoutState.isFullLayout());
if (layoutState.isFullLayout() || o.selfNeedsLayout())
dirtyLineBoxesForRenderer(o, layoutState.isFullLayout());
o.clearNeedsLayout();
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -2007,10 +2007,10 @@
RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState);
}
-LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint&, bool* offsetDependsOnPoint) const
+LayoutSize RenderBox::offsetFromContainer(RenderObject* renderer, const LayoutPoint&, bool* offsetDependsOnPoint) const
{
// A region "has" boxes inside it without being their container.
- ASSERT(o == container() || o->isRenderRegion());
+ ASSERT(renderer == container() || is<RenderRegion>(*renderer));
LayoutSize offset;
if (isInFlowPositioned())
@@ -2019,14 +2019,14 @@
if (!isInline() || isReplaced())
offset += topLeftLocationOffset();
- if (o->isBox())
- offset -= toRenderBox(o)->scrolledContentOffset();
+ if (is<RenderBox>(*renderer))
+ offset -= downcast<RenderBox>(*renderer).scrolledContentOffset();
- if (style().position() == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline())
- offset += toRenderInline(o)->offsetForInFlowPositionedInline(this);
+ if (style().position() == AbsolutePosition && renderer->isInFlowPositioned() && is<RenderInline>(*renderer))
+ offset += downcast<RenderInline>(*renderer).offsetForInFlowPositionedInline(this);
if (offsetDependsOnPoint)
- *offsetDependsOnPoint |= o->isRenderFlowThread();
+ *offsetDependsOnPoint |= is<RenderFlowThread>(*renderer);
return offset;
}
@@ -2165,8 +2165,8 @@
}
bool containerSkipped;
- auto o = container(repaintContainer, &containerSkipped);
- if (!o)
+ auto* renderer = container(repaintContainer, &containerSkipped);
+ if (!renderer)
return;
EPosition position = styleToUse.position();
@@ -2178,10 +2178,10 @@
// us to add the height twice.
// The same logic applies for elements flowed directly into the flow thread. Their topLeft member
// will already contain the portion rect of the region.
- if (o->isOutOfFlowRenderFlowThread() && position != AbsolutePosition && containingBlock() != flowThreadContainingBlock()) {
+ if (renderer->isOutOfFlowRenderFlowThread() && position != AbsolutePosition && containingBlock() != flowThreadContainingBlock()) {
RenderRegion* firstRegion = nullptr;
RenderRegion* lastRegion = nullptr;
- if (toRenderFlowThread(o)->getRegionRangeForBox(this, firstRegion, lastRegion))
+ if (downcast<RenderFlowThread>(*renderer).getRegionRangeForBox(this, firstRegion, lastRegion))
rect.moveBy(firstRegion->flowThreadPortionRect().location());
}
@@ -2201,8 +2201,8 @@
} else if (position == FixedPosition)
fixed = true;
- if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline())
- topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this);
+ if (position == AbsolutePosition && renderer->isInFlowPositioned() && is<RenderInline>(*renderer))
+ topLeft += downcast<RenderInline>(*renderer).offsetForInFlowPositionedInline(this);
else if (styleToUse.hasInFlowPosition() && layer()) {
// Apply the relative position offset when invalidating a rectangle. The layer
// is translated, but the render box isn't, so we need to do this to get the
@@ -2214,10 +2214,10 @@
// FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout,
// its controlClipRect will be wrong. For overflow clip we use the values cached by the layer.
rect.setLocation(topLeft);
- if (o->hasOverflowClip()) {
- RenderBox* containerBox = toRenderBox(o);
- if (shouldApplyContainersClipAndOffset(repaintContainer, containerBox)) {
- containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
+ if (renderer->hasOverflowClip()) {
+ RenderBox& containerBox = downcast<RenderBox>(*renderer);
+ if (shouldApplyContainersClipAndOffset(repaintContainer, &containerBox)) {
+ containerBox.applyCachedClipAndScrollOffsetForRepaint(rect);
if (rect.isEmpty())
return;
}
@@ -2225,12 +2225,12 @@
if (containerSkipped) {
// If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates.
- LayoutSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
+ LayoutSize containerOffset = repaintContainer->offsetFromAncestorContainer(renderer);
rect.move(-containerOffset);
return;
}
- o->computeRectForRepaint(repaintContainer, rect, fixed);
+ renderer->computeRectForRepaint(repaintContainer, rect, fixed);
}
void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect)
@@ -3107,11 +3107,11 @@
return (boxInfo) ? std::max<LayoutUnit>(0, cb.clientLogicalWidth() - (cb.logicalWidth() - boxInfo->logicalWidth())) : cb.clientLogicalWidth();
}
- ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositioned());
+ ASSERT(containingBlock->isInFlowPositioned());
- const RenderInline* flow = toRenderInline(containingBlock);
- InlineFlowBox* first = flow->firstLineBox();
- InlineFlowBox* last = flow->lastLineBox();
+ const auto& flow = downcast<RenderInline>(*containingBlock);
+ InlineFlowBox* first = flow.firstLineBox();
+ InlineFlowBox* last = flow.lastLineBox();
// If the containing block is empty, return a width of 0.
if (!first || !last)
@@ -3152,9 +3152,9 @@
return result;
}
- ASSERT(is<RenderInline>(*containingBlock) && containingBlock->isInFlowPositioned());
+ ASSERT(containingBlock->isInFlowPositioned());
- const RenderInline& flow = downcast<RenderInline>(*containingBlock);
+ const auto& flow = downcast<RenderInline>(*containingBlock);
InlineFlowBox* first = flow.firstLineBox();
InlineFlowBox* last = flow.lastLineBox();
@@ -3533,10 +3533,10 @@
// positioned, inline because right now, it is using the logical left position
// of the first line box when really it should use the last line box. When
// this is fixed elsewhere, this block should be removed.
- if (containerBlock->isRenderInline() && !containerBlock->style().isLeftToRightDirection()) {
- const RenderInline* flow = toRenderInline(containerBlock);
- InlineFlowBox* firstLine = flow->firstLineBox();
- InlineFlowBox* lastLine = flow->lastLineBox();
+ if (is<RenderInline>(*containerBlock) && !containerBlock->style().isLeftToRightDirection()) {
+ const auto& flow = downcast<RenderInline>(*containerBlock);
+ InlineFlowBox* firstLine = flow.firstLineBox();
+ InlineFlowBox* lastLine = flow.lastLineBox();
if (firstLine && lastLine && firstLine != lastLine) {
computedValues.m_position = logicalLeftValue + marginLogicalLeftValue + lastLine->borderLogicalLeft() + (lastLine->logicalLeft() - firstLine->logicalLeft());
return;
@@ -3973,10 +3973,10 @@
// positioned, inline containing block because right now, it is using the logical left position
// of the first line box when really it should use the last line box. When
// this is fixed elsewhere, this block should be removed.
- if (containerBlock->isRenderInline() && !containerBlock->style().isLeftToRightDirection()) {
- const RenderInline* flow = toRenderInline(containerBlock);
- InlineFlowBox* firstLine = flow->firstLineBox();
- InlineFlowBox* lastLine = flow->lastLineBox();
+ if (is<RenderInline>(*containerBlock) && !containerBlock->style().isLeftToRightDirection()) {
+ const auto& flow = downcast<RenderInline>(*containerBlock);
+ InlineFlowBox* firstLine = flow.firstLineBox();
+ InlineFlowBox* lastLine = flow.lastLineBox();
if (firstLine && lastLine && firstLine != lastLine) {
computedValues.m_position = logicalLeftValue + marginLogicalLeftAlias + lastLine->borderLogicalLeft() + (lastLine->logicalLeft() - firstLine->logicalLeft());
return;
@@ -4624,7 +4624,7 @@
RenderRegion* startRegion = nullptr;
RenderRegion* endRegion = nullptr;
if (flowThread->getRegionRangeForBox(this, startRegion, endRegion))
- overflowRect.unite(namedFlowFragment->visualOverflowRectForBox(this));
+ overflowRect.unite(namedFlowFragment->visualOverflowRectForBox(*this));
}
if (!m_overflow || !usesCompositedScrolling())
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -213,13 +213,9 @@
if (!child->isAnonymousBlock() || !child->isInFlowPositioned())
return LayoutSize();
LayoutSize offset;
- RenderElement* p = downcast<RenderBlock>(*child).inlineElementContinuation();
- while (is<RenderInline>(p)) {
- if (p->isInFlowPositioned()) {
- RenderInline& renderInline = downcast<RenderInline>(*p);
- offset += renderInline.offsetForInFlowPosition();
- }
- p = p->parent();
+ for (RenderElement* parent = downcast<RenderBlock>(*child).inlineElementContinuation(); is<RenderInline>(parent); parent = parent->parent()) {
+ if (parent->isInFlowPositioned())
+ offset += downcast<RenderInline>(*parent).offsetForInFlowPosition();
}
return offset;
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -996,7 +996,7 @@
view().frameView().removeSlowRepaintObject(this);
if (isOutOfFlowPositioned() && parent()->childrenInline())
- parent()->dirtyLinesFromChangedChild(this);
+ parent()->dirtyLinesFromChangedChild(*this);
if (auto* containerFlowThread = parent()->renderNamedFlowThreadWrapper())
containerFlowThread->removeFlowChild(*this);
Modified: trunk/Source/WebCore/rendering/RenderElement.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderElement.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -85,7 +85,7 @@
virtual RenderElement* hoverAncestor() const;
- virtual void dirtyLinesFromChangedChild(RenderObject*) { }
+ virtual void dirtyLinesFromChangedChild(RenderObject&) { }
bool ancestorLineBoxDirty() const { return m_ancestorLineBoxDirty; }
void setAncestorLineBoxDirty(bool f = true);
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -1446,7 +1446,7 @@
break;
continue;
}
- LayoutRect childVisualOverflowRect = region->visualOverflowRectForBoxForPropagation(child);
+ LayoutRect childVisualOverflowRect = region->visualOverflowRectForBoxForPropagation(*child);
childVisualOverflowRect.move(delta);
region->addVisualOverflowForBox(box, childVisualOverflowRect);
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -107,7 +107,7 @@
box->removeFromParent();
}
} else if (parent())
- parent()->dirtyLinesFromChangedChild(this);
+ parent()->dirtyLinesFromChangedChild(*this);
}
m_lineBoxes.deleteLineBoxes();
@@ -217,7 +217,7 @@
return;
RenderStyle* parentStyle = &parent()->style();
- RenderInline* parentRenderInline = parent()->isRenderInline() ? toRenderInline(parent()) : 0;
+ RenderInline* parentRenderInline = is<RenderInline>(*parent()) ? downcast<RenderInline>(parent()) : nullptr;
bool checkFonts = document().inNoQuirksMode();
RenderFlowThread* flowThread = flowThreadContainingBlock();
bool alwaysCreateLineBoxes = (parentRenderInline && parentRenderInline->alwaysCreateLineBoxes())
@@ -1107,27 +1107,27 @@
// We need to add in the in-flow position offsets of any inlines (including us) up to our
// containing block.
- RenderBlock* cb = containingBlock();
- for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRenderInline() && inlineFlow != cb;
+ RenderBlock* containingBlock = this->containingBlock();
+ for (const RenderElement* inlineFlow = this; is<RenderInline>(inlineFlow) && inlineFlow != containingBlock;
inlineFlow = inlineFlow->parent()) {
if (inlineFlow == repaintContainer) {
hitRepaintContainer = true;
break;
}
if (inlineFlow->style().hasInFlowPosition() && inlineFlow->hasLayer())
- repaintRect.move(toRenderInline(inlineFlow)->layer()->offsetForInFlowPosition());
+ repaintRect.move(downcast<RenderInline>(*inlineFlow).layer()->offsetForInFlowPosition());
}
LayoutUnit outlineSize = style().outlineSize();
repaintRect.inflate(outlineSize);
- if (hitRepaintContainer || !cb)
+ if (hitRepaintContainer || !containingBlock)
return repaintRect;
- if (cb->hasOverflowClip())
- cb->applyCachedClipAndScrollOffsetForRepaint(repaintRect);
+ if (containingBlock->hasOverflowClip())
+ containingBlock->applyCachedClipAndScrollOffsetForRepaint(repaintRect);
- cb->computeRectForRepaint(repaintContainer, repaintRect);
+ containingBlock->computeRectForRepaint(repaintContainer, repaintRect);
if (outlineSize) {
for (auto& child : childrenOfType<RenderElement>(*this))
Modified: trunk/Source/WebCore/rendering/RenderInline.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderInline.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -156,7 +156,7 @@
virtual std::unique_ptr<InlineFlowBox> createInlineFlowBox(); // Subclassed by RenderSVGInline
- virtual void dirtyLinesFromChangedChild(RenderObject* child) override final { m_lineBoxes.dirtyLinesFromChangedChild(this, child); }
+ virtual void dirtyLinesFromChangedChild(RenderObject& child) override final { m_lineBoxes.dirtyLinesFromChangedChild(*this, child); }
virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override final;
virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override final;
@@ -180,8 +180,6 @@
RenderLineBoxList m_lineBoxes; // All of the line boxes created for this inline flow. For example, <i>Hello<br>world.</i> will have two <i> line boxes.
};
-RENDER_OBJECT_TYPE_CASTS(RenderInline, isRenderInline())
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderInline, isRenderInline())
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -1198,8 +1198,8 @@
{
LayoutPoint localPoint;
LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLayer x/y for inlines, so we need to subtract it out when done.
- if (renderer().isInline() && renderer().isRenderInline()) {
- RenderInline& inlineFlow = toRenderInline(renderer());
+ if (renderer().isInline() && is<RenderInline>(renderer())) {
+ auto& inlineFlow = downcast<RenderInline>(renderer());
IntRect lineBox = inlineFlow.linesBoundingBox();
setSize(lineBox.size());
inlineBoundingBoxOffset = toLayoutSize(lineBox.location());
@@ -1238,8 +1238,8 @@
localPoint -= offset;
}
- if (renderer().isOutOfFlowPositioned() && positionedParent->renderer().isInFlowPositioned() && positionedParent->renderer().isRenderInline()) {
- LayoutSize offset = toRenderInline(positionedParent->renderer()).offsetForInFlowPositionedInline(&toRenderBox(renderer()));
+ if (renderer().isOutOfFlowPositioned() && positionedParent->renderer().isInFlowPositioned() && is<RenderInline>(positionedParent->renderer())) {
+ LayoutSize offset = downcast<RenderInline>(positionedParent->renderer()).offsetForInFlowPositionedInline(&toRenderBox(renderer()));
localPoint += offset;
}
} else if (parent()) {
@@ -5408,7 +5408,7 @@
if (isSelfPaintingLayer() && flowThread && !renderer().isInFlowRenderFlowThread()) {
ASSERT(namedFlowFragment->isValid());
const RenderBoxModelObject& boxModelObject = downcast<RenderBoxModelObject>(renderer());
- LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment->visualOverflowRectForBox(&boxModelObject);
+ LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment->visualOverflowRectForBox(boxModelObject);
// Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread.
if (&boxModelObject == flowThread && flowThread->style().isFlippedBlocksWritingMode()) {
@@ -5457,7 +5457,7 @@
if (renderBox()->hasVisualOverflow()) {
// FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
// individual region boxes as overflow.
- LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment ? namedFlowFragment->visualOverflowRectForBox(renderBox()) : renderBox()->visualOverflowRect();
+ LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment ? namedFlowFragment->visualOverflowRectForBox(*renderBox()) : renderBox()->visualOverflowRect();
renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped.
layerBoundsWithVisualOverflow.move(offsetFromRootLocal);
if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
@@ -5593,7 +5593,7 @@
// to the flow thread, not the last region (in which it will end up because of bottom:0px)
if (namedFlowFragment && renderer().flowThreadContainingBlock()) {
LayoutRect b = layerBounds;
- b.moveBy(namedFlowFragment->visualOverflowRectForBox(downcast<RenderBoxModelObject>(&renderer())).location());
+ b.moveBy(namedFlowFragment->visualOverflowRectForBox(downcast<RenderBoxModelObject>(renderer())).location());
b.inflate(renderer().view().maximalOutlineSize());
if (b.intersects(damageRect))
return true;
@@ -5620,10 +5620,10 @@
// as part of our bounding box. We do this because we are the responsible layer for both hit testing and painting those
// floats.
LayoutRect result;
- if (renderer().isInline() && renderer().isRenderInline())
- result = toRenderInline(renderer()).linesVisualOverflowBoundingBox();
+ if (renderer().isInline() && is<RenderInline>(renderer()))
+ result = downcast<RenderInline>(renderer()).linesVisualOverflowBoundingBox();
else if (is<RenderTableRow>(renderer())) {
- RenderTableRow& tableRow = downcast<RenderTableRow>(renderer());
+ auto& tableRow = downcast<RenderTableRow>(renderer());
// Our bounding box is just the union of all of our cells' border/overflow rects.
for (RenderTableCell* cell = tableRow.firstCell(); cell; cell = cell->nextCell()) {
LayoutRect bbox = cell->borderBoxRect();
Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -312,22 +312,22 @@
return false;
}
-void RenderLineBoxList::dirtyLinesFromChangedChild(RenderBoxModelObject* container, RenderObject* child)
+void RenderLineBoxList::dirtyLinesFromChangedChild(RenderBoxModelObject& container, RenderObject& child)
{
- ASSERT(container->isRenderInline() || container->isRenderBlockFlow());
- if (!container->parent() || (container->isRenderBlockFlow() && container->selfNeedsLayout()))
+ ASSERT(is<RenderInline>(container) || is<RenderBlockFlow>(container));
+ if (!container.parent() || (is<RenderBlockFlow>(container) && container.selfNeedsLayout()))
return;
- RenderInline* inlineContainer = container->isRenderInline() ? toRenderInline(container) : 0;
+ RenderInline* inlineContainer = is<RenderInline>(container) ? &downcast<RenderInline>(container) : nullptr;
InlineBox* firstBox = inlineContainer ? inlineContainer->firstLineBoxIncludingCulling() : firstLineBox();
// If we have no first line box, then just bail early.
if (!firstBox) {
// For an empty inline, go ahead and propagate the check up to our parent, unless the parent
// is already dirty.
- if (container->isInline() && !container->ancestorLineBoxDirty()) {
- container->parent()->dirtyLinesFromChangedChild(container);
- container->setAncestorLineBoxDirty(); // Mark the container to avoid dirtying the same lines again across multiple destroy() calls of the same subtree.
+ if (container.isInline() && !container.ancestorLineBoxDirty()) {
+ container.parent()->dirtyLinesFromChangedChild(container);
+ container.setAncestorLineBoxDirty(); // Mark the container to avoid dirtying the same lines again across multiple destroy() calls of the same subtree.
}
return;
}
@@ -337,7 +337,7 @@
// parent's first line box.
RootInlineBox* box = nullptr;
RenderObject* current;
- for (current = child->previousSibling(); current; current = current->previousSibling()) {
+ for (current = child.previousSibling(); current; current = current->previousSibling()) {
if (current->isFloatingOrOutOfFlowPositioned())
continue;
@@ -367,7 +367,7 @@
// This isn't good enough, since we won't locate the root line box that encloses the removed
// <br>. We have to just over-invalidate a bit and go up to our parent.
if (!inlineContainer->ancestorLineBoxDirty()) {
- inlineContainer->parent()->dirtyLinesFromChangedChild(inlineContainer);
+ inlineContainer->parent()->dirtyLinesFromChangedChild(*inlineContainer);
inlineContainer->setAncestorLineBoxDirty(); // Mark the container to avoid dirtying the same lines again across multiple destroy() calls of the same subtree.
}
return;
@@ -394,9 +394,9 @@
// If |child| has been inserted before the first element in the linebox, but after collapsed leading
// space, the search for |child|'s linebox will go past the leading space to the previous linebox and select that
// one as |box|. If we hit that situation here, dirty the |box| actually containing the child too.
- bool insertedAfterLeadingSpace = box->lineBreakObj() == child->previousSibling();
- if (adjacentBox && (adjacentBox->lineBreakObj() == child || child->isBR() || (current && current->isBR())
- || insertedAfterLeadingSpace || isIsolated(container->style().unicodeBidi())))
+ bool insertedAfterLeadingSpace = box->lineBreakObj() == child.previousSibling();
+ if (adjacentBox && (adjacentBox->lineBreakObj() == &child || child.isBR() || (current && current->isBR())
+ || insertedAfterLeadingSpace || isIsolated(container.style().unicodeBidi())))
adjacentBox->markDirty();
}
}
Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderLineBoxList.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -64,7 +64,7 @@
void removeLineBox(InlineFlowBox*);
void dirtyLineBoxes();
- void dirtyLinesFromChangedChild(RenderBoxModelObject* parent, RenderObject* child);
+ void dirtyLinesFromChangedChild(RenderBoxModelObject& parent, RenderObject& child);
void paint(RenderBoxModelObject*, PaintInfo&, const LayoutPoint&) const;
bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) const;
Modified: trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -284,7 +284,7 @@
LayoutRect RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment(const RenderBox& box, RenderNamedFlowFragment& fragment) const
{
- LayoutRect visualOverflowRect = fragment.visualOverflowRectForBox(&box);
+ LayoutRect visualOverflowRect = fragment.visualOverflowRectForBox(box);
LayoutUnit initialLogicalX = style().isHorizontalWritingMode() ? visualOverflowRect.x() : visualOverflowRect.y();
// The visual overflow rect returned by visualOverflowRectForBox is already flipped but the
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -2047,7 +2047,7 @@
// FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
if (!isFloating() && parent()->childrenInline())
- parent()->dirtyLinesFromChangedChild(this);
+ parent()->dirtyLinesFromChangedChild(*this);
// We have to unset the current layout RenderFlowThread here, since insertedIntoTree() can happen in
// the middle of layout but for objects inside a nested flow thread that is still being populated. This
Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderRegion.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -156,7 +156,7 @@
if (shouldClipFlowThreadContent())
return flowThreadPortionRect;
- LayoutRect flowThreadOverflow = overflowType == VisualOverflow ? visualOverflowRectForBox(m_flowThread) : layoutOverflowRectForBox(m_flowThread);
+ LayoutRect flowThreadOverflow = overflowType == VisualOverflow ? visualOverflowRectForBox(*m_flowThread) : layoutOverflowRectForBox(m_flowThread);
// We are interested about the outline size only when computing the visual overflow.
LayoutUnit outlineSize = overflowType == VisualOverflow ? LayoutUnit(maximalOutlineSize(PaintPhaseOutline)) : LayoutUnit();
@@ -523,16 +523,16 @@
return overflow->layoutOverflowRect();
}
-LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBoxModelObject* box)
+LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBoxModelObject& box)
{
- if (box->isRenderInline()) {
- const RenderInline* inlineBox = toRenderInline(box);
- return inlineBox->linesVisualOverflowBoundingBoxInRegion(this);
+ if (is<RenderInline>(box)) {
+ const RenderInline& inlineBox = downcast<RenderInline>(box);
+ return inlineBox.linesVisualOverflowBoundingBoxInRegion(this);
}
- if (box->isBox()) {
+ if (is<RenderBox>(box)) {
RefPtr<RenderOverflow> overflow;
- ensureOverflowForBox(toRenderBox(box), overflow, true);
+ ensureOverflowForBox(&downcast<RenderBox>(box), overflow, true);
ASSERT(overflow);
return overflow->visualOverflowRect();
@@ -563,7 +563,7 @@
return rect;
}
-LayoutRect RenderRegion::visualOverflowRectForBoxForPropagation(const RenderBoxModelObject* box)
+LayoutRect RenderRegion::visualOverflowRectForBoxForPropagation(const RenderBoxModelObject& box)
{
LayoutRect rect = visualOverflowRectForBox(box);
flowThread()->flipForWritingModeLocalCoordinates(rect);
Modified: trunk/Source/WebCore/rendering/RenderRegion.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderRegion.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderRegion.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -113,9 +113,9 @@
void addLayoutOverflowForBox(const RenderBox*, const LayoutRect&);
void addVisualOverflowForBox(const RenderBox*, const LayoutRect&);
LayoutRect layoutOverflowRectForBox(const RenderBox*);
- LayoutRect visualOverflowRectForBox(const RenderBoxModelObject*);
+ LayoutRect visualOverflowRectForBox(const RenderBoxModelObject&);
LayoutRect layoutOverflowRectForBoxForPropagation(const RenderBox*);
- LayoutRect visualOverflowRectForBoxForPropagation(const RenderBoxModelObject*);
+ LayoutRect visualOverflowRectForBoxForPropagation(const RenderBoxModelObject&);
LayoutRect rectFlowPortionForBox(const RenderBox*, const LayoutRect&) const;
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -74,7 +74,7 @@
void RenderReplaced::willBeDestroyed()
{
if (!documentBeingDestroyed() && parent())
- parent()->dirtyLinesFromChangedChild(this);
+ parent()->dirtyLinesFromChangedChild(*this);
RenderBox::willBeDestroyed();
}
Modified: trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -109,7 +109,7 @@
{
if (!m_first) {
if (renderer.parent())
- renderer.parent()->dirtyLinesFromChangedChild(&renderer);
+ renderer.parent()->dirtyLinesFromChangedChild(renderer);
return;
}
for (auto box = m_first; box; box = box->nextTextBox())
@@ -683,7 +683,7 @@
// If the text node is empty, dirty the line where new text will be inserted.
if (!m_first && renderer.parent()) {
- renderer.parent()->dirtyLinesFromChangedChild(&renderer);
+ renderer.parent()->dirtyLinesFromChangedChild(renderer);
dirtiedLines = true;
}
return dirtiedLines;
Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -286,8 +286,8 @@
unsigned lineDepth = 1;
LayoutUnit extraWidth = 0;
RenderElement* parent = child->parent();
- while (parent->isRenderInline() && lineDepth++ < cMaxLineDepth) {
- const RenderInline& parentAsRenderInline = toRenderInline(*parent);
+ while (is<RenderInline>(*parent) && lineDepth++ < cMaxLineDepth) {
+ const auto& parentAsRenderInline = downcast<RenderInline>(*parent);
if (!isEmptyInline(parentAsRenderInline)) {
checkStartEdge = checkStartEdge && shouldAddBorderPaddingMargin(previousInFlowSibling(child));
if (checkStartEdge)
@@ -373,7 +373,7 @@
inline void BreakingContext::handleEmptyInline()
{
- RenderInline& flowBox = toRenderInline(*m_current.renderer());
+ RenderInline& flowBox = downcast<RenderInline>(*m_current.renderer());
// This should only end up being called on empty inlines
ASSERT(isEmptyInline(flowBox));
Modified: trunk/Source/WebCore/rendering/line/LineInlineHeaders.h (174713 => 174714)
--- trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2014-10-15 00:29:51 UTC (rev 174714)
@@ -105,8 +105,8 @@
return true;
bool rendererIsEmptyInline = false;
- if (it.renderer()->isRenderInline()) {
- const RenderInline& inlineRenderer = toRenderInline(*it.renderer());
+ if (is<RenderInline>(*it.renderer())) {
+ const auto& inlineRenderer = downcast<RenderInline>(*it.renderer());
if (!alwaysRequiresLineBox(inlineRenderer) && !requiresLineBoxForContent(inlineRenderer, lineInfo))
return false;
rendererIsEmptyInline = isEmptyInline(inlineRenderer);
@@ -126,12 +126,12 @@
// will work for the common cases
RenderElement* containerBlock = child.container();
LayoutUnit blockHeight = block.logicalHeight();
- if (containerBlock->isRenderInline()) {
+ if (is<RenderInline>(*containerBlock)) {
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned
// inline so that we can obtain the value later.
- toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, false));
- toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHeight);
+ downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, false));
+ downcast<RenderInline>(*containerBlock).layer()->setStaticBlockPosition(blockHeight);
}
block.updateStaticInlinePositionForChild(child, blockHeight);
child.layer()->setStaticBlockPosition(blockHeight);
Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (174713 => 174714)
--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2014-10-15 00:02:24 UTC (rev 174713)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2014-10-15 00:29:51 UTC (rev 174714)
@@ -338,8 +338,8 @@
}
// Finally, paint the outline if any.
- if (renderer().style().hasOutline() && parentRenderer.isRenderInline())
- toRenderInline(parentRenderer).paintOutline(paintInfo, paintOffset);
+ if (renderer().style().hasOutline() && is<RenderInline>(parentRenderer))
+ downcast<RenderInline>(parentRenderer).paintOutline(paintInfo, paintOffset);
ASSERT(!m_paintingResource);
}