layout/forms/nsHTMLButtonControlFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/forms/nsHTMLButtonControlFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsHTMLButtonControlFrame_h___
    1.10 +#define nsHTMLButtonControlFrame_h___
    1.11 +
    1.12 +#include "mozilla/Attributes.h"
    1.13 +#include "nsContainerFrame.h"
    1.14 +#include "nsIFormControlFrame.h"
    1.15 +#include "nsButtonFrameRenderer.h"
    1.16 +
    1.17 +class nsRenderingContext;
    1.18 +class nsPresContext;
    1.19 +
    1.20 +class nsHTMLButtonControlFrame : public nsContainerFrame,
    1.21 +                                 public nsIFormControlFrame 
    1.22 +{
    1.23 +public:
    1.24 +  nsHTMLButtonControlFrame(nsStyleContext* aContext);
    1.25 +  ~nsHTMLButtonControlFrame();
    1.26 +
    1.27 +  virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
    1.28 +
    1.29 +  NS_DECL_QUERYFRAME
    1.30 +  NS_DECL_FRAMEARENA_HELPERS
    1.31 +
    1.32 +  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    1.33 +                                const nsRect&           aDirtyRect,
    1.34 +                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    1.35 +
    1.36 +  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.37 +
    1.38 +  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.39 +
    1.40 +  virtual nsresult Reflow(nsPresContext*           aPresContext,
    1.41 +                          nsHTMLReflowMetrics&     aDesiredSize,
    1.42 +                          const nsHTMLReflowState& aReflowState,
    1.43 +                          nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    1.44 +
    1.45 +  virtual nsresult HandleEvent(nsPresContext* aPresContext, 
    1.46 +                               mozilla::WidgetGUIEvent* aEvent,
    1.47 +                               nsEventStatus* aEventStatus) MOZ_OVERRIDE;
    1.48 +
    1.49 +  virtual void Init(nsIContent*      aContent,
    1.50 +                    nsIFrame*        aParent,
    1.51 +                    nsIFrame*        asPrevInFlow) MOZ_OVERRIDE;
    1.52 +
    1.53 +  virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
    1.54 +  virtual void SetAdditionalStyleContext(int32_t aIndex, 
    1.55 +                                         nsStyleContext* aStyleContext) MOZ_OVERRIDE;
    1.56 + 
    1.57 +  virtual nsresult AppendFrames(ChildListID     aListID,
    1.58 +                                nsFrameList&    aFrameList) MOZ_OVERRIDE;
    1.59 +
    1.60 +  virtual nsresult InsertFrames(ChildListID     aListID,
    1.61 +                                nsIFrame*       aPrevFrame,
    1.62 +                                nsFrameList&    aFrameList) MOZ_OVERRIDE;
    1.63 +
    1.64 +  virtual nsresult RemoveFrame(ChildListID     aListID,
    1.65 +                               nsIFrame*       aOldFrame) MOZ_OVERRIDE;
    1.66 +
    1.67 +#ifdef ACCESSIBILITY
    1.68 +  virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
    1.69 +#endif
    1.70 +
    1.71 +  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    1.72 +  
    1.73 +#ifdef DEBUG_FRAME_DUMP
    1.74 +  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
    1.75 +    return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
    1.76 +  }
    1.77 +#endif
    1.78 +
    1.79 +  virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; }
    1.80 +
    1.81 +  // nsIFormControlFrame
    1.82 +  void SetFocus(bool aOn, bool aRepaint) MOZ_OVERRIDE;
    1.83 +  virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
    1.84 +
    1.85 +  // Inserted child content gets its frames parented by our child block
    1.86 +  virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
    1.87 +    return GetFirstPrincipalChild()->GetContentInsertionFrame();
    1.88 +  }
    1.89 +
    1.90 +  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    1.91 +  {
    1.92 +    return nsContainerFrame::IsFrameOfType(aFlags &
    1.93 +      ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
    1.94 +  }
    1.95 +
    1.96 +protected:
    1.97 +  virtual bool IsInput() { return false; }
    1.98 +  // Reflows the button's sole child frame, and computes the desired size
    1.99 +  // of the button itself from the results.
   1.100 +  void ReflowButtonContents(nsPresContext* aPresContext,
   1.101 +                            nsHTMLReflowMetrics& aButtonDesiredSize,
   1.102 +                            const nsHTMLReflowState& aButtonReflowState,
   1.103 +                            nsIFrame* aFirstKid);
   1.104 +
   1.105 +  nsButtonFrameRenderer mRenderer;
   1.106 +};
   1.107 +
   1.108 +#endif
   1.109 +
   1.110 +
   1.111 +
   1.112 +

mercurial