Commit 0c305637 authored by hyatt@apple.com's avatar hyatt@apple.com

2009-01-23 David Hyatt <hyatt@apple.com>

        Make toRenderBox a non-member function.  Rename toConstRenderBox to just also be called toRenderBox.

        Reviewed by Oliver Hunt

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::sizingBox):
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * dom/ContainerNode.cpp:
        (WebCore::ContainerNode::getUpperLeftCorner):
        (WebCore::ContainerNode::getLowerRightCorner):
        * dom/Element.cpp:
        (WebCore::Element::scrollByUnits):
        * dom/Position.cpp:
        (WebCore::endsOfNodeAreVisuallyDistinctPositions):
        (WebCore::Position::hasRenderedNonAnonymousDescendantsWithHeight):
        (WebCore::Position::isCandidate):
        * editing/DeleteButtonController.cpp:
        (WebCore::isDeletableElement):
        * editing/EditorCommand.cpp:
        (WebCore::verticalScrollDistance):
        * editing/TextIterator.cpp:
        (WebCore::shouldEmitExtraNewlineForNode):
        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::isKeyboardFocusable):
        * html/HTMLFormControlElement.cpp:
        (WebCore::HTMLFormControlElement::isFocusable):
        * html/HTMLFrameElementBase.cpp:
        (WebCore::HTMLFrameElementBase::width):
        (WebCore::HTMLFrameElementBase::height):
        * page/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::doAccessibilityHitTest):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMouseDraggedEvent):
        (WebCore::EventHandler::autoscrollTimerFired):
        (WebCore::EventHandler::updateAutoscrollRenderer):
        (WebCore::EventHandler::stopAutoscrollTimer):
        (WebCore::EventHandler::scrollOverflow):
        * page/FrameView.cpp:
        (WebCore::FrameView::layout):
        * page/animation/AnimationBase.cpp:
        (WebCore::blendFunc):
        * rendering/InlineBox.cpp:
        (WebCore::InlineBox::adjustPosition):
        * rendering/InlineBox.h:
        (WebCore::InlineBox::renderBox):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::clearFloats):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::offsetFromContainer):
        (WebCore::RenderBox::computeAbsoluteRepaintRect):
        (WebCore::RenderBox::containingBlockWidthForPositioned):
        (WebCore::RenderBox::containingBlockHeightForPositioned):
        (WebCore::RenderBox::calcAbsoluteHorizontal):
        (WebCore::RenderBox::calcAbsoluteVertical):
        (WebCore::RenderBox::calcAbsoluteHorizontalReplaced):
        (WebCore::RenderBox::calcAbsoluteVerticalReplaced):
        * rendering/RenderBox.h:
        (WebCore::toRenderBox):
        (WebCore::RenderBox::previousSiblingBox):
        (WebCore::RenderBox::nextSiblingBox):
        (WebCore::RenderBox::parentBox):
        * rendering/RenderFlow.cpp:
        (WebCore::RenderFlow::absoluteClippedOverflowRect):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::updateLayerPosition):
        (WebCore::RenderLayer::resize):
        (WebCore::RenderLayer::boundingBox):
        * rendering/RenderObject.cpp:
        (WebCore::addLayers):
        (WebCore::RenderObject::removeLayers):
        (WebCore::RenderObject::moveLayers):
        (WebCore::RenderObject::findNextLayer):
        (WebCore::RenderObject::enclosingLayer):
        (WebCore::RenderObject::setNeedsLayout):
        (WebCore::RenderObject::setNeedsPositionedMovementLayout):
        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
        (WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
        (WebCore::RenderObject::computeAbsoluteRepaintRect):
        (WebCore::RenderObject::localToAbsolute):
        (WebCore::RenderObject::absoluteToLocal):
        (WebCore::RenderObject::localToAbsoluteQuad):
        (WebCore::RenderObject::offsetFromContainer):
        (WebCore::RenderObject::removeFromObjectLists):
        (WebCore::RenderObject::destroy):
        (WebCore::RenderObject::updateHitTestResult):
        (WebCore::RenderObject::addDashboardRegions):
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::layoutRows):
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::hitTestMediaControlPart):
        (WebCore::RenderTheme::baselinePosition):
        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::hitTestMediaControlPart):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::externalRepresentation):
        * rendering/bidi.cpp:
        (WebCore::inlineWidth):
        (WebCore::RenderBlock::computeHorizontalPositionsForLine):
        (WebCore::requiresLineBox):
        (WebCore::RenderBlock::findNextLineBreak):
        * svg/SVGLength.cpp:
        (WebCore::SVGLength::PercentageOfViewport):
        * wml/WMLAElement.cpp:
        (WebCore::WMLAElement::isKeyboardFocusable):
        * wml/WMLInputElement.cpp:
        (WebCore::isInputFocusable):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 16989217
