Changeset 32406 in webkit


Ignore:
Timestamp:
Apr 22, 2008 2:40:35 PM (16 years ago)
Author:
hyatt@apple.com
Message:

WebCore:

2008-04-22 David Hyatt <hyatt@apple.com>

Fix for <rdar://5589634>.

Implement CSS alpha masks. The syntax is very similar to that used for backgrounds. Multiple mask images
can be specified, and each one can be tiled, positioned, etc. The following new properties have been
added (all of which are analogous to their background-* counterparts).

mask, mask-image, mask-clip, mask-origin, mask-repeat, mask-attachment, mask-position

The alpha values in the final composite image are used to determine how the mask applies (alpha of 1 = show,
alpha of 0 = don't show).

SVG images and CSS gradients can also be used as masks.

Reviewed by Dan

Added fast/backgrounds/repeat/mask-negative-offset-repeat.html, fast/backgrounds/svg-as-mask.html

  • css/CSSMutableStyleDeclaration.cpp: (WebCore::CSSMutableStyleDeclaration::getPropertyValue): (WebCore::initShorthandMap):
  • css/CSSParser.cpp: (WebCore::CSSParser::parseFillProperty): (WebCore::CSSParser::parseTransformOrigin):
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::adjustRenderStyle): (WebCore::CSSStyleSelector::applyProperty):
  • rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::paint): (WebCore::InlineFlowBox::paintFillLayers): (WebCore::InlineFlowBox::paintFillLayer): (WebCore::InlineFlowBox::paintBoxDecorations): (WebCore::InlineFlowBox::paintMask):
  • rendering/InlineFlowBox.h:
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::paint): (WebCore::RenderBlock::paintObject):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::paintRootBoxDecorations): (WebCore::RenderBox::paintBoxDecorations): (WebCore::RenderBox::paintMask): (WebCore::RenderBox::paintFillLayers): (WebCore::RenderBox::paintFillLayer): (WebCore::RenderBox::paintFillLayerExtended):
  • rendering/RenderBox.h:
  • rendering/RenderFieldset.cpp: (WebCore::RenderFieldset::paintBoxDecorations): (WebCore::RenderFieldset::paintMask):
  • rendering/RenderFieldset.h:
  • rendering/RenderInline.cpp: (WebCore::RenderInline::requiresLayer):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::isTransparent): (WebCore::RenderLayer::paintLayer):
  • rendering/RenderObject.cpp: (WebCore::RenderObject::requiresLayer): (WebCore::mustRepaintFillLayers): (WebCore::RenderObject::mustRepaintBackgroundOrBorder): (WebCore::RenderObject::setStyle): (WebCore::RenderObject::updateFillImages):
  • rendering/RenderObject.h: (WebCore::): (WebCore::RenderObject::hasMask): (WebCore::RenderObject::paintMask): (WebCore::RenderObject::paintFillExtended):
  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::paint):
  • rendering/RenderStyle.cpp: (WebCore::FillLayer::FillLayer): (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
  • rendering/RenderStyle.h: (WebCore::FillLayer::initialFillComposite): (WebCore::FillLayer::initialFillSize): (WebCore::FillLayer::FillLayer): (WebCore::RenderStyle::hasMask):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::paint): (WebCore::RenderTable::paintBoxDecorations): (WebCore::RenderTable::paintMask):
  • rendering/RenderTable.h:
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::requiresLayer): (WebCore::RenderTableCell::paintBackgroundsBehindCell): (WebCore::RenderTableCell::paintMask):
  • rendering/RenderTableCell.h:
  • rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint):
  • svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw): (WebCore::SVGImage::dataChanged):

LayoutTests:

2008-04-22 David Hyatt <hyatt@apple.com>

Add support for CSS alpha masks. Test cases.

Reviewed by Dan

  • fast/backgrounds/repeat/mask-negative-offset-repeat.html: Added.
  • fast/backgrounds/repeat/resources/white.gif: Added.
  • fast/backgrounds/svg-as-mask.html: Added.
