Changeset 57482 in webkit


Ignore:
Timestamp:
Apr 12, 2010 2:53:35 PM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=37469, clean up ShadowData to be encapsulated properly.

Reviewed by Dan Bernstein.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::valueForShadow):

  • page/animation/AnimationBase.cpp:

(WebCore::blendFunc):
(WebCore::PropertyWrapperShadow::PropertyWrapperShadow):
(WebCore::PropertyWrapperShadow::equals):
(WebCore::PropertyWrapperShadow::blend):

  • page/mac/FrameMac.mm:

(WebCore::Frame::fontAttributesForSelectionStart):

  • rendering/EllipsisBox.cpp:

(WebCore::EllipsisBox::paint):

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::placeBoxesHorizontally):
(WebCore::InlineFlowBox::computeVerticalOverflow):
(WebCore::InlineFlowBox::paintTextDecorations):

  • rendering/InlineTextBox.cpp:

(WebCore::paintTextWithShadows):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintDecoration):

  • rendering/InlineTextBox.h:
  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintBoxShadow):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateRects):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::adjustRectForOutlineAndShadow):

  • rendering/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::paintCharacters):

  • rendering/SVGRenderSupport.cpp:

(WebCore::SVGRenderBase::prepareToRenderSVGContent):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::setTextShadow):
(WebCore::RenderStyle::setBoxShadow):
(WebCore::RenderStyle::getBoxShadowExtent):
(WebCore::RenderStyle::getBoxShadowHorizontalExtent):
(WebCore::RenderStyle::getBoxShadowVerticalExtent):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::textShadow):
(WebCore::InheritedFlags::boxShadow):

  • rendering/style/SVGRenderStyle.cpp:

(WebCore::getSVGShadowExtent):

  • rendering/style/ShadowData.cpp:

(WebCore::ShadowData::ShadowData):
(WebCore::ShadowData::operator==):

  • rendering/style/ShadowData.h:

(WebCore::ShadowData::ShadowData):
(WebCore::ShadowData::~ShadowData):
(WebCore::ShadowData::x):
(WebCore::ShadowData::y):
(WebCore::ShadowData::blur):
(WebCore::ShadowData::spread):
(WebCore::ShadowData::style):
(WebCore::ShadowData::color):
(WebCore::ShadowData::next):
(WebCore::ShadowData::setNext):

