Chromium Code Reviews| Index: Source/core/rendering/InlineTextBox.cpp |
| diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp |
| index 5bf59ce01c682b78c6ee0b46257a3f9379f52c22..d59ad8c72e4234120e26be5c6f450ff101391554 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; |
| @@ -695,9 +682,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()); |
|
f(malita)
2014/06/27 14:29:47
Since we're at it, I find "rendererToUse" somewhat
jbroman
2014/06/27 15:07:00
Fair enough (for history, this variable dates back
|
| + 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 +708,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 +720,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 +733,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)); |