1 | /* |
2 | * Copyright (C) 2006 Apple Inc. |
3 | * Copyright (C) 2009 Google, 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 "AffineTransform.h" |
24 | #include "FloatPoint.h" |
25 | #include "FloatRect.h" |
26 | #include "RenderSVGBlock.h" |
27 | |
28 | namespace WebCore { |
29 | |
30 | class SVGForeignObjectElement; |
31 | |
32 | class RenderSVGForeignObject final : public RenderSVGBlock { |
33 | WTF_MAKE_ISO_ALLOCATED(RenderSVGForeignObject); |
34 | public: |
35 | RenderSVGForeignObject(SVGForeignObjectElement&, RenderStyle&&); |
36 | virtual ~RenderSVGForeignObject(); |
37 | |
38 | SVGForeignObjectElement& foreignObjectElement() const; |
39 | |
40 | void paint(PaintInfo&, const LayoutPoint&) override; |
41 | |
42 | LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; |
43 | Optional<FloatRect> computeFloatVisibleRectInContainer(const FloatRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; |
44 | Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* container, VisibleRectContext) const override; |
45 | |
46 | bool requiresLayer() const override { return false; } |
47 | void layout() override; |
48 | |
49 | FloatRect objectBoundingBox() const override { return FloatRect(FloatPoint(), m_viewport.size()); } |
50 | FloatRect strokeBoundingBox() const override { return FloatRect(FloatPoint(), m_viewport.size()); } |
51 | FloatRect repaintRectInLocalCoordinates() const override { return FloatRect(FloatPoint(), m_viewport.size()); } |
52 | |
53 | bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override; |
54 | bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; |
55 | |
56 | void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override; |
57 | const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override; |
58 | void setNeedsTransformUpdate() override { m_needsTransformUpdate = true; } |
59 | |
60 | private: |
61 | bool isSVGForeignObject() const override { return true; } |
62 | void graphicsElement() const = delete; |
63 | const char* renderName() const override { return "RenderSVGForeignObject" ; } |
64 | |
65 | void updateLogicalWidth() override; |
66 | LogicalExtentComputedValues computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const override; |
67 | |
68 | const AffineTransform& localToParentTransform() const override; |
69 | AffineTransform localTransform() const override { return m_localTransform; } |
70 | |
71 | AffineTransform m_localTransform; |
72 | mutable AffineTransform m_localToParentTransform; |
73 | FloatRect m_viewport; |
74 | bool m_needsTransformUpdate { true }; |
75 | }; |
76 | |
77 | } // namespace WebCore |
78 | |