Commit 774bbed5 authored by hyatt@apple.com's avatar hyatt@apple.com

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

        Devirtualize the marginTop/Right/Left/Bottom functions and move them to RenderBox (along with some of the
        other margin functions that have to come along for the ride).

        Reviewed by Oliver Hunt

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * editing/TextIterator.cpp:
        (WebCore::shouldEmitExtraNewlineForNode):
        * rendering/InlineBox.cpp:
        * rendering/InlineBox.h:
        (WebCore::InlineBox::renderBox):
        * rendering/InlineFlowBox.cpp:
        (WebCore::InlineFlowBox::marginLeft):
        (WebCore::InlineFlowBox::marginRight):
        (WebCore::InlineFlowBox::placeBoxesHorizontally):
        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
        (WebCore::InlineFlowBox::placeBoxesVertically):
        (WebCore::InlineFlowBox::shrinkBoxesWithNoTextChildren):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::isSelfCollapsingBlock):
        (WebCore::RenderBlock::adjustPositionedBlock):
        (WebCore::RenderBlock::handleCompactChild):
        (WebCore::RenderBlock::estimateVerticalPosition):
        (WebCore::getBorderPaddingMargin):
        (WebCore::RenderBlock::calcInlinePrefWidths):
        * rendering/RenderBlock.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::calcHeight):
        * rendering/RenderBox.h:
        (WebCore::RenderBox::hasHorizontalBordersPaddingOrMargin):
        (WebCore::RenderBox::hasHorizontalBordersOrPadding):
        (WebCore::RenderBox::marginTop):
        (WebCore::RenderBox::marginBottom):
        (WebCore::RenderBox::marginLeft):
        (WebCore::RenderBox::marginRight):
        (WebCore::RenderBox::isSelfCollapsingBlock):
        (WebCore::RenderBox::collapsedMarginTop):
        (WebCore::RenderBox::collapsedMarginBottom):
        (WebCore::RenderBox::isTopMarginQuirk):
        (WebCore::RenderBox::isBottomMarginQuirk):
        (WebCore::RenderBox::maxTopMargin):
        (WebCore::RenderBox::maxBottomMargin):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
        * rendering/RenderObject.h:
        * rendering/RenderSVGContainer.cpp:
        (WebCore::RenderSVGContainer::lineHeight):
        (WebCore::RenderSVGContainer::baselinePosition):
        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::calcHeight):
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::baselinePosition):
        * rendering/bidi.cpp:
        (WebCore::getBorderPaddingMargin):
        (WebCore::inlineWidth):
        (WebCore::RenderBlock::computeHorizontalPositionsForLine):
        (WebCore::inlineFlowRequiresLineBox):
        (WebCore::requiresLineBox):
        (WebCore::RenderBlock::findNextLineBreak):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3bf1506f
