diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderBoxModelObject.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderBoxModelObject.cpp | 95 |
1 files changed, 34 insertions, 61 deletions
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index eed3577a3..fcca1b3d5 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -411,15 +411,6 @@ void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty repaint(); } } - - if (hasLayer() - && (oldStyle->hasAutoZIndex() != newStyle->hasAutoZIndex() - || oldStyle->zIndex() != newStyle->zIndex() - || oldStyle->visibility() != newStyle->visibility())) { - layer()->dirtyStackingContextZOrderLists(); - if (oldStyle->hasAutoZIndex() != newStyle->hasAutoZIndex() || oldStyle->visibility() != newStyle->visibility()) - layer()->dirtyZOrderLists(); - } } RenderObject::styleWillChange(diff, newStyle); @@ -478,7 +469,7 @@ static LayoutUnit accumulateRelativePositionOffsets(const RenderObject* child, R { if (!child->isAnonymousBlock() || !child->isRelPositioned()) return 0; - LayoutUnit offset = 0; + LayoutUnit offset = ZERO_LAYOUT_UNIT; RenderObject* p = toRenderBlock(child)->inlineElementContinuation(); while (p && p->isRenderInline()) { if (p->isRelPositioned()) @@ -535,71 +526,53 @@ LayoutUnit RenderBoxModelObject::relativePositionOffsetY() const return offset; } -LayoutUnit RenderBoxModelObject::offsetLeft() const +LayoutPoint RenderBoxModelObject::offsetTopLeft(const LayoutPoint& startPoint) const { // If the element is the HTML body element or does not have an associated box // return 0 and stop this algorithm. if (isBody()) - return 0; + return LayoutPoint(); - RenderBoxModelObject* offsetPar = offsetParent(); - LayoutUnit xPos = (isBox() ? toRenderBox(this)->left() : ZERO_LAYOUT_UNIT); + LayoutPoint referencePoint = startPoint; + referencePoint.move(parent()->offsetForColumns(referencePoint)); // If the offsetParent of the element is null, or is the HTML body element, // return the distance between the canvas origin and the left border edge // of the element and stop this algorithm. - if (offsetPar) { - if (offsetPar->isBox() && !offsetPar->isBody()) - xPos -= toRenderBox(offsetPar)->borderLeft(); + if (const RenderBoxModelObject* offsetParent = this->offsetParent()) { + if (offsetParent->isBox() && !offsetParent->isBody()) + referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRenderBox(offsetParent)->borderTop()); if (!isPositioned()) { if (isRelPositioned()) - xPos += relativePositionOffsetX(); - RenderObject* curr = parent(); - while (curr && curr != offsetPar) { + referencePoint.move(relativePositionOffset()); + const RenderObject* curr = parent(); + while (curr != offsetParent) { // FIXME: What are we supposed to do inside SVG content? if (curr->isBox() && !curr->isTableRow()) - xPos += toRenderBox(curr)->left(); + referencePoint.moveBy(toRenderBox(curr)->topLeftLocation()); + referencePoint.move(curr->parent()->offsetForColumns(referencePoint)); curr = curr->parent(); } - if (offsetPar->isBox() && offsetPar->isBody() && !offsetPar->isRelPositioned() && !offsetPar->isPositioned()) - xPos += toRenderBox(offsetPar)->left(); + if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent->isRelPositioned() && !offsetParent->isPositioned()) + referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation()); } } - return xPos; + return referencePoint; +} + +LayoutUnit RenderBoxModelObject::offsetLeft() const +{ + // Note that RenderInline and RenderBox override this to pass a different + // startPoint to offsetTopLeft. + return offsetTopLeft(LayoutPoint()).x(); } LayoutUnit RenderBoxModelObject::offsetTop() const { - // If the element is the HTML body element or does not have an associated box - // return 0 and stop this algorithm. - if (isBody()) - return 0; - - RenderBoxModelObject* offsetPar = offsetParent(); - LayoutUnit yPos = (isBox() ? toRenderBox(this)->top() : ZERO_LAYOUT_UNIT); - - // If the offsetParent of the element is null, or is the HTML body element, - // return the distance between the canvas origin and the top border edge - // of the element and stop this algorithm. - if (offsetPar) { - if (offsetPar->isBox() && !offsetPar->isBody()) - yPos -= toRenderBox(offsetPar)->borderTop(); - if (!isPositioned()) { - if (isRelPositioned()) - yPos += relativePositionOffsetY(); - RenderObject* curr = parent(); - while (curr && curr != offsetPar) { - // FIXME: What are we supposed to do inside SVG content? - if (curr->isBox() && !curr->isTableRow()) - yPos += toRenderBox(curr)->top(); - curr = curr->parent(); - } - if (offsetPar->isBox() && offsetPar->isBody() && !offsetPar->isRelPositioned() && !offsetPar->isPositioned()) - yPos += toRenderBox(offsetPar)->top(); - } - } - return yPos; + // Note that RenderInline and RenderBox override this to pass a different + // startPoint to offsetTopLeft. + return offsetTopLeft(LayoutPoint()).y(); } int RenderBoxModelObject::pixelSnappedOffsetWidth() const @@ -614,7 +587,7 @@ int RenderBoxModelObject::pixelSnappedOffsetHeight() const LayoutUnit RenderBoxModelObject::computedCSSPaddingTop() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingTop(); if (padding.isPercent()) @@ -626,7 +599,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingTop() const LayoutUnit RenderBoxModelObject::computedCSSPaddingBottom() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingBottom(); if (padding.isPercent()) @@ -638,7 +611,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingBottom() const LayoutUnit RenderBoxModelObject::computedCSSPaddingLeft() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingLeft(); if (padding.isPercent()) @@ -650,7 +623,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingLeft() const LayoutUnit RenderBoxModelObject::computedCSSPaddingRight() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingRight(); if (padding.isPercent()) @@ -662,7 +635,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingRight() const LayoutUnit RenderBoxModelObject::computedCSSPaddingBefore() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingBefore(); if (padding.isPercent()) @@ -674,7 +647,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingBefore() const LayoutUnit RenderBoxModelObject::computedCSSPaddingAfter() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingAfter(); if (padding.isPercent()) @@ -686,7 +659,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingAfter() const LayoutUnit RenderBoxModelObject::computedCSSPaddingStart() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingStart(); if (padding.isPercent()) @@ -698,7 +671,7 @@ LayoutUnit RenderBoxModelObject::computedCSSPaddingStart() const LayoutUnit RenderBoxModelObject::computedCSSPaddingEnd() const { - LayoutUnit w = 0; + LayoutUnit w = ZERO_LAYOUT_UNIT; RenderView* renderView = 0; Length padding = style()->paddingEnd(); if (padding.isPercent()) |