Location:
trunk
Files:
3 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r32402 r32406  
     12008-04-22  David Hyatt  <hyatt@apple.com>
     2
     3        Add support for CSS alpha masks.  Test cases.
     4
     5        Reviewed by Dan
     6
     7        * fast/backgrounds/repeat/mask-negative-offset-repeat.html: Added.
     8        * fast/backgrounds/repeat/resources/white.gif: Added.
     9        * fast/backgrounds/svg-as-mask.html: Added.
     10
    1112008-04-22  Dan Bernstein  <mitz@apple.com>
    212
  • trunk/WebCore/ChangeLog

    r32405 r32406  
     12008-04-22  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for <rdar://5589634>.
     4
     5        Implement CSS alpha masks.  The syntax is very similar to that used for backgrounds.  Multiple mask images
     6        can be specified, and each one can be tiled, positioned, etc.  The following new properties have been
     7        added (all of which are analogous to their background-* counterparts).
     8
     9        mask, mask-image, mask-clip, mask-origin, mask-repeat, mask-attachment, mask-position
     10
     11        The alpha values in the final composite image are used to determine how the mask applies (alpha of 1 = show,
     12        alpha of 0 = don't show).
     13
     14        SVG images and CSS gradients can also be used as masks.
     15
     16        Reviewed by Dan
     17
     18        Added fast/backgrounds/repeat/mask-negative-offset-repeat.html, fast/backgrounds/svg-as-mask.html
     19
     20        * css/CSSMutableStyleDeclaration.cpp:
     21        (WebCore::CSSMutableStyleDeclaration::getPropertyValue):
     22        (WebCore::initShorthandMap):
     23        * css/CSSParser.cpp:
     24        (WebCore::CSSParser::parseFillProperty):
     25        (WebCore::CSSParser::parseTransformOrigin):
     26        * css/CSSStyleSelector.cpp:
     27        (WebCore::CSSStyleSelector::adjustRenderStyle):
     28        (WebCore::CSSStyleSelector::applyProperty):
     29        * rendering/InlineFlowBox.cpp:
     30        (WebCore::InlineFlowBox::paint):
     31        (WebCore::InlineFlowBox::paintFillLayers):
     32        (WebCore::InlineFlowBox::paintFillLayer):
     33        (WebCore::InlineFlowBox::paintBoxDecorations):
     34        (WebCore::InlineFlowBox::paintMask):
     35        * rendering/InlineFlowBox.h:
     36        * rendering/RenderBlock.cpp:
     37        (WebCore::RenderBlock::paint):
     38        (WebCore::RenderBlock::paintObject):
     39        * rendering/RenderBox.cpp:
     40        (WebCore::RenderBox::paintRootBoxDecorations):
     41        (WebCore::RenderBox::paintBoxDecorations):
     42        (WebCore::RenderBox::paintMask):
     43        (WebCore::RenderBox::paintFillLayers):
     44        (WebCore::RenderBox::paintFillLayer):
     45        (WebCore::RenderBox::paintFillLayerExtended):
     46        * rendering/RenderBox.h:
     47        * rendering/RenderFieldset.cpp:
     48        (WebCore::RenderFieldset::paintBoxDecorations):
     49        (WebCore::RenderFieldset::paintMask):
     50        * rendering/RenderFieldset.h:
     51        * rendering/RenderInline.cpp:
     52        (WebCore::RenderInline::requiresLayer):
     53        * rendering/RenderLayer.cpp:
     54        (WebCore::RenderLayer::isTransparent):
     55        (WebCore::RenderLayer::paintLayer):
     56        * rendering/RenderObject.cpp:
     57        (WebCore::RenderObject::requiresLayer):
     58        (WebCore::mustRepaintFillLayers):
     59        (WebCore::RenderObject::mustRepaintBackgroundOrBorder):
     60        (WebCore::RenderObject::setStyle):
     61        (WebCore::RenderObject::updateFillImages):
     62        * rendering/RenderObject.h:
     63        (WebCore::):
     64        (WebCore::RenderObject::hasMask):
     65        (WebCore::RenderObject::paintMask):
     66        (WebCore::RenderObject::paintFillExtended):
     67        * rendering/RenderReplaced.cpp:
     68        (WebCore::RenderReplaced::paint):
     69        * rendering/RenderStyle.cpp:
     70        (WebCore::FillLayer::FillLayer):
     71        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
     72        * rendering/RenderStyle.h:
     73        (WebCore::FillLayer::initialFillComposite):
     74        (WebCore::FillLayer::initialFillSize):
     75        (WebCore::FillLayer::FillLayer):
     76        (WebCore::RenderStyle::hasMask):
     77        * rendering/RenderTable.cpp:
     78        (WebCore::RenderTable::paint):
     79        (WebCore::RenderTable::paintBoxDecorations):
     80        (WebCore::RenderTable::paintMask):
     81        * rendering/RenderTable.h:
     82        * rendering/RenderTableCell.cpp:
     83        (WebCore::RenderTableCell::requiresLayer):
     84        (WebCore::RenderTableCell::paintBackgroundsBehindCell):
     85        (WebCore::RenderTableCell::paintMask):
     86        * rendering/RenderTableCell.h:
     87        * rendering/RenderWidget.cpp:
     88        (WebCore::RenderWidget::paint):
     89        * svg/graphics/SVGImage.cpp:
     90        (WebCore::SVGImage::draw):
     91        (WebCore::SVGImage::dataChanged):
     92
    1932008-04-22  Sam Weinig  <sam@webkit.org>
    294
  • trunk/WebCore/css/CSSMutableStyleDeclaration.cpp

    r31993 r32406  
    8888        }
    8989        case CSSPropertyBackground: {
    90             const int properties[6] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat,
    91                                         CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPositionX,
    92                                         CSSPropertyBackgroundPositionY, CSSPropertyBackgroundColor };
    93             return getLayeredShorthandValue(properties, 6);
     90            const int properties[7] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat,
     91                                        CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPosition, CSSPropertyWebkitBackgroundClip,
     92                                        CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundColor };
     93            return getLayeredShorthandValue(properties, 7);
    9494        }
    9595        case CSSPropertyBorder: {
     
    152152                                        CSSPropertyListStyleImage };
    153153            return getShorthandValue(properties, 3);
     154        }
     155        case CSSPropertyWebkitMaskPosition: {
     156            // FIXME: Is this correct? The code in cssparser.cpp is confusing
     157            const int properties[2] = { CSSPropertyWebkitMaskPositionX,
     158                                        CSSPropertyWebkitMaskPositionY };
     159            return getLayeredShorthandValue(properties, 2);
     160        }
     161        case CSSPropertyWebkitMask: {
     162            const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
     163                                       CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition, CSSPropertyWebkitMaskClip,
     164                                       CSSPropertyWebkitMaskOrigin };
     165            return getLayeredShorthandValue(properties, 6);
    154166        }
    155167#if ENABLE(SVG)
     
    387399    static const int backgroundProperties[] = {
    388400        CSSPropertyBackgroundAttachment,
     401        CSSPropertyWebkitBackgroundClip,
    389402        CSSPropertyBackgroundColor,
    390403        CSSPropertyBackgroundImage,
     404        CSSPropertyWebkitBackgroundOrigin,
    391405        CSSPropertyBackgroundPositionX,
    392406        CSSPropertyBackgroundPositionY,
    393407        CSSPropertyBackgroundRepeat,
    394         CSSPropertyWebkitBackgroundSize
    395408    };
    396409    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBackground, backgroundProperties);
     
    417430    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitBorderRadius, borderRadiusProperties);
    418431
     432    static const int maskPositionProperties[] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY };
     433    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitMaskPosition, maskPositionProperties);
     434
     435    static const int maskProperties[] = {
     436        CSSPropertyWebkitMaskAttachment,
     437        CSSPropertyWebkitMaskClip,
     438        CSSPropertyWebkitMaskImage,
     439        CSSPropertyWebkitMaskOrigin,
     440        CSSPropertyWebkitMaskPositionX,
     441        CSSPropertyWebkitMaskPositionY,
     442        CSSPropertyWebkitMaskRepeat,
     443    };
     444    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBackground, maskProperties);
     445   
    419446    #undef SET_SHORTHAND_MAP_ENTRY
    420447}
  • trunk/WebCore/css/CSSParser.cpp

    r32362 r32406  
    20892089        propId1 = CSSPropertyBackgroundPositionX;
    20902090        propId2 = CSSPropertyBackgroundPositionY;
     2091    } else if (propId == CSSPropertyWebkitMaskPosition) {
     2092        propId1 = CSSPropertyWebkitMaskPositionX;
     2093        propId2 = CSSPropertyWebkitMaskPositionY;
    20912094    }
    20922095
     
    21152118                    break;
    21162119                case CSSPropertyBackgroundImage:
    2117                 case CSSPropertyWebkitMask:
     2120                case CSSPropertyWebkitMaskImage:
    21182121                    if (parseFillImage(currValue))
    21192122                        valueList->next();
     
    37583761        case CSSPropertyWebkitTransformOrigin:
    37593762            parseFillPosition(value, value2);
    3760             // Unlike the other functions, parseBackgroundPosition advances the valueList pointer
     3763            // Unlike the other functions, parseFillPosition advances the valueList pointer
    37613764            break;
    37623765        case CSSPropertyWebkitTransformOriginX: {
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r32348 r32406  
    168168HANDLE_FILL_LAYER_VALUE(background, Background, prop, Prop, value)
    169169
     170#define HANDLE_MASK_INHERIT_AND_INITIAL(prop, Prop) \
     171HANDLE_FILL_LAYER_INHERIT_AND_INITIAL(mask, Mask, prop, Prop)
     172
     173#define HANDLE_MASK_VALUE(prop, Prop, value) \
     174HANDLE_FILL_LAYER_VALUE(mask, Mask, prop, Prop, value)
     175
    170176#define HANDLE_TRANSITION_INHERIT_AND_INITIAL(prop, Prop) \
    171177if (isInherit) { \
     
    11641170
    11651171    // Make sure our z-index value is only applied if the object is positioned,
    1166     // relatively positioned, transparent, or has a transform.
    1167     if (style->position() == StaticPosition && style->opacity() == 1.0f && !style->hasTransform())
     1172    // relatively positioned, transparent, or has a transform/mask.
     1173    if (style->position() == StaticPosition && style->opacity() == 1.0f && !style->hasTransform() && !style->hasMask())
    11681174        style->setHasAutoZIndex();
    11691175
    11701176    // Auto z-index becomes 0 for the root element and transparent objects.  This prevents
    11711177    // cases where objects that should be blended as a single unit end up with a non-transparent
    1172     // object wedged in between them.  Auto z-index also becomes 0 for objects that specify transforms.
    1173     if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f || style->hasTransform()))
     1178    // object wedged in between them.  Auto z-index also becomes 0 for objects that specify transforms/masks.
     1179    if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f || style->hasTransform() || style->hasMask()))
    11741180        style->setZIndex(0);
    11751181   
     
    23412347        HANDLE_BACKGROUND_VALUE(size, Size, value)
    23422348        return;
     2349    case CSSPropertyWebkitMaskAttachment:
     2350        HANDLE_MASK_VALUE(attachment, Attachment, value)
     2351        return;
     2352    case CSSPropertyWebkitMaskClip:
     2353        HANDLE_MASK_VALUE(clip, Clip, value)
     2354        return;
     2355    case CSSPropertyWebkitMaskOrigin:
     2356        HANDLE_MASK_VALUE(origin, Origin, value)
     2357        return;
     2358    case CSSPropertyWebkitMaskRepeat:
     2359        HANDLE_MASK_VALUE(repeat, Repeat, value)
     2360        return;
     2361    case CSSPropertyWebkitMaskSize:
     2362        HANDLE_MASK_VALUE(size, Size, value)
     2363        return;
    23432364    case CSSPropertyBorderCollapse:
    23442365        HANDLE_INHERIT_AND_INITIAL(borderCollapse, BorderCollapse)
     
    26692690        return;
    26702691    }
     2692    case CSSPropertyWebkitMaskPosition:
     2693        HANDLE_MASK_INHERIT_AND_INITIAL(xPosition, XPosition);
     2694        HANDLE_MASK_INHERIT_AND_INITIAL(yPosition, YPosition);
     2695        return;
     2696    case CSSPropertyWebkitMaskPositionX: {
     2697        HANDLE_MASK_VALUE(xPosition, XPosition, value)
     2698        return;
     2699    }
     2700    case CSSPropertyWebkitMaskPositionY: {
     2701        HANDLE_MASK_VALUE(yPosition, YPosition, value)
     2702        return;
     2703    }
    26712704    case CSSPropertyBorderSpacing: {
    26722705        if (isInherit) {
     
    28112844    case CSSPropertyBackgroundImage:
    28122845        HANDLE_BACKGROUND_VALUE(image, Image, value)
     2846        return;
     2847    case CSSPropertyWebkitMaskImage:
     2848        HANDLE_MASK_VALUE(image, Image, value)
    28132849        return;
    28142850    case CSSPropertyListStyleImage:
     
    36503686            m_style->clearBackgroundLayers();
    36513687            m_style->setBackgroundColor(Color());
    3652             return;
    36533688        }
    36543689        else if (isInherit) {
     
    36573692        }
    36583693        return;
     3694    case CSSPropertyWebkitMask:
     3695        if (isInitial)
     3696            m_style->clearMaskLayers();
     3697        else if (isInherit)
     3698            m_style->inheritMaskLayers(*m_parentStyle->maskLayers());
     3699        return;
     3700
    36593701    case CSSPropertyBorder:
    36603702    case CSSPropertyBorderStyle:
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r32334 r32406  
    620620                    paintInfo.outlineObjects->add(flowObject());
    621621            }
     622        } else if (paintInfo.phase == PaintPhaseMask) {
     623            paintMask(paintInfo, tx, ty);
     624            return;
    622625        } else {
    623626            // 1. Paint our background, border and box-shadow.
     
    628631        }
    629632    }
     633
     634    if (paintInfo.phase == PaintPhaseMask)
     635        return;
    630636
    631637    PaintPhase paintPhase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhaseOutline : paintInfo.phase;
     
    647653}
    648654
    649 void InlineFlowBox::paintBackgrounds(const RenderObject::PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer,
    650                                      int my, int mh, int _tx, int _ty, int w, int h)
    651 {
    652     if (!bgLayer)
     655void InlineFlowBox::paintFillLayers(const RenderObject::PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer,
     656                                    int my, int mh, int _tx, int _ty, int w, int h)
     657{
     658    if (!fillLayer)
    653659        return;
    654     paintBackgrounds(paintInfo, c, bgLayer->next(), my, mh, _tx, _ty, w, h);
    655     paintBackground(paintInfo, c, bgLayer, my, mh, _tx, _ty, w, h);
    656 }
    657 
    658 void InlineFlowBox::paintBackground(const RenderObject::PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer,
    659                                     int my, int mh, int tx, int ty, int w, int h)
    660 {
    661     StyleImage* bg = bgLayer->image();
    662     bool hasBackgroundImage = bg && bg->canRender(object()->style()->effectiveZoom());
    663     if ((!hasBackgroundImage && !object()->style()->hasBorderRadius()) || (!prevLineBox() && !nextLineBox()) || !parent())
    664         object()->paintBackgroundExtended(paintInfo, c, bgLayer, my, mh, tx, ty, w, h, this);
     660    paintFillLayers(paintInfo, c, fillLayer->next(), my, mh, _tx, _ty, w, h);
     661    paintFillLayer(paintInfo, c, fillLayer, my, mh, _tx, _ty, w, h);
     662}
     663
     664void InlineFlowBox::paintFillLayer(const RenderObject::PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer,
     665                                   int my, int mh, int tx, int ty, int w, int h)
     666{
     667    StyleImage* img = fillLayer->image();
     668    bool hasFillImage = img && img->canRender(object()->style()->effectiveZoom());
     669    if ((!hasFillImage && !object()->style()->hasBorderRadius()) || (!prevLineBox() && !nextLineBox()) || !parent())
     670        object()->paintFillExtended(paintInfo, c, fillLayer, my, mh, tx, ty, w, h, this);
    665671    else {
    666         // We have a background image that spans multiple lines.
     672        // We have a fill image that spans multiple lines.
    667673        // We need to adjust _tx and _ty by the width of all previous lines.
    668674        // Think of background painting on inlines as though you had one long line, a single continuous
     
    681687        paintInfo.context->save();
    682688        paintInfo.context->clip(IntRect(tx, ty, width(), height()));
    683         object()->paintBackgroundExtended(paintInfo, c, bgLayer, my, mh, startX, ty,
    684                                           totalWidth, h, this);
     689        object()->paintFillExtended(paintInfo, c, fillLayer, my, mh, startX, ty, totalWidth, h, this);
    685690        paintInfo.context->restore();
    686691    }
     
    728733
    729734        Color c = styleToUse->backgroundColor();
    730         paintBackgrounds(paintInfo, c, styleToUse->backgroundLayers(), my, mh, tx, ty, w, h);
     735        paintFillLayers(paintInfo, c, styleToUse->backgroundLayers(), my, mh, tx, ty, w, h);
    731736
    732737        // :first-line cannot be used to put borders on a line. Always paint borders with our
     
    767772}
    768773
     774void InlineFlowBox::paintMask(RenderObject::PaintInfo& paintInfo, int tx, int ty)
     775{
     776    if (!object()->shouldPaintWithinRoot(paintInfo) || object()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
     777        return;
     778
     779    // Move x/y to our coordinates.
     780    tx += m_x;
     781    ty += m_y;
     782   
     783    int w = width();
     784    int h = height();
     785
     786    int my = max(ty, paintInfo.rect.y());
     787    int mh;
     788    if (ty < paintInfo.rect.y())
     789        mh = max(0, h - (paintInfo.rect.y() - ty));
     790    else
     791        mh = min(paintInfo.rect.height(), h);
     792
     793    if (object()->hasMask())
     794        paintFillLayers(paintInfo, Color(), object()->style()->maskLayers(), my, mh, tx, ty, w, h);
     795}
     796
    769797static bool shouldDrawTextDecoration(RenderObject* obj)
    770798{
  • trunk/WebCore/rendering/InlineFlowBox.h

    r32334 r32406  
    8484
    8585    virtual void paintBoxDecorations(RenderObject::PaintInfo&, int tx, int ty);
    86     void paintBackgrounds(const RenderObject::PaintInfo&, const Color&, const FillLayer*,
    87                           int my, int mh, int tx, int ty, int w, int h);
    88     void paintBackground(const RenderObject::PaintInfo&, const Color&, const FillLayer*,
     86    virtual void paintMask(RenderObject::PaintInfo&, int tx, int ty);
     87    void paintFillLayers(const RenderObject::PaintInfo&, const Color&, const FillLayer*,
     88                         int my, int mh, int tx, int ty, int w, int h);
     89    void paintFillLayer(const RenderObject::PaintInfo&, const Color&, const FillLayer*,
    8990                         int my, int mh, int tx, int ty, int w, int h);
    9091    void paintBoxShadow(GraphicsContext*, RenderStyle*, int tx, int ty, int w, int h);
  • trunk/WebCore/rendering/RenderBlock.cpp

    r31876 r32406  
    14001400    }
    14011401
    1402     bool useControlClip = phase != PaintPhaseBlockBackground && phase != PaintPhaseSelfOutline && hasControlClip();
     1402    bool useControlClip = phase != PaintPhaseBlockBackground && phase != PaintPhaseSelfOutline && phase != PaintPhaseMask && hasControlClip();
    14031403
    14041404    // Push a clip.
     
    15711571        hasBoxDecorations() && style()->visibility() == VISIBLE) {
    15721572        paintBoxDecorations(paintInfo, tx, ty);
     1573    }
     1574
     1575    if (paintPhase == PaintPhaseMask && style()->visibility() == VISIBLE) {
     1576        paintMask(paintInfo, tx, ty);
     1577        return;
    15731578    }
    15741579
  • trunk/WebCore/rendering/RenderBox.cpp

    r32334 r32406  
    357357    int my = max(by, paintInfo.rect.y());
    358358
    359     paintBackgrounds(paintInfo, bgColor, bgLayer, my, paintInfo.rect.height(), bx, by, bw, bh);
     359    paintFillLayers(paintInfo, bgColor, bgLayer, my, paintInfo.rect.height(), bx, by, bw, bh);
    360360
    361361    if (style()->hasBorder() && style()->display() != INLINE)
     
    400400        // since the root could be inline and wrapped in an anonymous block.
    401401        if (!isBody() || !document()->isHTMLDocument() || document()->documentElement()->renderer()->style()->hasBackground())
    402             paintBackgrounds(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
     402            paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
    403403        if (style()->hasAppearance())
    404404            theme()->paintDecorations(this, paintInfo, IntRect(tx, ty, w, h));
     
    410410}
    411411
    412 void RenderBox::paintBackgrounds(const PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer,
    413                                  int clipY, int clipH, int tx, int ty, int width, int height)
    414 {
    415     if (!bgLayer)
     412void RenderBox::paintMask(PaintInfo& paintInfo, int tx, int ty)
     413{
     414    if (!shouldPaintWithinRoot(paintInfo) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
    416415        return;
    417416
    418     paintBackgrounds(paintInfo, c, bgLayer->next(), clipY, clipH, tx, ty, width, height);
    419     paintBackground(paintInfo, c, bgLayer, clipY, clipH, tx, ty, width, height);
    420 }
    421 
    422 void RenderBox::paintBackground(const PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer,
     417    int w = width();
     418    int h = height() + borderTopExtra() + borderBottomExtra();
     419    ty -= borderTopExtra();
     420
     421    // border-fit can adjust where we paint our border and background.  If set, we snugly fit our line box descendants.  (The iChat
     422    // balloon layout is an example of this).
     423    borderFitAdjust(tx, w);
     424
     425    int my = max(ty, paintInfo.rect.y());
     426    int mh;
     427    if (ty < paintInfo.rect.y())
     428        mh = max(0, h - (paintInfo.rect.y() - ty));
     429    else
     430        mh = min(paintInfo.rect.height(), h);
     431
     432    paintFillLayers(paintInfo, Color(), style()->maskLayers(), my, mh, tx, ty, w, h);
     433}
     434
     435void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer,
    423436                                int clipY, int clipH, int tx, int ty, int width, int height)
    424437{
    425     paintBackgroundExtended(paintInfo, c, bgLayer, clipY, clipH, tx, ty, width, height);
     438    if (!fillLayer)
     439        return;
     440
     441    paintFillLayers(paintInfo, c, fillLayer->next(), clipY, clipH, tx, ty, width, height);
     442    paintFillLayer(paintInfo, c, fillLayer, clipY, clipH, tx, ty, width, height);
     443}
     444
     445void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer,
     446                               int clipY, int clipH, int tx, int ty, int width, int height)
     447{
     448    paintFillLayerExtended(paintInfo, c, fillLayer, clipY, clipH, tx, ty, width, height);
    426449}
    427450
     
    623646}
    624647
    625 void RenderBox::paintBackgroundExtended(const PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer, int clipY, int clipH,
    626                                         int tx, int ty, int w, int h, InlineFlowBox* box)
     648void RenderBox::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer, int clipY, int clipH,
     649                                       int tx, int ty, int w, int h, InlineFlowBox* box)
    627650{
    628651    GraphicsContext* context = paintInfo.context;
  • trunk/WebCore/rendering/RenderBox.h

    r32334 r32406  
    142142    virtual IntRect caretRect(int offset, EAffinity = UPSTREAM, int* extraWidthToEndOfLine = 0);
    143143
    144     virtual void paintBackgroundExtended(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight,
    145                                          int tx, int ty, int width, int height, InlineFlowBox* = 0);
     144    virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight,
     145                                        int tx, int ty, int width, int height, InlineFlowBox* = 0);
    146146    IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scaledHeight) const;
    147147
     
    155155
    156156    virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
     157    virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
    157158    virtual void imageChanged(WrappedImagePtr);
    158159
     
    166167
    167168protected:
    168     void paintBackground(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height);
    169     void paintBackgrounds(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height);
     169    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height);
     170    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height);
    170171
    171172#if PLATFORM(MAC)
  • trunk/WebCore/rendering/RenderFieldset.cpp

    r31200 r32406  
    130130    paintBoxShadow(paintInfo.context, tx, ty, w, h, style());
    131131
    132     paintBackground(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
     132    paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
    133133
    134134    if (style()->hasBorder())
     
    136136}
    137137
     138void RenderFieldset::paintMask(PaintInfo& paintInfo, int tx, int ty)
     139{
     140    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
     141        return;
     142
     143    int w = width();
     144    int h = height() + borderTopExtra() + borderBottomExtra();
     145    RenderObject* legend = findLegend();
     146    if (!legend)
     147        return RenderBlock::paintMask(paintInfo, tx, ty);
     148
     149    int yOff = (legend->yPos() > 0) ? 0 : (legend->height() - borderTop()) / 2;
     150    h -= yOff;
     151    ty += yOff - borderTopExtra();
     152
     153    int my = max(ty, paintInfo.rect.y());
     154    int end = min(paintInfo.rect.bottom(), ty + h);
     155    int mh = end - my;
     156
     157    paintFillLayers(paintInfo, Color(), style()->maskLayers(), my, mh, tx, ty, w, h);
     158}
     159       
    138160void RenderFieldset::paintBorderMinusLegend(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
    139161                                            const RenderStyle* style, int lx, int lw, int lb)
  • trunk/WebCore/rendering/RenderFieldset.h

    r25754 r32406  
    5050private:
    5151    virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
     52    virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
    5253    void paintBorderMinusLegend(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, int lx, int lw, int lb);
    5354    RenderObject* findLegend() const;
  • trunk/WebCore/rendering/RenderInline.cpp

    r25754 r32406  
    302302bool RenderInline::requiresLayer()
    303303{
    304     return isRelPositioned() || style()->opacity() < 1.0f;
     304    return isRelPositioned() || isTransparent() || hasMask();
    305305}
    306306
  • trunk/WebCore/rendering/RenderLayer.cpp

    r31604 r32406  
    435435        return false;
    436436#endif
    437     return m_object->isTransparent();
     437    return m_object->isTransparent() || m_object->hasMask();
    438438}
    439439
     
    16261626            it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot);
    16271627   
     1628    if (renderer()->hasMask() && shouldPaint && !selectionOnly && !damageRect.isEmpty()) {
     1629        setClip(p, paintDirtyRect, damageRect);
     1630
     1631        // Paint the mask.  We have to use an extra image buffer to hold the mask. Multiple mask images need
     1632        // to composite together using source-over so that they can then combine into a single unified mask that
     1633        // can be composited with the content using destination-in.  SVG images need to be able to set compositing modes
     1634        // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer
     1635        // and composite that  buffer as the mask.
     1636        p->setCompositeOperation(CompositeDestinationIn);
     1637        p->beginTransparencyLayer(1.0f);
     1638        RenderObject::PaintInfo paintInfo(p, damageRect, PaintPhaseMask, false, paintingRootForRenderer, 0);
     1639        renderer()->paint(paintInfo, tx, ty);
     1640        p->endTransparencyLayer();
     1641
     1642        // Restore the clip.
     1643        restoreClip(p, paintDirtyRect, damageRect);
     1644    }
     1645
    16281646    // End our transparency layer
    16291647    if (isTransparent() && m_usedTransparency) {
  • trunk/WebCore/rendering/RenderObject.cpp

    r32334 r32406  
    500500bool RenderObject::requiresLayer()
    501501{
    502     return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform();
     502    return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask();
    503503}
    504504
     
    837837}
    838838
     839static bool mustRepaintFillLayers(const RenderObject* renderer, const FillLayer* layer)
     840{
     841    // Nobody will use multiple layers without wanting fancy positioning.
     842    if (layer->next())
     843        return true;
     844
     845    // Make sure we have a valid image.
     846    StyleImage* img = layer->image();
     847    bool shouldPaintBackgroundImage = img && img->canRender(renderer->style()->effectiveZoom());
     848
     849    // These are always percents or auto.
     850    if (shouldPaintBackgroundImage &&
     851        (!layer->xPosition().isZero() || !layer->yPosition().isZero() ||
     852         layer->size().width.isPercent() || layer->size().height.isPercent()))
     853        // The image will shift unpredictably if the size changes.
     854        return true;
     855
     856    return false;
     857}
     858
    839859bool RenderObject::mustRepaintBackgroundOrBorder() const
    840860{
    841     // If we don't have a background/border, then nothing to do.
     861    if (hasMask() && mustRepaintFillLayers(this, style()->maskLayers()))
     862        return true;
     863
     864    // If we don't have a background/border/mask, then nothing to do.
    842865    if (!hasBoxDecorations())
    843866        return false;
    844867
    845     // Ok, let's check the background first.
    846     const FillLayer* bgLayer = style()->backgroundLayers();
    847 
    848     // Nobody will use multiple background layers without wanting fancy positioning.
    849     if (bgLayer->next())
     868    if (mustRepaintFillLayers(this, style()->backgroundLayers()))
    850869        return true;
    851 
    852     // Make sure we have a valid background image.
    853     StyleImage* bg = bgLayer->image();
    854     bool shouldPaintBackgroundImage = bg && bg->canRender(style()->effectiveZoom());
    855 
    856     // These are always percents or auto.
    857     if (shouldPaintBackgroundImage &&
    858             (!bgLayer->xPosition().isZero() || !bgLayer->yPosition().isZero() ||
    859              bgLayer->size().width.isPercent() || bgLayer->size().height.isPercent()))
    860         // The background image will shift unpredictably if the size changes.
    861         return true;
    862 
    863     // Background is ok.  Let's check border.
     870     
     871    // Our fill layers are ok.  Let's check border.
    864872    if (style()->hasBorder()) {
    865873        // Border images are not ok.
     
    22522260    m_style = style;
    22532261
    2254     updateBackgroundImages(oldStyle);
     2262    updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_style->backgroundLayers() : 0);
     2263    updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->maskLayers() : 0);
     2264
     2265    StyleImage* oldBorderImage = oldStyle ? oldStyle->borderImage().image() : 0;
     2266    StyleImage* newBorderImage = m_style ? m_style->borderImage().image() : 0;
     2267    if (oldBorderImage != newBorderImage) {
     2268        if (oldBorderImage)
     2269            oldBorderImage->removeClient(this);
     2270        if (newBorderImage)
     2271            newBorderImage->addClient(this);
     2272    }
    22552273
    22562274    if (m_style)
     
    22902308}
    22912309
    2292 void RenderObject::updateBackgroundImages(RenderStyle* oldStyle)
     2310void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
    22932311{
    22942312    // FIXME: This will be slow when a large number of images is used.  Fix by using a dict.
    2295     const FillLayer* oldLayers = oldStyle ? oldStyle->backgroundLayers() : 0;
    2296     const FillLayer* newLayers = m_style ? m_style->backgroundLayers() : 0;
    22972313    for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
    22982314        if (currOld->image() && (!newLayers || !newLayers->containsImage(currOld->image())))
     
    23022318        if (currNew->image() && (!oldLayers || !oldLayers->containsImage(currNew->image())))
    23032319            currNew->image()->addClient(this);
    2304     }
    2305 
    2306     StyleImage* oldBorderImage = oldStyle ? oldStyle->borderImage().image() : 0;
    2307     StyleImage* newBorderImage = m_style ? m_style->borderImage().image() : 0;
    2308     if (oldBorderImage != newBorderImage) {
    2309         if (oldBorderImage)
    2310             oldBorderImage->removeClient(this);
    2311         if (newBorderImage)
    2312             newBorderImage->addClient(this);
    23132320    }
    23142321}
  • trunk/WebCore/rendering/RenderObject.h

    r32334 r32406  
    8181    PaintPhaseSelection,
    8282    PaintPhaseCollapsedTableBorders,
    83     PaintPhaseTextClip
     83    PaintPhaseTextClip,
     84    PaintPhaseMask
    8485};
    8586
     
    365366    bool hasTransform() const { return m_hasTransform; }
    366367
     368    bool hasMask() const { return style() && style()->hasMask(); }
     369
    367370private:
    368371    bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
     
    419422    void scheduleRelayout();
    420423
    421     void updateBackgroundImages(RenderStyle* oldStyle);
     424    void updateFillImages(const FillLayer*, const FillLayer*);
    422425
    423426    virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false);
     
    473476    // RenderBox implements this.
    474477    virtual void paintBoxDecorations(PaintInfo&, int tx, int ty) { }
    475 
    476     virtual void paintBackgroundExtended(const PaintInfo&, const Color&, const FillLayer*,
    477                                          int clipy, int cliph, int tx, int ty, int width, int height,
    478                                          InlineFlowBox* box = 0) { }
     478    virtual void paintMask(PaintInfo&, int tx, int ty) { }
     479    virtual void paintFillExtended(const PaintInfo&, const Color&, const FillLayer*,
     480                                   int clipy, int cliph, int tx, int ty, int width, int height,
     481                                   InlineFlowBox* box = 0) { }
    479482
    480483   
  • trunk/WebCore/rendering/RenderReplaced.cpp

    r31155 r32406  
    108108    ty += m_y;
    109109   
    110     if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
     110    if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection) && style()->visibility() == VISIBLE)
    111111        paintBoxDecorations(paintInfo, tx, ty);
    112112   
     113    if (paintInfo.phase == PaintPhaseMask) {
     114        paintMask(paintInfo, tx, ty);
     115        return;
     116    }
     117
    113118    if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
    114119        paintOutline(paintInfo.context, tx, ty, width(), height(), style());
  • trunk/WebCore/rendering/RenderStyle.cpp

    r32348 r32406  
    239239    , m_xPosSet(false)
    240240    , m_yPosSet(false)
    241     , m_compositeSet(false)
     241    , m_compositeSet(type == MaskFillLayer)
    242242    , m_sizeSet(false)
    243243    , m_type(type)
     
    786786    , m_boxShadow(0)
    787787    , m_transition(0)
    788     , m_mask(MaskFillLayer)
     788    , m_mask(FillLayer(MaskFillLayer))
    789789#if ENABLE(XBL)
    790790    , bindingURI(0)
  • trunk/WebCore/rendering/RenderStyle.h

    r32348 r32406  
    655655    static EFillBox initialFillOrigin(EFillLayerType type) { return type == BackgroundFillLayer ? PaddingFillBox : BorderFillBox; }
    656656    static EFillRepeat initialFillRepeat(EFillLayerType) { return RepeatFill; }
    657     static CompositeOperator initialFillComposite(EFillLayerType type) { return type == BackgroundFillLayer ? CompositeSourceOver : CompositeDestinationOut; }
    658     static LengthSize initialFillSize(EFillLayerType type) { return type == BackgroundFillLayer ? LengthSize() : LengthSize(Length(100.0, Percent), Length(100.0, Percent)); }
     657    static CompositeOperator initialFillComposite(EFillLayerType) { return CompositeSourceOver; }
     658    static LengthSize initialFillSize(EFillLayerType) { return LengthSize(); }
    659659    static Length initialFillXPosition(EFillLayerType type) { return Length(0.0, Percent); }
    660660    static Length initialFillYPosition(EFillLayerType type) { return Length(0.0, Percent); }
    661661    static StyleImage* initialFillImage(EFillLayerType) { return 0; }
    662662
     663private:
     664    FillLayer() { }
     665
     666public:
    663667    RefPtr<StyleImage> m_image;
    664668
     
    670674    unsigned m_origin : 2; // EFillBox
    671675    unsigned m_repeat : 2; // EFillRepeat
    672     unsigned m_composite : 2; // CompositeOperator
     676    unsigned m_composite : 4; // CompositeOperator
    673677
    674678    LengthSize m_size;
     
    20052009    bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.isEmpty(); }
    20062010    void applyTransform(AffineTransform&, const IntSize& borderBoxSize) const;
     2011    bool hasMask() const { return rareNonInheritedData->m_mask.hasImage(); }
    20072012    // End CSS3 Getters
    20082013
  • trunk/WebCore/rendering/RenderTable.cpp

    r31663 r32406  
    453453        paintBoxDecorations(paintInfo, tx, ty);
    454454
     455    if (paintPhase == PaintPhaseMask) {
     456        paintMask(paintInfo, tx, ty);
     457        return;
     458    }
     459
    455460    // We're done.  We don't bother painting any children.
    456461    if (paintPhase == PaintPhaseBlockBackground)
     
    513518    paintBoxShadow(paintInfo.context, tx, ty, w, h, style());
    514519   
    515     paintBackground(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
     520    paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
    516521
    517522    if (style()->hasBorder() && !collapseBorders())
    518523        paintBorder(paintInfo.context, tx, ty, w, h, style());
     524}
     525
     526void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)
     527{
     528    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
     529        return;
     530
     531    int w = width();
     532    int h = height();
     533
     534    // Account for the caption.
     535    if (m_caption) {
     536        int captionHeight = (m_caption->height() + m_caption->marginBottom() +  m_caption->marginTop());
     537        h -= captionHeight;
     538        if (m_caption->style()->captionSide() != CAPBOTTOM)
     539            ty += captionHeight;
     540    }
     541
     542    int my = max(ty, paintInfo.rect.y());
     543    int mh;
     544    if (ty < paintInfo.rect.y())
     545        mh = max(0, h - (paintInfo.rect.y() - ty));
     546    else
     547        mh = min(paintInfo.rect.height(), h);
     548   
     549    paintFillLayers(paintInfo, Color(), style()->maskLayers(), my, mh, tx, ty, w, h);
    519550}
    520551
  • trunk/WebCore/rendering/RenderTable.h

    r30415 r32406  
    9999    virtual void paint(PaintInfo&, int tx, int ty);
    100100    virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
     101    virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
    101102    virtual void layout();
    102103    virtual void calcPrefWidths();
  • trunk/WebCore/rendering/RenderTableCell.cpp

    r32334 r32406  
    251251bool RenderTableCell::requiresLayer()
    252252{
    253     return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform();
     253    return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask();
    254254}
    255255
     
    826826            paintInfo.context->clip(clipRect);
    827827        }
    828         paintBackgrounds(paintInfo, c, bgLayer, my, mh, tx, ty, w, h);
     828        paintFillLayers(paintInfo, c, bgLayer, my, mh, tx, ty, w, h);
    829829        if (shouldClip)
    830830            paintInfo.context->restore();
     
    854854}
    855855
     856void RenderTableCell::paintMask(PaintInfo& paintInfo, int tx, int ty)
     857{
     858    if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
     859        return;
     860
     861    RenderTable* tableElt = table();
     862    if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild())
     863        return;
     864
     865    int w = width();
     866    int h = height() + borderTopExtra() + borderBottomExtra();
     867   
     868    int my = max(ty, paintInfo.rect.y());
     869    int end = min(paintInfo.rect.bottom(), ty + h);
     870    int mh = end - my;
     871
     872    paintFillLayers(paintInfo, Color(), style()->maskLayers(), my, mh, tx, ty, w, h);
     873}
     874
    856875} // namespace WebCore
  • trunk/WebCore/rendering/RenderTableCell.h

    r30415 r32406  
    9494    virtual void paint(PaintInfo&, int tx, int ty);
    9595    virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
     96    virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
    9697    void paintCollapsedBorder(GraphicsContext*, int x, int y, int w, int h);
    9798    void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject);
  • trunk/WebCore/rendering/RenderWidget.cpp

    r30992 r32406  
    179179    ty += m_y;
    180180
    181     if (hasBoxDecorations() && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline)
     181    if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
    182182        paintBoxDecorations(paintInfo, tx, ty);
     183
     184    if (paintInfo.phase == PaintPhaseMask) {
     185        paintMask(paintInfo, tx, ty);
     186        return;
     187    }
    183188
    184189    if (!m_view || paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
  • trunk/WebCore/svg/graphics/SVGImage.cpp

    r32231 r32406  
    146146   
    147147    context->save();
     148    context->setCompositeOperation(compositeOp);
    148149    context->clip(enclosingIntRect(dstRect));
    149150    context->translate(dstRect.location().x(), dstRect.location().y());
     
    215216        m_frame->loader()->write(m_data->data(), m_data->size());
    216217        m_frame->loader()->end();
     218        m_frameView->setTransparent(true); // SVG Images are transparent.
    217219    }
    218220    return m_frameView;
Note: See TracChangeset for help on using the changeset viewer.