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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139908
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-01-16 Simon Fraser <simon.fraser@apple.com>
+
+ 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 <timothy_horton@apple.com>
Add a missing #if to fix the Mac build sans ENABLE_CSS_FILTERS.
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());
}
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;
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;
}
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;
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;
* (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)
return !paintingRoot || paintingRoot == renderer;
}
+ bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlackText; }
+
#if ENABLE(SVG)
void applyTransform(const AffineTransform& localToAncestorTransform)
{
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
// 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());
}
// 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) {
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;
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);
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) {
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;