2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-01-06 18:14:43 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_SVGTextContentElement_h
|
|
|
|
#define mozilla_dom_SVGTextContentElement_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/SVGGraphicsElement.h"
|
2013-07-07 11:27:51 +04:00
|
|
|
#include "mozilla/dom/SVGAnimatedEnumeration.h"
|
|
|
|
#include "nsSVGEnum.h"
|
|
|
|
#include "nsSVGLength2.h"
|
|
|
|
|
2013-12-20 20:38:51 +04:00
|
|
|
class SVGTextFrame;
|
2013-01-06 18:14:43 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
class nsISVGPoint;
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-26 19:53:13 +04:00
|
|
|
class SVGIRect;
|
|
|
|
|
2013-01-06 18:14:43 +04:00
|
|
|
typedef SVGGraphicsElement SVGTextContentElementBase;
|
|
|
|
|
|
|
|
class SVGTextContentElement : public SVGTextContentElementBase
|
|
|
|
{
|
2018-03-29 05:12:05 +03:00
|
|
|
friend class ::SVGTextFrame;
|
2013-01-06 18:14:43 +04:00
|
|
|
public:
|
|
|
|
using FragmentOrElement::TextLength;
|
|
|
|
|
|
|
|
// WebIDL
|
2013-07-07 11:27:51 +04:00
|
|
|
already_AddRefed<SVGAnimatedLength> TextLength();
|
|
|
|
already_AddRefed<SVGAnimatedEnumeration> LengthAdjust();
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT int32_t GetNumberOfChars();
|
|
|
|
MOZ_CAN_RUN_SCRIPT float GetComputedTextLength();
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2013-04-01 13:43:38 +04:00
|
|
|
void SelectSubString(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2013-01-06 18:14:43 +04:00
|
|
|
float GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2013-01-06 18:14:43 +04:00
|
|
|
already_AddRefed<nsISVGPoint> GetStartPositionOfChar(uint32_t charnum, ErrorResult& rv);
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2013-01-06 18:14:43 +04:00
|
|
|
already_AddRefed<nsISVGPoint> GetEndPositionOfChar(uint32_t charnum, ErrorResult& rv);
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2013-03-26 19:53:13 +04:00
|
|
|
already_AddRefed<SVGIRect> GetExtentOfChar(uint32_t charnum, ErrorResult& rv);
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT float GetRotationOfChar(uint32_t charnum, ErrorResult& rv);
|
|
|
|
MOZ_CAN_RUN_SCRIPT int32_t GetCharNumAtPosition(nsISVGPoint& point);
|
2013-01-06 18:14:43 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2018-09-21 23:45:49 +03:00
|
|
|
explicit SVGTextContentElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
|
|
|
: SVGTextContentElementBase(std::move(aNodeInfo))
|
2013-01-06 18:14:43 +04:00
|
|
|
{}
|
|
|
|
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT SVGTextFrame* GetSVGTextFrame();
|
|
|
|
MOZ_CAN_RUN_SCRIPT SVGTextFrame* GetSVGTextFrameForNonLayoutDependentQuery();
|
|
|
|
MOZ_CAN_RUN_SCRIPT mozilla::Maybe<int32_t> GetNonLayoutDependentNumberOfChars();
|
2013-07-07 11:27:51 +04:00
|
|
|
|
|
|
|
enum { LENGTHADJUST };
|
2013-07-24 04:01:35 +04:00
|
|
|
virtual nsSVGEnum* EnumAttributes() = 0;
|
2013-07-07 11:27:51 +04:00
|
|
|
static nsSVGEnumMapping sLengthAdjustMap[];
|
|
|
|
static EnumInfo sEnumInfo[1];
|
|
|
|
|
|
|
|
enum { TEXTLENGTH };
|
2013-07-24 04:01:35 +04:00
|
|
|
virtual nsSVGLength2* LengthAttributes() = 0;
|
2013-07-07 11:27:51 +04:00
|
|
|
static LengthInfo sLengthInfo[1];
|
2013-01-06 18:14:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_SVGTextContentElement_h
|