OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef LayoutSVGBlock_h | 20 #ifndef LayoutSVGBlock_h |
21 #define LayoutSVGBlock_h | 21 #define LayoutSVGBlock_h |
22 | 22 |
23 #include "core/layout/LayoutBlockFlow.h" | 23 #include "core/layout/LayoutBlockFlow.h" |
24 | 24 |
25 namespace blink { | 25 namespace blink { |
26 | 26 |
27 class SVGElement; | 27 class SVGElement; |
28 | 28 |
| 29 // A common class of SVG objects that delegate layout, paint, etc. tasks to |
| 30 // LayoutBlockFlow. It has two coordinate spaces: |
| 31 // - local SVG coordinate space: similar to LayoutSVGModelObject, the space |
| 32 // that localSVGTransform() applies. |
| 33 // - local HTML coordinate space: defined by frameRect() as if the local SVG |
| 34 // coordinate space created a containing block. Like other LayoutBlockFlow |
| 35 // objects, LayoutSVGBlock's frameRect() is also in physical coordinates with |
| 36 // flipped blocks direction in the "containing block". |
29 class LayoutSVGBlock : public LayoutBlockFlow { | 37 class LayoutSVGBlock : public LayoutBlockFlow { |
30 public: | 38 public: |
31 explicit LayoutSVGBlock(SVGElement*); | 39 explicit LayoutSVGBlock(SVGElement*); |
32 | 40 |
| 41 // These mapping functions map coordinates in HTML spaces. |
33 void mapLocalToAncestor(const LayoutBoxModelObject* ancestor, | 42 void mapLocalToAncestor(const LayoutBoxModelObject* ancestor, |
34 TransformState&, | 43 TransformState&, |
35 MapCoordinatesFlags = ApplyContainerFlip) const final; | 44 MapCoordinatesFlags = ApplyContainerFlip) const final; |
36 void mapAncestorToLocal(const LayoutBoxModelObject* ancestor, | 45 void mapAncestorToLocal(const LayoutBoxModelObject* ancestor, |
37 TransformState&, | 46 TransformState&, |
38 MapCoordinatesFlags = ApplyContainerFlip) const final; | 47 MapCoordinatesFlags = ApplyContainerFlip) const final; |
39 const LayoutObject* pushMappingToContainer( | 48 const LayoutObject* pushMappingToContainer( |
40 const LayoutBoxModelObject* ancestorToStopAt, | 49 const LayoutBoxModelObject* ancestorToStopAt, |
41 LayoutGeometryMap&) const final; | 50 LayoutGeometryMap&) const final; |
| 51 bool mapToVisualRectInAncestorSpace( |
| 52 const LayoutBoxModelObject* ancestor, |
| 53 LayoutRect&, |
| 54 VisualRectFlags = DefaultVisualRectFlags) const final; |
42 | 55 |
43 AffineTransform localSVGTransform() const final { return m_localTransform; } | 56 AffineTransform localSVGTransform() const final { return m_localTransform; } |
44 | 57 |
45 PaintLayerType layerTypeRequired() const final { return NoPaintLayer; } | 58 PaintLayerType layerTypeRequired() const final { return NoPaintLayer; } |
46 | 59 |
47 protected: | 60 protected: |
48 void willBeDestroyed() override; | 61 void willBeDestroyed() override; |
49 bool mapToVisualRectInAncestorSpace( | |
50 const LayoutBoxModelObject* ancestor, | |
51 LayoutRect&, | |
52 VisualRectFlags = DefaultVisualRectFlags) const final; | |
53 | 62 |
54 AffineTransform m_localTransform; | 63 AffineTransform m_localTransform; |
55 | 64 |
56 bool isOfType(LayoutObjectType type) const override { | 65 bool isOfType(LayoutObjectType type) const override { |
57 return type == LayoutObjectSVG || LayoutBlockFlow::isOfType(type); | 66 return type == LayoutObjectSVG || LayoutBlockFlow::isOfType(type); |
58 } | 67 } |
59 | 68 |
60 private: | 69 private: |
61 LayoutRect absoluteVisualRect() const final; | 70 LayoutRect absoluteVisualRect() const final; |
62 | 71 |
63 bool allowsOverflowClip() const final; | 72 bool allowsOverflowClip() const final; |
64 | 73 |
65 void absoluteRects(Vector<IntRect>&, | 74 void absoluteRects(Vector<IntRect>&, |
66 const LayoutPoint& accumulatedOffset) const final; | 75 const LayoutPoint& accumulatedOffset) const final; |
67 | 76 |
68 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) final; | 77 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) final; |
69 | 78 |
70 bool nodeAtPoint(HitTestResult&, | 79 bool nodeAtPoint(HitTestResult&, |
71 const HitTestLocation& locationInContainer, | 80 const HitTestLocation& locationInContainer, |
72 const LayoutPoint& accumulatedOffset, | 81 const LayoutPoint& accumulatedOffset, |
73 HitTestAction) override; | 82 HitTestAction) override; |
74 }; | 83 }; |
75 | 84 |
76 } // namespace blink | 85 } // namespace blink |
77 #endif // LayoutSVGBlock_h | 86 #endif // LayoutSVGBlock_h |
OLD | NEW |