Index: Source/core/rendering/InlineTextBox.cpp |
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp |
index 5bf59ce01c682b78c6ee0b46257a3f9379f52c22..0fb900608a05ecf14d9e4f5db9551bfe9108a51c 100644 |
--- a/Source/core/rendering/InlineTextBox.cpp |
+++ b/Source/core/rendering/InlineTextBox.cpp |
@@ -50,7 +50,6 @@ |
#include "platform/fonts/FontCache.h" |
#include "platform/fonts/GlyphBuffer.h" |
#include "platform/fonts/WidthIterator.h" |
-#include "platform/graphics/DrawLooperBuilder.h" |
#include "platform/graphics/GraphicsContextStateSaver.h" |
#include "wtf/Vector.h" |
#include "wtf/text/CString.h" |
@@ -388,28 +387,16 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re |
} |
static void paintTextWithShadows(GraphicsContext* context, |
- const RenderObject& renderer, const Font& font, const TextRun& textRun, |
+ const Font& font, const TextRun& textRun, |
const AtomicString& emphasisMark, int emphasisMarkOffset, |
int startOffset, int endOffset, int truncationPoint, |
const FloatPoint& textOrigin, const FloatRect& boxRect, |
- const ShadowList* shadowList, bool stroked, bool horizontal) |
+ const ShadowList* shadowList, bool horizontal) |
{ |
// Text shadows are disabled when printing. http://crbug.com/258321 |
bool hasShadow = shadowList && !context->printing(); |
- |
- if (hasShadow) { |
- OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); |
- for (size_t i = shadowList->shadows().size(); i--; ) { |
- const ShadowData& shadow = shadowList->shadows()[i]; |
- float shadowX = horizontal ? shadow.x() : shadow.y(); |
- float shadowY = horizontal ? shadow.y() : -shadow.x(); |
- FloatSize offset(shadowX, shadowY); |
- drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(), |
- DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha); |
- } |
- drawLooperBuilder->addUnmodifiedContent(); |
- context->setDrawLooper(drawLooperBuilder.release()); |
- } |
+ if (hasShadow) |
+ context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::ShadowIgnoresAlpha, horizontal)); |
TextRunPaintInfo textRunPaintInfo(textRun); |
textRunPaintInfo.bounds = boxRect; |
@@ -519,9 +506,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
} |
GraphicsContext* context = paintInfo.context; |
- |
- RenderObject& rendererToUse = renderer(); |
- RenderStyle* styleToUse = rendererToUse.style(isFirstLineStyle()); |
+ RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); |
adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? 0 : -logicalHeight()); |
@@ -553,7 +538,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
textStrokeColor = Color::black; |
emphasisMarkColor = Color::black; |
} else { |
- textFillColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebkitTextFillColor); |
+ textFillColor = renderer().resolveColor(styleToUse, CSSPropertyWebkitTextFillColor); |
bool forceBackgroundToWhite = false; |
if (isPrinting) { |
@@ -567,13 +552,13 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
if (forceBackgroundToWhite) |
textFillColor = correctedTextColor(textFillColor, Color::white); |
- textStrokeColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebkitTextStrokeColor); |
+ textStrokeColor = renderer().resolveColor(styleToUse, CSSPropertyWebkitTextStrokeColor); |
// Make the text stroke color legible against a white background |
if (forceBackgroundToWhite) |
textStrokeColor = correctedTextColor(textStrokeColor, Color::white); |
- emphasisMarkColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebkitTextEmphasisColor); |
+ emphasisMarkColor = renderer().resolveColor(styleToUse, CSSPropertyWebkitTextEmphasisColor); |
// Make the text stroke color legible against a white background |
if (forceBackgroundToWhite) |
@@ -620,7 +605,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
selectionStrokeWidth = strokeWidth; |
} |
- Color stroke = paintInfo.forceBlackText() ? Color::black : rendererToUse.resolveColor(pseudoStyle, CSSPropertyWebkitTextStrokeColor); |
+ Color stroke = paintInfo.forceBlackText() ? Color::black : renderer().resolveColor(pseudoStyle, CSSPropertyWebkitTextStrokeColor); |
if (stroke != selectionStrokeColor) { |
if (!paintSelectedTextOnly) |
paintSelectedTextSeparately = true; |
@@ -695,9 +680,9 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth); |
if (!paintSelectedTextSeparately || ePos <= sPos) { |
// FIXME: Truncate right-to-left text correctly. |
- paintTextWithShadows(context, rendererToUse, font, textRun, nullAtom, 0, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal()); |
+ paintTextWithShadows(context, font, textRun, nullAtom, 0, 0, length, length, textOrigin, boxRect, textShadow, isHorizontal()); |
} else { |
- paintTextWithShadows(context, rendererToUse, font, textRun, nullAtom, 0, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal()); |
+ paintTextWithShadows(context, font, textRun, nullAtom, 0, ePos, sPos, length, textOrigin, boxRect, textShadow, isHorizontal()); |
} |
if (!emphasisMark.isEmpty()) { |
@@ -721,7 +706,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
endOffset = sPos; |
} |
// FIXME: Truncate right-to-left text correctly. |
- paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal()); |
+ paintTextWithShadows(context, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, textShadow, isHorizontal()); |
if (combinedText) |
context->concatCTM(rotation(boxRect, Counterclockwise)); |
@@ -733,7 +718,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
GraphicsContextStateSaver stateSaver(*context, selectionStrokeWidth > 0); |
updateGraphicsContext(context, selectionFillColor, selectionStrokeColor, selectionStrokeWidth); |
- paintTextWithShadows(context, rendererToUse, font, textRun, nullAtom, 0, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal()); |
+ paintTextWithShadows(context, font, textRun, nullAtom, 0, sPos, ePos, length, textOrigin, boxRect, selectionShadow, isHorizontal()); |
if (!emphasisMark.isEmpty()) { |
updateGraphicsContext(context, selectionEmphasisMarkColor, textStrokeColor, textStrokeWidth); |
@@ -746,7 +731,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
int startOffset = combinedText ? 0 : sPos; |
int endOffset = combinedText ? objectReplacementCharacterTextRun.length() : ePos; |
int paintRunLength = combinedText ? endOffset : length; |
- paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal()); |
+ paintTextWithShadows(context, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, selectionShadow, isHorizontal()); |
if (combinedText) |
context->concatCTM(rotation(boxRect, Counterclockwise)); |