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/. */
7 #ifndef DOM_SVG_SVGTEXTCONTENTELEMENT_H_
8 #define DOM_SVG_SVGTEXTCONTENTELEMENT_H_
10 #include "mozilla/dom/SVGGraphicsElement.h"
11 #include "SVGAnimatedEnumeration.h"
12 #include "SVGAnimatedLength.h"
21 class DOMSVGAnimatedEnumeration
;
25 using SVGTextContentElementBase
= SVGGraphicsElement
;
27 class SVGTextContentElement
: public SVGTextContentElementBase
{
28 friend class mozilla::SVGTextFrame
;
31 using FragmentOrElement::TextLength
;
34 already_AddRefed
<DOMSVGAnimatedLength
> TextLength();
35 already_AddRefed
<DOMSVGAnimatedEnumeration
> LengthAdjust();
36 MOZ_CAN_RUN_SCRIPT
int32_t GetNumberOfChars();
37 MOZ_CAN_RUN_SCRIPT
float GetComputedTextLength();
39 void SelectSubString(uint32_t charnum
, uint32_t nchars
, ErrorResult
& rv
);
41 float GetSubStringLength(uint32_t charnum
, uint32_t nchars
, ErrorResult
& rv
);
43 already_AddRefed
<DOMSVGPoint
> GetStartPositionOfChar(uint32_t charnum
,
46 already_AddRefed
<DOMSVGPoint
> GetEndPositionOfChar(uint32_t charnum
,
49 already_AddRefed
<SVGRect
> GetExtentOfChar(uint32_t charnum
, ErrorResult
& rv
);
50 MOZ_CAN_RUN_SCRIPT
float GetRotationOfChar(uint32_t charnum
, ErrorResult
& rv
);
51 MOZ_CAN_RUN_SCRIPT
int32_t GetCharNumAtPosition(const DOMPointInit
& aPoint
);
54 explicit SVGTextContentElement(
55 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
56 : SVGTextContentElementBase(std::move(aNodeInfo
)) {}
58 MOZ_CAN_RUN_SCRIPT SVGTextFrame
* GetSVGTextFrame();
59 MOZ_CAN_RUN_SCRIPT SVGTextFrame
* GetSVGTextFrameForNonLayoutDependentQuery();
60 MOZ_CAN_RUN_SCRIPT
mozilla::Maybe
<int32_t>
61 GetNonLayoutDependentNumberOfChars();
63 enum { LENGTHADJUST
};
64 virtual SVGAnimatedEnumeration
* EnumAttributes() = 0;
65 static SVGEnumMapping sLengthAdjustMap
[];
66 static EnumInfo sEnumInfo
[1];
69 virtual SVGAnimatedLength
* LengthAttributes() = 0;
70 static LengthInfo sLengthInfo
[1];
74 } // namespace mozilla
76 #endif // DOM_SVG_SVGTEXTCONTENTELEMENT_H_