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:
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit nsHTMLButtonControlFrame(nsStyleContext* aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
~nsHTMLButtonControlFrame();
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) 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,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) 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,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsReflowStatus& aStatus) 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,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsEventStatus* aEventStatus) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-24 15:20:40 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const override;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void SetAdditionalStyleContext(int32_t aIndex,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsStyleContext* aStyleContext) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-28 12:36:59 -07:00
|
|
|
#ifdef DEBUG
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIFrame* aOldFrame) override;
|
2014-05-28 12:36:59 -07:00
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2007-03-22 10:30:00 -07:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool HonorPrintBackgroundSettings() override { return false; }
|
2009-05-27 22:01:42 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFormControlFrame
|
2015-03-21 09:28:04 -07:00
|
|
|
void SetFocus(bool aOn, bool aRepaint) override;
|
|
|
|
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Inserted child content gets its frames parented by our child block
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2016-01-29 06:42:14 -08:00
|
|
|
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|