LCOV - code coverage report
Current view: directory - layout/forms - nsFileControlFrame.h (source / functions) Found Hit Coverage
Test: app.info Lines: 21 0 0.0 %
Date: 2012-06-02 Functions: 11 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #ifndef nsFileControlFrame_h___
      39                 : #define nsFileControlFrame_h___
      40                 : 
      41                 : #include "nsBlockFrame.h"
      42                 : #include "nsIFormControlFrame.h"
      43                 : #include "nsIDOMEventListener.h"
      44                 : #include "nsIAnonymousContentCreator.h"
      45                 : #include "nsICapturePicker.h"
      46                 : #include "nsCOMPtr.h"
      47                 : 
      48                 : class nsTextControlFrame;
      49                 : class nsIDOMDragEvent;
      50                 : 
      51                 : class nsFileControlFrame : public nsBlockFrame,
      52                 :                            public nsIFormControlFrame,
      53                 :                            public nsIAnonymousContentCreator
      54               0 : {
      55                 : public:
      56                 :   nsFileControlFrame(nsStyleContext* aContext);
      57                 : 
      58                 :   NS_IMETHOD Init(nsIContent* aContent,
      59                 :                   nsIFrame*   aParent,
      60                 :                   nsIFrame*   aPrevInFlow);
      61                 : 
      62                 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      63                 :                               const nsRect&           aDirtyRect,
      64                 :                               const nsDisplayListSet& aLists);
      65                 : 
      66                 :   NS_DECL_QUERYFRAME
      67                 :   NS_DECL_FRAMEARENA_HELPERS
      68                 : 
      69                 :   // nsIFormControlFrame
      70                 :   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
      71                 :   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const;
      72                 :   virtual void SetFocus(bool aOn, bool aRepaint);
      73                 : 
      74                 :   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
      75                 :   
      76                 :   virtual void DestroyFrom(nsIFrame* aDestructRoot);
      77                 : 
      78                 : #ifdef NS_DEBUG
      79                 :   NS_IMETHOD GetFrameName(nsAString& aResult) const;
      80                 : #endif
      81                 : 
      82                 :   NS_IMETHOD AttributeChanged(PRInt32         aNameSpaceID,
      83                 :                               nsIAtom*        aAttribute,
      84                 :                               PRInt32         aModType);
      85                 :   virtual void ContentStatesChanged(nsEventStates aStates);
      86                 :   virtual bool IsLeaf() const;
      87                 : 
      88                 : 
      89                 : 
      90                 :   // nsIAnonymousContentCreator
      91                 :   virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
      92                 :   virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
      93                 :                                         PRUint32 aFilter);
      94                 : 
      95                 : #ifdef ACCESSIBILITY
      96                 :   virtual already_AddRefed<nsAccessible> CreateAccessible();
      97                 : #endif  
      98                 : 
      99                 :   typedef bool (*AcceptAttrCallback)(const nsAString&, void*);
     100                 : 
     101                 : protected:
     102                 :   
     103                 :   struct CaptureCallbackData {
     104                 :     nsICapturePicker* picker;
     105                 :     PRUint32 mode;
     106                 :   };
     107                 :   
     108                 :   PRUint32 GetCaptureMode(const CaptureCallbackData& aData);
     109                 :   
     110                 :   class MouseListener;
     111                 :   friend class MouseListener;
     112                 :   class MouseListener : public nsIDOMEventListener {
     113                 :   public:
     114                 :     NS_DECL_ISUPPORTS
     115                 :     
     116               0 :     MouseListener(nsFileControlFrame* aFrame) :
     117               0 :       mFrame(aFrame)
     118               0 :     {}
     119                 : 
     120               0 :     void ForgetFrame() {
     121               0 :       mFrame = nsnull;
     122               0 :     }
     123                 : 
     124                 :   protected:
     125                 :     nsFileControlFrame* mFrame;
     126                 :   };
     127                 : 
     128                 :   class SyncDisabledStateEvent;
     129                 :   friend class SyncDisabledStateEvent;
     130                 :   class SyncDisabledStateEvent : public nsRunnable
     131               0 :   {
     132                 :   public:
     133               0 :     SyncDisabledStateEvent(nsFileControlFrame* aFrame)
     134               0 :       : mFrame(aFrame)
     135               0 :     {}
     136                 : 
     137               0 :     NS_IMETHOD Run() {
     138               0 :       nsFileControlFrame* frame = static_cast<nsFileControlFrame*>(mFrame.GetFrame());
     139               0 :       NS_ENSURE_STATE(frame);
     140                 : 
     141               0 :       frame->SyncDisabledState();
     142               0 :       return NS_OK;
     143                 :     }
     144                 : 
     145                 :   private:
     146                 :     nsWeakFrame mFrame;
     147                 :   };
     148                 : 
     149                 :   class CaptureMouseListener: public MouseListener {
     150                 :   public:
     151               0 :     CaptureMouseListener(nsFileControlFrame* aFrame) : MouseListener(aFrame),
     152               0 :                                                        mMode(0) {};
     153                 :     NS_DECL_NSIDOMEVENTLISTENER
     154                 :     PRUint32 mMode;
     155                 :   };
     156                 :   
     157                 :   class BrowseMouseListener: public MouseListener {
     158                 :   public:
     159               0 :     BrowseMouseListener(nsFileControlFrame* aFrame) : MouseListener(aFrame) {};
     160                 :     NS_DECL_NSIDOMEVENTLISTENER
     161                 : 
     162                 :     static bool IsValidDropData(nsIDOMDragEvent* aEvent);
     163                 :   };
     164                 : 
     165               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
     166                 :   {
     167                 :     return nsBlockFrame::IsFrameOfType(aFlags &
     168               0 :       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
     169                 :   }
     170                 : 
     171                 :   virtual PRIntn GetSkipSides() const;
     172                 : 
     173                 :   /**
     174                 :    * The text box input.
     175                 :    * @see nsFileControlFrame::CreateAnonymousContent
     176                 :    */
     177                 :   nsCOMPtr<nsIContent> mTextContent;
     178                 :   /**
     179                 :    * The browse button input.
     180                 :    * @see nsFileControlFrame::CreateAnonymousContent
     181                 :    */
     182                 :   nsCOMPtr<nsIContent> mBrowse;
     183                 : 
     184                 :   /**
     185                 :    * The capture button input.
     186                 :    * @see nsFileControlFrame::CreateAnonymousContent
     187                 :    */
     188                 :   nsCOMPtr<nsIContent> mCapture;
     189                 : 
     190                 :   /**
     191                 :    * Our mouse listener.  This makes sure we don't get used after destruction.
     192                 :    */
     193                 :   nsRefPtr<BrowseMouseListener> mMouseListener;
     194                 :   nsRefPtr<CaptureMouseListener> mCaptureMouseListener;
     195                 : 
     196                 : protected:
     197                 :   /**
     198                 :    * @return the text control frame, or null if not found
     199                 :    */
     200                 :   nsTextControlFrame* GetTextControlFrame();
     201                 : 
     202                 :   /**
     203                 :    * Copy an attribute from file content to text and button content.
     204                 :    * @param aNameSpaceID namespace of attr
     205                 :    * @param aAttribute attribute atom
     206                 :    * @param aWhichControls which controls to apply to (SYNC_TEXT or SYNC_FILE)
     207                 :    */
     208                 :   void SyncAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
     209                 :                 PRInt32 aWhichControls);
     210                 : 
     211                 :   /**
     212                 :    * Sync the disabled state of the content with anonymous children.
     213                 :    */
     214                 :   void SyncDisabledState();
     215                 : };
     216                 : 
     217                 : #endif
     218                 : 
     219                 : 

Generated by: LCOV version 1.7