tor-browser

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

SVGPatternElement.h (3307B)


      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_SVGPATTERNELEMENT_H_
      8 #define DOM_SVG_SVGPATTERNELEMENT_H_
      9 
     10 #include "SVGAnimatedEnumeration.h"
     11 #include "SVGAnimatedLength.h"
     12 #include "SVGAnimatedPreserveAspectRatio.h"
     13 #include "SVGAnimatedString.h"
     14 #include "SVGAnimatedTransformList.h"
     15 #include "SVGAnimatedViewBox.h"
     16 #include "mozilla/UniquePtr.h"
     17 #include "mozilla/dom/SVGElement.h"
     18 
     19 nsresult NS_NewSVGPatternElement(
     20    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     21 
     22 namespace mozilla {
     23 class SVGPatternFrame;
     24 
     25 namespace dom {
     26 class DOMSVGAnimatedTransformList;
     27 
     28 using SVGPatternElementBase = SVGElement;
     29 
     30 class SVGPatternElement final : public SVGPatternElementBase {
     31  friend class mozilla::SVGPatternFrame;
     32 
     33 protected:
     34  friend nsresult(::NS_NewSVGPatternElement(
     35      nsIContent** aResult,
     36      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
     37  explicit SVGPatternElement(
     38      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     39  JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
     40 
     41 public:
     42  // nsIContent interface
     43  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
     44  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
     45 
     46  // SVGSVGElement methods:
     47  bool HasValidDimensions() const override;
     48 
     49  SVGAnimatedTransformList* GetAnimatedTransformList(
     50      uint32_t aFlags = 0) override;
     51  nsStaticAtom* GetTransformListAttrName() const override {
     52    return nsGkAtoms::patternTransform;
     53  }
     54 
     55  // WebIDL
     56  already_AddRefed<SVGAnimatedRect> ViewBox();
     57  already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
     58  already_AddRefed<DOMSVGAnimatedEnumeration> PatternUnits();
     59  already_AddRefed<DOMSVGAnimatedEnumeration> PatternContentUnits();
     60  already_AddRefed<DOMSVGAnimatedTransformList> PatternTransform();
     61  already_AddRefed<DOMSVGAnimatedLength> X();
     62  already_AddRefed<DOMSVGAnimatedLength> Y();
     63  already_AddRefed<DOMSVGAnimatedLength> Width();
     64  already_AddRefed<DOMSVGAnimatedLength> Height();
     65  already_AddRefed<DOMSVGAnimatedString> Href();
     66 
     67 protected:
     68  LengthAttributesInfo GetLengthInfo() override;
     69  EnumAttributesInfo GetEnumInfo() override;
     70  StringAttributesInfo GetStringInfo() override;
     71  SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio() override;
     72  SVGAnimatedViewBox* GetAnimatedViewBox() override;
     73 
     74  enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
     75  SVGAnimatedLength mLengthAttributes[4];
     76  static LengthInfo sLengthInfo[4];
     77 
     78  enum { PATTERNUNITS, PATTERNCONTENTUNITS };
     79  SVGAnimatedEnumeration mEnumAttributes[2];
     80  static EnumInfo sEnumInfo[2];
     81 
     82  UniquePtr<SVGAnimatedTransformList> mPatternTransform;
     83 
     84  enum { HREF, XLINK_HREF };
     85  SVGAnimatedString mStringAttributes[2];
     86  static StringInfo sStringInfo[2];
     87 
     88  // SVGFitToViewbox properties
     89  SVGAnimatedViewBox mViewBox;
     90  SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
     91 };
     92 
     93 }  // namespace dom
     94 }  // namespace mozilla
     95 
     96 #endif  // DOM_SVG_SVGPATTERNELEMENT_H_