OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 class RenderSVGInlineText; | 32 class RenderSVGInlineText; |
33 class SVGTextElement; | 33 class SVGTextElement; |
34 class RenderSVGInlineText; | 34 class RenderSVGInlineText; |
35 | 35 |
36 class RenderSVGText : public RenderSVGBlock { | 36 class RenderSVGText : public RenderSVGBlock { |
37 public: | 37 public: |
38 RenderSVGText(SVGTextElement*); | 38 RenderSVGText(SVGTextElement*); |
| 39 virtual ~RenderSVGText(); |
39 | 40 |
40 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; | 41 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; |
41 | 42 |
42 void setNeedsPositioningValuesUpdate() { m_needsPositioningValuesUpdate = tr
ue; } | 43 void setNeedsPositioningValuesUpdate() { m_needsPositioningValuesUpdate = tr
ue; } |
43 virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } | 44 virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } |
44 void setNeedsTextMetricsUpdate() { m_needsTextMetricsUpdate = true; } | 45 void setNeedsTextMetricsUpdate() { m_needsTextMetricsUpdate = true; } |
45 virtual FloatRect repaintRectInLocalCoordinates() const; | 46 virtual FloatRect repaintRectInLocalCoordinates() const; |
46 | 47 |
47 static RenderSVGText* locateRenderSVGTextAncestor(RenderObject*); | 48 static RenderSVGText* locateRenderSVGTextAncestor(RenderObject*); |
48 static const RenderSVGText* locateRenderSVGTextAncestor(const RenderObject*)
; | 49 static const RenderSVGText* locateRenderSVGTextAncestor(const RenderObject*)
; |
49 | 50 |
50 bool needsReordering() const { return m_needsReordering; } | 51 bool needsReordering() const { return m_needsReordering; } |
| 52 Vector<SVGTextLayoutAttributes*>& layoutAttributes() { return m_layoutAttrib
utes; } |
51 | 53 |
52 // Call this method when either the children of a DOM text element have chan
ged, or the length of | 54 void subtreeChildWasAdded(RenderObject*); |
53 // the text in any child element has changed. | 55 void subtreeChildWillBeRemoved(RenderSVGInlineText*, Vector<SVGTextLayoutAtt
ributes*, 2>& affectedAttributes); |
54 void invalidateTextPositioningElements(); | 56 void subtreeChildWasRemoved(const Vector<SVGTextLayoutAttributes*, 2>& affec
tedAttributes); |
55 | 57 void subtreeStyleDidChange(RenderSVGInlineText*); |
56 void layoutAttributesChanged(RenderObject*); | 58 void subtreeTextDidChange(RenderSVGInlineText*); |
57 void layoutAttributesWillBeDestroyed(RenderSVGInlineText*, Vector<SVGTextLay
outAttributes*>& affectedAttributes); | |
58 void rebuildLayoutAttributes(bool performFullRebuild = false); | |
59 void rebuildLayoutAttributes(Vector<SVGTextLayoutAttributes*>& affectedAttri
butes); | |
60 | |
61 Vector<SVGTextLayoutAttributes*>& layoutAttributes() { return m_layoutAttrib
utes; } | |
62 | 59 |
63 private: | 60 private: |
64 virtual const char* renderName() const { return "RenderSVGText"; } | 61 virtual const char* renderName() const { return "RenderSVGText"; } |
65 virtual bool isSVGText() const { return true; } | 62 virtual bool isSVGText() const { return true; } |
66 | 63 |
67 virtual void paint(PaintInfo&, const LayoutPoint&); | 64 virtual void paint(PaintInfo&, const LayoutPoint&); |
68 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const Layout
Point& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); | 65 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const Layout
Point& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); |
69 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const F
loatPoint& pointInParent, HitTestAction); | 66 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const F
loatPoint& pointInParent, HitTestAction); |
70 virtual VisiblePosition positionForPoint(const LayoutPoint&); | 67 virtual VisiblePosition positionForPoint(const LayoutPoint&); |
71 | 68 |
72 virtual bool requiresLayer() const { return false; } | 69 virtual bool requiresLayer() const { return false; } |
73 virtual void layout(); | 70 virtual void layout(); |
74 | 71 |
75 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; | 72 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; |
76 | 73 |
77 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repai
ntContainer) const; | 74 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repai
ntContainer) const; |
78 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, L
ayoutRect&, bool fixed = false) const; | 75 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, L
ayoutRect&, bool fixed = false) const; |
79 virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContain
er, FloatRect&, bool fixed = false) const; | 76 virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContain
er, FloatRect&, bool fixed = false) const; |
80 | 77 |
81 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, boo
l useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyCon
tainerFlip, bool* wasFixed = 0) const; | 78 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, boo
l useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyCon
tainerFlip, bool* wasFixed = 0) const; |
82 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); | 79 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); |
| 80 virtual void removeChild(RenderObject*) OVERRIDE; |
| 81 virtual void willBeDestroyed() OVERRIDE; |
83 | 82 |
84 virtual FloatRect objectBoundingBox() const { return frameRect(); } | 83 virtual FloatRect objectBoundingBox() const { return frameRect(); } |
85 virtual FloatRect strokeBoundingBox() const; | 84 virtual FloatRect strokeBoundingBox() const; |
86 | 85 |
87 virtual const AffineTransform& localToParentTransform() const { return m_loc
alTransform; } | 86 virtual const AffineTransform& localToParentTransform() const { return m_loc
alTransform; } |
88 virtual AffineTransform localTransform() const { return m_localTransform; } | 87 virtual AffineTransform localTransform() const { return m_localTransform; } |
89 virtual RootInlineBox* createRootInlineBox(); | 88 virtual RootInlineBox* createRootInlineBox(); |
90 | 89 |
91 virtual RenderBlock* firstLineBlock() const; | 90 virtual RenderBlock* firstLineBlock() const; |
92 virtual void updateFirstLetter(); | 91 virtual void updateFirstLetter(); |
93 | 92 |
| 93 bool shouldHandleSubtreeMutations() const; |
| 94 |
94 bool m_needsReordering : 1; | 95 bool m_needsReordering : 1; |
95 bool m_needsPositioningValuesUpdate : 1; | 96 bool m_needsPositioningValuesUpdate : 1; |
96 bool m_needsTransformUpdate : 1; | 97 bool m_needsTransformUpdate : 1; |
97 bool m_needsTextMetricsUpdate : 1; | 98 bool m_needsTextMetricsUpdate : 1; |
98 AffineTransform m_localTransform; | 99 AffineTransform m_localTransform; |
99 SVGTextLayoutAttributesBuilder m_layoutAttributesBuilder; | 100 SVGTextLayoutAttributesBuilder m_layoutAttributesBuilder; |
100 Vector<SVGTextLayoutAttributes*> m_layoutAttributes; | 101 Vector<SVGTextLayoutAttributes*> m_layoutAttributes; |
101 }; | 102 }; |
102 | 103 |
103 inline RenderSVGText* toRenderSVGText(RenderObject* object) | 104 inline RenderSVGText* toRenderSVGText(RenderObject* object) |
104 { | 105 { |
105 ASSERT(!object || object->isSVGText()); | 106 ASSERT(!object || object->isSVGText()); |
106 return static_cast<RenderSVGText*>(object); | 107 return static_cast<RenderSVGText*>(object); |
107 } | 108 } |
108 | 109 |
109 inline const RenderSVGText* toRenderSVGText(const RenderObject* object) | 110 inline const RenderSVGText* toRenderSVGText(const RenderObject* object) |
110 { | 111 { |
111 ASSERT(!object || object->isSVGText()); | 112 ASSERT(!object || object->isSVGText()); |
112 return static_cast<const RenderSVGText*>(object); | 113 return static_cast<const RenderSVGText*>(object); |
113 } | 114 } |
114 | 115 |
115 // This will catch anyone doing an unnecessary cast. | 116 // This will catch anyone doing an unnecessary cast. |
116 void toRenderSVGText(const RenderSVGText*); | 117 void toRenderSVGText(const RenderSVGText*); |
117 | 118 |
118 } | 119 } |
119 | 120 |
120 #endif // ENABLE(SVG) | 121 #endif // ENABLE(SVG) |
121 #endif | 122 #endif |
OLD | NEW |