Diff
Modified: trunk/Source/WebCore/ChangeLog (139907 => 139908)
--- trunk/Source/WebCore/ChangeLog 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/ChangeLog 2013-01-16 20:00:52 UTC (rev 139908)
@@ -1,3 +1,34 @@
+2013-01-16 Simon Fraser <[email protected]>
+
+ Allow PaintInfo to carry all PaintBehavior flags
+ https://bugs.webkit.org/show_bug.cgi?id=106980
+
+ Reviewed by Sam Weinig.
+
+ PaintInfo has a single boolean for forceBlackText, but I'll be adding additional
+ paint behaviors that I'd like to access from PaintInfo, so it makes sense for
+ PaintInfo to just include the set of PaintBehavior flags.
+
+ Also add default values in the constructor arguments for rarely used parameters.
+
+ No behavior change, no tests.
+
+ * rendering/EllipsisBox.cpp:
+ (WebCore::EllipsisBox::paint): Use the forceBlackText() function.
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paint): Call forceBlackText().
+ * rendering/PaintInfo.h:
+ (WebCore::PaintInfo::PaintInfo): Pass PaintBehavior rather than a forceBlackText boolean.
+ (WebCore::PaintInfo::forceBlackText): Return true if the behavior flags contain PaintBehaviorForceBlackText.
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintFillLayerExtended): Pass PaintBehaviorForceBlackText instead of 'true'
+ when painting for background-clip: text.
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::paintLayerContents): Pass PaintBehaviorNormal where we used to pass 'false',
+ and omit default 0 parameters.
+ * rendering/svg/SVGRenderingContext.cpp:
+ (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): PaintBehaviorNormal and remove default params.
+
2013-01-16 Tim Horton <[email protected]>
Add a missing #if to fix the Mac build sans ENABLE_CSS_FILTERS.
Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (139907 => 139908)
--- trunk/Source/WebCore/rendering/EllipsisBox.cpp 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp 2013-01-16 20:00:52 UTC (rev 139908)
@@ -51,7 +51,7 @@
paintSelection(context, paintOffset, style, font);
// Select the correct color for painting the text.
- Color foreground = paintInfo.forceBlackText ? Color::black : renderer()->selectionForegroundColor();
+ Color foreground = paintInfo.forceBlackText() ? Color::black : renderer()->selectionForegroundColor();
if (foreground.isValid() && foreground != textColor)
context->setFillColor(foreground, style->colorSpace());
}
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (139907 => 139908)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-01-16 20:00:52 UTC (rev 139908)
@@ -553,9 +553,9 @@
Color textStrokeColor;
Color emphasisMarkColor;
float textStrokeWidth = styleToUse->textStrokeWidth();
- const ShadowData* textShadow = paintInfo.forceBlackText ? 0 : styleToUse->textShadow();
+ const ShadowData* textShadow = paintInfo.forceBlackText() ? 0 : styleToUse->textShadow();
- if (paintInfo.forceBlackText) {
+ if (paintInfo.forceBlackText()) {
textFillColor = Color::black;
textStrokeColor = Color::black;
emphasisMarkColor = Color::black;
@@ -597,14 +597,14 @@
const ShadowData* selectionShadow = textShadow;
if (haveSelection) {
// Check foreground color first.
- Color foreground = paintInfo.forceBlackText ? Color::black : renderer()->selectionForegroundColor();
+ Color foreground = paintInfo.forceBlackText() ? Color::black : renderer()->selectionForegroundColor();
if (foreground.isValid() && foreground != selectionFillColor) {
if (!paintSelectedTextOnly)
paintSelectedTextSeparately = true;
selectionFillColor = foreground;
}
- Color emphasisMarkForeground = paintInfo.forceBlackText ? Color::black : renderer()->selectionEmphasisMarkColor();
+ Color emphasisMarkForeground = paintInfo.forceBlackText() ? Color::black : renderer()->selectionEmphasisMarkColor();
if (emphasisMarkForeground.isValid() && emphasisMarkForeground != selectionEmphasisMarkColor) {
if (!paintSelectedTextOnly)
paintSelectedTextSeparately = true;
@@ -612,7 +612,7 @@
}
if (RenderStyle* pseudoStyle = renderer()->getCachedPseudoStyle(SELECTION)) {
- const ShadowData* shadow = paintInfo.forceBlackText ? 0 : pseudoStyle->textShadow();
+ const ShadowData* shadow = paintInfo.forceBlackText() ? 0 : pseudoStyle->textShadow();
if (shadow != selectionShadow) {
if (!paintSelectedTextOnly)
paintSelectedTextSeparately = true;
@@ -626,7 +626,7 @@
selectionStrokeWidth = strokeWidth;
}
- Color stroke = paintInfo.forceBlackText ? Color::black : pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
+ Color stroke = paintInfo.forceBlackText() ? Color::black : pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
if (stroke != selectionStrokeColor) {
if (!paintSelectedTextOnly)
paintSelectedTextSeparately = true;
Modified: trunk/Source/WebCore/rendering/PaintInfo.h (139907 => 139908)
--- trunk/Source/WebCore/rendering/PaintInfo.h 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/rendering/PaintInfo.h 2013-01-16 20:00:52 UTC (rev 139908)
@@ -52,13 +52,13 @@
* (tx|ty) is the calculated position of the parent
*/
struct PaintInfo {
- PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText,
- RenderObject* newPaintingRoot, RenderRegion* region, ListHashSet<RenderInline*>* newOutlineObjects,
+ PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior,
+ RenderObject* newPaintingRoot = 0, RenderRegion* region = 0, ListHashSet<RenderInline*>* newOutlineObjects = 0,
OverlapTestRequestMap* overlapTestRequests = 0)
: context(newContext)
, rect(newRect)
, phase(newPhase)
- , forceBlackText(newForceBlackText)
+ , paintBehavior(newPaintBehavior)
, paintingRoot(newPaintingRoot)
, renderRegion(region)
, outlineObjects(newOutlineObjects)
@@ -83,6 +83,8 @@
return !paintingRoot || paintingRoot == renderer;
}
+ bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlackText; }
+
#if ENABLE(SVG)
void applyTransform(const AffineTransform& localToAncestorTransform)
{
@@ -104,7 +106,7 @@
GraphicsContext* context;
IntRect rect;
PaintPhase phase;
- bool forceBlackText;
+ PaintBehavior paintBehavior;
RenderObject* paintingRoot; // used to draw just one element and its visual kids
RenderRegion* renderRegion;
ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (139907 => 139908)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-01-16 20:00:52 UTC (rev 139908)
@@ -870,7 +870,7 @@
// Now add the text to the clip. We do this by painting using a special paint phase that signals to
// InlineTextBoxes that they should just add their contents to the clip.
- PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, true, 0, paintInfo.renderRegion, 0);
+ PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, paintInfo.renderRegion);
if (box) {
RootInlineBox* root = box->root();
box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (139907 => 139908)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-01-16 20:00:52 UTC (rev 139908)
@@ -3687,7 +3687,7 @@
}
// Paint the background.
- PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseBlockBackground, false, paintingRootForRenderer, localPaintingInfo.region, 0);
+ PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseBlockBackground, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region);
renderer()->paint(paintInfo, paintOffset);
if (useClipRect) {
@@ -3714,7 +3714,7 @@
PaintInfo paintInfo(context, pixelSnappedIntRect(clipRectToApply.rect()),
selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds,
- forceBlackText, paintingRootForRenderer, localPaintingInfo.region, 0);
+ forceBlackText ? PaintBehaviorForceBlackText : PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region);
renderer()->paint(paintInfo, paintOffset);
if (!selectionOnly) {
paintInfo.phase = PaintPhaseFloat;
@@ -3734,7 +3734,7 @@
if (shouldPaintOutline && !outlineRect.isEmpty()) {
// Paint our own outline
- PaintInfo paintInfo(context, pixelSnappedIntRect(outlineRect.rect()), PaintPhaseSelfOutline, false, paintingRootForRenderer, localPaintingInfo.region, 0);
+ PaintInfo paintInfo(context, pixelSnappedIntRect(outlineRect.rect()), PaintPhaseSelfOutline, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region);
clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, outlineRect, DoNotIncludeSelfForBorderRadius);
renderer()->paint(paintInfo, paintOffset);
restoreClip(context, localPaintingInfo.paintDirtyRect, outlineRect);
@@ -3770,7 +3770,7 @@
clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self.
// Paint the mask.
- PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseMask, false, paintingRootForRenderer, localPaintingInfo.region, 0);
+ PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region);
renderer()->paint(paintInfo, paintOffset);
if (useClipRect) {
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (139907 => 139908)
--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2013-01-16 19:58:43 UTC (rev 139907)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2013-01-16 20:00:52 UTC (rev 139908)
@@ -251,7 +251,7 @@
ASSERT(image);
ASSERT(image->context());
- PaintInfo info(image->context(), PaintInfo::infiniteRect(), PaintPhaseForeground, 0, 0, 0, 0);
+ PaintInfo info(image->context(), PaintInfo::infiniteRect(), PaintPhaseForeground, PaintBehaviorNormal);
AffineTransform& contentTransformation = currentContentTransformation();
AffineTransform savedContentTransformation = contentTransformation;