2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
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.
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.
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.
24 #ifndef RenderSVGImage_h
25 #define RenderSVGImage_h
27 #include "core/rendering/svg/RenderSVGModelObject.h"
32 class RenderImageResource;
33 class SVGImageElement;
35 class RenderSVGImage final : public RenderSVGModelObject {
37 explicit RenderSVGImage(SVGImageElement*);
38 virtual ~RenderSVGImage();
39 virtual void destroy() override;
41 bool updateImageViewport();
42 virtual void setNeedsBoundariesUpdate() override { m_needsBoundariesUpdate = true; }
43 virtual void setNeedsTransformUpdate() override { m_needsTransformUpdate = true; }
45 RenderImageResource* imageResource() { return m_imageResource.get(); }
47 virtual const AffineTransform& localToParentTransform() const override { return m_localTransform; }
48 RefPtr<DisplayList>& bufferedForeground() { return m_bufferedForeground; }
50 virtual FloatRect paintInvalidationRectInLocalCoordinates() const override { return m_paintInvalidationBoundingBox; }
51 virtual FloatRect objectBoundingBox() const override { return m_objectBoundingBox; }
52 virtual bool isOfType(RenderObjectType type) const override { return type == RenderObjectSVGImage || RenderSVGModelObject::isOfType(type); }
55 virtual const char* renderName() const override { return "RenderSVGImage"; }
57 virtual FloatRect strokeBoundingBox() const override { return m_objectBoundingBox; }
59 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const override;
61 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
63 virtual void layout() override;
64 virtual void paint(PaintInfo&, const LayoutPoint&) override;
66 FloatSize computeImageViewportSize(ImageResource&) const;
68 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override;
70 virtual AffineTransform localTransform() const override { return m_localTransform; }
72 bool m_needsBoundariesUpdate : 1;
73 bool m_needsTransformUpdate : 1;
74 AffineTransform m_localTransform;
75 FloatRect m_objectBoundingBox;
76 FloatRect m_paintInvalidationBoundingBox;
77 OwnPtr<RenderImageResource> m_imageResource;
79 RefPtr<DisplayList> m_bufferedForeground;
82 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGImage, isSVGImage());
86 #endif // RenderSVGImage_h