1 | /* |
2 | * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
3 | * Copyright (C) 2006 Apple Inc. |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public License |
16 | * along with this library; see the file COPYING.LIB. If not, write to |
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #include "RenderInline.h" |
24 | #include "SVGGraphicsElement.h" |
25 | |
26 | namespace WebCore { |
27 | |
28 | class RenderSVGInline : public RenderInline { |
29 | WTF_MAKE_ISO_ALLOCATED(RenderSVGInline); |
30 | public: |
31 | RenderSVGInline(SVGGraphicsElement&, RenderStyle&&); |
32 | |
33 | SVGGraphicsElement& graphicsElement() const { return downcast<SVGGraphicsElement>(nodeForNonAnonymous()); } |
34 | |
35 | private: |
36 | void element() const = delete; |
37 | |
38 | const char* renderName() const override { return "RenderSVGInline" ; } |
39 | bool requiresLayer() const final { return false; } |
40 | bool isSVGInline() const final { return true; } |
41 | |
42 | void updateFromStyle() final; |
43 | |
44 | // Chapter 10.4 of the SVG Specification say that we should use the |
45 | // object bounding box of the parent text element. |
46 | // We search for the root text element and take its bounding box. |
47 | // It is also necessary to take the stroke and repaint rect of |
48 | // this element, since we need it for filters. |
49 | FloatRect objectBoundingBox() const final; |
50 | FloatRect strokeBoundingBox() const final; |
51 | FloatRect repaintRectInLocalCoordinates() const final; |
52 | |
53 | LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const final; |
54 | Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const final; |
55 | void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const final; |
56 | const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const final; |
57 | void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const final; |
58 | |
59 | std::unique_ptr<InlineFlowBox> createInlineFlowBox() final; |
60 | |
61 | void willBeDestroyed() final; |
62 | void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final; |
63 | }; |
64 | |
65 | } // namespace WebCore |
66 | |
67 | SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderSVGInline, isSVGInline()) |
68 | |