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> 2009-01-23 Chris Fleizach <cfleizach@apple.com>
Reviewed by Beth Dakin. Reviewed by Beth Dakin.
...@@ -398,7 +398,7 @@ static IntRect sizingBox(RenderObject* renderer) ...@@ -398,7 +398,7 @@ static IntRect sizingBox(RenderObject* renderer)
if (!renderer->isBox()) if (!renderer->isBox())
return IntRect(); return IntRect();
RenderBox* box = RenderBox::toRenderBox(renderer); RenderBox* box = toRenderBox(renderer);
return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect(); return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect();
} }
...@@ -763,22 +763,22 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper ...@@ -763,22 +763,22 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyMarginTop: case CSSPropertyMarginTop:
if (renderer && renderer->isBox()) if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified. // 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()); return CSSPrimitiveValue::create(style->marginTop());
case CSSPropertyMarginRight: case CSSPropertyMarginRight:
if (renderer && renderer->isBox()) if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified. // 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()); return CSSPrimitiveValue::create(style->marginRight());
case CSSPropertyMarginBottom: case CSSPropertyMarginBottom:
if (renderer && renderer->isBox()) if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified. // 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()); return CSSPrimitiveValue::create(style->marginBottom());
case CSSPropertyMarginLeft: case CSSPropertyMarginLeft:
if (renderer && renderer->isBox()) if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified. // 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()); return CSSPrimitiveValue::create(style->marginLeft());
case CSSPropertyWebkitMarqueeDirection: case CSSPropertyWebkitMarqueeDirection:
return CSSPrimitiveValue::create(style->marqueeDirection()); return CSSPrimitiveValue::create(style->marqueeDirection());
...@@ -863,19 +863,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper ...@@ -863,19 +863,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->overflowY()); return CSSPrimitiveValue::create(style->overflowY());
case CSSPropertyPaddingTop: case CSSPropertyPaddingTop:
if (renderer && renderer->isBox()) 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()); return CSSPrimitiveValue::create(style->paddingTop());
case CSSPropertyPaddingRight: case CSSPropertyPaddingRight:
if (renderer && renderer->isBox()) 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()); return CSSPrimitiveValue::create(style->paddingRight());
case CSSPropertyPaddingBottom: case CSSPropertyPaddingBottom:
if (renderer && renderer->isBox()) 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()); return CSSPrimitiveValue::create(style->paddingBottom());
case CSSPropertyPaddingLeft: case CSSPropertyPaddingLeft:
if (renderer && renderer->isBox()) 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()); return CSSPrimitiveValue::create(style->paddingLeft());
case CSSPropertyPageBreakAfter: case CSSPropertyPageBreakAfter:
return CSSPrimitiveValue::create(style->pageBreakAfter()); return CSSPrimitiveValue::create(style->pageBreakAfter());
......
...@@ -695,7 +695,7 @@ bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const ...@@ -695,7 +695,7 @@ bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
point.move(static_cast<RenderText *>(o)->linesBoundingBox().x(), point.move(static_cast<RenderText *>(o)->linesBoundingBox().x(),
static_cast<RenderText *>(o)->firstTextBox()->root()->topOverflow()); static_cast<RenderText *>(o)->firstTextBox()->root()->topOverflow());
} else if (o->isBox()) { } else if (o->isBox()) {
RenderBox* box = RenderBox::toRenderBox(o); RenderBox* box = toRenderBox(o);
point.move(box->x(), box->y()); point.move(box->x(), box->y());
} }
return true; return true;
...@@ -720,7 +720,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const ...@@ -720,7 +720,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
RenderObject *o = renderer(); RenderObject *o = renderer();
if (!o->isInline() || o->isReplaced()) if (!o->isInline() || o->isReplaced())
{ {
RenderBox* box = RenderBox::toRenderBox(o); RenderBox* box = toRenderBox(o);
point = o->localToAbsolute(); point = o->localToAbsolute();
point.move(box->width(), box->height()); point.move(box->width(), box->height());
return true; return true;
...@@ -749,7 +749,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const ...@@ -749,7 +749,7 @@ bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
IntRect linesBox = text->linesBoundingBox(); IntRect linesBox = text->linesBoundingBox();
point.move(linesBox.x() + linesBox.width(), linesBox.height()); point.move(linesBox.x() + linesBox.width(), linesBox.height());
} else { } else {
RenderBox* box = RenderBox::toRenderBox(o); RenderBox* box = toRenderBox(o);
point.move(box->x() + box->width(), box->y() + box->height()); point.move(box->x() + box->width(), box->y() + box->height());
} }
return true; return true;
......
...@@ -217,7 +217,7 @@ void Element::scrollByUnits(int units, ScrollGranularity granularity) ...@@ -217,7 +217,7 @@ void Element::scrollByUnits(int units, ScrollGranularity granularity)
direction = ScrollUp; direction = ScrollUp;
units = -units; 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) ...@@ -284,7 +284,7 @@ static bool endsOfNodeAreVisuallyDistinctPositions(Node* node)
return false; return false;
// There is a VisiblePosition inside an empty inline-block container. // 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) static Node* enclosingVisualBoundary(Node* node)
...@@ -538,7 +538,7 @@ bool Position::hasRenderedNonAnonymousDescendantsWithHeight(RenderObject* render ...@@ -538,7 +538,7 @@ bool Position::hasRenderedNonAnonymousDescendantsWithHeight(RenderObject* render
for (RenderObject *o = renderer->firstChild(); o && o != stop; o = o->nextInPreOrder()) for (RenderObject *o = renderer->firstChild(); o && o != stop; o = o->nextInPreOrder())
if (o->element()) { if (o->element()) {
if ((o->isText() && static_cast<RenderText*>(o)->linesBoundingBox().height()) || if ((o->isText() && static_cast<RenderText*>(o)->linesBoundingBox().height()) ||
(o->isBox() && RenderBox::toRenderBox(o)->height())) (o->isBox() && toRenderBox(o)->height()))
return true; return true;
} }
return false; return false;
...@@ -571,7 +571,7 @@ bool Position::isCandidate() const ...@@ -571,7 +571,7 @@ bool Position::isCandidate() const
return (offset() == 0 || offset() == maxDeepOffset(node())) && !nodeIsUserSelectNone(node()->parent()); return (offset() == 0 || offset() == maxDeepOffset(node())) && !nodeIsUserSelectNone(node()->parent());
if (!node()->hasTagName(htmlTag) && renderer->isBlockFlow() && !hasRenderedNonAnonymousDescendantsWithHeight(renderer) && 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 offset() == 0 && !nodeIsUserSelectNone(node());
return false; return false;
......
...@@ -74,7 +74,7 @@ static bool isDeletableElement(const Node* node) ...@@ -74,7 +74,7 @@ static bool isDeletableElement(const Node* node)
if (!renderer || !renderer->isBox()) if (!renderer || !renderer->isBox())
return false; return false;
RenderBox* box = RenderBox::toRenderBox(renderer); RenderBox* box = toRenderBox(renderer);
if (box->width() < minimumWidth || box->height() < minimumHeight) if (box->width() < minimumWidth || box->height() < minimumHeight)
return false; return false;
......
...@@ -232,7 +232,7 @@ static int verticalScrollDistance(Frame* frame) ...@@ -232,7 +232,7 @@ static int verticalScrollDistance(Frame* frame)
return 0; return 0;
if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea())) if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea()))
return 0; return 0;
int height = RenderBox::toRenderBox(renderer)->clientHeight(); int height = toRenderBox(renderer)->clientHeight();
return max((height + 1) / 2, height - cAmountToKeepWhenPaging); return max((height + 1) / 2, height - cAmountToKeepWhenPaging);
} }
......
...@@ -549,7 +549,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node) ...@@ -549,7 +549,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node)
|| node->hasTagName(pTag)) { || node->hasTagName(pTag)) {
RenderStyle* style = r->style(); RenderStyle* style = r->style();
if (style) { if (style) {
int bottomMargin = RenderBox::toRenderBox(r)->collapsedMarginBottom(); int bottomMargin = toRenderBox(r)->collapsedMarginBottom();
int fontSize = style->fontDescription().computedPixelSize(); int fontSize = style->fontDescription().computedPixelSize();
if (bottomMargin * 2 >= fontSize) if (bottomMargin * 2 >= fontSize)
return true; return true;
......
...@@ -113,7 +113,7 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const ...@@ -113,7 +113,7 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
// Before calling absoluteRects, check for the common case where the renderer // 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 // or one of the continuations is non-empty, since this is a faster check and
// almost always returns true. // almost always returns true.
RenderBox* box = RenderBox::toRenderBox(renderer()); RenderBox* box = toRenderBox(renderer());
if (box->width() > 0 && box->height() > 0) if (box->width() > 0 && box->height() > 0)
return true; return true;
for (RenderFlow* r = box->virtualContinuation(); r; r = r->continuation()) for (RenderFlow* r = box->virtualContinuation(); r; r = r->continuation())
......
...@@ -199,7 +199,7 @@ bool HTMLFormControlElement::isFocusable() const ...@@ -199,7 +199,7 @@ bool HTMLFormControlElement::isFocusable() const
{ {
if (disabled() || !renderer() || if (disabled() || !renderer() ||
(renderer()->style() && renderer()->style()->visibility() != VISIBLE) || (renderer()->style() && renderer()->style()->visibility() != VISIBLE) ||
!renderer()->isBox() || RenderBox::toRenderBox(renderer())->size().isEmpty()) !renderer()->isBox() || toRenderBox(renderer())->size().isEmpty())
return false; return false;
return true; return true;
} }
......
...@@ -311,7 +311,7 @@ int HTMLFrameElementBase::width() const ...@@ -311,7 +311,7 @@ int HTMLFrameElementBase::width() const
return 0; return 0;
document()->updateLayoutIgnorePendingStylesheets(); document()->updateLayoutIgnorePendingStylesheets();
return RenderBox::toRenderBox(renderer())->width(); return toRenderBox(renderer())->width();
} }
int HTMLFrameElementBase::height() const int HTMLFrameElementBase::height() const
...@@ -320,7 +320,7 @@ int HTMLFrameElementBase::height() const ...@@ -320,7 +320,7 @@ int HTMLFrameElementBase::height() const
return 0; return 0;
document()->updateLayoutIgnorePendingStylesheets(); document()->updateLayoutIgnorePendingStylesheets();
return RenderBox::toRenderBox(renderer())->height(); return toRenderBox(renderer())->height();
} }
} // namespace WebCore } // namespace WebCore
...@@ -1872,7 +1872,7 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int ...@@ -1872,7 +1872,7 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int
if (!m_renderer || !m_renderer->hasLayer()) if (!m_renderer || !m_renderer->hasLayer())
return 0; return 0;
RenderLayer* layer = RenderBox::toRenderBox(m_renderer)->layer(); RenderLayer* layer = toRenderBox(m_renderer)->layer();
HitTestRequest request(true, true); HitTestRequest request(true, true);
HitTestResult hitTestResult = HitTestResult(point); HitTestResult hitTestResult = HitTestResult(point);
......
...@@ -404,7 +404,7 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e ...@@ -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 // 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. // Otherwise, let the bridge handle it so the view can scroll itself.
RenderObject* renderer = targetNode->renderer(); 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()) if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
renderer = renderer->document()->ownerElement()->renderer(); renderer = renderer->document()->ownerElement()->renderer();
else else
...@@ -604,7 +604,7 @@ void EventHandler::autoscrollTimerFired(Timer<EventHandler>*) ...@@ -604,7 +604,7 @@ void EventHandler::autoscrollTimerFired(Timer<EventHandler>*)
stopAutoscrollTimer(); stopAutoscrollTimer();
return; return;
} }
RenderBox::toRenderBox(r)->autoscroll(); toRenderBox(r)->autoscroll();
} else { } else {
// we verify that the main frame hasn't received the order to stop the panScroll // we verify that the main frame hasn't received the order to stop the panScroll
if (!m_frame->page()->mainFrame()->eventHandler()->panScrollInProgress()) { if (!m_frame->page()->mainFrame()->eventHandler()->panScrollInProgress()) {
...@@ -665,7 +665,7 @@ void EventHandler::updateAutoscrollRenderer() ...@@ -665,7 +665,7 @@ void EventHandler::updateAutoscrollRenderer()
if (Node* nodeAtPoint = hitTest.innerNode()) if (Node* nodeAtPoint = hitTest.innerNode())
m_autoscrollRenderer = nodeAtPoint->renderer(); 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(); m_autoscrollRenderer = m_autoscrollRenderer->parent();
} }
...@@ -747,7 +747,7 @@ void EventHandler::stopAutoscrollTimer(bool rendererIsBeingDestroyed) ...@@ -747,7 +747,7 @@ void EventHandler::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
if (autoscrollRenderer()) { if (autoscrollRenderer()) {
if (!rendererIsBeingDestroyed && (m_autoscrollInProgress || m_panScrollInProgress)) if (!rendererIsBeingDestroyed && (m_autoscrollInProgress || m_panScrollInProgress))
RenderBox::toRenderBox(autoscrollRenderer())->stopAutoscroll(); toRenderBox(autoscrollRenderer())->stopAutoscroll();
#if ENABLE(PAN_SCROLLING) #if ENABLE(PAN_SCROLLING)
if (m_panScrollInProgress) { if (m_panScrollInProgress) {
m_frame->view()->removePanScrollIcon(); m_frame->view()->removePanScrollIcon();
...@@ -789,7 +789,7 @@ bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity g ...@@ -789,7 +789,7 @@ bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity g
if (node) { if (node) {
RenderObject* r = node->renderer(); RenderObject* r = node->renderer();
if (r && r->isBox() && !r->isListBox()) if (r && r->isBox() && !r->isListBox())
return RenderBox::toRenderBox(r)->scroll(direction, granularity); return toRenderBox(r)->scroll(direction, granularity);
} }
return false; return false;
......
...@@ -460,7 +460,7 @@ void FrameView::layout(bool allowSubtree) ...@@ -460,7 +460,7 @@ void FrameView::layout(bool allowSubtree)
hMode = ScrollbarAlwaysOff; hMode = ScrollbarAlwaysOff;
} else if (body->hasTagName(bodyTag)) { } else if (body->hasTagName(bodyTag)) {
if (!m_firstLayout && m_size.height() != layoutHeight() if (!m_firstLayout && m_size.height() != layoutHeight()
&& RenderBox::toRenderBox(body->renderer())->stretchesToViewHeight()) && toRenderBox(body->renderer())->stretchesToViewHeight())
body->renderer()->setChildNeedsLayout(true); body->renderer()->setChildNeedsLayout(true);
// It's sufficient to just check the X overflow, // It's sufficient to just check the X overflow,
// since it's illegal to have visible in only one direction. // since it's illegal to have visible in only one direction.
......
...@@ -134,7 +134,7 @@ static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra ...@@ -134,7 +134,7 @@ static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra
} }
} else { } else {
// Convert the TransformOperations into matrices // 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 fromT;
TransformationMatrix toT; TransformationMatrix toT;
from.apply(size, fromT); from.apply(size, fromT);
......
...@@ -131,7 +131,7 @@ void InlineBox::adjustPosition(int dx, int dy) ...@@ -131,7 +131,7 @@ void InlineBox::adjustPosition(int dx, int dy)
m_x += dx; m_x += dx;
m_y += dy; m_y += dy;
if (m_object->isReplaced()) { if (m_object->isReplaced()) {
RenderBox* box = RenderBox::toRenderBox(m_object); RenderBox* box = toRenderBox(m_object);
box->move(dx, dy); box->move(dx, dy);
} }
} }
......
...@@ -240,7 +240,7 @@ public: ...@@ -240,7 +240,7 @@ public:
bool visibleToHitTesting() const { return object()->style()->visibility() == VISIBLE && object()->style()->pointerEvents() != PE_NONE; } bool visibleToHitTesting() const { return object()->style()->visibility() == VISIBLE && object()->style()->pointerEvents() != PE_NONE; }
// Use with caution! The type is not checked! // Use with caution! The type is not checked!
RenderBox* renderBox() const { return RenderBox::toRenderBox(m_object); } RenderBox* renderBox() const { return toRenderBox(m_object); }
public: public:
RenderObject* m_object; RenderObject* m_object;
......
...@@ -2877,7 +2877,7 @@ void RenderBlock::clearFloats() ...@@ -2877,7 +2877,7 @@ void RenderBlock::clearFloats()
offset -= toRenderBox(prev)->y(); offset -= toRenderBox(prev)->y();
else if (parent()->isBox()) { else if (parent()->isBox()) {
prev = parent(); 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. // 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 ...@@ -1469,7 +1469,7 @@ IntSize RenderBox::offsetFromContainer(RenderObject* o) const
} }
if (o->hasOverflowClip()) if (o->hasOverflowClip())
offset -= RenderBox::toRenderBox(o)->layer()->scrolledContentOffset(); offset -= toRenderBox(o)->layer()->scrolledContentOffset();
if (style()->position() == AbsolutePosition) if (style()->position() == AbsolutePosition)
offset += offsetForPositionedInContainer(o); offset += offsetForPositionedInContainer(o);
...@@ -1616,7 +1616,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& rect, bool fixed) ...@@ -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, // 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. // its controlClipRect will be wrong. For overflow clip we use the values cached by the layer.
if (o->hasOverflowClip()) { 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 // 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 // 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 ...@@ -2199,13 +2199,13 @@ int RenderBox::containingBlockWidthForPositioned(const RenderObject* containingB
return max(0, (fromRight - fromLeft)); 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(); return containingBlockBox->width() - containingBlockBox->borderLeft() - containingBlockBox->borderRight() - containingBlockBox->verticalScrollbarWidth();
} }
int RenderBox::containingBlockHeightForPositioned(const RenderObject* containingBlock) const int RenderBox::containingBlockHeightForPositioned(const RenderObject* containingBlock) const
{ {
const RenderBox* containingBlockBox = RenderBox::toConstRenderBox(containingBlock);