Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_SVGTextContentElement_h
8 : #define mozilla_dom_SVGTextContentElement_h
9 :
10 : #include "mozilla/dom/SVGGraphicsElement.h"
11 : #include "mozilla/dom/SVGAnimatedEnumeration.h"
12 : #include "nsSVGEnum.h"
13 : #include "nsSVGLength2.h"
14 :
15 : static const unsigned short SVG_LENGTHADJUST_UNKNOWN = 0;
16 : static const unsigned short SVG_LENGTHADJUST_SPACING = 1;
17 : static const unsigned short SVG_LENGTHADJUST_SPACINGANDGLYPHS = 2;
18 :
19 : class SVGTextFrame;
20 :
21 : namespace mozilla {
22 : class nsISVGPoint;
23 :
24 : namespace dom {
25 :
26 : class SVGIRect;
27 :
28 : typedef SVGGraphicsElement SVGTextContentElementBase;
29 :
30 0 : class SVGTextContentElement : public SVGTextContentElementBase
31 : {
32 : public:
33 : using FragmentOrElement::TextLength;
34 :
35 : // WebIDL
36 : already_AddRefed<SVGAnimatedLength> TextLength();
37 : already_AddRefed<SVGAnimatedEnumeration> LengthAdjust();
38 : int32_t GetNumberOfChars();
39 : float GetComputedTextLength();
40 : void SelectSubString(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
41 : float GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
42 : already_AddRefed<nsISVGPoint> GetStartPositionOfChar(uint32_t charnum, ErrorResult& rv);
43 : already_AddRefed<nsISVGPoint> GetEndPositionOfChar(uint32_t charnum, ErrorResult& rv);
44 : already_AddRefed<SVGIRect> GetExtentOfChar(uint32_t charnum, ErrorResult& rv);
45 : float GetRotationOfChar(uint32_t charnum, ErrorResult& rv);
46 : int32_t GetCharNumAtPosition(nsISVGPoint& point);
47 :
48 : protected:
49 :
50 0 : explicit SVGTextContentElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
51 0 : : SVGTextContentElementBase(aNodeInfo)
52 0 : {}
53 :
54 : SVGTextFrame* GetSVGTextFrame();
55 : SVGTextFrame* GetSVGTextFrameForNonLayoutDependentQuery();
56 : mozilla::Maybe<int32_t> GetNonLayoutDependentNumberOfChars();
57 :
58 : enum { LENGTHADJUST };
59 : virtual nsSVGEnum* EnumAttributes() = 0;
60 : static nsSVGEnumMapping sLengthAdjustMap[];
61 : static EnumInfo sEnumInfo[1];
62 :
63 : enum { TEXTLENGTH };
64 : virtual nsSVGLength2* LengthAttributes() = 0;
65 : static LengthInfo sLengthInfo[1];
66 : };
67 :
68 : } // namespace dom
69 : } // namespace mozilla
70 :
71 : #endif // mozilla_dom_SVGTextContentElement_h
|