| OLD | NEW |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 static SVGLengthAdjustType fromString(const String& value) | 59 static SVGLengthAdjustType fromString(const String& value) |
| 60 { | 60 { |
| 61 if (value == "spacingAndGlyphs") | 61 if (value == "spacingAndGlyphs") |
| 62 return SVGLengthAdjustSpacingAndGlyphs; | 62 return SVGLengthAdjustSpacingAndGlyphs; |
| 63 if (value == "spacing") | 63 if (value == "spacing") |
| 64 return SVGLengthAdjustSpacing; | 64 return SVGLengthAdjustSpacing; |
| 65 return SVGLengthAdjustUnknown; | 65 return SVGLengthAdjustUnknown; |
| 66 } | 66 } |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class SVGAnimatedTextLength; |
| 70 |
| 69 class SVGTextContentElement : public SVGGraphicsElement, | 71 class SVGTextContentElement : public SVGGraphicsElement, |
| 70 public SVGExternalResourcesRequired { | 72 public SVGExternalResourcesRequired { |
| 71 public: | 73 public: |
| 72 // Forward declare enumerations in the W3C naming scheme, for IDL generation
. | 74 // Forward declare enumerations in the W3C naming scheme, for IDL generation
. |
| 73 enum { | 75 enum { |
| 74 LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown, | 76 LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown, |
| 75 LENGTHADJUST_SPACING = SVGLengthAdjustSpacing, | 77 LENGTHADJUST_SPACING = SVGLengthAdjustSpacing, |
| 76 LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs | 78 LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 unsigned getNumberOfChars(); | 81 unsigned getNumberOfChars(); |
| 80 float getComputedTextLength(); | 82 float getComputedTextLength(); |
| 81 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&)
; | 83 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&)
; |
| 82 SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionState&); | 84 SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionState&); |
| 83 SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionState&); | 85 SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionState&); |
| 84 SVGRect getExtentOfChar(unsigned charnum, ExceptionState&); | 86 SVGRect getExtentOfChar(unsigned charnum, ExceptionState&); |
| 85 float getRotationOfChar(unsigned charnum, ExceptionState&); | 87 float getRotationOfChar(unsigned charnum, ExceptionState&); |
| 86 int getCharNumAtPosition(const SVGPoint&); | 88 int getCharNumAtPosition(const SVGPoint&); |
| 87 void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&); | 89 void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&); |
| 88 | 90 |
| 89 static SVGTextContentElement* elementFromRenderer(RenderObject*); | 91 static SVGTextContentElement* elementFromRenderer(RenderObject*); |
| 90 | 92 |
| 91 // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH mac
ro | 93 SVGAnimatedLength* textLength() { return m_textLength.get(); } |
| 92 // as its getter needs special handling (return getComputedTextLength(), ins
tead of m_textLength). | 94 bool textLengthIsSpecifiedByUser() { return m_textLengthIsSpecifiedByUser; } |
| 93 SVGLength& specifiedTextLength() { return m_specifiedTextLength; } | |
| 94 PassRefPtr<SVGAnimatedLength> textLength(); | |
| 95 static const SVGPropertyInfo* textLengthPropertyInfo(); | |
| 96 | 95 |
| 97 protected: | 96 protected: |
| 98 SVGTextContentElement(const QualifiedName&, Document&); | 97 SVGTextContentElement(const QualifiedName&, Document&); |
| 99 | 98 |
| 100 virtual bool isValid() const { return SVGTests::isValid(); } | 99 virtual bool isValid() const { return SVGTests::isValid(); } |
| 101 | 100 |
| 102 bool isSupportedAttribute(const QualifiedName&); | 101 bool isSupportedAttribute(const QualifiedName&); |
| 103 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 102 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
| 104 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; | 103 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; |
| 105 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) OVERRIDE; | 104 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) OVERRIDE; |
| 106 virtual void svgAttributeChanged(const QualifiedName&); | 105 virtual void svgAttributeChanged(const QualifiedName&); |
| 107 | 106 |
| 108 virtual bool selfHasRelativeLengths() const; | 107 virtual bool selfHasRelativeLengths() const; |
| 109 | 108 |
| 110 private: | 109 private: |
| 111 virtual bool isTextContent() const { return true; } | 110 virtual bool isTextContent() const { return true; } |
| 112 | 111 |
| 113 // Custom 'textLength' property | 112 RefPtr<SVGAnimatedLength> m_textLength; |
| 114 static void synchronizeTextLength(SVGElement* contextElement); | 113 bool m_textLengthIsSpecifiedByUser; |
| 115 static PassRefPtr<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGEl
ement* contextElement); | |
| 116 mutable SVGSynchronizableAnimatedProperty<SVGLength> m_textLength; | |
| 117 SVGLength m_specifiedTextLength; | |
| 118 | |
| 119 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement) | 114 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement) |
| 120 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjust
Type) | 115 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjust
Type) |
| 121 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq
uired) | 116 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq
uired) |
| 122 END_DECLARE_ANIMATED_PROPERTIES | 117 END_DECLARE_ANIMATED_PROPERTIES |
| 123 }; | 118 }; |
| 124 | 119 |
| 125 inline bool isSVGTextContentElement(const Node& node) | 120 inline bool isSVGTextContentElement(const Node& node) |
| 126 { | 121 { |
| 127 return node.isSVGElement() && toSVGElement(node).isTextContent(); | 122 return node.isSVGElement() && toSVGElement(node).isTextContent(); |
| 128 } | 123 } |
| 129 | 124 |
| 130 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement); | 125 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement); |
| 131 | 126 |
| 132 } // namespace WebCore | 127 } // namespace WebCore |
| 133 | 128 |
| 134 #endif | 129 #endif |
| OLD | NEW |