Changeset 54556 in webkit


Ignore:
Timestamp:
Feb 9, 2010 8:53:07 AM (14 years ago)
Author:
Nikolas Zimmermann
Message:

2010-02-09 MORITA Hajime <morrita@gmail.com>

Reviewed by Nikolas Zimmermann.

SVG selection text foreground colour does not respect user settings
https://bugs.webkit.org/show_bug.cgi?id=15997

Add two subphases SVGTextPaintSubphaseGlyphFillSelection and
SVGTextPaintSubphaseGlyphStrokeSelection for painting selected
text on SVG. Selected texts are painted with style from
getCachedPseudoStyle() instead of style().


Tests: svg/text/selection-styles.xhtml

  • rendering/SVGCharacterLayoutInfo.h: (WebCore::SVGTextChunkWalker::SVGTextChunkWalker): (WebCore::SVGTextChunkWalker::setupFillSelection): (WebCore::SVGTextChunkWalker::setupStrokeSelection):
  • rendering/SVGRootInlineBox.cpp: (WebCore::SVGRootInlineBoxPaintWalker::mayHaveSelection): (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupFillSelectionCallback): (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupStrokeSelectionCallback): (WebCore::SVGRootInlineBoxPaintWalker::activePaintServer): (WebCore::SVGRootInlineBox::paint): (WebCore::SVGRootInlineBox::walkTextChunks):
  • rendering/SVGInlineTextBox.h: (WebCore::): Add callback hooks and its implementation for handle new subphases.


  • rendering/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::chunkSelectionStartEnd): (WebCore::SVGInlineTextBox::paintCharacters): Split box text into selected part and non-selected part, and use separate subphases to paint them.


  • svg/SVGFont.cpp: (WebCore::SVGTextRunWalker::walk): Relax ASSERT() condition to accept a part of text.


  • svg/graphics/SVGPaintServer.cpp: (WebCore::applyStrokeStyleToContext): (WebCore::SVGPaintServer::setup):
  • svg/graphics/SVGPaintServer.h:
  • svg/graphics/SVGPaintServerGradient.cpp: (WebCore::SVGPaintServerGradient::setup):
  • svg/graphics/SVGPaintServerGradient.h:
  • svg/graphics/SVGPaintServerPattern.cpp: (WebCore::SVGPaintServerPattern::setup):
  • svg/graphics/SVGPaintServerPattern.h:
  • svg/graphics/SVGPaintServerSolid.cpp: (WebCore::SVGPaintServerSolid::setup):
  • svg/graphics/SVGPaintServerSolid.h: Change setup() signature to accept RenderStyle instead of always using RenderObject::style().

2010-02-09 MORITA Hajime <morrita@gmail.com>

Reviewed by Nikolas Zimmermann.

SVG selection text foreground colour does not respect user settings
https://bugs.webkit.org/show_bug.cgi?id=15997

Add two subphases SVGTextPaintSubphaseGlyphFillSelection and
SVGTextPaintSubphaseGlyphStrokeSelection for painting SVG text
selection. texts are painted with style from getCachedPseudoStyle() instead of style().

  • platform/mac/svg/text/selection-styles-expected.checksum: Added.
  • platform/mac/svg/text/selection-styles-expected.png: Added.
  • platform/mac/svg/text/selection-styles-expected.txt: Added.
  • platform/mac/svg/text/text-deco-01-b-expected.checksum: Updated pixel tests to account for marginal painting differences.
  • platform/mac/svg/text/text-deco-01-b-expected.png: Ditto.
  • platform/mac/svg/text/text-path-01-b-expected.checksum: Dito.
  • platform/mac/svg/text/text-path-01-b-expected.png: Ditto.
  • platform/mac/svg/text/text-text-03-b-expected.checksum: Ditto.
  • platform/mac/svg/text/text-text-03-b-expected.png: Ditto.
  • svg/text/selection-styles.xhtml: Added.
