tor-browser

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

DOMSVGAnimatedBoolean.h (1509B)


      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_DOMSVGANIMATEDBOOLEAN_H_
      8 #define DOM_SVG_DOMSVGANIMATEDBOOLEAN_H_
      9 
     10 #include "SVGAnimatedBoolean.h"
     11 #include "mozilla/dom/SVGElement.h"
     12 #include "nsWrapperCache.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class DOMSVGAnimatedBoolean final : public nsWrapperCache {
     17  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedBoolean)
     18  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedBoolean)
     19 
     20  DOMSVGAnimatedBoolean(SVGAnimatedBoolean* aVal, SVGElement* aSVGElement)
     21      : mVal(aVal), mSVGElement(aSVGElement) {}
     22 
     23  // WebIDL
     24  SVGElement* GetParentObject() const { return mSVGElement; }
     25  JSObject* WrapObject(JSContext* aCx,
     26                       JS::Handle<JSObject*> aGivenProto) override;
     27  bool BaseVal() const { return mVal->GetBaseValue(); }
     28  void SetBaseVal(bool aValue) { mVal->SetBaseValue(aValue, mSVGElement); }
     29  bool AnimVal() const {
     30    mSVGElement->FlushAnimations();
     31    return mVal->GetAnimValue();
     32  }
     33 
     34 protected:
     35  ~DOMSVGAnimatedBoolean();
     36 
     37  SVGAnimatedBoolean* mVal;  // kept alive because it belongs to content
     38  RefPtr<SVGElement> mSVGElement;
     39 };
     40 
     41 }  // namespace mozilla::dom
     42 
     43 #endif  // DOM_SVG_DOMSVGANIMATEDBOOLEAN_H_