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#ifndef RenderSVGInline_h
22#define RenderSVGInline_h
23
24#include "RenderInline.h"
25#include "SVGGraphicsElement.h"
26
27namespace WebCore {
28
29class RenderSVGInline : public RenderInline {
30public:
31    RenderSVGInline(SVGGraphicsElement&, PassRef<RenderStyle>);
32
33    SVGGraphicsElement& graphicsElement() const { return toSVGGraphicsElement(nodeForNonAnonymous()); }
34
35private:
36    void element() const = delete;
37
38    virtual const char* renderName() const override { return "RenderSVGInline"; }
39    virtual bool requiresLayer() const override final { return false; }
40    virtual bool isSVGInline() const override final { return true; }
41
42    virtual void updateFromStyle() override 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    virtual FloatRect objectBoundingBox() const override final;
50    virtual FloatRect strokeBoundingBox() const override final;
51    virtual FloatRect repaintRectInLocalCoordinates() const override final;
52
53    virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override final;
54    virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const override final;
55    virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const override final;
56    virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override final;
57    virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override final;
58
59    virtual std::unique_ptr<InlineFlowBox> createInlineFlowBox() override final;
60
61    virtual void willBeDestroyed() override final;
62    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override final;
63
64    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override final;
65    virtual RenderObject* removeChild(RenderObject&) override final;
66};
67
68}
69
70#endif // !RenderSVGTSpan_H
71