Diff
Modified: trunk/Source/WebCore/ChangeLog (89978 => 89979)
--- trunk/Source/WebCore/ChangeLog 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/ChangeLog 2011-06-29 00:53:04 UTC (rev 89979)
@@ -1,3 +1,38 @@
+2011-06-28 Levi Weintraub <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Switch paintBoxShadow and paintBoxDecorations to new layout types
+ https://bugs.webkit.org/show_bug.cgi?id=63577
+
+ Switching paintBoxShadow and paintBoxDecorations to layout type abstraction
+ from more integral types.
+
+ No new tests as this is just moving to an abstraction.
+
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::paintBoxShadow):
+ (WebCore::InlineFlowBox::paintBoxDecorations):
+ * rendering/InlineFlowBox.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::paintBoxDecorations):
+ * rendering/RenderBox.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintBoxShadow):
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::paintBoxDecorations):
+ * rendering/RenderFieldset.h:
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::paintBoxDecorations):
+ * rendering/RenderTable.h:
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::paintBoxDecorations):
+ * rendering/RenderTableCell.h:
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::paintBoxDecorations):
+ * rendering/RenderView.h:
+
2011-06-28 Emil A Eklund <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -1063,7 +1063,7 @@
}
}
-void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, ShadowStyle shadowStyle, const IntRect& paintRect)
+void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect)
{
if ((!prevLineBox() && !nextLineBox()) || !parent())
boxModelObject()->paintBoxShadow(context, paintRect, s, shadowStyle);
@@ -1094,20 +1094,20 @@
}
}
-void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)
+void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground)
return;
// Pixel snap background/border painting.
- IntRect frameRect = roundedFrameRect();
+ LayoutRect frameRect = roundedFrameRect();
constrainToLineTopAndBottomIfNeeded(frameRect);
// Move x/y to our coordinates.
- IntRect localRect(frameRect);
+ LayoutRect localRect(frameRect);
flipForWritingMode(localRect);
- IntPoint adjustedPaintoffset = paintOffset + localRect.location();
+ LayoutPoint adjustedPaintoffset = paintOffset + localRect.location();
GraphicsContext* context = paintInfo.context;
@@ -1115,7 +1115,7 @@
// a line may actually have to paint a background.
RenderStyle* styleToUse = renderer()->style(m_firstLine);
if ((!parent() && m_firstLine && styleToUse != renderer()->style()) || (parent() && renderer()->hasBoxDecorations())) {
- IntRect paintRect = IntRect(adjustedPaintoffset, frameRect.size());
+ LayoutRect paintRect = LayoutRect(adjustedPaintoffset, frameRect.size());
// Shadow comes first and is behind the background and border.
paintBoxShadow(context, styleToUse, Normal, paintRect);
@@ -1144,20 +1144,20 @@
// the previous line left off.
// FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
// but it isn't even clear how this should work at all.
- int logicalOffsetOnLine = 0;
+ LayoutUnit logicalOffsetOnLine = 0;
for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
logicalOffsetOnLine += curr->logicalWidth();
- int totalLogicalWidth = logicalOffsetOnLine;
+ LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
totalLogicalWidth += curr->logicalWidth();
- int stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
- int stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
- int stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
- int stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
+ LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
+ LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
+ LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
+ LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
GraphicsContextStateSaver stateSaver(*context);
context->clip(paintRect);
- boxModelObject()->paintBorder(context, IntRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());
+ boxModelObject()->paintBorder(context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());
}
}
}
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (89978 => 89979)
--- trunk/Source/WebCore/rendering/InlineFlowBox.h 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h 2011-06-29 00:53:04 UTC (rev 89979)
@@ -103,11 +103,11 @@
IntRect roundedFrameRect() const;
- virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
+ virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
- void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const IntRect&);
+ void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const LayoutRect&);
virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, int lineTop, int lineBottom);
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -827,11 +827,11 @@
return BackgroundBleedUseTransparencyLayer;
}
-void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)
+void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(this))
return;
- IntRect paintRect(paintOffset, size());
+ LayoutRect paintRect(paintOffset, size());
// border-fit can adjust where we paint our border and background. If set, we snugly fit our line box descendants. (The iChat
// balloon layout is an example of this).
Modified: trunk/Source/WebCore/rendering/RenderBox.h (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderBox.h 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2011-06-29 00:53:04 UTC (rev 89979)
@@ -353,7 +353,7 @@
void popContentsClip(PaintInfo&, PaintPhase originalPhase, const IntPoint& accumulatedOffset);
virtual void paintObject(PaintInfo&, const IntPoint&) { ASSERT_NOT_REACHED(); }
- virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
+ virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -2090,7 +2090,7 @@
return unionRect(bounds, offsetBounds);
}
-void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, const IntRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
+void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, const LayoutRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{
// FIXME: Deal with border-image. Would be great to use border-image as a mask.
@@ -2108,9 +2108,9 @@
if (shadow->style() != shadowStyle)
continue;
- IntSize shadowOffset(shadow->x(), shadow->y());
- int shadowBlur = shadow->blur();
- int shadowSpread = shadow->spread();
+ LayoutSize shadowOffset(shadow->x(), shadow->y());
+ LayoutUnit shadowBlur = shadow->blur();
+ LayoutUnit shadowSpread = shadow->spread();
if (shadowOffset.isZero() && !shadowBlur && !shadowSpread)
continue;
@@ -2123,7 +2123,7 @@
if (fillRect.isEmpty())
continue;
- IntRect shadowRect(border.rect());
+ LayoutRect shadowRect(border.rect());
shadowRect.inflate(shadowBlur + shadowSpread);
shadowRect.move(shadowOffset);
@@ -2132,7 +2132,7 @@
// Move the fill just outside the clip, adding 1 pixel separation so that the fill does not
// bleed in (due to antialiasing) if the context is transformed.
- IntSize extraOffset(paintRect.width() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);
+ LayoutSize extraOffset(paintRect.width() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);
shadowOffset -= extraOffset;
fillRect.move(extraOffset);
@@ -2157,7 +2157,7 @@
fillRect.expandRadii(shadowSpread);
context->fillRoundedRect(fillRect, Color::black, s->colorSpace());
} else {
- IntRect rectToClipOut = border.rect();
+ LayoutRect rectToClipOut = border.rect();
// If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
// when painting the shadow. On the other hand, it introduces subpixel gaps along the
@@ -2176,7 +2176,7 @@
}
} else {
// Inset shadow.
- IntRect holeRect(border.rect());
+ LayoutRect holeRect(border.rect());
holeRect.inflate(-shadowSpread);
if (holeRect.isEmpty()) {
@@ -2205,7 +2205,7 @@
Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
- IntRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset);
+ LayoutRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset);
RoundedIntRect roundedHole(holeRect, border.radii());
GraphicsContextStateSaver stateSaver(*context);
@@ -2217,7 +2217,7 @@
} else
context->clip(border.rect());
- IntSize extraOffset(2 * paintRect.width() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
+ LayoutSize extraOffset(2 * paintRect.width() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
context->translate(extraOffset.width(), extraOffset.height());
shadowOffset -= extraOffset;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2011-06-29 00:53:04 UTC (rev 89979)
@@ -120,7 +120,7 @@
void paintBorder(GraphicsContext*, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
- void paintBoxShadow(GraphicsContext*, const IntRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
+ void paintBoxShadow(GraphicsContext*, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
// Overridden by subclasses to determine line height and baseline position.
Modified: trunk/Source/WebCore/rendering/RenderFieldset.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderFieldset.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderFieldset.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -118,12 +118,12 @@
return 0;
}
-void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)
+void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(this))
return;
- IntRect paintRect(paintOffset, size());
+ LayoutRect paintRect(paintOffset, size());
RenderBox* legend = findLegend();
if (!legend)
return RenderBlock::paintBoxDecorations(paintInfo, paintOffset);
@@ -132,11 +132,11 @@
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style()->isHorizontalWritingMode()) {
- int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
+ LayoutUnit yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
paintRect.setHeight(paintRect.height() - yOff);
paintRect.setY(paintRect.y() + yOff);
} else {
- int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
+ LayoutUnit xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
paintRect.setWidth(paintRect.width() - xOff);
paintRect.setX(paintRect.x() + xOff);
}
@@ -156,13 +156,13 @@
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style()->isHorizontalWritingMode()) {
- int clipTop = paintRect.y();
- int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
- graphicsContext->clipOut(IntRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
+ LayoutUnit clipTop = paintRect.y();
+ LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWidth()), legend->height());
+ graphicsContext->clipOut(LayoutRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
} else {
- int clipLeft = paintRect.x();
- int clipWidth = max(static_cast<int>(style()->borderLeftWidth()), legend->width());
- graphicsContext->clipOut(IntRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
+ LayoutUnit clipLeft = paintRect.x();
+ LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWidth()), legend->width());
+ graphicsContext->clipOut(LayoutRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
}
paintBorder(paintInfo.context, paintRect, style());
Modified: trunk/Source/WebCore/rendering/RenderFieldset.h (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderFieldset.h 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderFieldset.h 2011-06-29 00:53:04 UTC (rev 89979)
@@ -44,7 +44,7 @@
virtual bool avoidsFloats() const { return true; }
virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; }
- virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
+ virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
};
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -549,12 +549,12 @@
}
}
-void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)
+void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(this))
return;
- IntRect rect(paintOffset, size());
+ LayoutRect rect(paintOffset, size());
subtractCaptionRect(rect);
paintBoxShadow(paintInfo.context, rect, style(), Normal);
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -996,7 +996,7 @@
}
}
-void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint& paintOffset)
+void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(this))
return;
@@ -1005,7 +1005,7 @@
if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild())
return;
- IntRect paintRect = IntRect(paintOffset, size());
+ LayoutRect paintRect = LayoutRect(paintOffset, size());
paintBoxShadow(paintInfo.context, paintRect, style(), Normal);
// Paint our cell background.
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2011-06-29 00:53:04 UTC (rev 89979)
@@ -142,7 +142,7 @@
virtual void computeLogicalWidth();
- virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
+ virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2011-06-29 00:53:04 UTC (rev 89979)
@@ -185,7 +185,7 @@
&& !isComposited(object);
}
-void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint&)
+void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&)
{
// Check to see if we are enclosed by a layer that requires complex painting rules. If so, we cannot blit
// when scrolling, and we need to use slow repaints. Examples of layers that require this are transparent layers,
Modified: trunk/Source/WebCore/rendering/RenderView.h (89978 => 89979)
--- trunk/Source/WebCore/rendering/RenderView.h 2011-06-29 00:49:05 UTC (rev 89978)
+++ trunk/Source/WebCore/rendering/RenderView.h 2011-06-29 00:53:04 UTC (rev 89979)
@@ -70,7 +70,7 @@
virtual void repaintRectangleInViewAndCompositedLayers(const IntRect&, bool immediate = false);
virtual void paint(PaintInfo&, const IntPoint&);
- virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
+ virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld };
void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld);