Changeset 140702 in webkit


Ignore:
Timestamp:
Jan 24, 2013 11:35:17 AM (11 years ago)
Author:
mvujovic@adobe.com
Message:

[CSS Filters] CSS opacity property clips filter outsets
https://bugs.webkit.org/show_bug.cgi?id=106549

Reviewed by Dirk Schulze.

Source/WebCore:

Expand the transparencyClipBox for filter outsets and pass the filter output rect instead of
the input rect to beginTransparencyLayers for clipping. Details below.

Test: css3/filters/css-opacity-with-drop-shadow.html

  • rendering/RenderLayer.cpp:

(WebCore):
(WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):

Replace filter outset calcuation with a call to expandRectForFilterOutsets.

(WebCore::expandRectForFilterOutsets):

New method to factor out repeated filter outset calculation code.

(WebCore::transparencyClipBox):

After expanding the clip rect for descendants and reflection, expand it for filter
outsets, so they don't get clipped when we begin a transparency layer.

(WebCore::RenderLayer::paintLayerContents):

Pass paintingInfo.paintDirtyRect instead of localPaintingInfo.paintDirtyRect to
beginTransparencyLayers for clipping. localPaintingInfo.paintDirtyRect (aka the filter
input rect) does not contain filter outsets, so they would get clipped. Now, we pass
paintingInfo.paintDirtyRect (the filter output rect), which includes the filter outsets.

(WebCore::RenderLayer::calculateLayerBounds):

Replace filter outset calcuation with a call to expandRectForFilterOutsets.

  • rendering/RenderLayer.h:

(RenderLayer):

LayoutTests:

