| Index: Source/core/rendering/EllipsisBox.cpp
 | 
| diff --git a/Source/core/rendering/EllipsisBox.cpp b/Source/core/rendering/EllipsisBox.cpp
 | 
| index 9d49989f46eabfaeaa849de044d9025b853bb039..cdd315c503344abca7a1e9948297b541e661c4c8 100644
 | 
| --- a/Source/core/rendering/EllipsisBox.cpp
 | 
| +++ b/Source/core/rendering/EllipsisBox.cpp
 | 
| @@ -21,6 +21,7 @@
 | 
|  #include "core/rendering/EllipsisBox.h"
 | 
|  
 | 
|  #include "core/dom/Document.h"
 | 
| +#include "core/platform/graphics/DrawLooper.h"
 | 
|  #include "core/platform/graphics/Font.h"
 | 
|  #include "core/platform/graphics/GraphicsContextStateSaver.h"
 | 
|  #include "core/platform/graphics/TextRun.h"
 | 
| @@ -29,6 +30,8 @@
 | 
|  #include "core/rendering/PaintInfo.h"
 | 
|  #include "core/rendering/RenderBlock.h"
 | 
|  #include "core/rendering/RootInlineBox.h"
 | 
| +#include "core/rendering/style/ShadowData.h"
 | 
| +#include "wtf/Vector.h"
 | 
|  
 | 
|  #include <algorithm>
 | 
|  
 | 
| @@ -53,8 +56,29 @@ void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
 | 
|              actualTextColor = foreground;
 | 
|      }
 | 
|  
 | 
| -    // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
 | 
|      const ShadowData* shadow = style->textShadow();
 | 
| +    bool hasShadow = !!shadow;
 | 
| +    if (hasShadow) {
 | 
| +        // FIXME: it would be better if we could get the shadows top-to-bottom from the style.
 | 
| +        Vector<const ShadowData*, 4> shadows;
 | 
| +        do {
 | 
| +            shadows.append(shadow);
 | 
| +        } while (shadow = shadow->next());
 | 
| +
 | 
| +        DrawLooper drawLooper;
 | 
| +        drawLooper.addUnmodifiedContent();
 | 
| +        for (int i = shadows.size() - 1; i >= 0; i--) {
 | 
| +            shadow = shadows[i];
 | 
| +            int shadowX = isHorizontal() ? shadow->x() : shadow->y();
 | 
| +            int shadowY = isHorizontal() ? shadow->y() : -shadow->x();
 | 
| +            FloatSize offset(shadowX, shadowY);
 | 
| +            drawLooper.addShadow(offset, shadow->blur(), shadow->color(),
 | 
| +                DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresAlpha);
 | 
| +        }
 | 
| +        context->setDrawLooper(drawLooper);
 | 
| +    }
 | 
| +
 | 
| +    // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
 | 
|      FloatPoint boxOrigin(paintOffset);
 | 
|      boxOrigin.move(x(), y());
 | 
|      FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight()));
 | 
| @@ -62,47 +86,15 @@ void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
 | 
|      TextRun textRun = RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
 | 
|      TextRunPaintInfo textRunPaintInfo(textRun);
 | 
|      textRunPaintInfo.bounds = FloatRect(boxOrigin, FloatSize(logicalWidth(), logicalHeight()));
 | 
| -
 | 
| -    bool opaque = actualTextColor.alpha() == 255;
 | 
| -    if (!opaque)
 | 
| -        context->setFillColor(Color::black, style->colorSpace());
 | 
| -    else
 | 
| -        context->setFillColor(actualTextColor, style->colorSpace());
 | 
| -
 | 
| -    do {
 | 
| -        IntSize extraOffset;
 | 
| -        if (shadow) {
 | 
| -            FloatSize shadowOffset(shadow->x(), shadow->y());
 | 
| -            if (shadow->next() || !opaque) {
 | 
| -                FloatRect shadowRect(boxRect);
 | 
| -                shadowRect.inflate(shadow->blur());
 | 
| -                shadowRect.move(shadowOffset);
 | 
| -                context->save();
 | 
| -                context->clip(shadowRect);
 | 
| -                extraOffset = IntSize(0, 2 * boxRect.height() + std::max(0.0f, shadowOffset.height()) + shadow->blur());
 | 
| -                shadowOffset -= extraOffset;
 | 
| -            }
 | 
| -            context->setShadow(shadowOffset, shadow->blur(), shadow->color(), style->colorSpace());
 | 
| -        } else if (!opaque)
 | 
| -            context->setFillColor(actualTextColor, style->colorSpace());
 | 
| -
 | 
| -        context->drawText(font, textRunPaintInfo, textOrigin + extraOffset);
 | 
| -
 | 
| -        if (!shadow)
 | 
| -            break;
 | 
| -
 | 
| -        if (shadow->next() || !opaque)
 | 
| -            context->restore();
 | 
| -        else
 | 
| -            context->clearShadow();
 | 
| -
 | 
| -        shadow = shadow->next();
 | 
| -    } while (shadow || !opaque);
 | 
| +    context->drawText(font, textRunPaintInfo, textOrigin);
 | 
|  
 | 
|      // Restore the regular fill color.
 | 
|      if (textColor != context->fillColor())
 | 
|          context->setFillColor(textColor, style->colorSpace());
 | 
|  
 | 
| +    if (hasShadow)
 | 
| +        context->clearDrawLooper();
 | 
| +
 | 
|      paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
 | 
|  }
 | 
|  
 | 
| 
 |