Changeset 172110 in webkit
- Timestamp:
- Aug 5, 2014 4:40:24 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r172093 r172110 1 2014-08-05 Peyton Randolph <prandolph@apple.com> 2 3 Add the ability to force text to render in white, not just black 4 https://bugs.webkit.org/show_bug.cgi?id=135625 5 6 Reviewed by Beth Dakin. 7 8 This patch introduces PaintBehaviorForceWhiteText, a complement to PaintBehaviorForceBlackText. If 9 a client specifies both PaintBehaviorForceWhiteText and PaintBehaviorForceBlackText, the text will be 10 painted black. 11 12 No new tests. 13 14 * rendering/EllipsisBox.cpp: 15 (WebCore::EllipsisBox::paint): Use the forced text color to paint the text if requested. 16 * rendering/InlineTextBox.cpp: 17 (WebCore::InlineTextBox::paint): Disable the text shadow if a text color has been forced. 18 * rendering/PaintInfo.h: 19 (WebCore::PaintInfo::forceTextColor): 20 Return true iff the client has requested to force a black or white text color. 21 (WebCore::PaintInfo::forceWhiteText): 22 Return true iff forcing white text has been requested. 23 (WebCore::PaintInfo::forcedTextColor): 24 Return the forced text color. Currently only white and black are supported. 25 * rendering/PaintPhase.h: 26 * rendering/RenderLayer.cpp: 27 (WebCore::RenderLayer::paintLayerContents): Remove the forceBlackText-related code as it is redundant. 28 (WebCore::RenderLayer::paintForegroundForFragments): 29 Remove forceBlackText parameter and infer the correct behavior from the given paint behavior. 30 * rendering/RenderLayer.h: 31 * rendering/TextPaintStyle.cpp: 32 (WebCore::computeTextPaintStyle): Use the forced text color if available. 33 (WebCore::computeTextSelectionPaintStyle): Use the forced text color if available. 34 1 35 2014-08-05 Alex Christensen <achristensen@webkit.org> 2 36 -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r168528 r172110 60 60 61 61 // Select the correct color for painting the text. 62 Color foreground = paintInfo.force BlackText() ? Color::black: blockFlow().selectionForegroundColor();62 Color foreground = paintInfo.forceTextColor() ? paintInfo.forcedTextColor() : blockFlow().selectionForegroundColor(); 63 63 if (foreground.isValid() && foreground != textColor) 64 64 context->setFillColor(foreground, lineStyle.colorSpace()); -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r172008 r172110 629 629 emphasisMarkOffset = emphasisMarkAbove ? -font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fontMetrics().descent() + font.emphasisMarkAscent(emphasisMark); 630 630 631 const ShadowData* textShadow = paintInfo.forceBlackText() ? 0: lineStyle.textShadow();631 const ShadowData* textShadow = (paintInfo.forceTextColor()) ? nullptr : lineStyle.textShadow(); 632 632 633 633 FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent()); -
trunk/Source/WebCore/rendering/PaintInfo.h
r168967 r172110 81 81 } 82 82 83 bool forceTextColor() const { return forceBlackText() || forceWhiteText(); } 83 84 bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlackText; } 85 bool forceWhiteText() const { return paintBehavior & PaintBehaviorForceWhiteText; } 86 Color forcedTextColor() const { return (forceBlackText()) ? Color::black : Color::white; } 84 87 85 88 bool skipRootBackground() const { return paintBehavior & PaintBehaviorSkipRootBackground; } -
trunk/Source/WebCore/rendering/PaintPhase.h
r140068 r172110 57 57 PaintBehaviorSelectionOnly = 1 << 0, 58 58 PaintBehaviorForceBlackText = 1 << 1, 59 PaintBehaviorFlattenCompositingLayers = 1 << 2, 60 PaintBehaviorRenderingSVGMask = 1 << 3, 61 PaintBehaviorSkipRootBackground = 1 << 4, 62 PaintBehaviorRootBackgroundOnly = 1 << 5 59 PaintBehaviorForceWhiteText = 1 << 2, 60 PaintBehaviorFlattenCompositingLayers = 1 << 3, 61 PaintBehaviorRenderingSVGMask = 1 << 4, 62 PaintBehaviorSkipRootBackground = 1 << 5, 63 PaintBehaviorRootBackgroundOnly = 1 << 6, 63 64 }; 64 65 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r172008 r172110 4048 4048 performOverlapTests(*localPaintingInfo.overlapTestRequests, localPaintingInfo.rootLayer, this); 4049 4049 4050 bool forceBlackText = localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText;4051 4050 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionOnly; 4052 4051 … … 4088 4087 if (shouldPaintContent) 4089 4088 paintForegroundForFragments(layerFragments, context, transparencyLayerContext, paintingInfo.paintDirtyRect, haveTransparency, 4090 localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly , forceBlackText);4089 localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly); 4091 4090 } 4092 4091 … … 4429 4428 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragments, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 4430 4429 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 4431 RenderObject* subtreePaintRootForRenderer, bool selectionOnly , bool forceBlackText)4430 RenderObject* subtreePaintRootForRenderer, bool selectionOnly) 4432 4431 { 4433 4432 // Begin transparency if we have something to paint. … … 4441 4440 } 4442 4441 } 4443 4444 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBehaviorForceBlackText : paintBehavior; 4442 4443 PaintBehavior localPaintBehavior; 4444 if (localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText) 4445 localPaintBehavior = PaintBehaviorForceBlackText; 4446 else if (localPaintingInfo.paintBehavior & PaintBehaviorForceWhiteText) 4447 localPaintBehavior = PaintBehaviorForceWhiteText; 4448 else 4449 localPaintBehavior = paintBehavior; 4445 4450 4446 4451 // Optimize clipping for the single fragment case. -
trunk/Source/WebCore/rendering/RenderLayer.h
r171896 r172110 1005 1005 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, GraphicsContext* transparencyLayerContext, 1006 1006 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer, 1007 bool selectionOnly , bool forceBlackText);1007 bool selectionOnly); 1008 1008 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); 1009 1009 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); -
trunk/Source/WebCore/rendering/TextPaintStyle.cpp
r158803 r172110 81 81 paintStyle.strokeWidth = lineStyle.textStrokeWidth(); 82 82 83 if (paintInfo.force BlackText()) {84 paintStyle.fillColor = Color::black;85 paintStyle.strokeColor = Color::black;86 paintStyle.emphasisMarkColor = Color::black;83 if (paintInfo.forceTextColor()) { 84 paintStyle.fillColor = paintInfo.forcedTextColor(); 85 paintStyle.strokeColor = paintInfo.forcedTextColor(); 86 paintStyle.emphasisMarkColor = paintInfo.forcedTextColor(); 87 87 return paintStyle; 88 88 } … … 120 120 paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); 121 121 paintSelectedTextSeparately = false; 122 selectionShadow = paintInfo.forceBlackText() ? nullptr : lineStyle.textShadow();122 selectionShadow = (paintInfo.forceTextColor()) ? nullptr : lineStyle.textShadow(); 123 123 124 124 TextPaintStyle selectionPaintStyle = textPaintStyle; 125 125 126 126 #if ENABLE(TEXT_SELECTION) 127 Color foreground = paintInfo.force BlackText() ? Color::black: renderer.selectionForegroundColor();127 Color foreground = paintInfo.forceTextColor() ? paintInfo.forcedTextColor() : renderer.selectionForegroundColor(); 128 128 if (foreground.isValid() && foreground != selectionPaintStyle.fillColor) { 129 129 if (!paintSelectedTextOnly) … … 132 132 } 133 133 134 Color emphasisMarkForeground = paintInfo.force BlackText() ? Color::black: renderer.selectionEmphasisMarkColor();134 Color emphasisMarkForeground = paintInfo.forceTextColor() ? paintInfo.forcedTextColor() : renderer.selectionEmphasisMarkColor(); 135 135 if (emphasisMarkForeground.isValid() && emphasisMarkForeground != selectionPaintStyle.emphasisMarkColor) { 136 136 if (!paintSelectedTextOnly) … … 140 140 141 141 if (RenderStyle* pseudoStyle = renderer.getCachedPseudoStyle(SELECTION)) { 142 const ShadowData* shadow = paintInfo.force BlackText() ? 0: pseudoStyle->textShadow();142 const ShadowData* shadow = paintInfo.forceTextColor() ? nullptr : pseudoStyle->textShadow(); 143 143 if (shadow != selectionShadow) { 144 144 if (!paintSelectedTextOnly) … … 154 154 } 155 155 156 Color stroke = paintInfo.force BlackText() ? Color::black: pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);156 Color stroke = paintInfo.forceTextColor() ? paintInfo.forcedTextColor() : pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextStrokeColor); 157 157 if (stroke != selectionPaintStyle.strokeColor) { 158 158 if (!paintSelectedTextOnly)
Note: See TracChangeset
for help on using the changeset viewer.