Add a reftest to verify that an element's drop shadow filter is not clipped when a CSS
opacity property is not applied.

  • css3/filters/css-opacity-with-drop-shadow-expected.html: Added.
  • css3/filters/css-opacity-with-drop-shadow.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140701 r140702  
     12013-01-24  Max Vujovic  <mvujovic@adobe.com>
     2
     3        [CSS Filters] CSS opacity property clips filter outsets
     4        https://bugs.webkit.org/show_bug.cgi?id=106549
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Add a reftest to verify that an element's drop shadow filter is not clipped when a CSS
     9        opacity property is not applied.
     10
     11        * css3/filters/css-opacity-with-drop-shadow-expected.html: Added.
     12        * css3/filters/css-opacity-with-drop-shadow.html: Added.
     13
    1142013-01-24  Christophe Dumez  <christophe.dumez@intel.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r140700 r140702  
     12013-01-24  Max Vujovic  <mvujovic@adobe.com>
     2
     3        [CSS Filters] CSS opacity property clips filter outsets
     4        https://bugs.webkit.org/show_bug.cgi?id=106549
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Expand the transparencyClipBox for filter outsets and pass the filter output rect instead of
     9        the input rect to beginTransparencyLayers for clipping. Details below.
     10
     11        Test: css3/filters/css-opacity-with-drop-shadow.html
     12
     13        * rendering/RenderLayer.cpp:
     14        (WebCore):
     15        (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
     16            Replace filter outset calcuation with a call to expandRectForFilterOutsets.
     17        (WebCore::expandRectForFilterOutsets):
     18            New method to factor out repeated filter outset calculation code.
     19        (WebCore::transparencyClipBox):
     20            After expanding the clip rect for descendants and reflection, expand it for filter
     21            outsets, so they don't get clipped when we begin a transparency layer.
     22        (WebCore::RenderLayer::paintLayerContents):
     23            Pass paintingInfo.paintDirtyRect instead of localPaintingInfo.paintDirtyRect to
     24            beginTransparencyLayers for clipping. localPaintingInfo.paintDirtyRect (aka the filter
     25            input rect) does not contain filter outsets, so they would get clipped. Now, we pass
     26            paintingInfo.paintDirtyRect (the filter output rect), which includes the filter outsets.
     27        (WebCore::RenderLayer::calculateLayerBounds):
     28            Replace filter outset calcuation with a call to expandRectForFilterOutsets.
     29        * rendering/RenderLayer.h:
     30        (RenderLayer):
     31
    1322013-01-24  Ryosuke Niwa  <rniwa@webkit.org>
    233
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r140632 r140702  
    13631363}
    13641364
     1365static inline void expandRectForFilterOutsets(LayoutRect& rect, const RenderLayerModelObject* renderer)
     1366{
     1367    ASSERT(renderer);
     1368    if (!renderer->style()->hasFilterOutsets())
     1369        return;
     1370
     1371    int topOutset;
     1372    int rightOutset;
     1373    int bottomOutset;
     1374    int leftOutset;
     1375    renderer->style()->getFilterOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
     1376    rect.move(-leftOutset, -topOutset);
     1377    rect.expand(leftOutset + rightOutset, topOutset + bottomOutset);
     1378}
     1379
    13651380void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect, bool immediate)
    13661381{
     
    13691384   
    13701385    LayoutRect rectForRepaint = rect;
    1371    
    1372 #if ENABLE(CSS_FILTERS)
    1373     if (renderer()->style()->hasFilterOutsets()) {
    1374         int topOutset;
    1375         int rightOutset;
    1376         int bottomOutset;
    1377         int leftOutset;
    1378         renderer()->style()->getFilterOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
    1379         rectForRepaint.move(-leftOutset, -topOutset);
    1380         rectForRepaint.expand(leftOutset + rightOutset, topOutset + bottomOutset);
    1381     }
    1382 #endif
     1386    expandRectForFilterOutsets(rectForRepaint, renderer());
    13831387
    13841388    RenderLayerFilterInfo* filterInfo = this->filterInfo();
     
    15481552        LayoutRect clipRect = layer->boundingBox(layer);
    15491553        expandClipRectForDescendantsAndReflection(clipRect, layer, layer, paintBehavior);
     1554#if ENABLE(CSS_FILTERS)
     1555        expandRectForFilterOutsets(clipRect, layer->renderer());
     1556#endif
    15501557        return transform.mapRect(clipRect);
    15511558    }
     
    15531560    LayoutRect clipRect = layer->boundingBox(rootLayer);
    15541561    expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, paintBehavior);
     1562#if ENABLE(CSS_FILTERS)
     1563    expandRectForFilterOutsets(clipRect, layer->renderer());
     1564#endif
    15551565    return clipRect;
    15561566}
     
    37023712            // Begin transparency layers lazily now that we know we have to paint something.
    37033713            if (haveTransparency)
    3704                 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, localPaintingInfo.paintBehavior);
     3714                beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, localPaintingInfo.paintBehavior);
    37053715       
    37063716            if (useClipRect) {
     
    37293739            // Begin transparency layers lazily now that we know we have to paint something.
    37303740            if (haveTransparency)
    3731                 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, localPaintingInfo.paintBehavior);
     3741                beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, localPaintingInfo.paintBehavior);
    37323742
    37333743            if (useClipRect) {
     
    49624972    // filtered areas with the outsets if we know that the filter is going to render in hardware.
    49634973    // https://bugs.webkit.org/show_bug.cgi?id=81239
    4964     if ((flags & IncludeLayerFilterOutsets) && renderer->style()->hasFilterOutsets()) {
    4965         int topOutset;
    4966         int rightOutset;
    4967         int bottomOutset;
    4968         int leftOutset;
    4969         renderer->style()->getFilterOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
    4970         unionBounds.move(-leftOutset, -topOutset);
    4971         unionBounds.expand(leftOutset + rightOutset, topOutset + bottomOutset);
    4972     }
     4974    if (flags & IncludeLayerFilterOutsets)
     4975        expandRectForFilterOutsets(unionBounds, renderer);
    49734976#endif
    49744977
Note: See TracChangeset for help on using the changeset viewer.