tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SVGTextContentElement.h (2647B)


      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 DOM_SVG_SVGTEXTCONTENTELEMENT_H_
      8 #define DOM_SVG_SVGTEXTCONTENTELEMENT_H_
      9 
     10 #include "SVGAnimatedEnumeration.h"
     11 #include "SVGAnimatedLength.h"
     12 #include "mozilla/dom/SVGGraphicsElement.h"
     13 
     14 namespace mozilla {
     15 
     16 class SVGTextFrame;
     17 
     18 namespace dom {
     19 
     20 struct DOMPointInit;
     21 class DOMSVGAnimatedEnumeration;
     22 class DOMSVGPoint;
     23 class SVGRect;
     24 
     25 using SVGTextContentElementBase = SVGGraphicsElement;
     26 
     27 class SVGTextContentElement : public SVGTextContentElementBase {
     28  friend class mozilla::SVGTextFrame;
     29 
     30 public:
     31  using FragmentOrElement::TextLength;
     32 
     33  // WebIDL
     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();
     38  MOZ_CAN_RUN_SCRIPT
     39  void SelectSubString(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
     40  MOZ_CAN_RUN_SCRIPT
     41  float GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
     42  MOZ_CAN_RUN_SCRIPT
     43  already_AddRefed<DOMSVGPoint> GetStartPositionOfChar(uint32_t charnum,
     44                                                       ErrorResult& rv);
     45  MOZ_CAN_RUN_SCRIPT
     46  already_AddRefed<DOMSVGPoint> GetEndPositionOfChar(uint32_t charnum,
     47                                                     ErrorResult& rv);
     48  MOZ_CAN_RUN_SCRIPT
     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);
     52 
     53 protected:
     54  explicit SVGTextContentElement(
     55      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     56      : SVGTextContentElementBase(std::move(aNodeInfo)) {}
     57 
     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();
     62 
     63  enum { LENGTHADJUST };
     64  virtual SVGAnimatedEnumeration* EnumAttributes() = 0;
     65  static SVGEnumMapping sLengthAdjustMap[];
     66  static EnumInfo sEnumInfo[1];
     67 
     68  enum { TEXTLENGTH };
     69  virtual SVGAnimatedLength* LengthAttributes() = 0;
     70  static LengthInfo sLengthInfo[1];
     71 };
     72 
     73 }  // namespace dom
     74 }  // namespace mozilla
     75 
     76 #endif  // DOM_SVG_SVGTEXTCONTENTELEMENT_H_