2009-01-23 David Hyatt <hyatt@apple.com>
Make toRenderBox a non-member function. Rename toConstRenderBox to just also be called toRenderBox.
Reviewed by Oliver Hunt
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::sizingBox):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getUpperLeftCorner):
(WebCore::ContainerNode::getLowerRightCorner):
* dom/Element.cpp:
(WebCore::Element::scrollByUnits):
* dom/Position.cpp:
(WebCore::endsOfNodeAreVisuallyDistinctPositions):
(WebCore::Position::hasRenderedNonAnonymousDescendantsWithHeight):
(WebCore::Position::isCandidate):
* editing/DeleteButtonController.cpp:
(WebCore::isDeletableElement):
* editing/EditorCommand.cpp:
(WebCore::verticalScrollDistance):
* editing/TextIterator.cpp:
(WebCore::shouldEmitExtraNewlineForNode):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isKeyboardFocusable):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isFocusable):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::width):
(WebCore::HTMLFrameElementBase::height):
* page/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::doAccessibilityHitTest):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseDraggedEvent):
(WebCore::EventHandler::autoscrollTimerFired):
(WebCore::EventHandler::updateAutoscrollRenderer):
(WebCore::EventHandler::stopAutoscrollTimer):
(WebCore::EventHandler::scrollOverflow):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
* page/animation/AnimationBase.cpp:
(WebCore::blendFunc):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::adjustPosition):
* rendering/InlineBox.h:
(WebCore::InlineBox::renderBox):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::clearFloats):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::offsetFromContainer):
(WebCore::RenderBox::computeAbsoluteRepaintRect):
(WebCore::RenderBox::containingBlockWidthForPositioned):
(WebCore::RenderBox::containingBlockHeightForPositioned):
(WebCore::RenderBox::calcAbsoluteHorizontal):
(WebCore::RenderBox::calcAbsoluteVertical):
(WebCore::RenderBox::calcAbsoluteHorizontalReplaced):
(WebCore::RenderBox::calcAbsoluteVerticalReplaced):
* rendering/RenderBox.h:
(WebCore::toRenderBox):
(WebCore::RenderBox::previousSiblingBox):
(WebCore::RenderBox::nextSiblingBox):
(WebCore::RenderBox::parentBox):
* rendering/RenderFlow.cpp:
(WebCore::RenderFlow::absoluteClippedOverflowRect):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition):
(WebCore::RenderLayer::resize):
(WebCore::RenderLayer::boundingBox):
* rendering/RenderObject.cpp:
(WebCore::addLayers):
(WebCore::RenderObject::removeLayers):
(WebCore::RenderObject::moveLayers):
(WebCore::RenderObject::findNextLayer):
(WebCore::RenderObject::enclosingLayer):
(WebCore::RenderObject::setNeedsLayout):
(WebCore::RenderObject::setNeedsPositionedMovementLayout):
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
(WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
(WebCore::RenderObject::computeAbsoluteRepaintRect):
(WebCore::RenderObject::localToAbsolute):
(WebCore::RenderObject::absoluteToLocal):
(WebCore::RenderObject::localToAbsoluteQuad):
(WebCore::RenderObject::offsetFromContainer):
(WebCore::RenderObject::removeFromObjectLists):
(WebCore::RenderObject::destroy):
(WebCore::RenderObject::updateHitTestResult):
(WebCore::RenderObject::addDashboardRegions):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::hitTestMediaControlPart):
(WebCore::RenderTheme::baselinePosition):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::hitTestMediaControlPart):
* rendering/RenderTreeAsText.cpp:
(WebCore::externalRepresentation):
* rendering/bidi.cpp:
(WebCore::inlineWidth):
(WebCore::RenderBlock::computeHorizontalPositionsForLine):
(WebCore::requiresLineBox):
(WebCore::RenderBlock::findNextLineBreak):
* svg/SVGLength.cpp:
(WebCore::SVGLength::PercentageOfViewport):
* wml/WMLAElement.cpp:
(WebCore::WMLAElement::isKeyboardFocusable):
* wml/WMLInputElement.cpp:
(WebCore::isInputFocusable):
2009-01-23 Chris Fleizach <cfleizach@apple.com>
Reviewed by Beth Dakin.
......@@ -398,7 +398,7 @@ static IntRect sizingBox(RenderObject* renderer)
if (!renderer->isBox())
return IntRect();
RenderBox* box = RenderBox::toRenderBox(renderer);
RenderBox* box = toRenderBox(renderer);
return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect();
}
......@@ -763,22 +763,22 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyMarginTop:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginTop(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginTop(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginTop());
case CSSPropertyMarginRight:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginRight(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginRight(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginRight());
case CSSPropertyMarginBottom:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginBottom(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginBottom(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginBottom());
case CSSPropertyMarginLeft:
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginLeft(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->marginLeft(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginLeft());
case CSSPropertyWebkitMarqueeDirection:
return CSSPrimitiveValue::create(style->marqueeDirection());
......@@ -863,19 +863,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->overflowY());
case CSSPropertyPaddingTop:
if (renderer && renderer->isBox())
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->paddingTop(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingTop(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->paddingTop());
case CSSPropertyPaddingRight:
if (renderer && renderer->isBox())
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->paddingRight(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingRight(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->paddingRight());
case CSSPropertyPaddingBottom:
if (renderer && renderer->isBox())
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->paddingBottom(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingBottom(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->paddingBottom());
case CSSPropertyPaddingLeft:
if (renderer && renderer->isBox())
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->paddingLeft(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingLeft(false), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->paddingLeft());
case CSSPropertyPageBreakAfter:
return CSSPrimitiveValue::create(style->pageBreakAfter());
......
......@@ -695,7 +695,7 @@ bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
point.move(static_cast<RenderText *>(o)->linesBoundingBox().x(),
static_cast<RenderText *>(o)->firstTextBox()->root()->topOverflow());
} else if (o->isBox()) {
RenderBox* box = RenderBox::toRenderBox(o);
RenderBox* box = toRenderBox(o);
point.move(box->x(), box->y());
}
return true;
......@@ -720,7 +720,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
RenderObject *o = renderer();
if (!o->isInline() || o->isReplaced())
{
RenderBox* box = RenderBox::toRenderBox(o);
RenderBox* box = toRenderBox(o);
point = o->localToAbsolute();
point.move(box->width(), box->height());
return true;
......@@ -749,7 +749,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
IntRect linesBox = text->linesBoundingBox();
point.move(linesBox.x() + linesBox.width(), linesBox.height());
} else {
RenderBox* box = RenderBox::toRenderBox(o);
RenderBox* box = toRenderBox(o);
point.move(box->x() + box->width(), box->y() + box->height());
}
return true;
......
......@@ -217,7 +217,7 @@ void Element::scrollByUnits(int units, ScrollGranularity granularity)
direction = ScrollUp;
units = -units;
}
RenderBox::toRenderBox(rend)->layer()->scroll(direction, granularity, units);
toRenderBox(rend)->layer()->scroll(direction, granularity, units);
}
}
}
......
......@@ -284,7 +284,7 @@ static bool endsOfNodeAreVisuallyDistinctPositions(Node* node)
return false;
// There is a VisiblePosition inside an empty inline-block container.
return node->renderer()->isReplaced() && canHaveChildrenForEditing(node) && RenderBox::toRenderBox(node->renderer())->height() != 0 && !node->firstChild();
return node->renderer()->isReplaced() && canHaveChildrenForEditing(node) && toRenderBox(node->renderer())->height() != 0 && !node->firstChild();
}
static Node* enclosingVisualBoundary(Node* node)
......@@ -538,7 +538,7 @@ bool Position::hasRenderedNonAnonymousDescendantsWithHeight(RenderObject* render
for (RenderObject *o = renderer->firstChild(); o && o != stop; o = o->nextInPreOrder())
if (o->element()) {
if ((o->isText() && static_cast<RenderText*>(o)->linesBoundingBox().height()) ||
(o->isBox() && RenderBox::toRenderBox(o)->height()))
(o->isBox() && toRenderBox(o)->height()))
return true;
}
return false;
......@@ -571,7 +571,7 @@ bool Position::isCandidate() const
return (offset() == 0 || offset() == maxDeepOffset(node())) && !nodeIsUserSelectNone(node()->parent());
if (!node()->hasTagName(htmlTag) && renderer->isBlockFlow() && !hasRenderedNonAnonymousDescendantsWithHeight(renderer) &&
(RenderBox::toRenderBox(renderer)->height() || node()->hasTagName(bodyTag)))
(toRenderBox(renderer)->height() || node()->hasTagName(bodyTag)))
return offset() == 0 && !nodeIsUserSelectNone(node());
return false;
......
......@@ -74,7 +74,7 @@ static bool isDeletableElement(const Node* node)
if (!renderer || !renderer->isBox())
return false;
RenderBox* box = RenderBox::toRenderBox(renderer);
RenderBox* box = toRenderBox(renderer);
if (box->width() < minimumWidth || box->height() < minimumHeight)
return false;
......
......@@ -232,7 +232,7 @@ static int verticalScrollDistance(Frame* frame)
return 0;
if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea()))
return 0;
int height = RenderBox::toRenderBox(renderer)->clientHeight();
int height = toRenderBox(renderer)->clientHeight();
return max((height + 1) / 2, height - cAmountToKeepWhenPaging);
}
......
......@@ -549,7 +549,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node)
|| node->hasTagName(pTag)) {
RenderStyle* style = r->style();
if (style) {
int bottomMargin = RenderBox::toRenderBox(r)->collapsedMarginBottom();
int bottomMargin = toRenderBox(r)->collapsedMarginBottom();
int fontSize = style->fontDescription().computedPixelSize();
if (bottomMargin * 2 >= fontSize)
return true;
......
......@@ -113,7 +113,7 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
// Before calling absoluteRects, check for the common case where the renderer
// or one of the continuations is non-empty, since this is a faster check and
// almost always returns true.
RenderBox* box = RenderBox::toRenderBox(renderer());
RenderBox* box = toRenderBox(renderer());
if (box->width() > 0 && box->height() > 0)
return true;
for (RenderFlow* r = box->virtualContinuation(); r; r = r->continuation())
......
......@@ -199,7 +199,7 @@ bool HTMLFormControlElement::isFocusable() const
{
if (disabled() || !renderer() ||
(renderer()->style() && renderer()->style()->visibility() != VISIBLE) ||
!renderer()->isBox() || RenderBox::toRenderBox(renderer())->size().isEmpty())
!renderer()->isBox() || toRenderBox(renderer())->size().isEmpty())
return false;
return true;
}
......
......@@ -311,7 +311,7 @@ int HTMLFrameElementBase::width() const
return 0;
document()->updateLayoutIgnorePendingStylesheets();
return RenderBox::toRenderBox(renderer())->width();
return toRenderBox(renderer())->width();
}
int HTMLFrameElementBase::height() const
......@@ -320,7 +320,7 @@ int HTMLFrameElementBase::height() const
return 0;
document()->updateLayoutIgnorePendingStylesheets();
return RenderBox::toRenderBox(renderer())->height();
return toRenderBox(renderer())->height();
}
} // namespace WebCore
......@@ -1872,7 +1872,7 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int
if (!m_renderer || !m_renderer->hasLayer())
return 0;
RenderLayer* layer = RenderBox::toRenderBox(m_renderer)->layer();
RenderLayer* layer = toRenderBox(m_renderer)->layer();
HitTestRequest request(true, true);
HitTestResult hitTestResult = HitTestResult(point);
......
......@@ -404,7 +404,7 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
// If the selection is contained in a layer that can scroll, that layer should handle the autoscroll
// Otherwise, let the bridge handle it so the view can scroll itself.
RenderObject* renderer = targetNode->renderer();
while (renderer && (!renderer->isBox() || !RenderBox::toRenderBox(renderer)->canBeProgramaticallyScrolled(false))) {
while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeProgramaticallyScrolled(false))) {
if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
renderer = renderer->document()->ownerElement()->renderer();
else
......@@ -604,7 +604,7 @@ void EventHandler::autoscrollTimerFired(Timer<EventHandler>*)
stopAutoscrollTimer();
return;
}
RenderBox::toRenderBox(r)->autoscroll();
toRenderBox(r)->autoscroll();
} else {
// we verify that the main frame hasn't received the order to stop the panScroll
if (!m_frame->page()->mainFrame()->eventHandler()->panScrollInProgress()) {
......@@ -665,7 +665,7 @@ void EventHandler::updateAutoscrollRenderer()
if (Node* nodeAtPoint = hitTest.innerNode())
m_autoscrollRenderer = nodeAtPoint->renderer();
while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !RenderBox::toRenderBox(m_autoscrollRenderer)->canBeProgramaticallyScrolled(false)))
while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !toRenderBox(m_autoscrollRenderer)->canBeProgramaticallyScrolled(false)))
m_autoscrollRenderer = m_autoscrollRenderer->parent();
}
......@@ -747,7 +747,7 @@ void EventHandler::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
if (autoscrollRenderer()) {
if (!rendererIsBeingDestroyed && (m_autoscrollInProgress || m_panScrollInProgress))
RenderBox::toRenderBox(autoscrollRenderer())->stopAutoscroll();
toRenderBox(autoscrollRenderer())->stopAutoscroll();
#if ENABLE(PAN_SCROLLING)
if (m_panScrollInProgress) {
m_frame->view()->removePanScrollIcon();
......@@ -789,7 +789,7 @@ bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity g
if (node) {
RenderObject* r = node->renderer();
if (r && r->isBox() && !r->isListBox())
return RenderBox::toRenderBox(r)->scroll(direction, granularity);
return toRenderBox(r)->scroll(direction, granularity);
}
return false;
......
......@@ -460,7 +460,7 @@ void FrameView::layout(bool allowSubtree)
hMode = ScrollbarAlwaysOff;
} else if (body->hasTagName(bodyTag)) {
if (!m_firstLayout && m_size.height() != layoutHeight()
&& RenderBox::toRenderBox(body->renderer())->stretchesToViewHeight())
&& toRenderBox(body->renderer())->stretchesToViewHeight())
body->renderer()->setChildNeedsLayout(true);
// It's sufficient to just check the X overflow,
// since it's illegal to have visible in only one direction.
......
......@@ -134,7 +134,7 @@ static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra
}
} else {
// Convert the TransformOperations into matrices
IntSize size = anim->renderer()->isBox() ? RenderBox::toRenderBox(anim->renderer())->borderBoxRect().size() : IntSize();
IntSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : IntSize();
TransformationMatrix fromT;
TransformationMatrix toT;
from.apply(size, fromT);
......
......@@ -131,7 +131,7 @@ void InlineBox::adjustPosition(int dx, int dy)
m_x += dx;
m_y += dy;
if (m_object->isReplaced()) {
RenderBox* box = RenderBox::toRenderBox(m_object);
RenderBox* box = toRenderBox(m_object);
box->move(dx, dy);
}
}
......
......@@ -240,7 +240,7 @@ public:
bool visibleToHitTesting() const { return object()->style()->visibility() == VISIBLE && object()->style()->pointerEvents() != PE_NONE; }
// Use with caution! The type is not checked!
RenderBox* renderBox() const { return RenderBox::toRenderBox(m_object); }
RenderBox* renderBox() const { return toRenderBox(m_object); }
public:
RenderObject* m_object;
......
......@@ -2877,7 +2877,7 @@ void RenderBlock::clearFloats()
offset -= toRenderBox(prev)->y();
else if (parent()->isBox()) {
prev = parent();
xoffset += RenderBox::toRenderBox(prev)->borderLeft() + RenderBox::toRenderBox(prev)->paddingLeft();
xoffset += toRenderBox(prev)->borderLeft() + toRenderBox(prev)->paddingLeft();
}
// Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.
......
......@@ -1469,7 +1469,7 @@ IntSize RenderBox::offsetFromContainer(RenderObject* o) const
}
if (o->hasOverflowClip())
offset -= RenderBox::toRenderBox(o)->layer()->scrolledContentOffset();
offset -= toRenderBox(o)->layer()->scrolledContentOffset();
if (style()->position() == AbsolutePosition)
offset += offsetForPositionedInContainer(o);
......@@ -1616,7 +1616,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& rect, bool fixed)
// 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.
if (o->hasOverflowClip()) {
RenderBox* containerBox = RenderBox::toRenderBox(o);
RenderBox* containerBox = toRenderBox(o);
// o->height() is inaccurate if we're in the middle of a layout of |o|, so use the
// layer's size instead. Even if the layer's size is wrong, the layer itself will repaint
......@@ -2199,13 +2199,13 @@ int RenderBox::containingBlockWidthForPositioned(const RenderObject* containingB
return max(0, (fromRight - fromLeft));
}
const RenderBox* containingBlockBox = RenderBox::toConstRenderBox(containingBlock);
const RenderBox* containingBlockBox = toRenderBox(containingBlock);
return containingBlockBox->width() - containingBlockBox->borderLeft() - containingBlockBox->borderRight() - containingBlockBox->verticalScrollbarWidth();
}
int RenderBox::containingBlockHeightForPositioned(const RenderObject* containingBlock) const
{
const RenderBox* containingBlockBox = RenderBox::toConstRenderBox(containingBlock);
const RenderBox* containingBlockBox = toRenderBox(containingBlock);
int heightResult;
if (containingBlock->isInlineFlow()) {
......@@ -2251,7 +2251,7 @@ void RenderBox::calcAbsoluteHorizontal()
// We don't use containingBlock(), since we may be positioned by an enclosing
// relative positioned inline.
const RenderBox* containerBlock = RenderBox::toRenderBox(container());
const RenderBox* containerBlock = toRenderBox(container());
const int containerWidth = containingBlockWidthForPositioned(containerBlock);
......@@ -2558,7 +2558,7 @@ void RenderBox::calcAbsoluteVertical()
// We don't use containingBlock(), since we may be positioned by an enclosing relpositioned inline.
const RenderBox* containerBlock = RenderBox::toConstRenderBox(container());
const RenderBox* containerBlock = toRenderBox(container());
const int containerHeight = containingBlockHeightForPositioned(containerBlock);
......@@ -2781,7 +2781,7 @@ void RenderBox::calcAbsoluteHorizontalReplaced()
// We don't use containingBlock(), since we may be positioned by an enclosing
// relative positioned inline.
const RenderBox* containerBlock = RenderBox::toConstRenderBox(container());
const RenderBox* containerBlock = toRenderBox(container());
const int containerWidth = containingBlockWidthForPositioned(containerBlock);
......@@ -2954,7 +2954,7 @@ void RenderBox::calcAbsoluteVerticalReplaced()
// the numbers correspond to numbers in spec)
// We don't use containingBlock(), since we may be positioned by an enclosing relpositioned inline.
const RenderBox* containerBlock = RenderBox::toConstRenderBox(container());
const RenderBox* containerBlock = toRenderBox(container());
const int containerHeight = containingBlockHeightForPositioned(containerBlock);
......
......@@ -37,9 +37,6 @@ public:
virtual const char* renderName() const { return "RenderBox"; }
static RenderBox* toRenderBox(RenderObject* o) { ASSERT(!o || o->isBox()); return static_cast<RenderBox*>(o); }
static const RenderBox* toConstRenderBox(const RenderObject* o) { ASSERT(!o || o->isBox()); return static_cast<const RenderBox*>(o);}
int x() const { return m_frameRect.x(); }
int y() const { return m_frameRect.y(); }
int width() const { return m_frameRect.width(); }
......@@ -76,9 +73,9 @@ public:
virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
// Use this with caution! No type checking is done!
RenderBox* previousSiblingBox() const { ASSERT(!previousSibling() || previousSibling()->isBox()); return toRenderBox(previousSibling()); }
RenderBox* nextSiblingBox() const { ASSERT(!nextSibling() || nextSibling()->isBox()); return toRenderBox(nextSibling()); }
RenderBox* parentBox() const { ASSERT(!parent() || parent()->isBox()); return toRenderBox(parent()); }
RenderBox* previousSiblingBox() const;
RenderBox* nextSiblingBox() const;
RenderBox* parentBox() const;
// The height of a block when you include normal flow overflow spillage out of the bottom
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
......@@ -382,6 +379,33 @@ private:
static bool s_hadOverflowClip;
};
inline RenderBox* toRenderBox(RenderObject* o)
{
ASSERT(!o || o->isBox());
return static_cast<RenderBox*>(o);
}
inline const RenderBox* toRenderBox(const RenderObject* o)
{
ASSERT(!o || o->isBox());
return static_cast<const RenderBox*>(o);
}
inline RenderBox* RenderBox::previousSiblingBox() const
{
return toRenderBox(previousSibling());
}
inline RenderBox* RenderBox::nextSiblingBox() const
{
return toRenderBox(nextSibling());
}
inline RenderBox* RenderBox::parentBox() const
{
return toRenderBox(parent());
}
} // namespace WebCore
#endif // RenderBox_h
......@@ -503,7 +503,7 @@ IntRect RenderFlow::absoluteClippedOverflowRect()
for (RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isInlineFlow() && inlineFlow != cb;
inlineFlow = inlineFlow->parent()) {
if (inlineFlow->style()->position() == RelativePosition && inlineFlow->hasLayer())
RenderBox::toRenderBox(inlineFlow)->layer()->relativePositionOffset(left, top);
toRenderBox(inlineFlow)->layer()->relativePositionOffset(left, top);
}
IntRect r(-ow + left, -ow + top, boundingBox.width() + ow * 2, boundingBox.height() + ow * 2);
......
......@@ -402,8 +402,8 @@ void RenderLayer::updateLayerPosition()
m_relX = m_relY = 0;
if (renderer()->isRelPositioned()) {
m_relX = RenderBox::toRenderBox(renderer())->relativePositionOffsetX();
m_relY = RenderBox::toRenderBox(renderer())->relativePositionOffsetY();
m_relX = toRenderBox(renderer())->relativePositionOffsetX();
m_relY = toRenderBox(renderer())->relativePositionOffsetY();
x += m_relX; y += m_relY;
}
......@@ -415,7 +415,7 @@ void RenderLayer::updateLayerPosition()
positionedParent->subtractScrolledContentOffset(x, y);
if (renderer()->isPositioned()) {
IntSize offset = RenderBox::toRenderBox(renderer())->offsetForPositionedInContainer(positionedParent->renderer());
IntSize offset = toRenderBox(renderer())->offsetForPositionedInContainer(positionedParent->renderer());
x += offset.width();
y += offset.height();
}
......@@ -1043,7 +1043,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset
// Set the width and height of the shadow ancestor node if there is one.
// This is necessary for textarea elements since the resizable layer is in the shadow content.
Element* element = static_cast<Element*>(renderer()->node()->shadowAncestorNode());
RenderBox* renderer = RenderBox::toRenderBox(element->renderer());
RenderBox* renderer = toRenderBox(element->renderer());
EResize resize = renderer->style()->resize();
if (resize == RESIZE_NONE)
......@@ -2230,7 +2230,7 @@ IntRect RenderLayer::boundingBox(const RenderLayer* rootLayer) const
// Our bounding box is just the union of all of our cells' border/overflow rects.
for (RenderObject* child = renderer()->firstChild(); child; child = child->nextSibling()) {
if (child->isTableCell()) {
IntRect bbox = RenderBox::toRenderBox(child)->borderBoxRect();
IntRect bbox = toRenderBox(child)->borderBoxRect();
result.unite(bbox);
IntRect overflowRect = renderer()->overflowRect(false);
if (bbox != overflowRect)
......
......@@ -399,7 +399,7 @@ static void addLayers(RenderObject* obj, RenderLayer* parentLayer, RenderObject*
beforeChild = newObject->parent()->findNextLayer(parentLayer, newObject);
newObject = 0;
}
parentLayer->addChild(RenderBox::toRenderBox(obj)->layer(), beforeChild);
parentLayer->addChild(toRenderBox(obj)->layer(), beforeChild);
return;
}
......@@ -423,7 +423,7 @@ void RenderObject::removeLayers(RenderLayer* parentLayer)
return;
if (hasLayer()) {
parentLayer->removeChild(RenderBox::toRenderBox(this)->layer());
parentLayer->removeChild(toRenderBox(this)->layer());
return;
}
......@@ -437,7 +437,7 @@ void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent)
return;
if (hasLayer()) {
RenderLayer* layer = RenderBox::toRenderBox(this)->layer();
RenderLayer* layer = toRenderBox(this)->layer();
if (oldParent)
oldParent->removeChild(layer);
newParent->addChild(layer);
......@@ -456,7 +456,7 @@ RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject*
return 0;
// Step 1: If our layer is a child of the desired parent, then return our layer.
RenderLayer* ourLayer = hasLayer() ? RenderBox::toRenderBox(this)->layer() : 0;
RenderLayer* ourLayer = hasLayer() ? toRenderBox(this)->layer() : 0;