Changeset 211305 in webkit


Ignore:
Timestamp:
Jan 27, 2017 3:16:17 PM (7 years ago)
Author:
Simon Fraser
Message:

Element with a backdrop-filter and a mask may not correctly mask the backdrop
https://bugs.webkit.org/show_bug.cgi?id=167456
rdar://problem/29320059

Reviewed by Antoine Quint.

Source/WebCore:

If a layer had a backdrop filter, but also corner radii that triggered using a mask layer,
then the call to updateClippingStrategy() in GraphicsLayerCA::updateBackdropFiltersRect() would
set the backdrop layer's mask, but GraphicsLayerCA::updateMaskLayer() would promptly then set
the mask layer back to nil.

Fix by having GraphicsLayerCA::updateMaskLayer() put the mask on the structural layer, if there
is one. We always have a structural layer with backdrops, so this will mask both the layer
and the backdrop.

Test: css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::updateMaskLayer):

  • platform/graphics/mac/WebLayer.mm:

(-[CALayer _descriptionWithPrefix:]): Dump the mask layer.

LayoutTests:

  • css3/filters/backdrop/backdrop-filter-uneven-corner-radii-expected.html: Added.
  • css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211302 r211305  
     12017-01-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Element with a backdrop-filter and a mask may not correctly mask the backdrop
     4        https://bugs.webkit.org/show_bug.cgi?id=167456
     5        rdar://problem/29320059
     6
     7        Reviewed by Antoine Quint.
     8
     9        * css3/filters/backdrop/backdrop-filter-uneven-corner-radii-expected.html: Added.
     10        * css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html: Added.
     11
    1122017-01-27  Jer Noble  <jer.noble@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r211304 r211305  
     12017-01-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Element with a backdrop-filter and a mask may not correctly mask the backdrop
     4        https://bugs.webkit.org/show_bug.cgi?id=167456
     5        rdar://problem/29320059
     6
     7        Reviewed by Antoine Quint.
     8
     9        If a layer had a backdrop filter, but also corner radii that triggered using a mask layer,
     10        then the call to updateClippingStrategy() in GraphicsLayerCA::updateBackdropFiltersRect() would
     11        set the backdrop layer's mask, but GraphicsLayerCA::updateMaskLayer() would promptly then set
     12        the mask layer back to nil.
     13
     14        Fix by having GraphicsLayerCA::updateMaskLayer() put the mask on the structural layer, if there
     15        is one. We always have a structural layer with backdrops, so this will mask both the layer
     16        and the backdrop.
     17
     18        Test: css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html
     19
     20        * platform/graphics/ca/GraphicsLayerCA.cpp:
     21        (WebCore::GraphicsLayerCA::updateMaskLayer):
     22        * platform/graphics/mac/WebLayer.mm:
     23        (-[CALayer _descriptionWithPrefix:]): Dump the mask layer.
     24
    1252017-01-27  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r210758 r211305  
    25422542{
    25432543    PlatformCALayer* maskCALayer = m_maskLayer ? downcast<GraphicsLayerCA>(*m_maskLayer).primaryLayer() : nullptr;
    2544     m_layer->setMask(maskCALayer);
    2545 
    2546     if (m_backdropLayer) {
    2547         if (m_maskLayer) {
    2548             ReplicaState replicaState(ReplicaState::ChildBranch);
    2549             RefPtr<PlatformCALayer> maskClone = downcast<GraphicsLayerCA>(*m_maskLayer).fetchCloneLayers(this, replicaState, IntermediateCloneLevel);
    2550             m_backdropLayer->setMask(maskClone.get());
    2551         } else
    2552             m_backdropLayer->setMask(nullptr);
     2544   
     2545    LayerMap* layerCloneMap;
     2546    if (m_structuralLayer) {
     2547        m_structuralLayer->setMask(maskCALayer);
     2548        layerCloneMap = m_structuralLayerClones.get();
     2549    } else {
     2550        m_layer->setMask(maskCALayer);
     2551        layerCloneMap = m_layerClones.get();
    25532552    }
    25542553
    25552554    LayerMap* maskLayerCloneMap = m_maskLayer ? downcast<GraphicsLayerCA>(*m_maskLayer).primaryLayerClones() : nullptr;
    2556    
    2557     if (LayerMap* layerCloneMap = m_layerClones.get()) {
     2555    if (layerCloneMap) {
    25582556        for (auto& clone : *layerCloneMap) {
    25592557            PlatformCALayer* maskClone = maskLayerCloneMap ? maskLayerCloneMap->get(clone.key) : nullptr;
  • trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm

    r183655 r211305  
    169169        [curDesc appendString:@"\n"];
    170170
     171    if (CALayer *mask = [self mask]) {
     172        [curDesc appendString:@"mask: "];
     173        [curDesc appendString:[mask _descriptionWithPrefix:sublayerPrefix]];
     174    }
     175
    171176    return curDesc;
    172177}
Note: See TracChangeset for help on using the changeset viewer.