Location:
trunk/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57479 r57482  
     12010-04-12  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=37469, clean up ShadowData to be encapsulated properly.
     6
     7        * css/CSSComputedStyleDeclaration.cpp:
     8        (WebCore::CSSComputedStyleDeclaration::valueForShadow):
     9        * page/animation/AnimationBase.cpp:
     10        (WebCore::blendFunc):
     11        (WebCore::PropertyWrapperShadow::PropertyWrapperShadow):
     12        (WebCore::PropertyWrapperShadow::equals):
     13        (WebCore::PropertyWrapperShadow::blend):
     14        * page/mac/FrameMac.mm:
     15        (WebCore::Frame::fontAttributesForSelectionStart):
     16        * rendering/EllipsisBox.cpp:
     17        (WebCore::EllipsisBox::paint):
     18        * rendering/InlineFlowBox.cpp:
     19        (WebCore::InlineFlowBox::placeBoxesHorizontally):
     20        (WebCore::InlineFlowBox::computeVerticalOverflow):
     21        (WebCore::InlineFlowBox::paintTextDecorations):
     22        * rendering/InlineTextBox.cpp:
     23        (WebCore::paintTextWithShadows):
     24        (WebCore::InlineTextBox::paint):
     25        (WebCore::InlineTextBox::paintDecoration):
     26        * rendering/InlineTextBox.h:
     27        * rendering/RenderBoxModelObject.cpp:
     28        (WebCore::RenderBoxModelObject::paintBoxShadow):
     29        * rendering/RenderLayer.cpp:
     30        (WebCore::RenderLayer::calculateRects):
     31        * rendering/RenderObject.cpp:
     32        (WebCore::RenderObject::adjustRectForOutlineAndShadow):
     33        * rendering/SVGInlineTextBox.cpp:
     34        (WebCore::SVGInlineTextBox::paintCharacters):
     35        * rendering/SVGRenderSupport.cpp:
     36        (WebCore::SVGRenderBase::prepareToRenderSVGContent):
     37        * rendering/style/RenderStyle.cpp:
     38        (WebCore::RenderStyle::setTextShadow):
     39        (WebCore::RenderStyle::setBoxShadow):
     40        (WebCore::RenderStyle::getBoxShadowExtent):
     41        (WebCore::RenderStyle::getBoxShadowHorizontalExtent):
     42        (WebCore::RenderStyle::getBoxShadowVerticalExtent):
     43        * rendering/style/RenderStyle.h:
     44        (WebCore::InheritedFlags::textShadow):
     45        (WebCore::InheritedFlags::boxShadow):
     46        * rendering/style/SVGRenderStyle.cpp:
     47        (WebCore::getSVGShadowExtent):
     48        * rendering/style/ShadowData.cpp:
     49        (WebCore::ShadowData::ShadowData):
     50        (WebCore::ShadowData::operator==):
     51        * rendering/style/ShadowData.h:
     52        (WebCore::ShadowData::ShadowData):
     53        (WebCore::ShadowData::~ShadowData):
     54        (WebCore::ShadowData::x):
     55        (WebCore::ShadowData::y):
     56        (WebCore::ShadowData::blur):
     57        (WebCore::ShadowData::spread):
     58        (WebCore::ShadowData::style):
     59        (WebCore::ShadowData::color):
     60        (WebCore::ShadowData::next):
     61        (WebCore::ShadowData::setNext):
     62
    1632010-04-12  David Hyatt  <hyatt@apple.com>
    264
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r57479 r57482  
    565565
    566566    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
    567     for (const ShadowData* s = shadow; s; s = s->next) {
    568         RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x, CSSPrimitiveValue::CSS_PX);
    569         RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX);
    570         RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX);
    571         RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX);
    572         RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset);
    573         RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color.rgb());
     567    for (const ShadowData* s = shadow; s; s = s->next()) {
     568        RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x(), CSSPrimitiveValue::CSS_PX);
     569        RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y(), CSSPrimitiveValue::CSS_PX);
     570        RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur(), CSSPrimitiveValue::CSS_PX);
     571        RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread(), CSSPrimitiveValue::CSS_PX);
     572        RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset);
     573        RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color().rgb());
    574574        list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
    575575    }
  • trunk/WebCore/page/animation/AnimationBase.cpp

    r56825 r57482  
    136136
    137137    ASSERT(from && to);
    138     return new ShadowData(blendFunc(anim, from->x, to->x, progress), blendFunc(anim, from->y, to->y, progress),
    139                           blendFunc(anim, from->blur, to->blur, progress), blendFunc(anim, from->spread, to->spread, progress),
    140                           blendFunc(anim, from->style, to->style, progress), blendFunc(anim, from->color, to->color, progress));
     138    return new ShadowData(blendFunc(anim, from->x(), to->x(), progress), blendFunc(anim, from->y(), to->y(), progress),
     139                          blendFunc(anim, from->blur(), to->blur(), progress), blendFunc(anim, from->spread(), to->spread(), progress),
     140                          blendFunc(anim, from->style(), to->style(), progress), blendFunc(anim, from->color(), to->color(), progress));
    141141}
    142142
     
    297297#endif // USE(ACCELERATED_COMPOSITING)
    298298
    299 class PropertyWrapperShadow : public PropertyWrapperGetter<ShadowData*> {
     299class PropertyWrapperShadow : public PropertyWrapperBase {
    300300public:
    301     PropertyWrapperShadow(int prop, ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(ShadowData*, bool))
    302         : PropertyWrapperGetter<ShadowData*>(prop, getter)
     301    PropertyWrapperShadow(int prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(ShadowData*, bool))
     302        : PropertyWrapperBase(prop)
     303        , m_getter(getter)
    303304        , m_setter(setter)
    304305    {
     
    307308    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    308309    {
    309         ShadowData* shadowA = (a->*m_getter)();
    310         ShadowData* shadowB = (b->*m_getter)();
     310        const ShadowData* shadowA = (a->*m_getter)();
     311        const ShadowData* shadowB = (b->*m_getter)();
    311312       
    312313        while (true) {
     
    320321                return false;
    321322       
    322             shadowA = shadowA->next;
    323             shadowB = shadowB->next;
     323            shadowA = shadowA->next();
     324            shadowB = shadowB->next();
    324325        }
    325326
     
    329330    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
    330331    {
    331         ShadowData* shadowA = (a->*m_getter)();
    332         ShadowData* shadowB = (b->*m_getter)();
     332        const ShadowData* shadowA = (a->*m_getter)();
     333        const ShadowData* shadowB = (b->*m_getter)();
    333334        ShadowData defaultShadowData(0, 0, 0, 0, Normal, Color::transparent);
    334335
     
    336337       
    337338        while (shadowA || shadowB) {
    338             ShadowData* srcShadow = shadowA ? shadowA : &defaultShadowData;
    339             ShadowData* dstShadow = shadowB ? shadowB : &defaultShadowData;
     339            const ShadowData* srcShadow = shadowA ? shadowA : &defaultShadowData;
     340            const ShadowData* dstShadow = shadowB ? shadowB : &defaultShadowData;
    340341           
    341342            if (!newShadowData)
    342343                newShadowData = blendFunc(anim, srcShadow, dstShadow, progress);
    343344            else
    344                 newShadowData->next = blendFunc(anim, srcShadow, dstShadow, progress);
    345 
    346             shadowA = shadowA ? shadowA->next : 0;
    347             shadowB = shadowB ? shadowB->next : 0;
     345                newShadowData->setNext(blendFunc(anim, srcShadow, dstShadow, progress));
     346
     347            shadowA = shadowA ? shadowA->next() : 0;
     348            shadowB = shadowB ? shadowB->next() : 0;
    348349        }
    349350       
     
    352353
    353354private:
     355    const ShadowData* (RenderStyle::*m_getter)() const;
    354356    void (RenderStyle::*m_setter)(ShadowData*, bool);
    355357};
  • trunk/WebCore/page/mac/FrameMac.mm

    r53500 r57482  
    417417        [result setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
    418418
    419     ShadowData* shadow = style->textShadow();
     419    const ShadowData* shadow = style->textShadow();
    420420    if (shadow) {
    421421        NSShadow* s = [[NSShadow alloc] init];
    422         [s setShadowOffset:NSMakeSize(shadow->x, shadow->y)];
    423         [s setShadowBlurRadius:shadow->blur];
    424         [s setShadowColor:nsColor(shadow->color)];
     422        [s setShadowOffset:NSMakeSize(shadow->x(), shadow->y())];
     423        [s setShadowBlurRadius:shadow->blur()];
     424        [s setShadowColor:nsColor(shadow->color())];
    425425        [result setObject:s forKey:NSShadowAttributeName];
    426426    }
  • trunk/WebCore/rendering/EllipsisBox.cpp

    r52548 r57482  
    3737    bool setShadow = false;
    3838    if (style->textShadow()) {
    39         context->setShadow(IntSize(style->textShadow()->x, style->textShadow()->y),
    40                            style->textShadow()->blur, style->textShadow()->color, style->colorSpace());
     39        context->setShadow(IntSize(style->textShadow()->x(), style->textShadow()->y()),
     40                           style->textShadow()->blur(), style->textShadow()->color(), style->colorSpace());
    4141        setShadow = true;
    4242    }
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r57292 r57482  
    297297            int childOverflowLeft = leftGlyphOverflow;
    298298            int childOverflowRight = rightGlyphOverflow;
    299             for (ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next) {
    300                 childOverflowLeft = min(childOverflowLeft, shadow->x - shadow->blur + leftGlyphOverflow);
    301                 childOverflowRight = max(childOverflowRight, shadow->x + shadow->blur + rightGlyphOverflow);
     299            for (const ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next()) {
     300                childOverflowLeft = min(childOverflowLeft, shadow->x() - shadow->blur() + leftGlyphOverflow);
     301                childOverflowRight = max(childOverflowRight, shadow->x() + shadow->blur() + rightGlyphOverflow);
    302302            }
    303303           
     
    574574            int childOverflowTop = topGlyphOverflow;
    575575            int childOverflowBottom = bottomGlyphOverflow;
    576             for (ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next) {
    577                 childOverflowTop = min(childOverflowTop, shadow->y - shadow->blur + topGlyphOverflow);
    578                 childOverflowBottom = max(childOverflowBottom, shadow->y + shadow->blur + bottomGlyphOverflow);
     576            for (const ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next()) {
     577                childOverflowTop = min(childOverflowTop, shadow->y() - shadow->blur() + topGlyphOverflow);
     578                childOverflowBottom = max(childOverflowBottom, shadow->y() + shadow->blur() + bottomGlyphOverflow);
    579579            }
    580580           
     
    982982        bool setClip = false;
    983983        int extraOffset = 0;
    984         ShadowData* shadow = styleToUse->textShadow();
    985         if (!linesAreOpaque && shadow && shadow->next) {
     984        const ShadowData* shadow = styleToUse->textShadow();
     985        if (!linesAreOpaque && shadow && shadow->next()) {
    986986            IntRect clipRect(tx, ty, w, baselinePos + 2);
    987             for (ShadowData* s = shadow; s; s = s->next) {
     987            for (const ShadowData* s = shadow; s; s = s->next()) {
    988988                IntRect shadowRect(tx, ty, w, baselinePos + 2);
    989                 shadowRect.inflate(s->blur);
    990                 shadowRect.move(s->x, s->y);
     989                shadowRect.inflate(s->blur());
     990                shadowRect.move(s->x(), s->y());
    991991                clipRect.unite(shadowRect);
    992                 extraOffset = max(extraOffset, max(0, s->y) + s->blur);
     992                extraOffset = max(extraOffset, max(0, s->y()) + s->blur());
    993993            }
    994994            context->save();
     
    10031003        do {
    10041004            if (shadow) {
    1005                 if (!shadow->next) {
     1005                if (!shadow->next()) {
    10061006                    // The last set of lines paints normally inside the clip.
    10071007                    ty -= extraOffset;
    10081008                    extraOffset = 0;
    10091009                }
    1010                 context->setShadow(IntSize(shadow->x, shadow->y - extraOffset), shadow->blur, shadow->color, colorSpace);
     1010                context->setShadow(IntSize(shadow->x(), shadow->y() - extraOffset), shadow->blur(), shadow->color(), colorSpace);
    10111011                setShadow = true;
    1012                 shadow = shadow->next;
     1012                shadow = shadow->next();
    10131013            }
    10141014
  • trunk/WebCore/rendering/InlineTextBox.cpp

    r57292 r57482  
    274274}
    275275
    276 static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, int truncationPoint, const IntPoint& textOrigin, int x, int y, int w, int h, ShadowData* shadow, bool stroked)
     276static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, int truncationPoint, const IntPoint& textOrigin, int x, int y, int w, int h, const ShadowData* shadow, bool stroked)
    277277{
    278278    Color fillColor = context->fillColor();
     
    286286
    287287        if (shadow) {
    288             IntSize shadowOffset(shadow->x, shadow->y);
    289             int shadowBlur = shadow->blur;
    290             const Color& shadowColor = shadow->color;
    291 
    292             if (shadow->next || stroked || !opaque) {
     288            IntSize shadowOffset(shadow->x(), shadow->y());
     289            int shadowBlur = shadow->blur();
     290            const Color& shadowColor = shadow->color();
     291
     292            if (shadow->next() || stroked || !opaque) {
    293293                IntRect shadowRect(x, y, w, h);
    294294                shadowRect.inflate(shadowBlur);
     
    316316            break;
    317317
    318         if (shadow->next || stroked || !opaque)
     318        if (shadow->next() || stroked || !opaque)
    319319            context->restore();
    320320        else
    321321            context->clearShadow();
    322322
    323         shadow = shadow->next;
     323        shadow = shadow->next();
    324324    } while (shadow || stroked || !opaque);
    325325}
     
    406406    Color textStrokeColor;
    407407    float textStrokeWidth = styleToUse->textStrokeWidth();
    408     ShadowData* textShadow = paintInfo.forceBlackText ? 0 : styleToUse->textShadow();
     408    const ShadowData* textShadow = paintInfo.forceBlackText ? 0 : styleToUse->textShadow();
    409409
    410410    if (paintInfo.forceBlackText) {
     
    431431    Color selectionStrokeColor = textStrokeColor;
    432432    float selectionStrokeWidth = textStrokeWidth;
    433     ShadowData* selectionShadow = textShadow;
     433    const ShadowData* selectionShadow = textShadow;
    434434    if (haveSelection) {
    435435        // Check foreground color first.
     
    442442
    443443        if (RenderStyle* pseudoStyle = renderer()->getCachedPseudoStyle(SELECTION)) {
    444             ShadowData* shadow = paintInfo.forceBlackText ? 0 : pseudoStyle->textShadow();
     444            const ShadowData* shadow = paintInfo.forceBlackText ? 0 : pseudoStyle->textShadow();
    445445            if (shadow != selectionShadow) {
    446446                if (!paintSelectedTextOnly)
     
    641641#endif
    642642
    643 void InlineTextBox::paintDecoration(GraphicsContext* context, int tx, int ty, int deco, ShadowData* shadow)
     643void InlineTextBox::paintDecoration(GraphicsContext* context, int tx, int ty, int deco, const ShadowData* shadow)
    644644{
    645645    tx += m_x;
     
    670670    bool setClip = false;
    671671    int extraOffset = 0;
    672     if (!linesAreOpaque && shadow && shadow->next) {
     672    if (!linesAreOpaque && shadow && shadow->next()) {
    673673        context->save();
    674674        IntRect clipRect(tx, ty, width, baseline + 2);
    675         for (ShadowData* s = shadow; s; s = s->next) {
     675        for (const ShadowData* s = shadow; s; s = s->next()) {
    676676            IntRect shadowRect(tx, ty, width, baseline + 2);
    677             shadowRect.inflate(s->blur);
    678             shadowRect.move(s->x, s->y);
     677            shadowRect.inflate(s->blur());
     678            shadowRect.move(s->x(), s->y());
    679679            clipRect.unite(shadowRect);
    680             extraOffset = max(extraOffset, max(0, s->y) + s->blur);
     680            extraOffset = max(extraOffset, max(0, s->y()) + s->blur());
    681681        }
    682682        context->save();
     
    692692    do {
    693693        if (shadow) {
    694             if (!shadow->next) {
     694            if (!shadow->next()) {
    695695                // The last set of lines paints normally inside the clip.
    696696                ty -= extraOffset;
    697697                extraOffset = 0;
    698698            }
    699             context->setShadow(IntSize(shadow->x, shadow->y - extraOffset), shadow->blur, shadow->color, colorSpace);
     699            context->setShadow(IntSize(shadow->x(), shadow->y() - extraOffset), shadow->blur(), shadow->color(), colorSpace);
    700700            setShadow = true;
    701             shadow = shadow->next;
     701            shadow = shadow->next();
    702702        }
    703703
  • trunk/WebCore/rendering/InlineTextBox.h

    r57215 r57482  
    151151
    152152private:
    153     void paintDecoration(GraphicsContext*, int tx, int ty, int decoration, ShadowData*);
     153    void paintDecoration(GraphicsContext*, int tx, int ty, int decoration, const ShadowData*);
    154154    void paintSelection(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&);
    155155    void paintSpellingOrGrammarMarker(GraphicsContext*, int tx, int ty, const DocumentMarker&, RenderStyle*, const Font&, bool grammar);
  • trunk/WebCore/rendering/RenderBoxModelObject.cpp

    r57479 r57482  
    13231323
    13241324    bool hasOpaqueBackground = s->backgroundColor().isValid() && s->backgroundColor().alpha() == 255;
    1325     for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) {
    1326         if (shadow->style != shadowStyle)
     1325    for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) {
     1326        if (shadow->style() != shadowStyle)
    13271327            continue;
    13281328
    1329         IntSize shadowOffset(shadow->x, shadow->y);
    1330         int shadowBlur = shadow->blur;
    1331         int shadowSpread = shadow->spread;
    1332         Color& shadowColor = shadow->color;
    1333 
    1334         if (shadow->style == Normal) {
     1329        IntSize shadowOffset(shadow->x(), shadow->y());
     1330        int shadowBlur = shadow->blur();
     1331        int shadowSpread = shadow->spread();
     1332        const Color& shadowColor = shadow->color();
     1333
     1334        if (shadow->style() == Normal) {
    13351335            IntRect fillRect(rect);
    13361336            fillRect.inflate(shadowSpread);
  • trunk/WebCore/rendering/RenderLayer.cpp

    r57033 r57482  
    29122912        // If we establish a clip at all, then go ahead and make sure our background
    29132913        // rect is intersected with our layer's bounds.
    2914         if (ShadowData* boxShadow = renderer()->style()->boxShadow()) {
     2914        // FIXME: This could be changed to just use generic visual overflow.
     2915        // See https://bugs.webkit.org/show_bug.cgi?id=37467 for more information.
     2916        if (const ShadowData* boxShadow = renderer()->style()->boxShadow()) {
    29152917            IntRect overflow = layerBounds;
    29162918            do {
    2917                 if (boxShadow->style == Normal) {
     2919                if (boxShadow->style() == Normal) {
    29182920                    IntRect shadowRect = layerBounds;
    2919                     shadowRect.move(boxShadow->x, boxShadow->y);
    2920                     shadowRect.inflate(boxShadow->blur + boxShadow->spread);
     2921                    shadowRect.move(boxShadow->x(), boxShadow->y());
     2922                    shadowRect.inflate(boxShadow->blur() + boxShadow->spread());
    29212923                    overflow.unite(shadowRect);
    29222924                }
    29232925
    2924                 boxShadow = boxShadow->next;
     2926                boxShadow = boxShadow->next();
    29252927            } while (boxShadow);
    29262928            backgroundRect.intersect(overflow);
  • trunk/WebCore/rendering/RenderObject.cpp

    r57292 r57482  
    23552355{
    23562356    int outlineSize = outlineStyleForRepaint()->outlineSize();
    2357     if (ShadowData* boxShadow = style()->boxShadow()) {
     2357    if (const ShadowData* boxShadow = style()->boxShadow()) {
    23582358        int shadowLeft = 0;
    23592359        int shadowRight = 0;
     
    23622362
    23632363        do {
    2364             if (boxShadow->style == Normal) {
    2365                 shadowLeft = min(boxShadow->x - boxShadow->blur - boxShadow->spread - outlineSize, shadowLeft);
    2366                 shadowRight = max(boxShadow->x + boxShadow->blur + boxShadow->spread + outlineSize, shadowRight);
    2367                 shadowTop = min(boxShadow->y - boxShadow->blur - boxShadow->spread - outlineSize, shadowTop);
    2368                 shadowBottom = max(boxShadow->y + boxShadow->blur + boxShadow->spread + outlineSize, shadowBottom);
     2364            if (boxShadow->style() == Normal) {
     2365                shadowLeft = min(boxShadow->x() - boxShadow->blur() - boxShadow->spread() - outlineSize, shadowLeft);
     2366                shadowRight = max(boxShadow->x() + boxShadow->blur() + boxShadow->spread() + outlineSize, shadowRight);
     2367                shadowTop = min(boxShadow->y() - boxShadow->blur() - boxShadow->spread() - outlineSize, shadowTop);
     2368                shadowBottom = max(boxShadow->y() + boxShadow->blur() + boxShadow->spread() + outlineSize, shadowBottom);
    23692369            }
    23702370
    2371             boxShadow = boxShadow->next;
     2371            boxShadow = boxShadow->next();
    23722372        } while (boxShadow);
    23732373
  • trunk/WebCore/rendering/SVGInlineTextBox.cpp

    r54556 r57482  
    406406    if  (isGlyphPhase || isSelectionGlyphPhase) {
    407407        // Set a text shadow if we have one.
    408         // FIXME: Support multiple shadow effects.  Need more from the CG API before
    409         // we can do this.
     408        // FIXME: Support multiple shadow effects.  See how it's done in InlineTextBox.cpp.
    410409        bool setShadow = false;
    411410        if (styleToUse->textShadow()) {
    412             paintInfo.context->setShadow(IntSize(styleToUse->textShadow()->x, styleToUse->textShadow()->y),
    413                                          styleToUse->textShadow()->blur, styleToUse->textShadow()->color,
     411            paintInfo.context->setShadow(IntSize(styleToUse->textShadow()->x(), styleToUse->textShadow()->y()),
     412                                         styleToUse->textShadow()->blur(), styleToUse->textShadow()->color(),
    414413                                         styleToUse->colorSpace());
    415414            setShadow = true;
  • trunk/WebCore/rendering/SVGRenderSupport.cpp

    r56693 r57482  
    106106    }
    107107
    108     if (ShadowData* shadow = svgStyle->shadow()) {
     108    if (const ShadowData* shadow = svgStyle->shadow()) {
    109109        paintInfo.context->clip(repaintRect);
    110         paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color, style->colorSpace());
     110        paintInfo.context->setShadow(IntSize(shadow->x(), shadow->y()), shadow->blur(), shadow->color(), style->colorSpace());
    111111        paintInfo.context->beginTransparencyLayer(1.0f);
    112112    }
  • trunk/WebCore/rendering/style/RenderStyle.cpp

    r57358 r57482  
    713713    }
    714714
    715     val->next = rareData->textShadow;
     715    val->setNext(rareData->textShadow);
    716716    rareData->textShadow = val;
    717717}
     
    725725    }
    726726
    727     shadowData->next = rareData->m_boxShadow.release();
     727    shadowData->setNext(rareData->m_boxShadow.release());
    728728    rareData->m_boxShadow.set(shadowData);
    729729}
     
    922922    left = 0;
    923923
    924     for (ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    925         if (boxShadow->style == Inset)
     924    for (const ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next()) {
     925        if (boxShadow->style() == Inset)
    926926            continue;
    927         int blurAndSpread = boxShadow->blur + boxShadow->spread;
    928 
    929         top = min(top, boxShadow->y - blurAndSpread);
    930         right = max(right, boxShadow->x + blurAndSpread);
    931         bottom = max(bottom, boxShadow->y + blurAndSpread);
    932         left = min(left, boxShadow->x - blurAndSpread);
     927        int blurAndSpread = boxShadow->blur() + boxShadow->spread();
     928
     929        top = min(top, boxShadow->y() - blurAndSpread);
     930        right = max(right, boxShadow->x() + blurAndSpread);
     931        bottom = max(bottom, boxShadow->y() + blurAndSpread);
     932        left = min(left, boxShadow->x() - blurAndSpread);
    933933    }
    934934}
     
    939939    right = 0;
    940940
    941     for (ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    942         if (boxShadow->style == Inset)
     941    for (const ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next()) {
     942        if (boxShadow->style() == Inset)
    943943            continue;
    944         int blurAndSpread = boxShadow->blur + boxShadow->spread;
    945 
    946         left = min(left, boxShadow->x - blurAndSpread);
    947         right = max(right, boxShadow->x + blurAndSpread);
     944        int blurAndSpread = boxShadow->blur() + boxShadow->spread();
     945
     946        left = min(left, boxShadow->x() - blurAndSpread);
     947        right = max(right, boxShadow->x() + blurAndSpread);
    948948    }
    949949}
     
    954954    bottom = 0;
    955955
    956     for (ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    957         if (boxShadow->style == Inset)
     956    for (const ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next()) {
     957        if (boxShadow->style() == Inset)
    958958            continue;
    959         int blurAndSpread = boxShadow->blur + boxShadow->spread;
    960 
    961         top = min(top, boxShadow->y - blurAndSpread);
    962         bottom = max(bottom, boxShadow->y + blurAndSpread);
     959        int blurAndSpread = boxShadow->blur() + boxShadow->spread();
     960
     961        top = min(top, boxShadow->y() - blurAndSpread);
     962        bottom = max(bottom, boxShadow->y() + blurAndSpread);
    963963    }
    964964}
  • trunk/WebCore/rendering/style/RenderStyle.h

    r57371 r57482  
    615615    }
    616616
    617     ShadowData* textShadow() const { return rareInheritedData->textShadow; }
     617    const ShadowData* textShadow() const { return rareInheritedData->textShadow; }
    618618    const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
    619619    float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
     
    631631    EBoxAlignment boxPack() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->pack); }
    632632
    633     ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
     633    const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
    634634    void getBoxShadowExtent(int &top, int &right, int &bottom, int &left) const;
    635635    void getBoxShadowHorizontalExtent(int &left, int &right) const;
  • trunk/WebCore/rendering/style/SVGRenderStyle.cpp

    r53300 r57482  
    153153    left = 0;
    154154
    155     int blurAndSpread = shadow->blur + shadow->spread;
    156 
    157     top = min(top, shadow->y - blurAndSpread);
    158     right = max(right, shadow->x + blurAndSpread);
    159     bottom = max(bottom, shadow->y + blurAndSpread);
    160     left = min(left, shadow->x - blurAndSpread);
     155    int blurAndSpread = shadow->blur() + shadow->spread();
     156
     157    top = min(top, shadow->y() - blurAndSpread);
     158    right = max(right, shadow->x() + blurAndSpread);
     159    bottom = max(bottom, shadow->y() + blurAndSpread);
     160    left = min(left, shadow->x() - blurAndSpread);
    161161}
    162162
  • trunk/WebCore/rendering/style/ShadowData.cpp

    r46361 r57482  
    2626
    2727ShadowData::ShadowData(const ShadowData& o)
    28     : x(o.x)
    29     , y(o.y)
    30     , blur(o.blur)
    31     , spread(o.spread)
    32     , style(o.style)
    33     , color(o.color)
     28    : m_x(o.m_x)
     29    , m_y(o.m_y)
     30    , m_blur(o.m_blur)
     31    , m_spread(o.m_spread)
     32    , m_style(o.m_style)
     33    , m_color(o.m_color)
    3434{
    35     next = o.next ? new ShadowData(*o.next) : 0;
     35    m_next = o.m_next ? new ShadowData(*o.m_next) : 0;
    3636}
    3737
    3838bool ShadowData::operator==(const ShadowData& o) const
    3939{
    40     if ((next && !o.next) || (!next && o.next) ||
    41         (next && o.next && *next != *o.next))
     40    if ((m_next && !o.m_next) || (!m_next && o.m_next) ||
     41        (m_next && o.m_next && *m_next != *o.m_next))
    4242        return false;
    4343   
    44     return x == o.x && y == o.y && blur == o.blur && spread == o.spread && style == o.style && color == o.color;
     44    return m_x == o.m_x && m_y == o.m_y && m_blur == o.m_blur && m_spread == o.m_spread && m_style == o.m_style && m_color == o.m_color;
    4545}
    4646
  • trunk/WebCore/rendering/style/ShadowData.h

    r51466 r57482  
    3535// This struct holds information about shadows for the text-shadow and box-shadow properties.
    3636
    37 struct ShadowData : FastAllocBase {
     37class ShadowData : public FastAllocBase {
     38public:
    3839    ShadowData()
    39         : x(0)
    40         , y(0)
    41         , blur(0)
    42         , spread(0)
    43         , style(Normal)
    44         , next(0)
     40        : m_x(0)
     41        , m_y(0)
     42        , m_blur(0)
     43        , m_spread(0)
     44        , m_style(Normal)
     45        , m_next(0)
    4546    {
    4647    }
    4748
    4849    ShadowData(int x, int y, int blur, int spread, ShadowStyle style, const Color& color)
    49         : x(x)
    50         , y(y)
    51         , blur(blur)
    52         , spread(spread)
    53         , style(style)
    54         , color(color)
    55         , next(0)
     50        : m_x(x)
     51        , m_y(y)
     52        , m_blur(blur)
     53        , m_spread(spread)
     54        , m_style(style)
     55        , m_color(color)
     56        , m_next(0)
    5657    {
    5758    }
    5859
    5960    ShadowData(const ShadowData& o);
    60 
    61     ~ShadowData() { delete next; }
     61    ~ShadowData() { delete m_next; }
    6262
    6363    bool operator==(const ShadowData& o) const;
     
    6767    }
    6868   
    69     int x;
    70     int y;
    71     int blur;
    72     int spread;
    73     ShadowStyle style;
    74     Color color;
    75     ShadowData* next;
     69    int x() const { return m_x; }
     70    int y() const { return m_y; }
     71    int blur() const { return m_blur; }
     72    int spread() const { return m_spread; }
     73    ShadowStyle style() const { return m_style; }
     74    const Color& color() const { return m_color; }
     75   
     76    const ShadowData* next() const { return m_next; }
     77    void setNext(ShadowData* shadow) { m_next = shadow; }
     78
     79private:
     80    int m_x;
     81    int m_y;
     82    int m_blur;
     83    int m_spread;
     84    ShadowStyle m_style;
     85    Color m_color;
     86    ShadowData* m_next;
    7687};
    7788
Note: See TracChangeset for help on using the changeset viewer.