Commit a97f4677 authored by hyatt@apple.com's avatar hyatt@apple.com

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

        Properly encapsulate m_frameRect.y() behind the RenderBox::y() method now that they are the same thing.
        Make m_frameRect private.

        Reviewed by Oliver Hunt

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::paint):
        (WebCore::RenderBlock::clearFloats):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::offsetTop):
        (WebCore::RenderBox::nodeAtPoint):
        (WebCore::RenderBox::paint):
        (WebCore::RenderBox::paintCustomHighlight):
        (WebCore::RenderBox::containingBlockWidth):
        (WebCore::RenderBox::localToAbsolute):
        (WebCore::RenderBox::offsetFromContainer):
        (WebCore::RenderBox::computeAbsoluteRepaintRect):
        (WebCore::RenderBox::repaintDuringLayoutIfMoved):
        * rendering/RenderContainer.cpp:
        (WebCore::RenderContainer::layout):
        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::layoutBlock):
        * rendering/RenderFrameSet.cpp:
        (WebCore::RenderFrameSet::paint):
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::paintReplaced):
        (WebCore::RenderImage::nodeAtPoint):
        * rendering/RenderListMarker.cpp:
        (WebCore::RenderListMarker::paint):
        (WebCore::RenderListMarker::getRelativeMarkerRect):
        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::paint):
        (WebCore::RenderReplaced::shouldPaint):
        * rendering/RenderReplica.cpp:
        (WebCore::RenderReplica::paint):
        * rendering/RenderSVGRoot.cpp:
        (WebCore::RenderSVGRoot::applyContentTransforms):
        (WebCore::RenderSVGRoot::paint):
        (WebCore::RenderSVGRoot::absoluteTransform):
        (WebCore::RenderSVGRoot::nodeAtPoint):
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::calcWidth):
        (WebCore::RenderTable::layout):
        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::paint):
        (WebCore::RenderTableCell::paintBackgroundsBehindCell):
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::setCellWidths):
        (WebCore::RenderTableSection::calcRowHeight):
        (WebCore::RenderTableSection::layoutRows):
        (WebCore::RenderTableSection::paint):
        (WebCore::RenderTableSection::nodeAtPoint):
        * rendering/RenderWidget.cpp:
        (WebCore::RenderWidget::paint):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0bf6c84c
