tor-browser

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

SVGViewElement.h (2313B)


      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_SVGVIEWELEMENT_H_
      8 #define DOM_SVG_SVGVIEWELEMENT_H_
      9 
     10 #include "SVGAnimatedEnumeration.h"
     11 #include "SVGAnimatedPreserveAspectRatio.h"
     12 #include "SVGAnimatedViewBox.h"
     13 #include "SVGStringList.h"
     14 #include "mozilla/dom/SVGElement.h"
     15 
     16 nsresult NS_NewSVGViewElement(
     17    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     18 
     19 namespace mozilla {
     20 class SVGFragmentIdentifier;
     21 class SVGOuterSVGFrame;
     22 
     23 namespace dom {
     24 class SVGViewportElement;
     25 
     26 using SVGViewElementBase = SVGElement;
     27 
     28 class SVGViewElement final : public SVGViewElementBase {
     29 protected:
     30  friend class mozilla::SVGFragmentIdentifier;
     31  friend class mozilla::SVGOuterSVGFrame;
     32  friend class SVGSVGElement;
     33  friend class SVGViewportElement;
     34  explicit SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     35  friend nsresult(::NS_NewSVGViewElement(
     36      nsIContent** aResult,
     37      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
     38  JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
     39 
     40 public:
     41  NS_IMPL_FROMNODE_WITH_TAG(SVGViewElement, kNameSpaceID_SVG, view)
     42 
     43  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
     44 
     45  // WebIDL
     46  uint16_t ZoomAndPan() { return mEnumAttributes[ZOOMANDPAN].GetAnimValue(); }
     47  void SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv);
     48  already_AddRefed<SVGAnimatedRect> ViewBox();
     49  already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
     50 
     51 private:
     52  // SVGElement overrides
     53 
     54  EnumAttributesInfo GetEnumInfo() override;
     55 
     56  enum { ZOOMANDPAN };
     57  SVGAnimatedEnumeration mEnumAttributes[1];
     58  static SVGEnumMapping sZoomAndPanMap[];
     59  static EnumInfo sEnumInfo[1];
     60 
     61  SVGAnimatedViewBox* GetAnimatedViewBox() override;
     62  SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio() override;
     63 
     64  SVGAnimatedViewBox mViewBox;
     65  SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
     66 };
     67 
     68 }  // namespace dom
     69 }  // namespace mozilla
     70 
     71 #endif  // DOM_SVG_SVGVIEWELEMENT_H_