Changeset 46097 in webkit


Ignore:
Timestamp:
Jul 18, 2009 3:58:15 PM (15 years ago)
Author:
mitz@apple.com
Message:

WebCore:

Reviewed by Anders Carlsson.

Add spread radius support to -webkit-box-shadow
https://bugs.webkit.org/show_bug.cgi?id=27417

Test: fast/box-shadow/spread.html

  • css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForShadow): Added a property ID parameter and used it to

include the spread length for box-shadow but not for text-shadow.

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

Pass the property ID to valueForShadow().

  • css/CSSParser.cpp: (WebCore::ShadowParseContext::ShadowParseContext): Added property,

spread, and allowSpread members. Added a property ID parameter to
the constructor. Initialize the property and allowSpread members.

(WebCore::ShadowParseContext::allowLength): Added allowSpread.
(WebCore::ShadowParseContext::commitValue): Pass the spread value to

the ShadowValue constructor. Reset allowSpread.

(WebCore::ShadowParseContext::commitLength): Allow spread after blur

for the box-shadow property.

(WebCore::ShadowParseContext::commitColor): Reset allowSpread.
(WebCore::CSSParser::parseShadow): Pass the property ID to

ShadowParseContext().

  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty): Get the spread value from

the shadow value and pass it to the ShadowData constructor.

  • css/ShadowValue.cpp: (WebCore::ShadowValue::ShadowValue): Added spread. (WebCore::ShadowValue::cssText): Added spread.
  • css/ShadowValue.h: (WebCore::ShadowValue::create): Added spread.
  • page/animation/AnimationBase.cpp: (WebCore::blendFunc): Blend the spread value. (WebCore::PropertyWrapperShadow::blend): Added 0 spread to the default

shadow.

  • rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesHorizontally): Account for spread in

the visual overflow calculations.

(WebCore::InlineFlowBox::placeBoxesVertically): Ditto.
(WebCore::InlineFlowBox::paint): Ditto.

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::overflowHeight): Ditto. (WebCore::RenderBlock::overflowWidth): Ditto. (WebCore::RenderBlock::overflowLeft): Ditto. (WebCore::RenderBlock::overflowTop): Ditto. (WebCore::RenderBlock::overflowRect): Ditto. (WebCore::RenderBlock::layoutBlock): Ditto.
  • rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBoxShadow): Inflate the shadow-

casting rect by the shadow spread value. Adjust border radii if
necessary.

  • rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutBlock): Account for spread in the

visual overflow calculations.

  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateRects): Ditto.
  • rendering/RenderObject.cpp: (WebCore::RenderObject::repaintAfterLayoutIfNeeded): Account for spread. (WebCore::RenderObject::adjustRectForOutlineAndShadow): Ditto.
  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::adjustOverflowForBoxShadowAndReflect): Ditto.
  • rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::setTextShadow): Assert that text shadows do not

have spread.

  • rendering/style/ShadowData.cpp: (WebCore::ShadowData::ShadowData): Added spread. (WebCore::ShadowData::operator==): Compare spread.
  • rendering/style/ShadowData.h: (WebCore::ShadowData::ShadowData): Added spread.

LayoutTests:

Reviewed by Anders Carlsson.

Test box-shadow spread radius
https://bugs.webkit.org/show_bug.cgi?id=27417

  • fast/box-shadow/spread.html: Added.
  • platform/mac/fast/box-shadow/spread-expected.checksum: Added.
  • platform/mac/fast/box-shadow/spread-expected.png: Added.
  • platform/mac/fast/box-shadow/spread-expected.txt: Added.