2009-01-22 David Hyatt <hyatt@apple.com>
Properly encapsulate m_frameRect.y() behind the RenderBox::y() method now that they are the same thing.
Make m_frameRect private.
Reviewed by Oliver Hunt
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::clearFloats):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::offsetTop):
(WebCore::RenderBox::nodeAtPoint):
(WebCore::RenderBox::paint):
(WebCore::RenderBox::paintCustomHighlight):
(WebCore::RenderBox::containingBlockWidth):
(WebCore::RenderBox::localToAbsolute):
(WebCore::RenderBox::offsetFromContainer):
(WebCore::RenderBox::computeAbsoluteRepaintRect):
(WebCore::RenderBox::repaintDuringLayoutIfMoved):
* rendering/RenderContainer.cpp:
(WebCore::RenderContainer::layout):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::paint):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::nodeAtPoint):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
(WebCore::RenderListMarker::getRelativeMarkerRect):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderReplica.cpp:
(WebCore::RenderReplica::paint):
* rendering/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::applyContentTransforms):
(WebCore::RenderSVGRoot::paint):
(WebCore::RenderSVGRoot::absoluteTransform):
(WebCore::RenderSVGRoot::nodeAtPoint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::calcWidth):
(WebCore::RenderTable::layout):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paint):
(WebCore::RenderTableCell::paintBackgroundsBehindCell):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::setCellWidths):
(WebCore::RenderTableSection::calcRowHeight):
(WebCore::RenderTableSection::layoutRows):
(WebCore::RenderTableSection::paint):
(WebCore::RenderTableSection::nodeAtPoint):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
2009-01-22 David Hyatt <hyatt@apple.com>
Fix for https://bugs.webkit.org/show_bug.cgi?id=23487.
......@@ -1483,7 +1483,7 @@ void RenderBlock::repaintOverhangingFloats(bool paintAllDescendants)
void RenderBlock::paint(PaintInfo& paintInfo, int tx, int ty)
{
tx += x();
ty += m_frameRect.y();
ty += y();
PaintPhase phase = paintInfo.phase;
......@@ -2844,7 +2844,7 @@ void RenderBlock::clearFloats()
}
// First add in floats from the parent.
int offset = m_frameRect.y();
int offset = y();
if (parentHasFloats)
addIntrudingFloats(static_cast<RenderBlock *>(parent()),
parent()->borderLeft() + parent()->paddingLeft(), offset);
......
......@@ -244,7 +244,7 @@ int RenderBox::offsetTop() const
RenderBox* offsetPar = offsetParent();
if (!offsetPar)
return 0;
int yPos = m_frameRect.y() - offsetPar->borderTop();
int yPos = y() - offsetPar->borderTop();
if (!isPositioned()) {
if (isRelPositioned())
yPos += relativePositionOffsetY();
......@@ -556,7 +556,7 @@ int RenderBox::calcContentBoxHeight(int height) const
bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int xPos, int yPos, int tx, int ty, HitTestAction action)
{
tx += x();
ty += m_frameRect.y();
ty += y();
// Check kids first.
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
......@@ -585,7 +585,7 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
void RenderBox::paint(PaintInfo& paintInfo, int tx, int ty)
{
tx += x();
ty += m_frameRect.y();
ty += y();
// default implementation. Just pass paint through to the children
PaintInfo childInfo(paintInfo);
......@@ -1138,7 +1138,7 @@ void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, b
FloatRect imageRect(tx + x(), rootRect.y(), width(), rootRect.height());
page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, rootRect, behindText, false);
} else {
FloatRect imageRect(tx + x(), ty + m_frameRect.y(), width(), height());
FloatRect imageRect(tx + x(), ty + y(), width(), height());
page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, imageRect, behindText, false);
}
}
......@@ -1201,7 +1201,7 @@ int RenderBox::containingBlockWidth() const
if (!cb)
return 0;
if (shrinkToAvoidFloats())
return cb->lineWidth(m_frameRect.y());
return cb->lineWidth(y());
return cb->availableWidth();
}
......@@ -1248,7 +1248,7 @@ FloatPoint RenderBox::localToAbsolute(FloatPoint localPoint, bool fixed, bool us
if (v->layoutStateEnabled()) {
LayoutState* layoutState = v->layoutState();
IntSize offset = layoutState->m_offset;
offset.expand(x(), m_frameRect.y());
offset.expand(x(), y());
localPoint += offset;
if (style()->position() == RelativePosition && m_layer)
localPoint += m_layer->relativePositionOffset();
......@@ -1328,11 +1328,11 @@ IntSize RenderBox::offsetFromContainer(RenderObject* o) const
RenderBlock* cb;
if (o->isBlockFlow() && style()->position() != AbsolutePosition && style()->position() != FixedPosition
&& (cb = static_cast<RenderBlock*>(o))->hasColumns()) {
IntRect rect(x(), m_frameRect.y(), 1, 1);
IntRect rect(x(), y(), 1, 1);
cb->adjustRectForColumns(rect);
offset.expand(rect.x(), rect.y());
} else
offset.expand(x(), m_frameRect.y());
offset.expand(x(), y());
}
if (o->hasOverflowClip())
......@@ -1429,7 +1429,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& rect, bool fixed)
if (style()->position() == RelativePosition && m_layer)
rect.move(m_layer->relativePositionOffset());
rect.move(x(), m_frameRect.y());
rect.move(x(), y());
rect.move(layoutState->m_offset);
if (layoutState->m_clipped)
rect.intersect(layoutState->m_clipRect);
......@@ -1445,7 +1445,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& rect, bool fixed)
return;
IntPoint topLeft = rect.location();
topLeft.move(x(), m_frameRect.y());
topLeft.move(x(), y());
if (style()->position() == FixedPosition)
fixed = true;
......@@ -1467,7 +1467,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& rect, bool fixed)
rect = m_layer->transform()->mapRect(rect);
// FIXME: this clobbers topLeft adjustment done for multicol above
topLeft = rect.location();
topLeft.move(x(), m_frameRect.y());
topLeft.move(x(), y());
}
if (style()->position() == AbsolutePosition)
......@@ -1502,7 +1502,7 @@ void RenderBox::computeAbsoluteRepaintRect(IntRect& rect, bool fixed)
void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)
{
int newX = x();
int newY = m_frameRect.y();
int newY = y();
int newWidth = width();
int newHeight = height();
if (rect.x() != newX || rect.y() != newY) {
......
......@@ -308,10 +308,11 @@ private:
// These include tables, positioned objects, floats and flexible boxes.
virtual void calcPrefWidths() = 0;
protected:
private:
// The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
IntRect m_frameRect;
protected:
int m_marginLeft;
int m_marginRight;
int m_marginTop;
......
......@@ -524,7 +524,7 @@ void RenderContainer::layout()
{
ASSERT(needsLayout());
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), m_frameRect.y()));
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()));
RenderObject* child = m_firstChild;
while (child) {
......
......@@ -208,7 +208,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
oldOutlineBox = absoluteOutlineBounds();
}
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), m_frameRect.y()), hasTransform() || hasReflection());
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection());
int previousWidth = width();
int previousHeight = height();
......
......@@ -127,7 +127,7 @@ void RenderFrameSet::paint(PaintInfo& paintInfo, int tx, int ty)
// Add in our offsets.
tx += x();
ty += m_frameRect.y();
ty += y();
int rows = frameSet()->totalRows();
int cols = frameSet()->totalCols();
......
......@@ -396,7 +396,7 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
#if PLATFORM(MAC)
if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
paintCustomHighlight(tx - x(), ty - m_frameRect.y(), style()->highlight(), true);
paintCustomHighlight(tx - x(), ty - y(), style()->highlight(), true);
#endif
IntSize contentSize(cWidth, cHeight);
......@@ -425,7 +425,7 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
if (inside && element()) {
int tx = _tx + x();
int ty = _ty + m_frameRect.y();
int ty = _ty + y();
HTMLMapElement* map = imageMap();
if (map) {
......
......@@ -530,7 +530,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
IntRect marker = getRelativeMarkerRect();
marker.move(tx, ty);
IntRect box(tx + x(), ty + m_frameRect.y(), width(), height());
IntRect box(tx + x(), ty + y(), width(), height());
if (box.y() > paintInfo.rect.bottom() || box.y() + box.height() < paintInfo.rect.y())
return;
......@@ -829,7 +829,7 @@ bool RenderListMarker::isInside() const
IntRect RenderListMarker::getRelativeMarkerRect()
{
if (isImage())
return IntRect(x(), m_frameRect.y(), m_image->imageSize(this, style()->effectiveZoom()).width(), m_image->imageSize(this, style()->effectiveZoom()).height());
return IntRect(x(), y(), m_image->imageSize(this, style()->effectiveZoom()).width(), m_image->imageSize(this, style()->effectiveZoom()).height());
switch (style()->listStyleType()) {
case DISC:
......@@ -839,7 +839,7 @@ IntRect RenderListMarker::getRelativeMarkerRect()
const Font& font = style()->font();
int ascent = font.ascent();
int bulletWidth = (ascent * 2 / 3 + 1) / 2;
return IntRect(x() + 1, m_frameRect.y() + 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth, bulletWidth);
return IntRect(x() + 1, y() + 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth, bulletWidth);
}
case LNONE:
return IntRect();
......@@ -866,7 +866,7 @@ IntRect RenderListMarker::getRelativeMarkerRect()
int itemWidth = font.width(m_text);
const UChar periodSpace[2] = { '.', ' ' };
int periodSpaceWidth = font.width(TextRun(periodSpace, 2));
return IntRect(x(), m_frameRect.y() + font.ascent(), itemWidth + periodSpaceWidth, font.height());
return IntRect(x(), y() + font.ascent(), itemWidth + periodSpaceWidth, font.height());
}
return IntRect();
......
......@@ -111,7 +111,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
return;
tx += x();
ty += m_frameRect.y();
ty += y();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, tx, ty);
......@@ -160,7 +160,7 @@ bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, int& tx, int& ty)
return false;
int currentTX = tx + x();
int currentTY = ty + m_frameRect.y();
int currentTY = ty + y();
// Early exit if the element touches the edges.
int top = currentTY + overflowTop();
......
......@@ -42,7 +42,7 @@ RenderReplica::~RenderReplica()
void RenderReplica::layout()
{
m_frameRect = parentBox()->borderBoxRect();
setFrameRect(parentBox()->borderBoxRect());
setNeedsLayout(false);
}
......@@ -59,7 +59,7 @@ void RenderReplica::paint(PaintInfo& paintInfo, int tx, int ty)
return;
tx += x();
ty += m_frameRect.y();
ty += y();
if (paintInfo.phase == PaintPhaseForeground)
// Turn around and paint the parent layer. Use temporary clipRects, so that the layer doesn't end up caching clip rects
......
......@@ -125,7 +125,7 @@ void RenderSVGRoot::applyContentTransforms(PaintInfo& paintInfo, int parentX, in
// Translate from parent offsets (html renderers) to a relative transform (svg renderers)
IntPoint origin;
origin.move(parentX, parentY);
origin.move(x(), m_frameRect.y());
origin.move(x(), y());
origin.move(borderLeft(), borderTop());
origin.move(paddingLeft(), paddingTop());
......@@ -165,7 +165,7 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
// This should only exist for <svg> renderers
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, x() + parentX, m_frameRect.y() + parentY);
paintBoxDecorations(paintInfo, x() + parentX, y() + parentY);
if (!firstChild()) {
#if ENABLE(SVG_FILTERS)
......@@ -268,7 +268,7 @@ void RenderSVGRoot::absoluteQuads(Vector<FloatQuad>& quads, bool)
TransformationMatrix RenderSVGRoot::absoluteTransform() const
{
TransformationMatrix ctm = RenderContainer::absoluteTransform();
ctm.translate(x(), m_frameRect.y());
ctm.translate(x(), y());
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
ctm.scale(svg->currentScale());
ctm.translate(svg->currentTranslate().x(), svg->currentTranslate().y());
......@@ -309,7 +309,7 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
&& style()->overflowX() == OHIDDEN
&& style()->overflowY() == OHIDDEN) {
int tx = x() - _tx + sx;
int ty = m_frameRect.y() - _ty + sy;
int ty = y() - _ty + sy;
// Check if we need to do anything at all.
IntRect overflowBox = overflowRect(false);
......
......@@ -224,7 +224,7 @@ void RenderTable::calcWidth()
} else {
// An auto width table should shrink to fit within the line width if necessary in order to
// avoid overlapping floats.
availableWidth = cb->lineWidth(m_frameRect.y());
availableWidth = cb->lineWidth(y());
// Subtract out any fixed margins from our available width for auto width tables.
int marginTotal = 0;
......@@ -265,7 +265,7 @@ void RenderTable::layout()
oldOutlineBox = absoluteOutlineBounds();
}
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), m_frameRect.y()));
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()));
setHeight(0);
m_overflowHeight = 0;
......
......@@ -645,7 +645,7 @@ int RenderTableCell::borderHalfBottom(bool outer) const
void RenderTableCell::paint(PaintInfo& paintInfo, int tx, int ty)
{
tx += x();
ty += m_frameRect.y();
ty += y();
// check if we need to do anything at all...
int os = 2 * maximalOutlineSize(paintInfo.phase);
......@@ -820,7 +820,7 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, i
if (backgroundObject != this) {
tx += x();
ty += m_frameRect.y();
ty += y();
}
int w = width();
......
......@@ -283,7 +283,7 @@ void RenderTableSection::setCellWidths()
if (!statePusher.didPush()) {
// Technically, we should also push state for the row, but since
// rows don't push a coordinate transform, that's not necessary.
statePusher.push(this, IntSize(x(), m_frameRect.y()));
statePusher.push(this, IntSize(x(), y()));
}
cell->repaint();
}
......@@ -333,7 +333,7 @@ int RenderTableSection::calcRowHeight()
if (!statePusher.didPush()) {
// Technically, we should also push state for the row, but since
// rows don't push a coordinate transform, that's not necessary.
statePusher.push(this, IntSize(x(), m_frameRect.y()));
statePusher.push(this, IntSize(x(), y()));
}
cell->setOverrideSize(-1);
cell->setChildNeedsLayout(true, false);
......@@ -458,7 +458,7 @@ int RenderTableSection::layoutRows(int toAdd)
int vspacing = table()->vBorderSpacing();
int nEffCols = table()->numEffCols();
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), m_frameRect.y()));
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()));
for (int r = 0; r < totalRows; r++) {
// Set the row's x/y position and width/height.
......@@ -885,7 +885,7 @@ void RenderTableSection::paint(PaintInfo& paintInfo, int tx, int ty)
return;
tx += x();
ty += m_frameRect.y();
ty += y();
// Check which rows and cols are visible and only paint these.
// FIXME: Could use a binary search here.
......@@ -1076,7 +1076,7 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul
// Table sections cannot ever be hit tested. Effectively they do not exist.
// Just forward to our children always.
tx += x();
ty += m_frameRect.y();
ty += y();
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
// FIXME: We have to skip over inline flows, since they can show up inside table rows
......
......@@ -174,7 +174,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
return;
tx += x();
ty += m_frameRect.y();
ty += y();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, tx, ty);
......@@ -189,7 +189,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
#if PLATFORM(MAC)
if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
paintCustomHighlight(tx - x(), ty - m_frameRect.y(), style()->highlight(), true);
paintCustomHighlight(tx - x(), ty - y(), style()->highlight(), true);
#endif
if (m_widget) {
......
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