Diff
Modified: trunk/Source/WebCore/ChangeLog (89969 => 89970)
--- trunk/Source/WebCore/ChangeLog 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/ChangeLog 2011-06-28 22:41:36 UTC (rev 89970)
@@ -1,3 +1,27 @@
+2011-06-28 Levi Weintraub <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Switch paintFillLayer* to new layout types
+ https://bugs.webkit.org/show_bug.cgi?id=63570
+
+ Switching painFillLayer* to layout type abstraction from more integral types.
+
+ No new tests as this is just moving to an abstraction.
+
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::paintFillLayers):
+ (WebCore::InlineFlowBox::paintFillLayer):
+ * rendering/InlineFlowBox.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::paintFillLayers):
+ (WebCore::RenderBox::paintFillLayer):
+ * rendering/RenderBox.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderObject.h:
+
2011-06-28 Luke Macpherson <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (89969 => 89970)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2011-06-28 22:41:36 UTC (rev 89970)
@@ -1016,7 +1016,7 @@
}
}
-void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect, CompositeOperator op)
+void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
{
if (!fillLayer)
return;
@@ -1024,7 +1024,7 @@
paintFillLayer(paintInfo, c, fillLayer, rect, op);
}
-void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect, CompositeOperator op)
+void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
{
StyleImage* img = fillLayer->image();
bool hasFillImage = img && img->canRender(renderer()->style()->effectiveZoom());
@@ -1037,8 +1037,8 @@
// strip. Even though that strip has been broken up across multiple lines, you still paint it
// as though you had one single line. This means each line has to pick up the background where
// the previous line left off.
- int logicalOffsetOnLine = 0;
- int totalLogicalWidth;
+ LayoutUnit logicalOffsetOnLine = 0;
+ LayoutUnit totalLogicalWidth;
if (renderer()->style()->direction() == LTR) {
for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
logicalOffsetOnLine += curr->logicalWidth();
@@ -1052,14 +1052,14 @@
for (InlineFlowBox* curr = this; curr; curr = curr->prevLineBox())
totalLogicalWidth += curr->logicalWidth();
}
- int stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
- int stripY = rect.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
- int stripWidth = isHorizontal() ? totalLogicalWidth : width();
- int stripHeight = isHorizontal() ? height() : totalLogicalWidth;
+ LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
+ LayoutUnit stripY = rect.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
+ LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : width();
+ LayoutUnit stripHeight = isHorizontal() ? height() : totalLogicalWidth;
GraphicsContextStateSaver stateSaver(*paintInfo.context);
- paintInfo.context->clip(IntRect(rect.x(), rect.y(), width(), height()));
- boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, IntRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.size(), op);
+ paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
+ boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.size(), op);
}
}
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (89969 => 89970)
--- trunk/Source/WebCore/rendering/InlineFlowBox.h 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h 2011-06-28 22:41:36 UTC (rev 89970)
@@ -105,8 +105,8 @@
virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
virtual void paintMask(PaintInfo&, const IntPoint&);
- void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver);
- void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver);
+ 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&);
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 (89969 => 89970)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2011-06-28 22:41:36 UTC (rev 89970)
@@ -977,7 +977,7 @@
return result;
}
-void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect,
+void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
{
if (!fillLayer)
@@ -987,7 +987,7 @@
paintFillLayer(paintInfo, c, fillLayer, rect, bleedAvoidance, op, backgroundObject);
}
-void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect,
+void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
{
paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, IntSize(), op, backgroundObject);
Modified: trunk/Source/WebCore/rendering/RenderBox.h (89969 => 89970)
--- trunk/Source/WebCore/rendering/RenderBox.h 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2011-06-28 22:41:36 UTC (rev 89970)
@@ -417,8 +417,8 @@
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual void updateBoxModelInfoFromStyle();
- void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
- void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
+ void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
+ void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
void paintMaskImages(const PaintInfo&, const IntRect&);
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (89969 => 89970)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2011-06-28 22:41:36 UTC (rev 89970)
@@ -589,8 +589,8 @@
return adjustedRect;
}
-void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const IntRect& rect,
- BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const IntSize& boxSize, CompositeOperator op, RenderObject* backgroundObject)
+void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const LayoutRect& rect,
+ BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const LayoutSize& boxSize, CompositeOperator op, RenderObject* backgroundObject)
{
GraphicsContext* context = paintInfo.context;
if (context->paintingDisabled() || rect.isEmpty())
@@ -646,19 +646,19 @@
context->addRoundedRectClip(border);
}
- int bLeft = includeLeftEdge ? borderLeft() : 0;
- int bRight = includeRightEdge ? borderRight() : 0;
- int pLeft = includeLeftEdge ? paddingLeft() : 0;
- int pRight = includeRightEdge ? paddingRight() : 0;
+ LayoutUnit bLeft = includeLeftEdge ? borderLeft() : 0;
+ LayoutUnit bRight = includeRightEdge ? borderRight() : 0;
+ LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : 0;
+ LayoutUnit pRight = includeRightEdge ? paddingRight() : 0;
GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithLocalScrolling);
- IntRect scrolledPaintRect = rect;
+ LayoutRect scrolledPaintRect = rect;
if (clippedWithLocalScrolling) {
// Clip to the overflow area.
context->clip(toRenderBox(this)->overflowClipRect(rect.location()));
// Adjust the paint rect to reflect a scrolled content box with borders at the ends.
- IntSize offset = layer()->scrolledContentOffset();
+ LayoutSize offset = layer()->scrolledContentOffset();
scrolledPaintRect.move(-offset);
scrolledPaintRect.setWidth(bLeft + layer()->scrollWidth() + bRight);
scrolledPaintRect.setHeight(borderTop() + layer()->scrollHeight() + borderBottom());
@@ -668,7 +668,7 @@
if (bgLayer->clip() == PaddingFillBox || bgLayer->clip() == ContentFillBox) {
// Clip to the padding or content boxes as necessary.
bool includePadding = bgLayer->clip() == ContentFillBox;
- IntRect clipRect = IntRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : 0),
+ LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : 0),
scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : 0),
scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : 0),
scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : 0));
@@ -678,7 +678,7 @@
// We have to draw our text into a mask that can then be used to clip background drawing.
// First figure out how big the mask has to be. It should be no bigger than what we need
// to actually render, so we should intersect the dirty rect with the border box of the background.
- IntRect maskRect = rect;
+ LayoutRect maskRect = rect;
maskRect.intersect(paintInfo.rect);
// Now create the mask.
@@ -694,9 +694,9 @@
PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, true, 0, 0);
if (box) {
RootInlineBox* root = box->root();
- box->paint(info, IntPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
+ box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
} else {
- IntSize localOffset = isBox() ? toRenderBox(this)->locationOffset() : IntSize();
+ LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset() : LayoutSize();
paint(info, scrolledPaintRect.location() - localOffset);
}
@@ -738,7 +738,7 @@
// Paint the color first underneath all images.
if (!bgLayer->next()) {
- IntRect backgroundRect(scrolledPaintRect);
+ LayoutRect backgroundRect(scrolledPaintRect);
backgroundRect.intersect(paintInfo.rect);
// If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
Color baseColor;
@@ -763,12 +763,12 @@
// no progressive loading of the background image
if (shouldPaintBackgroundImage) {
- IntRect destRect;
- IntPoint phase;
- IntSize tileSize;
+ LayoutRect destRect;
+ LayoutPoint phase;
+ LayoutSize tileSize;
calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, destRect, phase, tileSize);
- IntPoint destOrigin = destRect.location();
+ LayoutPoint destOrigin = destRect.location();
destRect.intersect(paintInfo.rect);
if (!destRect.isEmpty()) {
phase += destRect.location() - destOrigin;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (89969 => 89970)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2011-06-28 22:41:36 UTC (rev 89970)
@@ -121,7 +121,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 paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const IntSize& = IntSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
+ 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.
virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
Modified: trunk/Source/WebCore/rendering/RenderObject.h (89969 => 89970)
--- trunk/Source/WebCore/rendering/RenderObject.h 2011-06-28 22:33:06 UTC (rev 89969)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2011-06-28 22:41:36 UTC (rev 89970)
@@ -30,6 +30,7 @@
#include "Document.h"
#include "Element.h"
#include "FloatQuad.h"
+#include "LayoutTypes.h"
#include "PaintPhase.h"
#include "RenderObjectChildList.h"
#include "RenderStyle.h"