Changeset 201648 in webkit


Ignore:
Timestamp:
Jun 3, 2016 11:13:52 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Reflection of element does not respect backdrop-filter property
https://bugs.webkit.org/show_bug.cgi?id=158201

Patch by Antoine Quint <Antoine Quint> on 2016-06-03
Reviewed by Dean Jackson.

Source/WebCore:

We weren't cloning the PlatformCALayer for the backdrop so reflections would simply
not show their backdrops. We now follow the same pattern as other PlatformCALayers
owned by a GraphicsLayerCA and keep a list of backdrop layer clones that we add
to the structural layer when cloning to match the layer order of the original
and update the backdrop layer clone properties to match the original when the
backdrop filters or rectangle changes.

Tests: css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop.html

css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop.html
css3/filters/backdrop/backdrop-filter-with-reflection-value-change.html
css3/filters/backdrop/backdrop-filter-with-reflection.html

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::updateBackdropFilters):
(WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
Update backdrop layer clones to match new values set when the backdrop filter
configuration changes.

(WebCore::GraphicsLayerCA::ensureCloneLayers):
Create the backdrop layer clones map if needed and clone the existing backdrop layer.

(WebCore::GraphicsLayerCA::clearClones):
Clear the backdrop layer clones map.

(WebCore::GraphicsLayerCA::fetchCloneLayers):
Obtain a clone for the backdrop layer, and if we have a valid clone, add it to the
structural layer clone as its first child to match the operation in updateSublayerList().

  • platform/graphics/ca/GraphicsLayerCA.h:

Modify the signature for ensureCloneLayers() to account for the new backdrop layer clone and
declare the backdrop layer clone map.

  • platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:

(PlatformCALayerCocoa::clone):
Reflect the backdrop layer type when cloning a PlatformCALayer.

LayoutTests:

  • css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop-expected.html: Added.
  • css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop.html: Added.

Covers the case where a reflected element without a backdrop-filter initially has one added later.

  • css3/filters/backdrop/backdrop-filter-with-reflection-expected.html: Added.
  • css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop-expected.html: Added.

Covers the case where a reflected element with a backdrop-filter initially has it removed later.

  • css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop.html: Added.
  • css3/filters/backdrop/backdrop-filter-with-reflection-value-change-expected.html: Added.

Covers the case where a reflected element with a backdrop-filter has its backdrop-filter property changed later.

  • css3/filters/backdrop/backdrop-filter-with-reflection-value-change.html: Added.
  • css3/filters/backdrop/backdrop-filter-with-reflection.html: Added.

Covers the basic case of a reflected element with a backdrop-filter.

Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201639 r201648  
     12016-06-03  Antoine Quint  <graouts@apple.com>
     2
     3        Reflection of element does not respect backdrop-filter property
     4        https://bugs.webkit.org/show_bug.cgi?id=158201
     5
     6        Reviewed by Dean Jackson.
     7
     8        * css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop-expected.html: Added.
     9        * css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop.html: Added.
     10
     11        Covers the case where a reflected element without a backdrop-filter initially has one added later.
     12
     13        * css3/filters/backdrop/backdrop-filter-with-reflection-expected.html: Added.
     14        * css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop-expected.html: Added.
     15
     16        Covers the case where a reflected element with a backdrop-filter initially has it removed later.
     17
     18        * css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop.html: Added.
     19        * css3/filters/backdrop/backdrop-filter-with-reflection-value-change-expected.html: Added.
     20
     21        Covers the case where a reflected element with a backdrop-filter has its backdrop-filter property changed later.
     22
     23        * css3/filters/backdrop/backdrop-filter-with-reflection-value-change.html: Added.
     24        * css3/filters/backdrop/backdrop-filter-with-reflection.html: Added.
     25
     26        Covers the basic case of a reflected element with a backdrop-filter.
     27
    1282016-06-03  Antoine Quint  <graouts@apple.com>
    229
  • trunk/Source/WebCore/ChangeLog

    r201647 r201648  
     12016-06-03  Antoine Quint  <graouts@apple.com>
     2
     3        Reflection of element does not respect backdrop-filter property
     4        https://bugs.webkit.org/show_bug.cgi?id=158201
     5
     6        Reviewed by Dean Jackson.
     7
     8        We weren't cloning the PlatformCALayer for the backdrop so reflections would simply
     9        not show their backdrops. We now follow the same pattern as other PlatformCALayers
     10        owned by a GraphicsLayerCA and keep a list of backdrop layer clones that we add
     11        to the structural layer when cloning to match the layer order of the original
     12        and update the backdrop layer clone properties to match the original when the
     13        backdrop filters or rectangle changes.
     14
     15        Tests: css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop.html
     16               css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop.html
     17               css3/filters/backdrop/backdrop-filter-with-reflection-value-change.html
     18               css3/filters/backdrop/backdrop-filter-with-reflection.html
     19
     20        * platform/graphics/ca/GraphicsLayerCA.cpp:
     21        (WebCore::GraphicsLayerCA::updateBackdropFilters):
     22        (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
     23        Update backdrop layer clones to match new values set when the backdrop filter
     24        configuration changes.
     25
     26        (WebCore::GraphicsLayerCA::ensureCloneLayers):
     27        Create the backdrop layer clones map if needed and clone the existing backdrop layer.
     28
     29        (WebCore::GraphicsLayerCA::clearClones):
     30        Clear the backdrop layer clones map.
     31
     32        (WebCore::GraphicsLayerCA::fetchCloneLayers):
     33        Obtain a clone for the backdrop layer, and if we have a valid clone, add it to the
     34        structural layer clone as its first child to match the operation in updateSublayerList().
     35
     36        * platform/graphics/ca/GraphicsLayerCA.h:
     37        Modify the signature for ensureCloneLayers() to account for the new backdrop layer clone and
     38        declare the backdrop layer clone map.
     39
     40        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
     41        (PlatformCALayerCocoa::clone):
     42        Reflect the backdrop layer type when cloning a PlatformCALayer.
     43
    1442016-06-03  Brady Eidson  <beidson@apple.com>
    245
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r201374 r201648  
    19511951    m_backdropLayer->setHidden(!m_contentsVisible);
    19521952    m_backdropLayer->setFilters(m_backdropFilters);
     1953
     1954    if (LayerMap* layerCloneMap = m_backdropLayerClones.get()) {
     1955        for (auto& clone : *layerCloneMap) {
     1956            PlatformCALayer* cloneLayer = clone.value.get();
     1957            cloneLayer->setHidden(!m_contentsVisible);
     1958            cloneLayer->setFilters(m_backdropFilters);
     1959        }
     1960    }
    19531961}
    19541962
     
    19601968    m_backdropLayer->setBounds(contentBounds);
    19611969    m_backdropLayer->setPosition(m_backdropFiltersRect.location());
     1970
     1971    if (LayerMap* layerCloneMap = m_backdropLayerClones.get()) {
     1972        for (auto& clone : *layerCloneMap) {
     1973            PlatformCALayer* cloneLayer = clone.value.get();
     1974            cloneLayer->setBounds(contentBounds);
     1975            cloneLayer->setPosition(m_backdropFiltersRect.location());
     1976        }
     1977    }
    19621978}
    19631979
     
    35813597
    35823598void GraphicsLayerCA::ensureCloneLayers(CloneID cloneID, RefPtr<PlatformCALayer>& primaryLayer, RefPtr<PlatformCALayer>& structuralLayer,
    3583     RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, RefPtr<PlatformCALayer>& contentsShapeMaskLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, CloneLevel cloneLevel)
     3599    RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, RefPtr<PlatformCALayer>& contentsShapeMaskLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, RefPtr<PlatformCALayer>& backdropLayer, CloneLevel cloneLevel)
    35843600{
    35853601    structuralLayer = nullptr;
     
    36043620        m_shapeMaskLayerClones = std::make_unique<LayerMap>();
    36053621
     3622    if (!m_backdropLayerClones && m_backdropLayer)
     3623        m_backdropLayerClones = std::make_unique<LayerMap>();
     3624   
    36063625    primaryLayer = findOrMakeClone(cloneID, m_layer.get(), m_layerClones.get(), cloneLevel);
    36073626    structuralLayer = findOrMakeClone(cloneID, m_structuralLayer.get(), m_structuralLayerClones.get(), cloneLevel);
     
    36103629    contentsShapeMaskLayer = findOrMakeClone(cloneID, m_contentsShapeMaskLayer.get(), m_contentsShapeMaskLayerClones.get(), cloneLevel);
    36113630    shapeMaskLayer = findOrMakeClone(cloneID, m_shapeMaskLayer.get(), m_shapeMaskLayerClones.get(), cloneLevel);
     3631    backdropLayer = findOrMakeClone(cloneID, m_backdropLayer.get(), m_backdropLayerClones.get(), cloneLevel);
    36123632}
    36133633
     
    36313651    clearClones(m_contentsShapeMaskLayerClones);
    36323652    clearClones(m_shapeMaskLayerClones);
     3653    clearClones(m_backdropLayerClones);
    36333654}
    36343655
     
    36643685    RefPtr<PlatformCALayer> contentsShapeMaskLayer;
    36653686    RefPtr<PlatformCALayer> shapeMaskLayer;
    3666     ensureCloneLayers(replicaState.cloneID(), primaryLayer, structuralLayer, contentsLayer, contentsClippingLayer, contentsShapeMaskLayer, shapeMaskLayer, cloneLevel);
     3687    RefPtr<PlatformCALayer> backdropLayer;
     3688    ensureCloneLayers(replicaState.cloneID(), primaryLayer, structuralLayer, contentsLayer, contentsClippingLayer, contentsShapeMaskLayer, shapeMaskLayer, backdropLayer, cloneLevel);
    36673689
    36683690    if (m_maskLayer) {
     
    37083730    if (shapeMaskLayer)
    37093731        primaryLayer->setMask(shapeMaskLayer.get());
    3710    
     3732
    37113733    if (replicaLayer || structuralLayer || contentsLayer || contentsClippingLayer || childLayers.size() > 0) {
    37123734        if (structuralLayer) {
     3735            if (backdropLayer)
     3736                clonalSublayers.append(backdropLayer);
     3737           
    37133738            // Replicas render behind the actual layer content.
    37143739            if (replicaLayer)
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r198189 r201648  
    375375
    376376    void ensureCloneLayers(CloneID, RefPtr<PlatformCALayer>& primaryLayer, RefPtr<PlatformCALayer>& structuralLayer,
    377         RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, RefPtr<PlatformCALayer>& contentsShapeMaskLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, CloneLevel);
     377        RefPtr<PlatformCALayer>& contentsLayer, RefPtr<PlatformCALayer>& contentsClippingLayer, RefPtr<PlatformCALayer>& contentsShapeMaskLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, RefPtr<PlatformCALayer>& backdropLayer, CloneLevel);
    378378
    379379    static void clearClones(std::unique_ptr<LayerMap>&);
     
    519519    std::unique_ptr<LayerMap> m_contentsShapeMaskLayerClones;
    520520    std::unique_ptr<LayerMap> m_shapeMaskLayerClones;
     521    std::unique_ptr<LayerMap> m_backdropLayerClones;
    521522
    522523#ifdef VISIBLE_TILE_WASH
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm

    r201038 r201648  
    327327        type = LayerTypeShapeLayer;
    328328        break;
     329    case LayerTypeBackdropLayer:
     330        type = LayerTypeBackdropLayer;
     331        break;
    329332    case LayerTypeLayer:
    330333    default:
Note: See TracChangeset for help on using the changeset viewer.