2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above
10 * copyright notice, this list of conditions and the following
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #ifndef RenderLayerFilterInfo_h
32 #define RenderLayerFilterInfo_h
34 #if ENABLE(CSS_FILTERS)
36 #include "CachedResourceHandle.h"
37 #include "CachedSVGDocumentClient.h"
38 #include "RenderLayer.h"
44 class RenderLayer::FilterInfo final : public CachedSVGDocumentClient
47 static FilterInfo& get(RenderLayer&);
48 static FilterInfo* getIfExists(const RenderLayer&);
49 static void remove(RenderLayer&);
51 const LayoutRect& dirtySourceRect() const { return m_dirtySourceRect; }
52 void expandDirtySourceRect(const LayoutRect& rect) { m_dirtySourceRect.unite(rect); }
53 void resetDirtySourceRect() { m_dirtySourceRect = LayoutRect(); }
55 FilterEffectRenderer* renderer() const { return m_renderer.get(); }
56 void setRenderer(PassRefPtr<FilterEffectRenderer>);
58 void updateReferenceFilterClients(const FilterOperations&);
59 void removeReferenceFilterClients();
62 explicit FilterInfo(RenderLayer&);
65 friend void WTF::deleteOwnedPtr<FilterInfo>(FilterInfo*);
67 virtual void notifyFinished(CachedResource*) override;
69 static HashMap<const RenderLayer*, OwnPtr<FilterInfo>>& map();
72 #pragma clang diagnostic push
73 #if defined(__has_warning) && __has_warning("-Wunused-private-field")
74 #pragma clang diagnostic ignored "-Wunused-private-field"
79 #pragma clang diagnostic pop
82 RefPtr<FilterEffectRenderer> m_renderer;
83 LayoutRect m_dirtySourceRect;
85 Vector<RefPtr<Element>> m_internalSVGReferences;
86 Vector<CachedResourceHandle<CachedSVGDocument>> m_externalSVGReferences;
89 } // namespace WebCore
91 #endif // ENABLE(CSS_FILTERS)
93 #endif // RenderLayerFilterInfo_h