| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 
 | /*
 * Copyright (C) 2023 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */
#pragma once
#include "PlatformCAAnimationRemote.h"
#include <WebCore/PlatformCALayer.h>
namespace WebKit {
class RemoteLayerBackingStore;
class RemoteLayerBackingStoreProperties;
enum class LayerChangeIndex : size_t {
    EventRegionChanged = 40,
#if ENABLE(SCROLLING_THREAD)
    ScrollingNodeIDChanged,
#endif
#if HAVE(CORE_ANIMATION_SEPARATED_LAYERS)
    SeparatedChanged,
#if HAVE(CORE_ANIMATION_SEPARATED_PORTALS)
    SeparatedPortalChanged,
    DescendentOfSeparatedPortalChanged,
#endif
#endif
#if ENABLE(INTERACTION_REGIONS_IN_EVENT_REGION)
    VisibleRectChanged,
#endif
#if HAVE(CORE_MATERIAL)
    AppleVisualEffectChanged,
#endif
};
enum class LayerChange : uint64_t {
    NameChanged                         = 1LLU << 0,
    TransformChanged                    = 1LLU << 1,
    SublayerTransformChanged            = 1LLU << 2,
    ShapeRoundedRectChanged             = 1LLU << 3,
    ChildrenChanged                     = 1LLU << 4,
    AnimationsChanged                   = 1LLU << 5,
    PositionChanged                     = 1LLU << 6,
    AnchorPointChanged                  = 1LLU << 7,
    BoundsChanged                       = 1LLU << 8,
    ContentsRectChanged                 = 1LLU << 9,
    BackingStoreChanged                 = 1LLU << 10,
    FiltersChanged                      = 1LLU << 11,
    ShapePathChanged                    = 1LLU << 12,
    MaskLayerChanged                    = 1LLU << 13,
    ClonedContentsChanged               = 1LLU << 14,
    TimeOffsetChanged                   = 1LLU << 15,
    SpeedChanged                        = 1LLU << 16,
    ContentsScaleChanged                = 1LLU << 17,
    CornerRadiusChanged                 = 1LLU << 18,
    BorderWidthChanged                  = 1LLU << 19,
    OpacityChanged                      = 1LLU << 20,
    BackgroundColorChanged              = 1LLU << 21,
    BorderColorChanged                  = 1LLU << 22,
    CustomAppearanceChanged             = 1LLU << 23,
    MinificationFilterChanged           = 1LLU << 24,
    MagnificationFilterChanged          = 1LLU << 25,
    BlendModeChanged                    = 1LLU << 26,
    WindRuleChanged                     = 1LLU << 27,
    VideoGravityChanged                 = 1LLU << 28,
    AntialiasesEdgesChanged             = 1LLU << 29,
    HiddenChanged                       = 1LLU << 30,
    BackingStoreAttachmentChanged       = 1LLU << 31,
    GeometryFlippedChanged              = 1LLU << 32,
    DoubleSidedChanged                  = 1LLU << 33,
    MasksToBoundsChanged                = 1LLU << 34,
    ContentsHiddenChanged               = 1LLU << 35,
    UserInteractionEnabledChanged       = 1LLU << 36,
    BackdropRootChanged                 = 1LLU << 37,
    BackdropRootIsOpaqueChanged         = 1LLU << 38,
    TonemappingEnabledChanged           = 1LLU << 39,
    EventRegionChanged                  = 1LLU << static_cast<size_t>(LayerChangeIndex::EventRegionChanged),
#if ENABLE(SCROLLING_THREAD)
    ScrollingNodeIDChanged              = 1LLU << static_cast<size_t>(LayerChangeIndex::ScrollingNodeIDChanged),
#endif
#if HAVE(CORE_ANIMATION_SEPARATED_LAYERS)
    SeparatedChanged                    = 1LLU << static_cast<size_t>(LayerChangeIndex::SeparatedChanged),
#if HAVE(CORE_ANIMATION_SEPARATED_PORTALS)
    SeparatedPortalChanged              = 1LLU << static_cast<size_t>(LayerChangeIndex::SeparatedPortalChanged),
    DescendentOfSeparatedPortalChanged  = 1LLU << static_cast<size_t>(LayerChangeIndex::DescendentOfSeparatedPortalChanged),
#endif
#endif
#if ENABLE(INTERACTION_REGIONS_IN_EVENT_REGION)
    VisibleRectChanged                  = 1LLU << static_cast<size_t>(LayerChangeIndex::VisibleRectChanged),
#endif
#if HAVE(CORE_MATERIAL)
    AppleVisualEffectChanged            = 1LLU << static_cast<size_t>(LayerChangeIndex::AppleVisualEffectChanged),
#endif
};
struct RemoteLayerBackingStoreOrProperties {
    RemoteLayerBackingStoreOrProperties() = default;
    ~RemoteLayerBackingStoreOrProperties();
    RemoteLayerBackingStoreOrProperties(RemoteLayerBackingStoreOrProperties&&) = default;
    RemoteLayerBackingStoreOrProperties& operator=(RemoteLayerBackingStoreOrProperties&&) = default;
    RemoteLayerBackingStoreOrProperties(std::unique_ptr<RemoteLayerBackingStoreProperties>&&);
    // Used in the WebContent process.
    std::unique_ptr<RemoteLayerBackingStore> store;
    // Used in the UI process.
    std::unique_ptr<RemoteLayerBackingStoreProperties> properties;
};
struct LayerProperties {
    WTF_DEPRECATED_MAKE_STRUCT_FAST_ALLOCATED(LayerProperties);
    void notePropertiesChanged(OptionSet<LayerChange> changeFlags)
    {
        changedProperties.add(changeFlags);
        everChangedProperties.add(changeFlags);
    }
    void resetChangedProperties()
    {
        changedProperties = { };
    }
    OptionSet<LayerChange> changedProperties;
    OptionSet<LayerChange> everChangedProperties;
    String name;
    std::unique_ptr<WebCore::TransformationMatrix> transform;
    std::unique_ptr<WebCore::TransformationMatrix> sublayerTransform;
    std::unique_ptr<WebCore::FloatRoundedRect> shapeRoundedRect;
    Vector<WebCore::PlatformLayerIdentifier> children;
    struct AnimationChanges {
        Vector<std::pair<String, PlatformCAAnimationRemote::Properties>> addedAnimations;
        HashSet<String> keysOfAnimationsToRemove;
#if ENABLE(THREADED_ANIMATION_RESOLUTION)
        Vector<Ref<WebCore::AcceleratedEffect>> effects;
        WebCore::AcceleratedEffectValues baseValues;
#endif
    } animationChanges;
    WebCore::FloatPoint3D position;
    WebCore::FloatPoint3D anchorPoint { 0.5, 0.5, 0 };
    WebCore::FloatRect bounds;
    WebCore::FloatRect contentsRect { 0, 0, 1, 1 };
    RemoteLayerBackingStoreOrProperties backingStoreOrProperties;
    std::unique_ptr<WebCore::FilterOperations> filters;
    WebCore::Path shapePath;
    Markable<WebCore::PlatformLayerIdentifier> maskLayerID;
    Markable<WebCore::PlatformLayerIdentifier> clonedLayerID;
    double timeOffset { 0 };
    float speed { 1 };
    float contentsScale { 1 };
    float cornerRadius { 0 };
    float borderWidth { 0 };
    float opacity { 1 };
    WebCore::Color backgroundColor { WebCore::Color::transparentBlack };
    WebCore::Color borderColor { WebCore::Color::black };
    WebCore::GraphicsLayer::CustomAppearance customAppearance { WebCore::GraphicsLayer::CustomAppearance::None };
    WebCore::PlatformCALayer::FilterType minificationFilter { WebCore::PlatformCALayer::FilterType::Linear };
    WebCore::PlatformCALayer::FilterType magnificationFilter { WebCore::PlatformCALayer::FilterType::Linear };
    WebCore::BlendMode blendMode { WebCore::BlendMode::Normal };
    WebCore::WindRule windRule { WebCore::WindRule::NonZero };
    WebCore::MediaPlayerVideoGravity videoGravity { WebCore::MediaPlayerVideoGravity::ResizeAspect };
    bool antialiasesEdges { true };
    bool hidden { false };
    bool backingStoreAttached { true };
    bool geometryFlipped { false };
    bool doubleSided { false };
    bool masksToBounds { false };
    bool opaque { false };
    bool contentsHidden { false };
    bool userInteractionEnabled { true };
    bool backdropRoot { false };
    bool backdropRootIsOpaque { false };
    bool tonemappingEnabled { false };
    WebCore::EventRegion eventRegion;
#if ENABLE(SCROLLING_THREAD)
    Markable<WebCore::ScrollingNodeID> scrollingNodeID;
#endif
#if HAVE(CORE_ANIMATION_SEPARATED_LAYERS)
    bool isSeparated { false };
#if HAVE(CORE_ANIMATION_SEPARATED_PORTALS)
    bool isSeparatedPortal { false };
    bool isDescendentOfSeparatedPortal { false };
#endif
#endif
#if ENABLE(INTERACTION_REGIONS_IN_EVENT_REGION)
    WebCore::FloatRect visibleRect;
#endif
    WebCore::ContentsFormat contentsFormat { WebCore::ContentsFormat::RGBA8 };
#if HAVE(CORE_MATERIAL)
    WebCore::AppleVisualEffectData appleVisualEffectData;
#endif
};
}
 |