2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsHTMLButtonControlFrame_h___
|
|
|
|
#define nsHTMLButtonControlFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIFormControlFrame.h"
|
|
|
|
#include "nsButtonFrameRenderer.h"
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
class nsRenderingContext;
|
2010-04-10 13:10:12 -07:00
|
|
|
class nsPresContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-27 12:18:48 -08:00
|
|
|
class nsHTMLButtonControlFrame : public nsContainerFrame,
|
2007-03-22 10:30:00 -07:00
|
|
|
public nsIFormControlFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsHTMLButtonControlFrame(nsStyleContext* aContext);
|
|
|
|
~nsHTMLButtonControlFrame();
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
2014-02-18 00:36:33 -08:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-24 15:20:40 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void SetAdditionalStyleContext(int32_t aIndex,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsStyleContext* aStyleContext) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult AppendFrames(ChildListID aListID,
|
2014-02-18 00:36:33 -08:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult InsertFrames(ChildListID aListID,
|
2014-02-18 00:36:33 -08:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult RemoveFrame(ChildListID aListID,
|
2014-02-18 00:36:33 -08:00
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-28 14:53:44 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; }
|
2009-05-27 22:01:42 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFormControlFrame
|
2013-05-14 09:33:23 -07:00
|
|
|
void SetFocus(bool aOn, bool aRepaint) MOZ_OVERRIDE;
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Inserted child content gets its frames parented by our child block
|
2014-05-24 15:20:39 -07:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
|
2011-08-24 13:54:30 -07:00
|
|
|
return GetFirstPrincipalChild()->GetContentInsertionFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-12-27 12:18:48 -08:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2007-03-22 10:30:00 -07:00
|
|
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsInput() { return false; }
|
2013-09-26 23:43:16 -07:00
|
|
|
// Reflows the button's sole child frame, and computes the desired size
|
|
|
|
// of the button itself from the results.
|
2007-03-22 10:30:00 -07:00
|
|
|
void ReflowButtonContents(nsPresContext* aPresContext,
|
2013-09-26 23:43:16 -07:00
|
|
|
nsHTMLReflowMetrics& aButtonDesiredSize,
|
2013-09-26 23:43:15 -07:00
|
|
|
const nsHTMLReflowState& aButtonReflowState,
|
2013-09-26 23:43:16 -07:00
|
|
|
nsIFrame* aFirstKid);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsButtonFrameRenderer mRenderer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|