2009-01-22 David Hyatt <hyatt@apple.com>
Devirtualize the marginTop/Right/Left/Bottom functions and move them to RenderBox (along with some of the
other margin functions that have to come along for the ride).
Reviewed by Oliver Hunt
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* editing/TextIterator.cpp:
(WebCore::shouldEmitExtraNewlineForNode):
* rendering/InlineBox.cpp:
* rendering/InlineBox.h:
(WebCore::InlineBox::renderBox):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::marginLeft):
(WebCore::InlineFlowBox::marginRight):
(WebCore::InlineFlowBox::placeBoxesHorizontally):
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
(WebCore::InlineFlowBox::placeBoxesVertically):
(WebCore::InlineFlowBox::shrinkBoxesWithNoTextChildren):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::isSelfCollapsingBlock):
(WebCore::RenderBlock::adjustPositionedBlock):
(WebCore::RenderBlock::handleCompactChild):
(WebCore::RenderBlock::estimateVerticalPosition):
(WebCore::getBorderPaddingMargin):
(WebCore::RenderBlock::calcInlinePrefWidths):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::calcHeight):
* rendering/RenderBox.h:
(WebCore::RenderBox::hasHorizontalBordersPaddingOrMargin):
(WebCore::RenderBox::hasHorizontalBordersOrPadding):
(WebCore::RenderBox::marginTop):
(WebCore::RenderBox::marginBottom):
(WebCore::RenderBox::marginLeft):
(WebCore::RenderBox::marginRight):
(WebCore::RenderBox::isSelfCollapsingBlock):
(WebCore::RenderBox::collapsedMarginTop):
(WebCore::RenderBox::collapsedMarginBottom):
(WebCore::RenderBox::isTopMarginQuirk):
(WebCore::RenderBox::isBottomMarginQuirk):
(WebCore::RenderBox::maxTopMargin):
(WebCore::RenderBox::maxBottomMargin):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
* rendering/RenderObject.h:
* rendering/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::lineHeight):
(WebCore::RenderSVGContainer::baselinePosition):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::calcHeight):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::baselinePosition):
* rendering/bidi.cpp:
(WebCore::getBorderPaddingMargin):
(WebCore::inlineWidth):
(WebCore::RenderBlock::computeHorizontalPositionsForLine):
(WebCore::inlineFlowRequiresLineBox):
(WebCore::requiresLineBox):
(WebCore::RenderBlock::findNextLineBreak):
2009-01-22 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Anders Carlsson.
......@@ -761,24 +761,24 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyListStyleType:
return CSSPrimitiveValue::create(style->listStyleType());
case CSSPropertyMarginTop:
if (renderer)
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(renderer->marginTop(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginTop(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginTop());
case CSSPropertyMarginRight:
if (renderer)
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(renderer->marginRight(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginRight(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginRight());
case CSSPropertyMarginBottom:
if (renderer)
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(renderer->marginBottom(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginBottom(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginBottom());
case CSSPropertyMarginLeft:
if (renderer)
if (renderer && renderer->isBox())
// FIXME: Supposed to return the percentage if percentage was specified.
return CSSPrimitiveValue::create(renderer->marginLeft(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(RenderBox::toRenderBox(renderer)->marginLeft(), CSSPrimitiveValue::CSS_PX);
return CSSPrimitiveValue::create(style->marginLeft());
case CSSPropertyWebkitMarqueeDirection:
return CSSPrimitiveValue::create(style->marqueeDirection());
......
......@@ -535,7 +535,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node)
// result even without margin collapsing. For example: <div><p>text</p></div>
// will work right even if both the <div> and the <p> have bottom margins.
RenderObject* r = node->renderer();
if (!r)
if (!r || !r->isBox())
return false;
// NOTE: We only do this for a select set of nodes, and fwiw WinIE appears
......@@ -549,7 +549,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node)
|| node->hasTagName(pTag)) {
RenderStyle* style = r->style();
if (style) {
int bottomMargin = r->collapsedMarginBottom();
int bottomMargin = RenderBox::toRenderBox(r)->collapsedMarginBottom();
int fontSize = style->fontDescription().computedPixelSize();
if (bottomMargin * 2 >= fontSize)
return true;
......
......@@ -85,12 +85,6 @@ void InlineBox::showTreeForThis() const
}
#endif
RenderBox* InlineBox::renderBox() const
{
ASSERT(m_object->isBox());
return RenderBox::toRenderBox(m_object);
}
int InlineBox::caretMinOffset() const
{
return m_object->caretMinOffset();
......
......@@ -21,13 +21,12 @@
#ifndef InlineBox_h
#define InlineBox_h
#include "RenderObject.h" // needed for RenderObject::PaintInfo
#include "RenderBox.h"
#include "TextDirection.h"
namespace WebCore {
class HitTestResult;
class RenderBox;
class RootInlineBox;
struct HitTestRequest;
......@@ -241,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;
RenderBox* renderBox() const { return RenderBox::toRenderBox(m_object); }
public:
RenderObject* m_object;
......
......@@ -66,7 +66,7 @@ int InlineFlowBox::marginLeft()
return 0;
if (margin.isFixed())
return margin.value();
return object()->marginLeft();
return renderBox()->marginLeft();
}
int InlineFlowBox::marginRight()
......@@ -79,7 +79,7 @@ int InlineFlowBox::marginRight()
return 0;
if (margin.isFixed())
return margin.value();
return object()->marginRight();
return renderBox()->marginRight();
}
int InlineFlowBox::marginBorderPaddingLeft()
......@@ -339,11 +339,11 @@ int InlineFlowBox::placeBoxesHorizontally(int x, int& leftPosition, int& rightPo
x += flow->marginRight();
}
} else if (!curr->object()->isCompact() && (!curr->object()->isListMarker() || static_cast<RenderListMarker*>(curr->object())->isInside())) {
x += curr->object()->marginLeft();
x += curr->renderBox()->marginLeft();
curr->setXPos(x);
leftPosition = min(x + curr->renderBox()->overflowLeft(false), leftPosition);
rightPosition = max(x + curr->renderBox()->overflowWidth(false), rightPosition);
x += curr->width() + curr->object()->marginRight();
x += curr->width() + curr->renderBox()->marginRight();
}
}
}
......@@ -458,7 +458,7 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
if (maxPositionBottom < curr->height())
maxPositionBottom = curr->height();
}
else if (curr->hasTextChildren() || curr->object()->hasHorizontalBordersOrPadding() || strictMode) {
else if (curr->hasTextChildren() || curr->renderBox()->hasHorizontalBordersOrPadding() || strictMode) {
int ascent = curr->baseline() - curr->yPos();
int descent = curr->height() - ascent;
if (maxAscent < ascent)
......@@ -493,7 +493,7 @@ void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bo
else if (curr->yPos() == PositionBottom)
curr->setYPos(y + maxHeight - curr->height());
else {
if (!curr->hasTextChildren() && !curr->object()->hasHorizontalBordersOrPadding() && !strictMode)
if (!curr->hasTextChildren() && !curr->renderBox()->hasHorizontalBordersOrPadding() && !strictMode)
childAffectsTopBottomPos = false;
curr->setYPos(curr->yPos() + y + maxAscent - curr->baseline());
}
......@@ -535,8 +535,8 @@ void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bo
newBaseline += curr->object()->borderTop() + curr->object()->paddingTop();
}
} else if (!curr->object()->isBR()) {
newY += curr->object()->marginTop();
newHeight = curr->height() - (curr->object()->marginTop() + curr->object()->marginBottom());
newY += curr->renderBox()->marginTop();
newHeight = curr->height() - (curr->renderBox()->marginTop() + curr->renderBox()->marginBottom());
overflowTop = curr->renderBox()->overflowTop(false);
overflowBottom = curr->renderBox()->overflowHeight(false) - newHeight;
}
......@@ -577,7 +577,7 @@ void InlineFlowBox::shrinkBoxesWithNoTextChildren(int topPos, int bottomPos)
}
// See if we have text children. If not, then we need to shrink ourselves to fit on the line.
if (!hasTextChildren() && !object()->hasHorizontalBordersOrPadding()) {
if (!hasTextChildren() && !renderBox()->hasHorizontalBordersOrPadding()) {
if (yPos() < topPos)
setYPos(topPos);
if (yPos() + height() > bottomPos)
......
......@@ -547,7 +547,7 @@ bool RenderBlock::isSelfCollapsingBlock() const
// Whether or not we collapse is dependent on whether all our normal flow children
// are also self-collapsing.
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
if (child->isFloatingOrPositioned())
continue;
if (!child->isSelfCollapsingBlock())
......@@ -763,7 +763,7 @@ bool RenderBlock::expandsToEncloseOverhangingFloats() const
return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isFlexibleBox()) || m_hasColumns || isTableCell() || isFieldset();
}
void RenderBlock::adjustPositionedBlock(RenderObject* child, const MarginInfo& marginInfo)
void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo)
{
if (child->hasStaticX()) {
if (style()->direction() == LTR)
......@@ -863,13 +863,12 @@ RenderBox* RenderBlock::handleCompactChild(RenderBox* child, CompactInfo& compac
// compact A followed by another compact B should simply be treated as block A.
if (child->isCompact() && !compactInfo.compact() && (child->childrenInline() || child->isReplaced())) {
// Get the next non-positioned/non-floating RenderBlock.
RenderObject* next = child->nextSibling();
RenderObject* curr = next;
RenderBox* next = child->nextSiblingBox();
RenderBox* curr = next;
while (curr && curr->isFloatingOrPositioned())
curr = curr->nextSibling();
curr = curr->nextSiblingBox();
if (curr && curr->isRenderBlock() && !curr->isCompact() && !curr->isRunIn()) {
curr->calcWidth(); // So that horizontal margins are correct.
child->setInline(true); // Need to compute the margins/width for the child as though it is an inline, so that it won't try to puff up the margins to
// fill the containing block width.
child->calcWidth();
......@@ -1103,7 +1102,7 @@ void RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo,
child->layoutIfNeeded();
}
int RenderBlock::estimateVerticalPosition(RenderObject* child, const MarginInfo& marginInfo)
int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& marginInfo)
{
// FIXME: We need to eliminate the estimation of vertical position, because when it's wrong we sometimes trigger a pathological
// relayout if there are intruding floats.
......@@ -3800,7 +3799,7 @@ static int getBPMWidth(int childValue, Length cssUnit)
return 0;
}
static int getBorderPaddingMargin(const RenderObject* child, bool endOfInline)
static int getBorderPaddingMargin(const RenderBox* child, bool endOfInline)
{
RenderStyle* cstyle = child->style();
int result = 0;
......@@ -3903,7 +3902,7 @@ void RenderBlock::calcInlinePrefWidths()
if (child->isInlineFlow()) {
// Add in padding/border/margin from the appropriate side of
// the element.
int bpm = getBorderPaddingMargin(child, childIterator.endOfInline);
int bpm = getBorderPaddingMargin(static_cast<RenderFlow*>(child), childIterator.endOfInline);
childMin += bpm;
childMax += bpm;
......
......@@ -449,7 +449,7 @@ protected:
int margin() const { return m_posMargin - m_negMargin; }
};
void adjustPositionedBlock(RenderObject* child, const MarginInfo&);
void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
void adjustFloatingBlock(const MarginInfo&);
RenderBox* handleSpecialChild(RenderBox* child, const MarginInfo&, CompactInfo&, bool& handled);
RenderBox* handleFloatingChild(RenderBox* child, const MarginInfo&, bool& handled);
......@@ -459,7 +459,7 @@ protected:
void collapseMargins(RenderBox* child, MarginInfo&, int yPosEstimate);
void clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin);
void insertCompactIfNeeded(RenderBox* child, CompactInfo&);
int estimateVerticalPosition(RenderObject* child, const MarginInfo&);
int estimateVerticalPosition(RenderBox* child, const MarginInfo&);
void determineHorizontalPosition(RenderBox* child);
void handleBottomOfBlock(int top, int bottom, MarginInfo&);
void setCollapsedBottomMargin(const MarginInfo&);
......
......@@ -1786,7 +1786,7 @@ void RenderBox::calcHeight()
if (isRoot())
setHeight(max(height(), visHeight - margins));
else {
int marginsBordersPadding = margins + parent()->marginTop() + parent()->marginBottom()
int marginsBordersPadding = margins + parentBox()->marginTop() + parentBox()->marginBottom()
+ parent()->borderTop() + parent()->borderBottom()
+ parent()->paddingTop() + parent()->paddingBottom();
setHeight(max(height(), visHeight - marginsBordersPadding));
......
......@@ -120,6 +120,28 @@ public:
virtual void setScrollLeft(int);
virtual void setScrollTop(int);
bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
int marginTop() const { return m_marginTop; }
int marginBottom() const { return m_marginBottom; }
int marginLeft() const { return m_marginLeft; }
int marginRight() const { return m_marginRight; }
// The following seven functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
// formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
// For a non-collapsing box, such as a leaf element, this formula will simply return
// the margin of the element. Blocks override the maxTopMargin and maxBottomMargin
// methods.
virtual bool isSelfCollapsingBlock() const { return false; }
int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); }
int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); }
virtual bool isTopMarginQuirk() const { return false; }
virtual bool isBottomMarginQuirk() const { return false; }
virtual int maxTopMargin(bool positive) const { return positive ? std::max(0, marginTop()) : -std::min(0, marginTop()); }
virtual int maxBottomMargin(bool positive) const { return positive ? std::max(0, marginBottom()) : -std::min(0, marginBottom()); }
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
......@@ -146,12 +168,7 @@ public:
virtual FloatQuad localToAbsoluteQuad(const FloatQuad&, bool fixed = false) const;
virtual IntSize offsetFromContainer(RenderObject*) const;
virtual int marginTop() const { return m_marginTop; }
virtual int marginBottom() const { return m_marginBottom; }
virtual int marginLeft() const { return m_marginLeft; }
virtual int marginRight() const { return m_marginRight; }
int calcBorderBoxWidth(int width) const;
int calcBorderBoxHeight(int height) const;
int calcContentBoxWidth(int width) const;
......
......@@ -1845,7 +1845,7 @@ IntRect RenderObject::getAbsoluteRepaintRectWithOutline(int ow)
r.inflate(ow);
if (virtualContinuation() && !isInline())
r.inflateY(collapsedMarginTop());
r.inflateY(RenderBox::toRenderBox(this)->collapsedMarginTop());
if (isInlineFlow()) {
for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
......@@ -2945,16 +2945,6 @@ int RenderObject::nextOffset(int current) const
return current + 1;
}
int RenderObject::maxTopMargin(bool positive) const
{
return positive ? max(0, marginTop()) : -min(0, marginTop());
}
int RenderObject::maxBottomMargin(bool positive) const
{
return positive ? max(0, marginBottom()) : -min(0, marginBottom());
}
void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const
{
int outlineSize = !isInline() && virtualContinuation() ? virtualContinuation()->style()->outlineSize() : style()->outlineSize();
......
......@@ -341,9 +341,6 @@ public:
bool hasBoxDecorations() const { return m_paintBackground; }
bool mustRepaintBackgroundOrBorder() const;
bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsPositionedMovementLayout; }
bool selfNeedsLayout() const { return m_needsLayout; }
......@@ -582,26 +579,6 @@ public:
virtual bool isScrollable() const;
// The following seven functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
// formula for computing a collapsed margin is |maxPosMargin|-|maxNegmargin|.
// For a non-collapsing, e.g., a leaf element, this formula will simply return
// the margin of the element. Blocks override the maxTopMargin and maxBottomMargin
// methods.
virtual bool isSelfCollapsingBlock() const { return false; }
virtual int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); }
virtual int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); }
virtual bool isTopMarginQuirk() const { return false; }
virtual bool isBottomMarginQuirk() const { return false; }
virtual int maxTopMargin(bool positive) const;
virtual int maxBottomMargin(bool positive) const;
virtual int marginTop() const { return 0; }
virtual int marginBottom() const { return 0; }
virtual int marginLeft() const { return 0; }
virtual int marginRight() const { return 0; }
// Virtual since table cells override
virtual int paddingTop(bool includeIntrinsicPadding = true) const;
virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
......
......@@ -210,12 +210,12 @@ bool RenderSVGContainer::requiresLayer()
int RenderSVGContainer::lineHeight(bool, bool) const
{
return height() + marginTop() + marginBottom();
return height();
}
int RenderSVGContainer::baselinePosition(bool, bool) const
{
return height() + marginTop() + marginBottom();
return height();
}
bool RenderSVGContainer::calculateLocalTransform()
......
......@@ -420,7 +420,7 @@ void RenderTextControl::calcHeight()
{
setHeight(m_innerText->renderer()->borderTop() + m_innerText->renderer()->borderBottom() +
m_innerText->renderer()->paddingTop() + m_innerText->renderer()->paddingBottom() +
m_innerText->renderer()->marginTop() + m_innerText->renderer()->marginBottom());
m_innerText->renderBox()->marginTop() + m_innerText->renderBox()->marginBottom());
adjustControlHeightBasedOnLineHeight(m_innerText->renderer()->lineHeight(true, true));
setHeight(height() + paddingTop() + paddingBottom() + borderTop() + borderBottom());
......
......@@ -485,10 +485,12 @@ int RenderTheme::baselinePosition(const RenderObject* o) const
if (!o->isBox())
return 0;
const RenderBox* box = RenderBox::toConstRenderBox(o);
#if USE(NEW_THEME)
return RenderBox::toConstRenderBox(o)->height() + o->marginTop() + m_theme->baselinePositionAdjustment(o->style()->appearance()) * o->style()->effectiveZoom();
return box->height() + box->marginTop() + m_theme->baselinePositionAdjustment(o->style()->appearance()) * o->style()->effectiveZoom();
#else
return RenderBox::toConstRenderBox(o)->height() + o->marginTop();
return box->height() + box->marginTop();
#endif
}
......
......@@ -88,7 +88,7 @@ static bool betweenMidpoints;
static bool isLineEmpty = true;
static bool previousLineBrokeCleanly = true;
static int getBorderPaddingMargin(RenderObject* child, bool endOfInline)
static int getBorderPaddingMargin(RenderBox* child, bool endOfInline)
{
bool leftSide = (child->style()->direction() == LTR) ? !endOfInline : endOfInline;
if (leftSide)
......@@ -101,11 +101,11 @@ static int inlineWidth(RenderObject* child, bool start = true, bool end = true)
unsigned lineDepth = 1;
int extraWidth = 0;
RenderObject* parent = child->parent();
while (parent->isInline() && !parent->isInlineBlockOrInlineTable() && lineDepth++ < cMaxLineDepth) {
while (parent->isBox() && parent->isInline() && !parent->isInlineBlockOrInlineTable() && lineDepth++ < cMaxLineDepth) {
if (start && parent->firstChild() == child)
extraWidth += getBorderPaddingMargin(parent, false);
extraWidth += getBorderPaddingMargin(RenderBox::toRenderBox(parent), false);
if (end && parent->lastChild() == child)
extraWidth += getBorderPaddingMargin(parent, true);
extraWidth += getBorderPaddingMargin(RenderBox::toRenderBox(parent), true);
child = parent;
parent = child->parent();
}
......@@ -596,10 +596,11 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
}
r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, m_firstLine));
} else if (!r->m_object->isInlineFlow()) {
r->m_object->calcWidth();
r->m_box->setWidth(toRenderBox(r->m_object)->width());
RenderBox* renderBox = RenderBox::toRenderBox(r->m_object);
renderBox->calcWidth();
r->m_box->setWidth(renderBox->width());
if (!r->m_compact)
totWidth += r->m_object->marginLeft() + r->m_object->marginRight();
totWidth += renderBox->marginLeft() + renderBox->marginRight();
}
// Compacts don't contribute to the width of the line, since they are placed in the margin.
......@@ -1416,7 +1417,7 @@ static inline bool shouldPreserveNewline(RenderObject* object)
return object->style()->preserveNewline();
}
static bool inlineFlowRequiresLineBox(RenderObject* flow)
static bool inlineFlowRequiresLineBox(RenderBox* flow)
{
// FIXME: Right now, we only allow line boxes for inlines that are truly empty.
// We need to fix this, though, because at the very least, inlines containing only
......@@ -1429,7 +1430,7 @@ static inline bool requiresLineBox(const InlineIterator& it)
if (it.obj->isFloatingOrPositioned())
return false;
if (it.obj->isInlineFlow() && !inlineFlowRequiresLineBox(it.obj))
if (it.obj->isInlineFlow() && !inlineFlowRequiresLineBox(RenderBox::toRenderBox(it.obj)))
return false;
if (!shouldCollapseWhiteSpace(it.obj->style()) || it.obj->isBR())
......@@ -1706,11 +1707,13 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, ECle
// Right now, we should only encounter empty inlines here.
ASSERT(!o->firstChild());
RenderBox* flowBox = RenderBox::toRenderBox(o);
// Now that some inline flows have line boxes, if we are already ignoring spaces, we need
// to make sure that we stop to include this object and then start ignoring spaces again.
// If this object is at the start of the line, we need to behave like list markers and
// start ignoring spaces.
if (inlineFlowRequiresLineBox(o)) {
if (inlineFlowRequiresLineBox(flowBox)) {
isLineEmpty = false;
if (ignoringSpaces) {
trailingSpaceObject = 0;
......@@ -1726,8 +1729,8 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, ECle
}
}
tmpW += o->marginLeft() + o->borderLeft() + o->paddingLeft() +
o->marginRight() + o->borderRight() + o->paddingRight();
tmpW += flowBox->marginLeft() + flowBox->borderLeft() + flowBox->paddingLeft() +
flowBox->marginRight() + flowBox->borderRight() + flowBox->paddingRight();
} else if (o->isReplaced()) {
RenderBox* replacedBox = toRenderBox(o);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment