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"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIFormControlFrame.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
|
|
|
|
#include "nsStyleContext.h"
|
|
|
|
#include "nsLeafFrame.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsIComponentManager.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
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-03-19 18:47:48 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* asPrevInFlow) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const;
|
|
|
|
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
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2012-09-14 09:10:08 -07: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
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool HonorPrintBackgroundSettings() { return false; }
|
2009-05-27 22:01:42 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFormControlFrame
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetFocus(bool aOn, bool aRepaint);
|
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
|
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
2011-08-24 13:54:30 -07:00
|
|
|
return GetFirstPrincipalChild()->GetContentInsertionFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const
|
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; }
|
2007-03-22 10:30:00 -07:00
|
|
|
void ReflowButtonContents(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsIFrame* aFirstKid,
|
|
|
|
nsMargin aFocusPadding,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
nsButtonFrameRenderer mRenderer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|