Location:
trunk
Files:
4 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r46096 r46097  
     12009-07-18  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Test box-shadow spread radius
     6        https://bugs.webkit.org/show_bug.cgi?id=27417
     7
     8        * fast/box-shadow/spread.html: Added.
     9        * platform/mac/fast/box-shadow/spread-expected.checksum: Added.
     10        * platform/mac/fast/box-shadow/spread-expected.png: Added.
     11        * platform/mac/fast/box-shadow/spread-expected.txt: Added.
     12
    1132009-07-18  Jan Michael Alonzo  <jmalonzo@webkit.org>
    214
  • trunk/WebCore/ChangeLog

    r46094 r46097  
     12009-07-18  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Add spread radius support to -webkit-box-shadow
     6        https://bugs.webkit.org/show_bug.cgi?id=27417
     7
     8        Test: fast/box-shadow/spread.html
     9
     10        * css/CSSComputedStyleDeclaration.cpp:
     11        (WebCore::valueForShadow): Added a property ID parameter and used it to
     12            include the spread length for box-shadow but not for text-shadow.
     13        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     14            Pass the property ID to valueForShadow().
     15
     16        * css/CSSParser.cpp:
     17        (WebCore::ShadowParseContext::ShadowParseContext): Added property,
     18            spread, and allowSpread members. Added a property ID parameter to
     19            the constructor. Initialize the property and allowSpread members.
     20        (WebCore::ShadowParseContext::allowLength): Added allowSpread.
     21        (WebCore::ShadowParseContext::commitValue): Pass the spread value to
     22            the ShadowValue constructor. Reset allowSpread.
     23        (WebCore::ShadowParseContext::commitLength): Allow spread after blur
     24            for the box-shadow property.
     25        (WebCore::ShadowParseContext::commitColor): Reset allowSpread.
     26        (WebCore::CSSParser::parseShadow): Pass the property ID to
     27            ShadowParseContext().
     28
     29        * css/CSSStyleSelector.cpp:
     30        (WebCore::CSSStyleSelector::applyProperty): Get the spread value from
     31            the shadow value and pass it to the ShadowData constructor.
     32
     33        * css/ShadowValue.cpp:
     34        (WebCore::ShadowValue::ShadowValue): Added spread.
     35        (WebCore::ShadowValue::cssText): Added spread.
     36
     37        * css/ShadowValue.h:
     38        (WebCore::ShadowValue::create): Added spread.
     39
     40        * page/animation/AnimationBase.cpp:
     41        (WebCore::blendFunc): Blend the spread value.
     42        (WebCore::PropertyWrapperShadow::blend): Added 0 spread to the default
     43            shadow.
     44
     45        * rendering/InlineFlowBox.cpp:
     46        (WebCore::InlineFlowBox::placeBoxesHorizontally): Account for spread in
     47            the visual overflow calculations.
     48        (WebCore::InlineFlowBox::placeBoxesVertically): Ditto.
     49        (WebCore::InlineFlowBox::paint): Ditto.
     50
     51        * rendering/RenderBlock.cpp:
     52        (WebCore::RenderBlock::overflowHeight): Ditto.
     53        (WebCore::RenderBlock::overflowWidth): Ditto.
     54        (WebCore::RenderBlock::overflowLeft): Ditto.
     55        (WebCore::RenderBlock::overflowTop): Ditto.
     56        (WebCore::RenderBlock::overflowRect): Ditto.
     57        (WebCore::RenderBlock::layoutBlock): Ditto.
     58
     59        * rendering/RenderBoxModelObject.cpp:
     60        (WebCore::RenderBoxModelObject::paintBoxShadow): Inflate the shadow-
     61            casting rect by the shadow spread value. Adjust border radii if
     62            necessary.
     63
     64        * rendering/RenderFlexibleBox.cpp:
     65        (WebCore::RenderFlexibleBox::layoutBlock): Account for spread in the
     66            visual overflow calculations.
     67        * rendering/RenderLayer.cpp:
     68        (WebCore::RenderLayer::calculateRects): Ditto.
     69
     70        * rendering/RenderObject.cpp:
     71        (WebCore::RenderObject::repaintAfterLayoutIfNeeded): Account for spread.
     72        (WebCore::RenderObject::adjustRectForOutlineAndShadow): Ditto.
     73
     74        * rendering/RenderReplaced.cpp:
     75        (WebCore::RenderReplaced::adjustOverflowForBoxShadowAndReflect): Ditto.
     76
     77        * rendering/style/RenderStyle.cpp:
     78        (WebCore::RenderStyle::setTextShadow): Assert that text shadows do not
     79            have spread.
     80
     81        * rendering/style/ShadowData.cpp:
     82        (WebCore::ShadowData::ShadowData): Added spread.
     83        (WebCore::ShadowData::operator==): Compare spread.
     84        * rendering/style/ShadowData.h:
     85        (WebCore::ShadowData::ShadowData): Added spread.
     86
    1872009-07-18  Adam Barth  <abarth@webkit.org>
    288
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r45014 r46097  
    262262const unsigned numComputedProperties = sizeof(computedProperties) / sizeof(computedProperties[0]);
    263263
    264 static PassRefPtr<CSSValue> valueForShadow(const ShadowData* shadow)
     264static PassRefPtr<CSSValue> valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID)
    265265{
    266266    if (!shadow)
     
    272272        RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX);
    273273        RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX);
     274        RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX);
    274275        RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color.rgb());
    275         list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), color.release()));
     276        list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), color.release()));
    276277    }
    277278    return list.release();
     
    723724            return valueForReflection(style->boxReflect());
    724725        case CSSPropertyWebkitBoxShadow:
    725             return valueForShadow(style->boxShadow());
     726            return valueForShadow(style->boxShadow(), static_cast<CSSPropertyID>(propertyID));
    726727        case CSSPropertyCaptionSide:
    727728            return CSSPrimitiveValue::create(style->captionSide());
     
    10501051            return CSSPrimitiveValue::create(style->textIndent());
    10511052        case CSSPropertyTextShadow:
    1052             return valueForShadow(style->textShadow());
     1053            return valueForShadow(style->textShadow(), static_cast<CSSPropertyID>(propertyID));
    10531054        case CSSPropertyWebkitTextSecurity:
    10541055            return CSSPrimitiveValue::create(style->textSecurity());
  • trunk/WebCore/css/CSSParser.cpp

    r46061 r46097  
    34423442// without the allowBreak bit being set, then it will clean up all of the objects and destroy them.
    34433443struct ShadowParseContext {
    3444     ShadowParseContext()
    3445     : allowX(true)
    3446     , allowY(false)
    3447     , allowBlur(false)
    3448     , allowColor(true)
    3449     , allowBreak(true)
    3450     {}
    3451 
    3452     bool allowLength() { return allowX || allowY || allowBlur; }
     3444    ShadowParseContext(CSSPropertyID prop)
     3445        : property(prop)
     3446        , allowX(true)
     3447        , allowY(false)
     3448        , allowBlur(false)
     3449        , allowSpread(false)
     3450        , allowColor(true)
     3451        , allowBreak(true)
     3452    {
     3453    }
     3454
     3455    bool allowLength() { return allowX || allowY || allowBlur || allowSpread; }
    34533456
    34543457    void commitValue()
    34553458    {
    34563459        // Handle the ,, case gracefully by doing nothing.
    3457         if (x || y || blur || color) {
     3460        if (x || y || blur || spread || color) {
    34583461            if (!values)
    34593462                values = CSSValueList::createCommaSeparated();
    34603463           
    34613464            // Construct the current shadow value and add it to the list.
    3462             values->append(ShadowValue::create(x.release(), y.release(), blur.release(), color.release()));
    3463         }
    3464        
     3465            values->append(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), color.release()));
     3466        }
     3467
    34653468        // Now reset for the next shadow value.
    3466         x = y = blur = color = 0;
    3467         allowX = allowColor = allowBreak = true;
    3468         allowY = allowBlur = false; 
     3469        x = 0;
     3470        y = 0;
     3471        blur = 0;
     3472        spread = 0;
     3473        color = 0;
     3474
     3475        allowX = true;
     3476        allowColor = true;
     3477        allowBreak = true;
     3478        allowY = false;
     3479        allowBlur = false;
     3480        allowSpread = false; 
    34693481    }
    34703482
     
    34753487        if (allowX) {
    34763488            x = val.release();
    3477             allowX = false; allowY = true; allowColor = false; allowBreak = false;
    3478         }
    3479         else if (allowY) {
     3489            allowX = false;
     3490            allowY = true;
     3491            allowColor = false;
     3492            allowBreak = false;
     3493        } else if (allowY) {
    34803494            y = val.release();
    3481             allowY = false; allowBlur = true; allowColor = true; allowBreak = true;
    3482         }
    3483         else if (allowBlur) {
     3495            allowY = false;
     3496            allowBlur = true;
     3497            allowColor = true;
     3498            allowBreak = true;
     3499        } else if (allowBlur) {
    34843500            blur = val.release();
    34853501            allowBlur = false;
     3502            allowSpread = property == CSSPropertyWebkitBoxShadow;
     3503        } else if (allowSpread) {
     3504            spread = val.release();
     3505            allowSpread = false;
    34863506        }
    34873507    }
     
    34933513        if (allowX)
    34943514            allowBreak = false;
    3495         else
     3515        else {
    34963516            allowBlur = false;
    3497     }
    3498    
     3517            allowSpread = false;
     3518        }
     3519    }
     3520
     3521    CSSPropertyID property;
     3522
    34993523    RefPtr<CSSValueList> values;
    35003524    RefPtr<CSSPrimitiveValue> x;
    35013525    RefPtr<CSSPrimitiveValue> y;
    35023526    RefPtr<CSSPrimitiveValue> blur;
     3527    RefPtr<CSSPrimitiveValue> spread;
    35033528    RefPtr<CSSPrimitiveValue> color;
    35043529
     
    35063531    bool allowY;
    35073532    bool allowBlur;
     3533    bool allowSpread;
    35083534    bool allowColor;
    35093535    bool allowBreak;
     
    35123538bool CSSParser::parseShadow(int propId, bool important)
    35133539{
    3514     ShadowParseContext context;
     3540    ShadowParseContext context(static_cast<CSSPropertyID>(propId));
    35153541    CSSParserValue* val;
    35163542    while ((val = m_valueList->current())) {
     
    35243550            // The value is good.  Commit it.
    35253551            context.commitValue();
    3526         }
    3527         // Check to see if we're a length.
    3528         else if (validUnit(val, FLength, true)) {
     3552        } else if (validUnit(val, FLength, true)) {
    35293553            // We required a length and didn't get one. Invalid.
    35303554            if (!context.allowLength())
     
    35333557            // A length is allowed here.  Construct the value and add it.
    35343558            context.commitLength(val);
    3535         }
    3536         else {
     3559        } else {
    35373560            // The only other type of value that's ok is a color value.
    35383561            RefPtr<CSSPrimitiveValue> parsedColor;
     
    35553578            context.commitColor(parsedColor.release());
    35563579        }
    3557        
     3580
    35583581        m_valueList->next();
    35593582    }
     
    35673590        }
    35683591    }
    3569    
     3592
    35703593    return false;
    35713594}
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r46062 r46097  
    45404540            int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
    45414541            int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0;
     4542            int spread = item->spread ? item->spread->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0;
    45424543            Color color;
    45434544            if (item->color)
    45444545                color = getColorFromPrimitiveValue(item->color.get());
    4545             ShadowData* shadowData = new ShadowData(x, y, blur, color.isValid() ? color : Color::transparent);
     4546            ShadowData* shadowData = new ShadowData(x, y, blur, spread, color.isValid() ? color : Color::transparent);
    45464547            if (id == CSSPropertyTextShadow)
    45474548                m_style->setTextShadow(shadowData, i != 0);
  • trunk/WebCore/css/ShadowValue.cpp

    r25754 r46097  
    3232    PassRefPtr<CSSPrimitiveValue> _y,
    3333    PassRefPtr<CSSPrimitiveValue> _blur,
     34    PassRefPtr<CSSPrimitiveValue> _spread,
    3435    PassRefPtr<CSSPrimitiveValue> _color)
    3536    : x(_x)
    3637    , y(_y)
    3738    , blur(_blur)
     39    , spread(_spread)
    3840    , color(_color)
    3941{
     
    6163        text += blur->cssText();
    6264    }
     65    if (spread) {
     66        if (!text.isEmpty())
     67            text += " ";
     68        text += spread->cssText();
     69    }
    6370
    6471    return text;
  • trunk/WebCore/css/ShadowValue.h

    r34627 r46097  
    3636        PassRefPtr<CSSPrimitiveValue> y,
    3737        PassRefPtr<CSSPrimitiveValue> blur,
     38        PassRefPtr<CSSPrimitiveValue> spread,
    3839        PassRefPtr<CSSPrimitiveValue> color)
    3940    {
    40         return adoptRef(new ShadowValue(x, y, blur, color));
     41        return adoptRef(new ShadowValue(x, y, blur, spread, color));
    4142    }
    4243
     
    4647    RefPtr<CSSPrimitiveValue> y;
    4748    RefPtr<CSSPrimitiveValue> blur;
     49    RefPtr<CSSPrimitiveValue> spread;
    4850    RefPtr<CSSPrimitiveValue> color;
    4951
     
    5254        PassRefPtr<CSSPrimitiveValue> y,
    5355        PassRefPtr<CSSPrimitiveValue> blur,
     56        PassRefPtr<CSSPrimitiveValue> spread,
    5457        PassRefPtr<CSSPrimitiveValue> color);
    5558};
  • trunk/WebCore/page/animation/AnimationBase.cpp

    r45556 r46097  
    118118    ASSERT(from && to);
    119119    return new ShadowData(blendFunc(anim, from->x, to->x, progress), blendFunc(anim, from->y, to->y, progress),
    120                           blendFunc(anim, from->blur, to->blur, progress), blendFunc(anim, from->color, to->color, progress));
     120                          blendFunc(anim, from->blur, to->blur, progress), blendFunc(anim, from->spread, to->spread, progress),
     121                          blendFunc(anim, from->color, to->color, progress));
    121122}
    122123
     
    301302        ShadowData* shadowA = (a->*m_getter)();
    302303        ShadowData* shadowB = (b->*m_getter)();
    303         ShadowData defaultShadowData(0, 0, 0, Color::transparent);
     304        ShadowData defaultShadowData(0, 0, 0, 0, Color::transparent);
    304305
    305306        if (!shadowA)
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r45702 r46097  
    257257    int boxShadowRight = 0;
    258258    for (ShadowData* boxShadow = renderer()->style(m_firstLine)->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    259         boxShadowLeft = min(boxShadow->x - boxShadow->blur, boxShadowLeft);
    260         boxShadowRight = max(boxShadow->x + boxShadow->blur, boxShadowRight);
     259        boxShadowLeft = min(boxShadow->x - boxShadow->blur - boxShadow->spread, boxShadowLeft);
     260        boxShadowRight = max(boxShadow->x + boxShadow->blur + boxShadow->spread, boxShadowRight);
    261261    }
    262262    leftPosition = min(xPos + boxShadowLeft, leftPosition);
     
    530530
    531531            for (ShadowData* boxShadow = curr->renderer()->style(m_firstLine)->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    532                 overflowTop = min(overflowTop, boxShadow->y - boxShadow->blur);
    533                 overflowBottom = max(overflowBottom, boxShadow->y + boxShadow->blur);
     532                overflowTop = min(overflowTop, boxShadow->y - boxShadow->blur - boxShadow->spread);
     533                overflowBottom = max(overflowBottom, boxShadow->y + boxShadow->blur + boxShadow->spread);
    534534            }
    535535
     
    602602    int shadowRight = 0;
    603603    for (ShadowData* boxShadow = renderer()->style(m_firstLine)->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    604         shadowLeft = min(boxShadow->x - boxShadow->blur, shadowLeft);
    605         shadowRight = max(boxShadow->x + boxShadow->blur, shadowRight);
     604        shadowLeft = min(boxShadow->x - boxShadow->blur - boxShadow->spread, shadowLeft);
     605        shadowRight = max(boxShadow->x + boxShadow->blur + boxShadow->spread, shadowRight);
    606606    }
    607607    for (ShadowData* textShadow = renderer()->style(m_firstLine)->textShadow(); textShadow; textShadow = textShadow->next) {
  • trunk/WebCore/rendering/RenderBlock.cpp

    r46044 r46097  
    556556        int shadowHeight = 0;
    557557        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next)
    558             shadowHeight = max(boxShadow->y + boxShadow->blur, shadowHeight);
     558            shadowHeight = max(boxShadow->y + boxShadow->blur + boxShadow->spread, shadowHeight);
    559559        int inflatedHeight = height() + shadowHeight;
    560560        if (hasReflection())
     
    570570        int shadowWidth = 0;
    571571        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next)
    572             shadowWidth = max(boxShadow->x + boxShadow->blur, shadowWidth);
     572            shadowWidth = max(boxShadow->x + boxShadow->blur + boxShadow->spread, shadowWidth);
    573573        int inflatedWidth = width() + shadowWidth;
    574574        if (hasReflection())
     
    584584        int shadowLeft = 0;
    585585        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next)
    586             shadowLeft = min(boxShadow->x - boxShadow->blur, shadowLeft);
     586            shadowLeft = min(boxShadow->x - boxShadow->blur - boxShadow->spread, shadowLeft);
    587587        int left = shadowLeft;
    588588        if (hasReflection())
     
    598598        int shadowTop = 0;
    599599        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next)
    600             shadowTop = min(boxShadow->y - boxShadow->blur, shadowTop);
     600            shadowTop = min(boxShadow->y - boxShadow->blur - boxShadow->spread, shadowTop);
    601601        int top = shadowTop;
    602602        if (hasReflection())
     
    617617
    618618        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    619             shadowLeft = min(boxShadow->x - boxShadow->blur, shadowLeft);
    620             shadowRight = max(boxShadow->x + boxShadow->blur, shadowRight);
    621             shadowTop = min(boxShadow->y - boxShadow->blur, shadowTop);
    622             shadowBottom = max(boxShadow->y + boxShadow->blur, shadowBottom);
     619            shadowLeft = min(boxShadow->x - boxShadow->blur - boxShadow->spread, shadowLeft);
     620            shadowRight = max(boxShadow->x + boxShadow->blur + boxShadow->spread, shadowRight);
     621            shadowTop = min(boxShadow->y - boxShadow->blur - boxShadow->spread, shadowTop);
     622            shadowBottom = max(boxShadow->y + boxShadow->blur + boxShadow->spread, shadowBottom);
    623623        }
    624624
     
    872872    if (!hasOverflowClip()) {
    873873        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    874             m_overflowLeft = min(m_overflowLeft, boxShadow->x - boxShadow->blur);
    875             m_overflowWidth = max(m_overflowWidth, width() + boxShadow->x + boxShadow->blur);
    876             m_overflowTop = min(m_overflowTop, boxShadow->y - boxShadow->blur);
    877             m_overflowHeight = max(m_overflowHeight, height() + boxShadow->y + boxShadow->blur);
     874            m_overflowLeft = min(m_overflowLeft, boxShadow->x - boxShadow->blur - boxShadow->spread);
     875            m_overflowWidth = max(m_overflowWidth, width() + boxShadow->x + boxShadow->blur + boxShadow->spread);
     876            m_overflowTop = min(m_overflowTop, boxShadow->y - boxShadow->blur - boxShadow->spread);
     877            m_overflowHeight = max(m_overflowHeight, height() + boxShadow->y + boxShadow->blur + boxShadow->spread);
    878878        }
    879879       
  • trunk/WebCore/rendering/RenderBoxModelObject.cpp

    r45988 r46097  
    11391139    bool hasOpaqueBackground = s->backgroundColor().isValid() && s->backgroundColor().alpha() == 255;
    11401140    for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) {
    1141         context->save();
    1142 
    11431141        IntSize shadowOffset(shadow->x, shadow->y);
    11441142        int shadowBlur = shadow->blur;
     1143        int shadowSpread = shadow->spread;
    11451144        IntRect fillRect(rect);
     1145        fillRect.inflate(shadowSpread);
     1146        if (fillRect.isEmpty())
     1147            continue;
    11461148
    11471149        IntRect shadowRect(rect);
    1148         shadowRect.inflate(shadowBlur);
     1150        shadowRect.inflate(shadowBlur + shadowSpread);
    11491151        shadowRect.move(shadowOffset);
     1152
     1153        context->save();
    11501154        context->clip(shadowRect);
    11511155
    11521156        // Move the fill just outside the clip, adding 1 pixel separation so that the fill does not
    11531157        // bleed in (due to antialiasing) if the context is transformed.
    1154         IntSize extraOffset(w + max(0, shadowOffset.width()) + shadowBlur + 1, 0);
     1158        IntSize extraOffset(w + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);
    11551159        shadowOffset -= extraOffset;
    11561160        fillRect.move(extraOffset);
     
    11711175            IntSize bottomLeftToClipOut = bottomLeft;
    11721176            IntSize bottomRightToClipOut = bottomRight;
     1177
     1178            if (shadowSpread < 0) {
     1179                topLeft.expand(shadowSpread, shadowSpread);
     1180                topLeft.clampNegativeToZero();
     1181
     1182                topRight.expand(shadowSpread, shadowSpread);
     1183                topRight.clampNegativeToZero();
     1184
     1185                bottomLeft.expand(shadowSpread, shadowSpread);
     1186                bottomLeft.clampNegativeToZero();
     1187
     1188                bottomRight.expand(shadowSpread, shadowSpread);
     1189                bottomRight.clampNegativeToZero();
     1190            }
    11731191
    11741192            // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
  • trunk/WebCore/rendering/RenderFlexibleBox.cpp

    r46044 r46097  
    281281    if (!hasOverflowClip()) {
    282282        for (ShadowData* boxShadow = style()->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
    283             m_overflowLeft = min(m_overflowLeft, boxShadow->x - boxShadow->blur);
    284             m_overflowWidth = max(m_overflowWidth, width() + boxShadow->x + boxShadow->blur);
    285             m_overflowTop = min(m_overflowTop, boxShadow->y - boxShadow->blur);
    286             m_overflowHeight = max(m_overflowHeight, height() + boxShadow->y + boxShadow->blur);
     283            m_overflowLeft = min(m_overflowLeft, boxShadow->x - boxShadow->blur - boxShadow->spread);
     284            m_overflowWidth = max(m_overflowWidth, width() + boxShadow->x + boxShadow->blur + boxShadow->spread);
     285            m_overflowTop = min(m_overflowTop, boxShadow->y - boxShadow->blur - boxShadow->spread);
     286            m_overflowHeight = max(m_overflowHeight, height() + boxShadow->y + boxShadow->blur + boxShadow->spread);
    287287        }
    288288       
  • trunk/WebCore/rendering/RenderLayer.cpp

    r45715 r46097  
    27102710                IntRect shadowRect = layerBounds;
    27112711                shadowRect.move(boxShadow->x, boxShadow->y);
    2712                 shadowRect.inflate(boxShadow->blur);
     2712                shadowRect.inflate(boxShadow->blur + boxShadow->spread);
    27132713                overflow.unite(shadowRect);
    27142714                boxShadow = boxShadow->next;
  • trunk/WebCore/rendering/RenderObject.cpp

    r45624 r46097  
    12191219        int shadowRight = 0;
    12201220        for (ShadowData* shadow = boxShadow; shadow; shadow = shadow->next)
    1221             shadowRight = max(shadow->x + shadow->blur, shadowRight);
     1221            shadowRight = max(shadow->x + shadow->blur + shadow->spread, shadowRight);
    12221222
    12231223        int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
     
    12371237        int shadowBottom = 0;
    12381238        for (ShadowData* shadow = boxShadow; shadow; shadow = shadow->next)
    1239             shadowBottom = max(shadow->y + shadow->blur, shadowBottom);
     1239            shadowBottom = max(shadow->y + shadow->blur + shadow->spread, shadowBottom);
    12401240
    12411241        int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
     
    22412241
    22422242        do {
    2243             shadowLeft = min(boxShadow->x - boxShadow->blur - outlineSize, shadowLeft);
    2244             shadowRight = max(boxShadow->x + boxShadow->blur + outlineSize, shadowRight);
    2245             shadowTop = min(boxShadow->y - boxShadow->blur - outlineSize, shadowTop);
    2246             shadowBottom = max(boxShadow->y + boxShadow->blur + outlineSize, shadowBottom);
     2243            shadowLeft = min(boxShadow->x - boxShadow->blur - boxShadow->spread - outlineSize, shadowLeft);
     2244            shadowRight = max(boxShadow->x + boxShadow->blur + boxShadow->spread + outlineSize, shadowRight);
     2245            shadowTop = min(boxShadow->y - boxShadow->blur - boxShadow->spread - outlineSize, shadowTop);
     2246            shadowBottom = max(boxShadow->y + boxShadow->blur + boxShadow->spread + outlineSize, shadowBottom);
    22472247
    22482248            boxShadow = boxShadow->next;
  • trunk/WebCore/rendering/RenderReplaced.cpp

    r45486 r46097  
    334334        IntRect shadow = borderBoxRect();
    335335        shadow.move(boxShadow->x, boxShadow->y);
    336         shadow.inflate(boxShadow->blur);
     336        shadow.inflate(boxShadow->blur + boxShadow->spread);
    337337        overflow.unite(shadow);
    338338    }
  • trunk/WebCore/rendering/style/RenderStyle.cpp

    r45612 r46097  
    696696void RenderStyle::setTextShadow(ShadowData* val, bool add)
    697697{
     698    ASSERT(!val || !val->spread);
     699
    698700    StyleRareInheritedData* rareData = rareInheritedData.access();
    699701    if (!add) {
  • trunk/WebCore/rendering/style/ShadowData.cpp

    r36619 r46097  
    2929    , y(o.y)
    3030    , blur(o.blur)
     31    , spread(o.spread)
    3132    , color(o.color)
    3233{
     
    4041        return false;
    4142   
    42     return x == o.x && y == o.y && blur == o.blur && color == o.color;
     43    return x == o.x && y == o.y && blur == o.blur && spread == o.spread && color == o.color;
    4344}
    4445
  • trunk/WebCore/rendering/style/ShadowData.h

    r36619 r46097  
    3737        , y(0)
    3838        , blur(0)
     39        , spread(0)
    3940        , next(0)
    4041    {
    4142    }
    4243
    43     ShadowData(int _x, int _y, int _blur, const Color& _color)
    44         : x(_x)
    45         , y(_y)
    46         , blur(_blur)
    47         , color(_color)
     44    ShadowData(int x, int y, int blur, int spread, const Color& color)
     45        : x(x)
     46        , y(y)
     47        , blur(blur)
     48        , spread(spread)
     49        , color(color)
    4850        , next(0)
    4951    {
     
    6365    int y;
    6466    int blur;
     67    int spread;
    6568    Color color;
    6669    ShadowData* next;
Note: See TracChangeset for help on using the changeset viewer.