LCOV - code coverage report
Current view: top level - editor/libeditor - TypeInState.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef TypeInState_h
       7             : #define TypeInState_h
       8             : 
       9             : #include "mozilla/UniquePtr.h"
      10             : #include "nsCOMPtr.h"
      11             : #include "nsCycleCollectionParticipant.h"
      12             : #include "nsISelectionListener.h"
      13             : #include "nsISupportsImpl.h"
      14             : #include "nsString.h"
      15             : #include "nsTArray.h"
      16             : #include "nscore.h"
      17             : 
      18             : // Workaround for windows headers
      19             : #ifdef SetProp
      20             : #undef SetProp
      21             : #endif
      22             : 
      23             : class nsIAtom;
      24             : class nsIDOMNode;
      25             : 
      26             : namespace mozilla {
      27             : 
      28             : class HTMLEditRules;
      29             : namespace dom {
      30             : class Selection;
      31             : } // namespace dom
      32             : 
      33           0 : struct PropItem
      34             : {
      35             :   nsIAtom* tag;
      36             :   nsString attr;
      37             :   nsString value;
      38             : 
      39             :   PropItem();
      40             :   PropItem(nsIAtom* aTag, const nsAString& aAttr, const nsAString& aValue);
      41             :   ~PropItem();
      42             : };
      43             : 
      44             : class TypeInState final : public nsISelectionListener
      45             : {
      46             : public:
      47             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      48           0 :   NS_DECL_CYCLE_COLLECTION_CLASS(TypeInState)
      49             : 
      50             :   TypeInState();
      51             :   void Reset();
      52             : 
      53             :   nsresult UpdateSelState(dom::Selection* aSelection);
      54             : 
      55             :   // nsISelectionListener
      56             :   NS_DECL_NSISELECTIONLISTENER
      57             : 
      58             :   void SetProp(nsIAtom* aProp, const nsAString& aAttr, const nsAString& aValue);
      59             : 
      60             :   void ClearAllProps();
      61             :   void ClearProp(nsIAtom* aProp, const nsAString& aAttr);
      62             : 
      63             :   /**
      64             :    * TakeClearProperty() hands back next property item on the clear list.
      65             :    * Caller assumes ownership of PropItem and must delete it.
      66             :    */
      67             :   UniquePtr<PropItem> TakeClearProperty();
      68             : 
      69             :   /**
      70             :    * TakeSetProperty() hands back next property item on the set list.
      71             :    * Caller assumes ownership of PropItem and must delete it.
      72             :    */
      73             :   UniquePtr<PropItem> TakeSetProperty();
      74             : 
      75             :   /**
      76             :    * TakeRelativeFontSize() hands back relative font value, which is then
      77             :    * cleared out.
      78             :    */
      79             :   int32_t TakeRelativeFontSize();
      80             : 
      81             :   void GetTypingState(bool& isSet, bool& theSetting, nsIAtom* aProp);
      82             :   void GetTypingState(bool& isSet, bool& theSetting, nsIAtom* aProp,
      83             :                       const nsString& aAttr, nsString* outValue);
      84             : 
      85             :   static bool FindPropInList(nsIAtom* aProp, const nsAString& aAttr,
      86             :                              nsAString* outValue, nsTArray<PropItem*>& aList,
      87             :                              int32_t& outIndex);
      88             : 
      89             : protected:
      90             :   virtual ~TypeInState();
      91             : 
      92             :   void RemovePropFromSetList(nsIAtom* aProp, const nsAString& aAttr);
      93             :   void RemovePropFromClearedList(nsIAtom* aProp, const nsAString& aAttr);
      94             :   bool IsPropSet(nsIAtom* aProp, const nsAString& aAttr, nsAString* outValue);
      95             :   bool IsPropSet(nsIAtom* aProp, const nsAString& aAttr, nsAString* outValue,
      96             :                  int32_t& outIndex);
      97             :   bool IsPropCleared(nsIAtom* aProp, const nsAString& aAttr);
      98             :   bool IsPropCleared(nsIAtom* aProp, const nsAString& aAttr, int32_t& outIndex);
      99             : 
     100             :   nsTArray<PropItem*> mSetArray;
     101             :   nsTArray<PropItem*> mClearedArray;
     102             :   int32_t mRelativeFontSize;
     103             :   nsCOMPtr<nsIDOMNode> mLastSelectionContainer;
     104             :   int32_t mLastSelectionOffset;
     105             : 
     106             :   friend class HTMLEditRules;
     107             : };
     108             : 
     109             : } // namespace mozilla
     110             : 
     111             : #endif  // #ifndef TypeInState_h
     112             : 

Generated by: LCOV version 1.13