LCOV - code coverage report
Current view: top level - dom/smil - nsSMILTimeValueSpec.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 17 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 NS_SMILTIMEVALUESPEC_H_
       8             : #define NS_SMILTIMEVALUESPEC_H_
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "nsSMILTimeValueSpecParams.h"
      12             : #include "nsReferencedElement.h"
      13             : #include "nsIDOMEventListener.h"
      14             : 
      15             : class nsAString;
      16             : class nsSMILTimeValue;
      17             : class nsSMILTimedElement;
      18             : class nsSMILTimeContainer;
      19             : class nsSMILInstanceTime;
      20             : class nsSMILInterval;
      21             : 
      22             : namespace mozilla {
      23             : class EventListenerManager;
      24             : } // namespace mozilla
      25             : 
      26             : //----------------------------------------------------------------------
      27             : // nsSMILTimeValueSpec class
      28             : //
      29             : // An individual element of a 'begin' or 'end' attribute, e.g. '5s', 'a.end'.
      30             : // This class handles the parsing of such specifications and performs the
      31             : // necessary event handling (for event, repeat, and accesskey specifications)
      32             : // and synchronisation (for syncbase specifications).
      33             : //
      34             : // For an overview of how this class is related to other SMIL time classes see
      35             : // the documentation in nsSMILTimeValue.h
      36             : 
      37             : class nsSMILTimeValueSpec
      38             : {
      39             : public:
      40             :   typedef mozilla::dom::Element Element;
      41             : 
      42             :   nsSMILTimeValueSpec(nsSMILTimedElement& aOwner, bool aIsBegin);
      43             :   ~nsSMILTimeValueSpec();
      44             : 
      45             :   nsresult SetSpec(const nsAString& aStringSpec, Element* aContextNode);
      46             :   void     ResolveReferences(nsIContent* aContextNode);
      47             :   bool     IsEventBased() const;
      48             : 
      49             :   void     HandleNewInterval(nsSMILInterval& aInterval,
      50             :                              const nsSMILTimeContainer* aSrcContainer);
      51             :   void     HandleTargetElementChange(Element* aNewTarget);
      52             : 
      53             :   // For created nsSMILInstanceTime objects
      54             :   bool     DependsOnBegin() const;
      55             :   void     HandleChangedInstanceTime(const nsSMILInstanceTime& aBaseTime,
      56             :                                      const nsSMILTimeContainer* aSrcContainer,
      57             :                                      nsSMILInstanceTime& aInstanceTimeToUpdate,
      58             :                                      bool aObjectChanged);
      59             :   void     HandleDeletedInstanceTime(nsSMILInstanceTime& aInstanceTime);
      60             : 
      61             :   // Cycle-collection support
      62             :   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
      63             :   void Unlink();
      64             : 
      65             : protected:
      66             :   void UpdateReferencedElement(Element* aFrom, Element* aTo);
      67             :   void UnregisterFromReferencedElement(Element* aElement);
      68             :   nsSMILTimedElement* GetTimedElement(Element* aElement);
      69             :   bool IsWhitelistedEvent();
      70             :   void RegisterEventListener(Element* aElement);
      71             :   void UnregisterEventListener(Element* aElement);
      72             :   mozilla::EventListenerManager* GetEventListenerManager(Element* aElement);
      73             :   void HandleEvent(nsIDOMEvent* aEvent);
      74             :   bool CheckEventDetail(nsIDOMEvent* aEvent);
      75             :   bool CheckRepeatEventDetail(nsIDOMEvent* aEvent);
      76             :   bool CheckAccessKeyEventDetail(nsIDOMEvent* aEvent);
      77             :   nsSMILTimeValue ConvertBetweenTimeContainers(const nsSMILTimeValue& aSrcTime,
      78             :                                       const nsSMILTimeContainer* aSrcContainer);
      79             :   bool ApplyOffset(nsSMILTimeValue& aTime) const;
      80             : 
      81             :   nsSMILTimedElement*           mOwner;
      82             :   bool                          mIsBegin; // Indicates if *we* are a begin spec,
      83             :                                           // not to be confused with
      84             :                                           // mParams.mSyncBegin which indicates
      85             :                                           // if we're synced with the begin of
      86             :                                           // the target.
      87             :   nsSMILTimeValueSpecParams     mParams;
      88             : 
      89           0 :   class TimeReferenceElement : public nsReferencedElement
      90             :   {
      91             :   public:
      92           0 :     explicit TimeReferenceElement(nsSMILTimeValueSpec* aOwner) : mSpec(aOwner) { }
      93           0 :     void ResetWithElement(Element* aTo) {
      94           0 :       RefPtr<Element> from = get();
      95           0 :       Unlink();
      96           0 :       ElementChanged(from, aTo);
      97           0 :     }
      98             : 
      99             :   protected:
     100           0 :     virtual void ElementChanged(Element* aFrom, Element* aTo) override
     101             :     {
     102           0 :       nsReferencedElement::ElementChanged(aFrom, aTo);
     103           0 :       mSpec->UpdateReferencedElement(aFrom, aTo);
     104           0 :     }
     105           0 :     virtual bool IsPersistent() override { return true; }
     106             :   private:
     107             :     nsSMILTimeValueSpec* mSpec;
     108             :   };
     109             : 
     110             :   TimeReferenceElement mReferencedElement;
     111             : 
     112             :   class EventListener final : public nsIDOMEventListener
     113             :   {
     114           0 :     ~EventListener() {}
     115             :   public:
     116           0 :     explicit EventListener(nsSMILTimeValueSpec* aOwner) : mSpec(aOwner) { }
     117           0 :     void Disconnect()
     118             :     {
     119           0 :       mSpec = nullptr;
     120           0 :     }
     121             : 
     122             :     NS_DECL_ISUPPORTS
     123             :     NS_DECL_NSIDOMEVENTLISTENER
     124             : 
     125             :   private:
     126             :     nsSMILTimeValueSpec* mSpec;
     127             :   };
     128             :   RefPtr<EventListener> mEventListener;
     129             : };
     130             : 
     131             : #endif // NS_SMILTIMEVALUESPEC_H_

Generated by: LCOV version 1.13