LCOV - code coverage report
Current view: top level - layout/forms - nsFileControlFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 15 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 nsFileControlFrame_h___
       7             : #define nsFileControlFrame_h___
       8             : 
       9             : #include "mozilla/Attributes.h"
      10             : #include "nsBlockFrame.h"
      11             : #include "nsIFormControlFrame.h"
      12             : #include "nsIDOMEventListener.h"
      13             : #include "nsIAnonymousContentCreator.h"
      14             : #include "nsCOMPtr.h"
      15             : 
      16             : class nsIDOMDataTransfer;
      17             : class nsIDOMFileList;
      18             : namespace mozilla {
      19             : namespace dom {
      20             : class BlobImpl;
      21             : } // namespace dom
      22             : } // namespace mozilla
      23             : 
      24           0 : class nsFileControlFrame : public nsBlockFrame,
      25             :                            public nsIFormControlFrame,
      26             :                            public nsIAnonymousContentCreator
      27             : {
      28             : public:
      29             :   explicit nsFileControlFrame(nsStyleContext* aContext);
      30             : 
      31             :   virtual void Init(nsIContent*       aContent,
      32             :                     nsContainerFrame* aParent,
      33             :                     nsIFrame*         aPrevInFlow) override;
      34             : 
      35             :   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      36             :                                 const nsRect&           aDirtyRect,
      37             :                                 const nsDisplayListSet& aLists) override;
      38             : 
      39             :   NS_DECL_QUERYFRAME
      40           0 :   NS_DECL_FRAMEARENA_HELPERS(nsFileControlFrame)
      41             : 
      42             :   // nsIFormControlFrame
      43             :   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;
      44             :   virtual void SetFocus(bool aOn, bool aRepaint) override;
      45             : 
      46             :   virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
      47             : 
      48             :   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
      49             : 
      50             : #ifdef DEBUG_FRAME_DUMP
      51             :   virtual nsresult GetFrameName(nsAString& aResult) const override;
      52             : #endif
      53             : 
      54             :   virtual nsresult AttributeChanged(int32_t         aNameSpaceID,
      55             :                                     nsIAtom*        aAttribute,
      56             :                                     int32_t         aModType) override;
      57             :   virtual void ContentStatesChanged(mozilla::EventStates aStates) override;
      58             : 
      59             :   // nsIAnonymousContentCreator
      60             :   virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
      61             :   virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
      62             :                                         uint32_t aFilter) override;
      63             : 
      64             : #ifdef ACCESSIBILITY
      65             :   virtual mozilla::a11y::AccType AccessibleType() override;
      66             : #endif
      67             : 
      68             :   typedef bool (*AcceptAttrCallback)(const nsAString&, void*);
      69             : 
      70             : protected:
      71             : 
      72             :   class MouseListener;
      73             :   friend class MouseListener;
      74             :   class MouseListener : public nsIDOMEventListener {
      75             :   public:
      76             :     NS_DECL_ISUPPORTS
      77             : 
      78           0 :     explicit MouseListener(nsFileControlFrame* aFrame)
      79           0 :      : mFrame(aFrame)
      80           0 :     {}
      81             : 
      82           0 :     void ForgetFrame() {
      83           0 :       mFrame = nullptr;
      84           0 :     }
      85             : 
      86             :   protected:
      87           0 :     virtual ~MouseListener() {}
      88             : 
      89             :     nsFileControlFrame* mFrame;
      90             :   };
      91             : 
      92             :   class SyncDisabledStateEvent;
      93             :   friend class SyncDisabledStateEvent;
      94           0 :   class SyncDisabledStateEvent : public mozilla::Runnable
      95             :   {
      96             :   public:
      97           0 :     explicit SyncDisabledStateEvent(nsFileControlFrame* aFrame)
      98           0 :       : mozilla::Runnable("nsFileControlFrame::SyncDisabledStateEvent")
      99           0 :       , mFrame(aFrame)
     100           0 :     {}
     101             : 
     102           0 :     NS_IMETHOD Run() override {
     103           0 :       nsFileControlFrame* frame = static_cast<nsFileControlFrame*>(mFrame.GetFrame());
     104           0 :       NS_ENSURE_STATE(frame);
     105             : 
     106           0 :       frame->SyncDisabledState();
     107           0 :       return NS_OK;
     108             :     }
     109             : 
     110             :   private:
     111             :     WeakFrame mFrame;
     112             :   };
     113             : 
     114           0 :   class DnDListener: public MouseListener {
     115             :   public:
     116           0 :     explicit DnDListener(nsFileControlFrame* aFrame)
     117           0 :       : MouseListener(aFrame)
     118           0 :     {}
     119             : 
     120             :     NS_DECL_NSIDOMEVENTLISTENER
     121             : 
     122             :     nsresult GetBlobImplForWebkitDirectory(nsIDOMFileList* aFileList,
     123             :                                            mozilla::dom::BlobImpl** aBlobImpl);
     124             : 
     125             :     bool IsValidDropData(nsIDOMDataTransfer* aDOMDataTransfer);
     126             :     bool CanDropTheseFiles(nsIDOMDataTransfer* aDOMDataTransfer, bool aSupportsMultiple);
     127             :   };
     128             : 
     129           0 :   virtual bool IsFrameOfType(uint32_t aFlags) const override
     130             :   {
     131           0 :     return nsBlockFrame::IsFrameOfType(aFlags &
     132           0 :       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
     133             :   }
     134             : 
     135             :   /**
     136             :    * The text box input.
     137             :    * @see nsFileControlFrame::CreateAnonymousContent
     138             :    */
     139             :   nsCOMPtr<nsIContent> mTextContent;
     140             :   /**
     141             :    * The button to open a file or directory picker.
     142             :    * @see nsFileControlFrame::CreateAnonymousContent
     143             :    */
     144             :   nsCOMPtr<nsIContent> mBrowseFilesOrDirs;
     145             : 
     146             :   /**
     147             :    * Drag and drop mouse listener.
     148             :    * This makes sure we don't get used after destruction.
     149             :    */
     150             :   RefPtr<DnDListener> mMouseListener;
     151             : 
     152             : protected:
     153             :   /**
     154             :    * Sync the disabled state of the content with anonymous children.
     155             :    */
     156             :   void SyncDisabledState();
     157             : 
     158             :   /**
     159             :    * Updates the displayed value by using aValue.
     160             :    */
     161             :   void UpdateDisplayedValue(const nsAString& aValue, bool aNotify);
     162             : };
     163             : 
     164             : #endif // nsFileControlFrame_h___

Generated by: LCOV version 1.13