Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: Source/core/svg/SVGTextContentElement.h

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert aggressive svgAttributeChanged, add NeedsRebaseline Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 static SVGLengthAdjustType fromString(const String& value) 58 static SVGLengthAdjustType fromString(const String& value)
59 { 59 {
60 if (value == "spacingAndGlyphs") 60 if (value == "spacingAndGlyphs")
61 return SVGLengthAdjustSpacingAndGlyphs; 61 return SVGLengthAdjustSpacingAndGlyphs;
62 if (value == "spacing") 62 if (value == "spacing")
63 return SVGLengthAdjustSpacing; 63 return SVGLengthAdjustSpacing;
64 return SVGLengthAdjustUnknown; 64 return SVGLengthAdjustUnknown;
65 } 65 }
66 }; 66 };
67 67
68 class SVGAnimatedTextLength;
69
68 class SVGTextContentElement : public SVGGraphicsElement { 70 class SVGTextContentElement : public SVGGraphicsElement {
69 public: 71 public:
70 // Forward declare enumerations in the W3C naming scheme, for IDL generation . 72 // Forward declare enumerations in the W3C naming scheme, for IDL generation .
71 enum { 73 enum {
72 LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown, 74 LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown,
73 LENGTHADJUST_SPACING = SVGLengthAdjustSpacing, 75 LENGTHADJUST_SPACING = SVGLengthAdjustSpacing,
74 LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs 76 LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs
75 }; 77 };
76 78
77 unsigned getNumberOfChars(); 79 unsigned getNumberOfChars();
78 float getComputedTextLength(); 80 float getComputedTextLength();
79 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&) ; 81 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&) ;
80 SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionState&); 82 SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionState&);
81 SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionState&); 83 SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionState&);
82 SVGRect getExtentOfChar(unsigned charnum, ExceptionState&); 84 SVGRect getExtentOfChar(unsigned charnum, ExceptionState&);
83 float getRotationOfChar(unsigned charnum, ExceptionState&); 85 float getRotationOfChar(unsigned charnum, ExceptionState&);
84 int getCharNumAtPosition(const SVGPoint&); 86 int getCharNumAtPosition(const SVGPoint&);
85 void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&); 87 void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&);
86 88
87 static SVGTextContentElement* elementFromRenderer(RenderObject*); 89 static SVGTextContentElement* elementFromRenderer(RenderObject*);
88 90
89 // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH mac ro 91 SVGAnimatedLength* textLength() { return m_textLength.get(); }
90 // as its getter needs special handling (return getComputedTextLength(), ins tead of m_textLength). 92 bool textLengthIsSpecifiedByUser() { return m_textLengthIsSpecifiedByUser; }
91 SVGLength& specifiedTextLength() { return m_specifiedTextLength; }
92 PassRefPtr<SVGAnimatedLength> textLength();
93 static const SVGPropertyInfo* textLengthPropertyInfo();
94 93
95 protected: 94 protected:
96 SVGTextContentElement(const QualifiedName&, Document&); 95 SVGTextContentElement(const QualifiedName&, Document&);
97 96
98 virtual bool isValid() const { return SVGTests::isValid(); } 97 virtual bool isValid() const { return SVGTests::isValid(); }
99 98
100 bool isSupportedAttribute(const QualifiedName&); 99 bool isSupportedAttribute(const QualifiedName&);
101 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 100 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
102 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 101 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
103 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; 102 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE;
104 virtual void svgAttributeChanged(const QualifiedName&); 103 virtual void svgAttributeChanged(const QualifiedName&);
105 104
106 virtual bool selfHasRelativeLengths() const; 105 virtual bool selfHasRelativeLengths() const;
107 106
108 private: 107 private:
109 virtual bool isTextContent() const { return true; } 108 virtual bool isTextContent() const { return true; }
110 109
111 // Custom 'textLength' property 110 RefPtr<SVGAnimatedLength> m_textLength;
112 static void synchronizeTextLength(SVGElement* contextElement); 111 bool m_textLengthIsSpecifiedByUser;
113 static PassRefPtr<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGEl ement* contextElement);
114 mutable SVGSynchronizableAnimatedProperty<SVGLength> m_textLength;
115 SVGLength m_specifiedTextLength;
116
117 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement) 112 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement)
118 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjust Type) 113 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjust Type)
119 END_DECLARE_ANIMATED_PROPERTIES 114 END_DECLARE_ANIMATED_PROPERTIES
120 }; 115 };
121 116
122 inline bool isSVGTextContentElement(const Node& node) 117 inline bool isSVGTextContentElement(const Node& node)
123 { 118 {
124 return node.isSVGElement() && toSVGElement(node).isTextContent(); 119 return node.isSVGElement() && toSVGElement(node).isTextContent();
125 } 120 }
126 121
127 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement); 122 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement);
128 123
129 } // namespace WebCore 124 } // namespace WebCore
130 125
131 #endif 126 #endif
OLDNEW
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698