Location:
trunk
Files:
4 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r54551 r54556  
     12010-02-09  MORITA Hajime  <morrita@gmail.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG selection text foreground colour does not respect user settings
     6        https://bugs.webkit.org/show_bug.cgi?id=15997
     7
     8        Add two subphases SVGTextPaintSubphaseGlyphFillSelection and
     9        SVGTextPaintSubphaseGlyphStrokeSelection for painting SVG text
     10        selection. texts are painted with style from getCachedPseudoStyle() instead of style().
     11
     12        * platform/mac/svg/text/selection-styles-expected.checksum: Added.
     13        * platform/mac/svg/text/selection-styles-expected.png: Added.
     14        * platform/mac/svg/text/selection-styles-expected.txt: Added.
     15        * platform/mac/svg/text/text-deco-01-b-expected.checksum: Updated pixel tests to account for marginal painting differences.
     16        * platform/mac/svg/text/text-deco-01-b-expected.png: Ditto.
     17        * platform/mac/svg/text/text-path-01-b-expected.checksum: Dito.
     18        * platform/mac/svg/text/text-path-01-b-expected.png: Ditto.
     19        * platform/mac/svg/text/text-text-03-b-expected.checksum: Ditto.
     20        * platform/mac/svg/text/text-text-03-b-expected.png: Ditto.
     21        * svg/text/selection-styles.xhtml: Added.
     22
    1232010-02-09  Nikolas Zimmermann  <nzimmermann@rim.com>
    224
  • trunk/LayoutTests/platform/mac/svg/text/text-deco-01-b-expected.checksum

    r53070 r54556  
    1 84af7660597ced8a114bbdcd4972a174
     14f36848813cb87d756d9d1d55e96512e
  • trunk/LayoutTests/platform/mac/svg/text/text-path-01-b-expected.checksum

    r53070 r54556  
    1 9d489dcf1db67dbd4eed1d02b5885e2c
     105a3accd486710d5a5d9cdcd47c253ae
  • trunk/LayoutTests/platform/mac/svg/text/text-text-03-b-expected.checksum

    r53070 r54556  
    1 4472074ea6f69b13c6860505b59b8d4e
     15cbc1204e81a97fcd388f7eb175a9b29
  • trunk/WebCore/ChangeLog

    r54551 r54556  
     12010-02-09  MORITA Hajime  <morrita@gmail.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG selection text foreground colour does not respect user settings
     6        https://bugs.webkit.org/show_bug.cgi?id=15997
     7
     8        Add two subphases SVGTextPaintSubphaseGlyphFillSelection and
     9        SVGTextPaintSubphaseGlyphStrokeSelection for painting selected
     10        text on SVG. Selected texts are painted with style from
     11        getCachedPseudoStyle() instead of style().
     12       
     13        Tests: svg/text/selection-styles.xhtml
     14
     15        * rendering/SVGCharacterLayoutInfo.h:
     16        (WebCore::SVGTextChunkWalker::SVGTextChunkWalker):
     17        (WebCore::SVGTextChunkWalker::setupFillSelection):
     18        (WebCore::SVGTextChunkWalker::setupStrokeSelection):
     19        * rendering/SVGRootInlineBox.cpp:
     20        (WebCore::SVGRootInlineBoxPaintWalker::mayHaveSelection):
     21        (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupFillSelectionCallback):
     22        (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupStrokeSelectionCallback):
     23        (WebCore::SVGRootInlineBoxPaintWalker::activePaintServer):
     24        (WebCore::SVGRootInlineBox::paint):
     25        (WebCore::SVGRootInlineBox::walkTextChunks):
     26        * rendering/SVGInlineTextBox.h:
     27        (WebCore::):       
     28        Add callback hooks and its implementation for handle new
     29        subphases.
     30       
     31        * rendering/SVGInlineTextBox.cpp:
     32        (WebCore::SVGInlineTextBox::chunkSelectionStartEnd):
     33        (WebCore::SVGInlineTextBox::paintCharacters):
     34        Split box text into selected part and non-selected part, and use
     35        separate subphases to paint them.
     36       
     37        * svg/SVGFont.cpp:
     38        (WebCore::SVGTextRunWalker::walk):
     39        Relax ASSERT() condition to accept a part of text.
     40       
     41        * svg/graphics/SVGPaintServer.cpp:
     42        (WebCore::applyStrokeStyleToContext):
     43        (WebCore::SVGPaintServer::setup):
     44        * svg/graphics/SVGPaintServer.h:
     45        * svg/graphics/SVGPaintServerGradient.cpp:
     46        (WebCore::SVGPaintServerGradient::setup):
     47        * svg/graphics/SVGPaintServerGradient.h:
     48        * svg/graphics/SVGPaintServerPattern.cpp:
     49        (WebCore::SVGPaintServerPattern::setup):
     50        * svg/graphics/SVGPaintServerPattern.h:
     51        * svg/graphics/SVGPaintServerSolid.cpp:
     52        (WebCore::SVGPaintServerSolid::setup):
     53        * svg/graphics/SVGPaintServerSolid.h:
     54        Change setup() signature to accept RenderStyle instead of always
     55        using RenderObject::style().
     56
    1572010-02-09  Nikolas Zimmermann  <nzimmermann@rim.com>
    258
  • trunk/WebCore/rendering/SVGCharacterLayoutInfo.h

    r54503 r54556  
    301301    virtual bool setupBackground(InlineBox*) = 0;
    302302    virtual bool setupFill(InlineBox*) = 0;
     303    virtual bool setupFillSelection(InlineBox*) = 0;
    303304    virtual bool setupStroke(InlineBox*) = 0;
     305    virtual bool setupStrokeSelection(InlineBox*) = 0;
    304306    virtual bool setupForeground(InlineBox*) = 0;
    305307};
     
    329331                       SVGTextChunkSetupBackgroundCallback background = 0,
    330332                       SVGTextChunkSetupFillCallback fill = 0,
     333                       SVGTextChunkSetupFillCallback fillSelection = 0,
    331334                       SVGTextChunkSetupStrokeCallback stroke = 0,
     335                       SVGTextChunkSetupStrokeCallback strokeSelection = 0,
    332336                       SVGTextChunkSetupForegroundCallback foreground = 0)
    333337        : m_object(object)
     
    337341        , m_setupBackgroundCallback(background)
    338342        , m_setupFillCallback(fill)
     343        , m_setupFillSelectionCallback(fillSelection)
    339344        , m_setupStrokeCallback(stroke)
     345        , m_setupStrokeSelectionCallback(strokeSelection)
    340346        , m_setupForegroundCallback(foreground)
    341347    {
     
    385391    }
    386392
     393    virtual bool setupFillSelection(InlineBox* box)
     394    {
     395        if (m_setupFillSelectionCallback)
     396            return (*m_object.*m_setupFillSelectionCallback)(box);
     397
     398        ASSERT_NOT_REACHED();
     399        return false;
     400    }
     401
    387402    virtual bool setupStroke(InlineBox* box)
    388403    {
    389404        if (m_setupStrokeCallback)
    390405            return (*m_object.*m_setupStrokeCallback)(box);
     406
     407        ASSERT_NOT_REACHED();
     408        return false;
     409    }
     410
     411    virtual bool setupStrokeSelection(InlineBox* box)
     412    {
     413        if (m_setupStrokeSelectionCallback)
     414            return (*m_object.*m_setupStrokeSelectionCallback)(box);
    391415
    392416        ASSERT_NOT_REACHED();
     
    410434    SVGTextChunkSetupBackgroundCallback m_setupBackgroundCallback;
    411435    SVGTextChunkSetupFillCallback m_setupFillCallback;
     436    SVGTextChunkSetupFillCallback m_setupFillSelectionCallback;
    412437    SVGTextChunkSetupStrokeCallback m_setupStrokeCallback;
     438    SVGTextChunkSetupStrokeCallback m_setupStrokeSelectionCallback;
    413439    SVGTextChunkSetupForegroundCallback m_setupForegroundCallback;
    414440};
  • trunk/WebCore/rendering/SVGInlineTextBox.cpp

    r54503 r54556  
    323323}
    324324
     325bool SVGInlineTextBox::chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd)
     326{
     327    // NOTE: We ignore SVGInlineTextBox::m_start here because it is always 0.
     328    //       Curently SVG doesn't use HTML block-level layout, in which m_start would be set.
     329
     330    int chunkStart = chunk - textRenderer()->characters();
     331    ASSERT(0 <= chunkStart);   
     332
     333    selectionStartEnd(selectionStart, selectionEnd);
     334    if (selectionEnd <= chunkStart)
     335        return false;
     336    if (chunkStart + chunkLength <= selectionStart)
     337        return false;
     338
     339    // Map indices from view-global to chunk-local.
     340    selectionStart -= chunkStart;
     341    selectionEnd -= chunkStart;
     342    // Then clamp with chunk range
     343    if (selectionStart < 0)
     344        selectionStart = 0;
     345    if (chunkLength < selectionEnd)
     346        selectionEnd = chunkLength;
     347
     348    return selectionStart < selectionEnd;
     349}
     350
    325351void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int tx, int ty, const SVGChar& svgChar, const UChar* chars, int length, SVGTextPaintInfo& textPaintInfo)
    326352{
     
    375401    }
    376402
    377     if  (textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFill || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStroke) {
     403    bool isGlyphPhase = textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFill || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStroke;
     404    bool isSelectionGlyphPhase = textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFillSelection || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStrokeSelection;
     405
     406    if  (isGlyphPhase || isSelectionGlyphPhase) {
    378407        // Set a text shadow if we have one.
    379408        // FIXME: Support multiple shadow effects.  Need more from the CG API before
     
    397426#endif
    398427
    399         paintInfo.context->drawText(font, run, origin);
     428        int selectionStart = 0;
     429        int selectionEnd = 0;
     430        bool haveSelectedRange = haveSelection && chunkSelectionStartEnd(chars, length, selectionStart, selectionEnd);
     431       
     432        if (isGlyphPhase) {
     433            if (haveSelectedRange) {
     434                paintInfo.context->drawText(font, run, origin, 0, selectionStart);
     435                paintInfo.context->drawText(font, run, origin, selectionEnd, run.length());
     436            } else
     437                paintInfo.context->drawText(font, run, origin);
     438        } else {
     439            ASSERT(isSelectionGlyphPhase);
     440            if (haveSelectedRange)
     441                paintInfo.context->drawText(font, run, origin, selectionStart, selectionEnd);
     442        }
    400443
    401444        if (setShadow)
  • trunk/WebCore/rendering/SVGInlineTextBox.h

    r52904 r54556  
    3636        SVGTextPaintSubphaseBackground,
    3737        SVGTextPaintSubphaseGlyphFill,
     38        SVGTextPaintSubphaseGlyphFillSelection,
    3839        SVGTextPaintSubphaseGlyphStroke,
     40        SVGTextPaintSubphaseGlyphStrokeSelection,
    3941        SVGTextPaintSubphaseForeground
    4042    };
     
    8486        friend class RenderSVGInlineText;
    8587        bool svgCharacterHitsPosition(int x, int y, int& offset) const;
     88        bool chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd);
    8689       
    8790        int m_height;
  • trunk/WebCore/rendering/SVGRootInlineBox.cpp

    r54503 r54556  
    364364    }
    365365
     366    bool mayHaveSelection(InlineBox* box) const
     367    {
     368        int selectionStart = 0, selectionEnd = 0;
     369        box->renderer()->selectionStartEnd(selectionStart, selectionEnd);
     370        return selectionStart < selectionEnd;
     371    }
     372
    366373    void teardownFillPaintServer()
    367374    {
     
    458465    }
    459466
     467    bool chunkSetupFillSelectionCallback(InlineBox* box)
     468    {
     469        InlineFlowBox* flowBox = box->parent();
     470
     471        // Setup fill paint server
     472        RenderObject* object = flowBox->renderer();
     473        ASSERT(object);
     474        RenderStyle* style = object->getCachedPseudoStyle(SELECTION);
     475        if (!style)
     476            style = object->style();
     477
     478        ASSERT(!m_strokePaintServer);
     479        teardownFillPaintServer();
     480
     481        if (!mayHaveSelection(box))
     482            return false;
     483
     484        m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFillSelection;
     485        m_fillPaintServer = SVGPaintServer::fillPaintServer(style, object);
     486        if (m_fillPaintServer) {
     487            m_fillPaintServer->setup(m_paintInfo.context, object, style, ApplyToFillTargetType, true);
     488            m_fillPaintServerObject = object;
     489            return true;
     490        }
     491
     492        return false;
     493    }
     494
    460495    bool chunkSetupStrokeCallback(InlineBox* box)
    461496    {
     
    482517    }
    483518
     519    bool chunkSetupStrokeSelectionCallback(InlineBox* box)
     520    {
     521        InlineFlowBox* flowBox = box->parent();
     522
     523        // Setup stroke paint server
     524        RenderObject* object = flowBox->renderer();
     525        ASSERT(object);
     526        RenderStyle* style = object->getCachedPseudoStyle(SELECTION);
     527        if (!style)
     528            style = object->style();
     529
     530        // If we're both stroked & filled, teardown fill paint server before stroking.
     531        teardownFillPaintServer();
     532        teardownStrokePaintServer();
     533
     534        if (!mayHaveSelection(box))
     535            return false;
     536
     537        m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStrokeSelection;
     538        m_strokePaintServer = SVGPaintServer::strokePaintServer(style, object);
     539        if (m_strokePaintServer) {
     540            m_strokePaintServer->setup(m_paintInfo.context, object, style, ApplyToStrokeTargetType, true);
     541            m_strokePaintServerObject = object;
     542            return true;
     543        }
     544
     545        return false;
     546    }
     547
    484548    bool chunkSetupForegroundCallback(InlineBox* /*box*/)
    485549    {
     
    496560        switch (m_textPaintInfo.subphase) {
    497561        case SVGTextPaintSubphaseGlyphFill:
     562        case SVGTextPaintSubphaseGlyphFillSelection:
    498563            ASSERT(m_fillPaintServer);
    499564            return m_fillPaintServer;
    500565        case SVGTextPaintSubphaseGlyphStroke:
     566        case SVGTextPaintSubphaseGlyphStrokeSelection:
    501567            ASSERT(m_strokePaintServer);
    502568            return m_strokePaintServer;
     
    617683                                                               &SVGRootInlineBoxPaintWalker::chunkSetupBackgroundCallback,
    618684                                                               &SVGRootInlineBoxPaintWalker::chunkSetupFillCallback,
     685                                                               &SVGRootInlineBoxPaintWalker::chunkSetupFillSelectionCallback,
    619686                                                               &SVGRootInlineBoxPaintWalker::chunkSetupStrokeCallback,
     687                                                               &SVGRootInlineBoxPaintWalker::chunkSetupStrokeSelectionCallback,
    620688                                                               &SVGRootInlineBoxPaintWalker::chunkSetupForegroundCallback);
    621689
     
    17201788                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
    17211789
     1790                if (walker->setupFillSelection(range.box))
     1791                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
     1792
    17221793                if (walker->setupStroke(range.box))
    17231794                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
    17241795
     1796                if (walker->setupStrokeSelection(range.box))
     1797                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
     1798
    17251799                if (walker->setupForeground(range.box))
    17261800                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
  • trunk/WebCore/svg/SVGFont.cpp

    r52525 r54556  
    241241    void walk(const TextRun& run, bool isVerticalText, const String& language, int from, int to)
    242242    {
    243         // Should hold true for SVG text, otherwhise sth. is wrong
    244         ASSERT(to - from == run.length());
     243        ASSERT(0 <= from && from <= to && to - from <= run.length());
    245244
    246245        const String text = Font::normalizeSpaces(String(run.data(from), run.length()));
  • trunk/WebCore/svg/graphics/SVGPaintServer.cpp

    r52580 r54556  
    152152}
    153153
    154 void applyStrokeStyleToContext(GraphicsContext* context, RenderStyle* style, const RenderObject* object)
     154void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
    155155{
    156156    context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f));
     
    163163    float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f);
    164164    context->setLineDash(dashes, dashOffset);
     165}
     166
     167bool SVGPaintServer::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
     168{
     169    return setup(context, object, object ? object->style() : 0, type, isPaintingText);
    165170}
    166171
  • trunk/WebCore/svg/graphics/SVGPaintServer.h

    r52580 r54556  
    7272        virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const;
    7373
    74         virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
     74        virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText = false) const = 0;
     75
     76        bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const;
    7577
    7678        static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
     
    8688    SVGPaintServer* getPaintServerById(Document*, const AtomicString&, const RenderObject*);
    8789
    88     void applyStrokeStyleToContext(GraphicsContext*, RenderStyle*, const RenderObject*);
     90    void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*);
    8991    DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
    9092} // namespace WebCore
  • trunk/WebCore/svg/graphics/SVGPaintServerGradient.cpp

    r54503 r54556  
    190190#endif
    191191
    192 bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
     192bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle*style, SVGPaintTargetType type, bool isPaintingText) const
    193193{
    194194    m_ownerElement->buildGradient();
    195195
    196     const SVGRenderStyle* style = object->style()->svgStyle();
    197     bool isFilled = (type & ApplyToFillTargetType) && style->hasFill();
    198     bool isStroked = (type & ApplyToStrokeTargetType) && style->hasStroke();
     196    const SVGRenderStyle* svgStyle = style->svgStyle();
     197    bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill();
     198    bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke();
    199199
    200200    ASSERT((isFilled && !isStroked) || (!isFilled && isStroked));
     
    213213
    214214    if (isFilled) {
    215         context->setAlpha(style->fillOpacity());
     215        context->setAlpha(svgStyle->fillOpacity());
    216216        context->setFillGradient(m_gradient);
    217         context->setFillRule(style->fillRule());
     217        context->setFillRule(svgStyle->fillRule());
    218218    }
    219219    if (isStroked) {
    220         context->setAlpha(style->strokeOpacity());
     220        context->setAlpha(svgStyle->strokeOpacity());
    221221        context->setStrokeGradient(m_gradient);
    222         applyStrokeStyleToContext(context, object->style(), object);
     222        applyStrokeStyleToContext(context, style, object);
    223223    }
    224224
     
    238238        if (bbox.width() == 0 || bbox.height() == 0) {
    239239            Color color(0, 0, 0);
    240             context->setStrokeColor(color, object->style()->colorSpace());
     240            context->setStrokeColor(color, style->colorSpace());
    241241            return true;
    242242        }
  • trunk/WebCore/svg/graphics/SVGPaintServerGradient.h

    r54503 r54556  
    6767        virtual TextStream& externalRepresentation(TextStream&) const;
    6868
    69         virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
     69        virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
    7070        virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
    7171
  • trunk/WebCore/svg/graphics/SVGPaintServerPattern.cpp

    r54503 r54556  
    9696}
    9797
    98 bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
     98bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const
    9999{
    100100    FloatRect targetRect = object->objectBoundingBox();
    101101
    102     const SVGRenderStyle* style = object->style()->svgStyle();
    103     bool isFilled = (type & ApplyToFillTargetType) && style->hasFill();
    104     bool isStroked = (type & ApplyToStrokeTargetType) && style->hasStroke();
     102    const SVGRenderStyle* svgStyle = style->svgStyle();
     103    bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill();
     104    bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke();
    105105
    106106    ASSERT((isFilled && !isStroked) || (!isFilled && isStroked));
     
    132132            for (int j = numX; j > 0; j--) {
    133133                tileImageContext->translate(patternBoundaries().width(), 0);
    134                 tileImageContext->drawImage(tile()->image(), object->style()->colorSpace(), tileRect, tileRect);
     134                tileImageContext->drawImage(tile()->image(), style->colorSpace(), tileRect, tileRect);
    135135            }
    136136            tileImageContext->translate(-patternBoundaries().width() * numX, 0);
     
    144144
    145145    if (isFilled) {
    146         context->setAlpha(style->fillOpacity());
     146        context->setAlpha(svgStyle->fillOpacity());
    147147        context->setFillPattern(m_pattern);
    148         context->setFillRule(style->fillRule());
     148        context->setFillRule(svgStyle->fillRule());
    149149    }
    150150    if (isStroked) {
    151         context->setAlpha(style->strokeOpacity());
     151        context->setAlpha(svgStyle->strokeOpacity());
    152152        context->setStrokePattern(m_pattern);
    153         applyStrokeStyleToContext(context, object->style(), object);
     153        applyStrokeStyleToContext(context, style, object);
    154154    }
    155155
  • trunk/WebCore/svg/graphics/SVGPaintServerPattern.h

    r54503 r54556  
    6565        virtual TextStream& externalRepresentation(TextStream&) const;
    6666
    67         virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
     67        virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
    6868        virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
    6969
  • trunk/WebCore/svg/graphics/SVGPaintServerSolid.cpp

    r50760 r54556  
    6161}
    6262
    63 bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const
     63bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const
    6464{
    65     RenderStyle* style = object ? object->style() : 0;
    6665    const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
    6766    ColorSpace colorSpace = style ? style->colorSpace() : DeviceColorSpace;
  • trunk/WebCore/svg/graphics/SVGPaintServerSolid.h

    r40088 r54556  
    4646        virtual TextStream& externalRepresentation(TextStream&) const;
    4747
    48         virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const;
     48        virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const;
    4949
    5050    private:
Note: See TracChangeset for help on using the changeset viewer.