diff options
Diffstat (limited to 'WebCore/rendering/RenderReplaced.cpp')
-rw-r--r-- | WebCore/rendering/RenderReplaced.cpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp index b54a228..d3b449c 100644 --- a/WebCore/rendering/RenderReplaced.cpp +++ b/WebCore/rendering/RenderReplaced.cpp @@ -57,6 +57,13 @@ RenderReplaced::~RenderReplaced() { } +void RenderReplaced::setStyle(PassRefPtr<RenderStyle> newStyle) +{ + if (newStyle->blockFlow() != TopToBottomBlockFlow) + newStyle->setBlockFlow(TopToBottomBlockFlow); + RenderBox::setStyle(newStyle); +} + void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderBox::styleDidChange(diff, oldStyle); @@ -75,8 +82,8 @@ void RenderReplaced::layout() setHeight(minimumReplacedHeight()); - calcWidth(); - calcHeight(); + computeLogicalWidth(); + computeLogicalHeight(); m_overflow.clear(); addShadowOverflow(); @@ -200,34 +207,34 @@ static inline bool lengthIsSpecified(Length length) return lengthType == Fixed || lengthType == Percent; } -int RenderReplaced::calcReplacedWidth(bool includeMaxWidth) const +int RenderReplaced::computeReplacedWidth(bool includeMaxWidth) const { int width; if (lengthIsSpecified(style()->width())) - width = calcReplacedWidthUsing(style()->width()); + width = computeReplacedWidthUsing(style()->width()); else if (m_hasIntrinsicSize) width = calcAspectRatioWidth(); else width = intrinsicSize().width(); - int minW = calcReplacedWidthUsing(style()->minWidth()); - int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth()); + int minW = computeReplacedWidthUsing(style()->minWidth()); + int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth()); return max(minW, min(width, maxW)); } -int RenderReplaced::calcReplacedHeight() const +int RenderReplaced::computeReplacedHeight() const { int height; if (lengthIsSpecified(style()->height())) - height = calcReplacedHeightUsing(style()->height()); + height = computeReplacedHeightUsing(style()->height()); else if (m_hasIntrinsicSize) height = calcAspectRatioHeight(); else height = intrinsicSize().height(); - int minH = calcReplacedHeightUsing(style()->minHeight()); - int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight()); + int minH = computeReplacedHeightUsing(style()->minHeight()); + int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight()); return max(minH, min(height, maxH)); } @@ -238,7 +245,7 @@ int RenderReplaced::calcAspectRatioWidth() const int intrinsicHeight = intrinsicSize().height(); if (!intrinsicHeight) return 0; - return RenderBox::calcReplacedHeight() * intrinsicWidth / intrinsicHeight; + return RenderBox::computeReplacedHeight() * intrinsicWidth / intrinsicHeight; } int RenderReplaced::calcAspectRatioHeight() const @@ -247,27 +254,27 @@ int RenderReplaced::calcAspectRatioHeight() const int intrinsicHeight = intrinsicSize().height(); if (!intrinsicWidth) return 0; - return RenderBox::calcReplacedWidth() * intrinsicHeight / intrinsicWidth; + return RenderBox::computeReplacedWidth() * intrinsicHeight / intrinsicWidth; } -void RenderReplaced::calcPrefWidths() +void RenderReplaced::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); int borderAndPadding = borderAndPaddingWidth(); - m_maxPrefWidth = calcReplacedWidth(false) + borderAndPadding; + m_maxPreferredLogicalWidth = computeReplacedWidth(false) + borderAndPadding; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) - m_maxPrefWidth = min(m_maxPrefWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); + m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); if (style()->width().isPercent() || style()->height().isPercent() || style()->maxWidth().isPercent() || style()->maxHeight().isPercent() || style()->minWidth().isPercent() || style()->minHeight().isPercent()) - m_minPrefWidth = 0; + m_minPreferredLogicalWidth = 0; else - m_minPrefWidth = m_maxPrefWidth; + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } int RenderReplaced::lineHeight(bool, bool) const |