| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef SVGTextContentElement_h | 21 #ifndef SVGTextContentElement_h |
| 22 #define SVGTextContentElement_h | 22 #define SVGTextContentElement_h |
| 23 | 23 |
| 24 #include "core/svg/SVGAnimatedBoolean.h" | 24 #include "core/svg/SVGAnimatedBoolean.h" |
| 25 #include "core/svg/SVGAnimatedEnumeration.h" | 25 #include "core/svg/SVGAnimatedEnumeration.h" |
| 26 #include "core/svg/SVGAnimatedLength.h" | 26 #include "core/svg/SVGAnimatedLength.h" |
| 27 #include "core/svg/SVGGraphicsElement.h" | 27 #include "core/svg/SVGGraphicsElement.h" |
| 28 #include "core/svg/SVGPointTearOff.h" | 28 #include "core/svg/SVGPointTearOff.h" |
| 29 #include "platform/heap/Handle.h" |
| 29 | 30 |
| 30 namespace blink { | 31 namespace blink { |
| 31 | 32 |
| 32 class ExceptionState; | 33 class ExceptionState; |
| 33 | 34 |
| 34 enum SVGLengthAdjustType { | 35 enum SVGLengthAdjustType { |
| 35 SVGLengthAdjustUnknown, | 36 SVGLengthAdjustUnknown, |
| 36 SVGLengthAdjustSpacing, | 37 SVGLengthAdjustSpacing, |
| 37 SVGLengthAdjustSpacingAndGlyphs | 38 SVGLengthAdjustSpacingAndGlyphs |
| 38 }; | 39 }; |
| 39 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGLengthAd
justType>(); | 40 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGLengthAd
justType>(); |
| 40 | 41 |
| 41 class SVGTextContentElement : public SVGGraphicsElement { | 42 class SVGTextContentElement : public SVGGraphicsElement { |
| 42 DEFINE_WRAPPERTYPEINFO(); | 43 DEFINE_WRAPPERTYPEINFO(); |
| 43 public: | 44 public: |
| 44 // Forward declare enumerations in the W3C naming scheme, for IDL generation
. | 45 // Forward declare enumerations in the W3C naming scheme, for IDL generation
. |
| 45 enum { | 46 enum { |
| 46 LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown, | 47 LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown, |
| 47 LENGTHADJUST_SPACING = SVGLengthAdjustSpacing, | 48 LENGTHADJUST_SPACING = SVGLengthAdjustSpacing, |
| 48 LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs | 49 LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 unsigned getNumberOfChars(); | 52 unsigned getNumberOfChars(); |
| 52 float getComputedTextLength(); | 53 float getComputedTextLength(); |
| 53 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&)
; | 54 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&)
; |
| 54 PassRefPtr<SVGPointTearOff> getStartPositionOfChar(unsigned charnum, Excepti
onState&); | 55 PassRefPtrWillBeRawPtr<SVGPointTearOff> getStartPositionOfChar(unsigned char
num, ExceptionState&); |
| 55 PassRefPtr<SVGPointTearOff> getEndPositionOfChar(unsigned charnum, Exception
State&); | 56 PassRefPtrWillBeRawPtr<SVGPointTearOff> getEndPositionOfChar(unsigned charnu
m, ExceptionState&); |
| 56 PassRefPtr<SVGRectTearOff> getExtentOfChar(unsigned charnum, ExceptionState&
); | 57 PassRefPtrWillBeRawPtr<SVGRectTearOff> getExtentOfChar(unsigned charnum, Exc
eptionState&); |
| 57 float getRotationOfChar(unsigned charnum, ExceptionState&); | 58 float getRotationOfChar(unsigned charnum, ExceptionState&); |
| 58 int getCharNumAtPosition(PassRefPtr<SVGPointTearOff>, ExceptionState&); | 59 int getCharNumAtPosition(PassRefPtrWillBeRawPtr<SVGPointTearOff>, ExceptionS
tate&); |
| 59 void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&); | 60 void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&); |
| 60 | 61 |
| 61 static SVGTextContentElement* elementFromRenderer(RenderObject*); | 62 static SVGTextContentElement* elementFromRenderer(RenderObject*); |
| 62 | 63 |
| 63 SVGAnimatedLength* textLength() { return m_textLength.get(); } | 64 SVGAnimatedLength* textLength() { return m_textLength.get(); } |
| 64 bool textLengthIsSpecifiedByUser() { return m_textLengthIsSpecifiedByUser; } | 65 bool textLengthIsSpecifiedByUser() { return m_textLengthIsSpecifiedByUser; } |
| 65 SVGAnimatedEnumeration<SVGLengthAdjustType>* lengthAdjust() { return m_lengt
hAdjust.get(); } | 66 SVGAnimatedEnumeration<SVGLengthAdjustType>* lengthAdjust() { return m_lengt
hAdjust.get(); } |
| 66 | 67 |
| 68 virtual void trace(Visitor*) override; |
| 69 |
| 67 protected: | 70 protected: |
| 68 SVGTextContentElement(const QualifiedName&, Document&); | 71 SVGTextContentElement(const QualifiedName&, Document&); |
| 69 | 72 |
| 70 bool isSupportedAttribute(const QualifiedName&); | 73 bool isSupportedAttribute(const QualifiedName&); |
| 71 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | 74 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; |
| 72 virtual bool isPresentationAttribute(const QualifiedName&) const override fi
nal; | 75 virtual bool isPresentationAttribute(const QualifiedName&) const override fi
nal; |
| 73 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override final; | 76 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override final; |
| 74 virtual void svgAttributeChanged(const QualifiedName&) override; | 77 virtual void svgAttributeChanged(const QualifiedName&) override; |
| 75 | 78 |
| 76 virtual bool selfHasRelativeLengths() const override; | 79 virtual bool selfHasRelativeLengths() const override; |
| 77 | 80 |
| 78 private: | 81 private: |
| 79 virtual bool isTextContent() const override final { return true; } | 82 virtual bool isTextContent() const override final { return true; } |
| 80 | 83 |
| 81 RefPtr<SVGAnimatedLength> m_textLength; | 84 RefPtrWillBeMember<SVGAnimatedLength> m_textLength; |
| 82 bool m_textLengthIsSpecifiedByUser; | 85 bool m_textLengthIsSpecifiedByUser; |
| 83 RefPtr<SVGAnimatedEnumeration<SVGLengthAdjustType> > m_lengthAdjust; | 86 RefPtrWillBeMember<SVGAnimatedEnumeration<SVGLengthAdjustType> > m_lengthAdj
ust; |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 inline bool isSVGTextContentElement(const SVGElement& element) | 89 inline bool isSVGTextContentElement(const SVGElement& element) |
| 87 { | 90 { |
| 88 return element.isTextContent(); | 91 return element.isTextContent(); |
| 89 } | 92 } |
| 90 | 93 |
| 91 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement); | 94 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement); |
| 92 | 95 |
| 93 } // namespace blink | 96 } // namespace blink |
| 94 | 97 |
| 95 #endif // SVGTextContentElement_h | 98 #endif // SVGTextContentElement_h |
| OLD | NEW |