Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / graphics / filters / SVGFEImage.h
1 /*
2  * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4  * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5  * Copyright (C) 2010 Dirk Schulze <krit@webkit.org>
6  * Copyright (C) 2013 Google Inc. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23
24 #ifndef SVGFEImage_h
25 #define SVGFEImage_h
26
27 #include "core/dom/TreeScope.h"
28 #include "core/svg/SVGPreserveAspectRatio.h"
29 #include "platform/graphics/filters/FilterEffect.h"
30
31 namespace blink {
32
33 class Image;
34 class RenderObject;
35
36 class FEImage final : public FilterEffect {
37 public:
38     static PassRefPtr<FEImage> createWithImage(Filter*, PassRefPtr<Image>, PassRefPtr<SVGPreserveAspectRatio>);
39     static PassRefPtr<FEImage> createWithIRIReference(Filter*, TreeScope&, const String&, PassRefPtr<SVGPreserveAspectRatio>);
40
41     virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedRect) override;
42
43     virtual FilterEffectType filterEffectType() const override { return FilterEffectTypeImage; }
44
45     virtual TextStream& externalRepresentation(TextStream&, int indention) const override;
46     virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) override;
47
48 private:
49     virtual ~FEImage() { }
50     FEImage(Filter*, PassRefPtr<Image>, PassRefPtr<SVGPreserveAspectRatio>);
51     FEImage(Filter*, TreeScope&, const String&, PassRefPtr<SVGPreserveAspectRatio>);
52     RenderObject* referencedRenderer() const;
53
54     PassRefPtr<SkImageFilter> createImageFilterForRenderer(RenderObject* rendererer, SkiaImageFilterBuilder*);
55
56     RefPtr<Image> m_image;
57
58     // m_treeScope will never be a dangling reference. See https://bugs.webkit.org/show_bug.cgi?id=99243
59     TreeScope* m_treeScope;
60     String m_href;
61     PassRefPtr<SVGPreserveAspectRatio> m_preserveAspectRatio;
62 };
63
64 } // namespace blink
65
66 #endif // SVGFEImage_h