2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
#ifndef nsComboboxControlFrame_h___
|
|
|
|
#define nsComboboxControlFrame_h___
|
|
|
|
|
2000-03-07 15:54:31 +00:00
|
|
|
#ifdef DEBUG_evaughan
|
|
|
|
//#define DEBUG_rods
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_rods
|
2000-10-04 13:39:07 +00:00
|
|
|
//#define DO_REFLOW_DEBUG
|
|
|
|
//#define DO_REFLOW_COUNTER
|
2000-03-15 15:47:11 +00:00
|
|
|
//#define DO_UNCONSTRAINED_CHECK
|
2000-03-07 15:54:31 +00:00
|
|
|
//#define DO_PIXELS
|
|
|
|
//#define DO_NEW_REFLOW
|
|
|
|
#endif
|
2000-01-05 16:42:47 +00:00
|
|
|
|
2006-09-30 05:07:49 +00:00
|
|
|
//Mark used to indicate when onchange has been fired for current combobox item
|
|
|
|
#define NS_SKIP_NOTIFY_INDEX -2
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2008-12-29 15:07:38 +00:00
|
|
|
#include "nsBlockFrame.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
#include "nsIFormControlFrame.h"
|
2006-02-27 04:13:51 +00:00
|
|
|
#include "nsIComboboxControlFrame.h"
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
1999-08-26 14:54:07 +00:00
|
|
|
#include "nsISelectControlFrame.h"
|
1999-09-21 21:20:50 +00:00
|
|
|
#include "nsIRollupListener.h"
|
2001-11-02 07:40:01 +00:00
|
|
|
#include "nsIStatefulFrame.h"
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsThreadUtils.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
class nsStyleContext;
|
|
|
|
class nsIListControlFrame;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
class nsComboboxDisplayFrame;
|
2013-08-28 14:30:02 +00:00
|
|
|
class nsIDOMEventListener;
|
|
|
|
class nsIScrollableFrame;
|
1999-01-18 15:14:00 +00:00
|
|
|
|
2015-01-21 16:23:28 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsComboboxControlFrame final : public nsBlockFrame,
|
2015-03-27 18:52:19 +00:00
|
|
|
public nsIFormControlFrame,
|
|
|
|
public nsIComboboxControlFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsISelectControlFrame,
|
|
|
|
public nsIRollupListener,
|
|
|
|
public nsIStatefulFrame
|
1999-01-18 15:14:00 +00:00
|
|
|
{
|
2015-01-21 16:23:28 +00:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
public:
|
2014-05-24 22:20:40 +00:00
|
|
|
friend nsContainerFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
nsFrameState aFlags);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
friend class nsComboboxDisplayFrame;
|
1999-12-05 20:43:18 +00:00
|
|
|
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsComboboxControlFrame(nsStyleContext* aContext);
|
1999-01-18 15:14:00 +00:00
|
|
|
~nsComboboxControlFrame();
|
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-02-18 17:34:09 +00:00
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 18:41:57 +00:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aFilter) override;
|
|
|
|
virtual nsIFrame* CreateFrameFor(nsIContent* aContent) override;
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
2001-05-17 23:52:32 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aCX,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
1999-01-18 15:14:00 +00:00
|
|
|
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
2014-02-18 08:36:33 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsEventStatus* aEventStatus) override;
|
1999-07-28 21:38:08 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2006-01-26 02:29:17 +00:00
|
|
|
|
2015-01-21 16:23:28 +00:00
|
|
|
void PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt);
|
2006-01-26 02:29:17 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// XXXbz this is only needed to prevent the quirk percent height stuff from
|
|
|
|
// leaking out of the combobox. We may be able to get rid of this as more
|
|
|
|
// things move to IsFrameOfType.
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIAtom* GetType() const override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2007-02-24 18:33:33 +00:00
|
|
|
{
|
2008-12-29 15:07:38 +00:00
|
|
|
return nsBlockFrame::IsFrameOfType(aFlags &
|
2007-02-24 18:33:33 +00:00
|
|
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override {
|
2009-09-01 11:22:31 +00:00
|
|
|
return do_QueryFrame(mDropdownFrame);
|
|
|
|
}
|
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2014-05-28 19:36:58 +00:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsFrameList& aChildList) override;
|
|
|
|
virtual const nsFrameList& GetChildList(ChildListID aListID) const override;
|
|
|
|
virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override;
|
2004-07-18 12:02:53 +00:00
|
|
|
|
2005-12-12 23:53:06 +00:00
|
|
|
// nsIFormControlFrame
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* Inform the control that it got (or lost) focus.
|
|
|
|
* If it lost focus, the dropdown menu will be rolled up if needed,
|
|
|
|
* and FireOnChange() will be called.
|
2011-10-17 14:59:28 +00:00
|
|
|
* @param aOn true if got focus, false if lost focus.
|
|
|
|
* @param aRepaint if true then force repaint (NOTE: we always force repaint currently)
|
2007-05-17 11:12:30 +00:00
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SetFocus(bool aOn, bool aRepaint) override;
|
1999-03-06 19:43:13 +00:00
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
//nsIComboboxControlFrame
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsDroppedDown() override { return mDroppedDown; }
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ShowDropDown(bool aDoDropDown) override;
|
|
|
|
virtual nsIFrame* GetDropDown() override;
|
|
|
|
virtual void SetDropDown(nsIFrame* aDropDownFrame) override;
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void RollupFromList() override;
|
2012-06-23 01:13:56 +00:00
|
|
|
|
|
|
|
/**
|
2015-02-08 15:31:14 +00:00
|
|
|
* Return the available space before and after this frame for
|
2012-06-23 01:13:56 +00:00
|
|
|
* placing the drop-down list, and the current 2D translation.
|
|
|
|
* Note that either or both can be less than or equal to zero,
|
|
|
|
* if both are then the drop-down should be closed.
|
|
|
|
*/
|
2015-02-08 15:31:14 +00:00
|
|
|
void GetAvailableDropdownSpace(mozilla::WritingMode aWM,
|
|
|
|
nscoord* aBefore,
|
|
|
|
nscoord* aAfter,
|
|
|
|
mozilla::LogicalPoint* aTranslation);
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual int32_t GetIndexOfDisplayArea() override;
|
2009-02-18 03:27:25 +00:00
|
|
|
/**
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD RedisplaySelectedText() override;
|
|
|
|
virtual int32_t UpdateRecentIndex(int32_t aIndex) override;
|
|
|
|
virtual void OnContentReset() override;
|
1999-08-26 14:54:07 +00:00
|
|
|
|
|
|
|
// nsISelectControlFrame
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD AddOption(int32_t index) override;
|
|
|
|
NS_IMETHOD RemoveOption(int32_t index) override;
|
|
|
|
NS_IMETHOD DoneAddingChildren(bool aIsDone) override;
|
|
|
|
NS_IMETHOD OnOptionSelected(int32_t aIndex, bool aSelected) override;
|
|
|
|
NS_IMETHOD OnSetSelectedIndex(int32_t aOldIndex, int32_t aNewIndex) override;
|
1999-09-15 05:31:31 +00:00
|
|
|
|
1999-09-21 21:20:50 +00:00
|
|
|
//nsIRollupListener
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* Hide the dropdown menu and stop capturing mouse events.
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2015-01-08 01:52:20 +00:00
|
|
|
virtual bool Rollup(uint32_t aCount, bool aFlush,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsIntPoint* pos, nsIContent** aLastRolledUp) override;
|
|
|
|
virtual void NotifyGeometryChange() override;
|
2011-11-08 19:59:07 +00:00
|
|
|
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* A combobox should roll up if a mousewheel event happens outside of
|
|
|
|
* the popup area.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool ShouldRollupOnMouseWheelEvent() override
|
2011-11-08 19:59:07 +00:00
|
|
|
{ return true; }
|
1999-09-21 21:20:50 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool ShouldConsumeOnMouseWheelEvent() override
|
2013-03-08 19:48:48 +00:00
|
|
|
{ return false; }
|
|
|
|
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* A combobox should not roll up if activated by a mouse activate message
|
|
|
|
* (eg. X-mouse).
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool ShouldRollupOnMouseActivate() override
|
2011-11-08 19:59:07 +00:00
|
|
|
{ return false; }
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual uint32_t GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain) override
|
2011-11-08 19:59:07 +00:00
|
|
|
{ return 0; }
|
2001-12-11 06:16:07 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIWidget* GetRollupWidget() override;
|
2012-10-26 13:15:22 +00:00
|
|
|
|
2001-11-02 07:40:01 +00:00
|
|
|
//nsIStatefulFrame
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) override;
|
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) override;
|
2001-11-02 07:40:01 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool ToolkitHasNativePopup();
|
2005-02-16 05:13:16 +00:00
|
|
|
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
protected:
|
2012-06-23 01:13:56 +00:00
|
|
|
friend class RedisplayTextEvent;
|
|
|
|
friend class nsAsyncResize;
|
|
|
|
friend class nsResizeDropdownAtFinalPosition;
|
2002-01-25 23:35:44 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// Utilities
|
2014-05-13 00:47:52 +00:00
|
|
|
void ReflowDropdown(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState);
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
2012-06-23 01:13:56 +00:00
|
|
|
enum DropDownPositionState {
|
|
|
|
// can't show the dropdown at its current position
|
|
|
|
eDropDownPositionSuppressed,
|
|
|
|
// a resize reflow is pending, don't show it yet
|
|
|
|
eDropDownPositionPendingResize,
|
|
|
|
// the dropdown has its final size and position and can be displayed here
|
|
|
|
eDropDownPositionFinal
|
|
|
|
};
|
|
|
|
DropDownPositionState AbsolutelyPositionDropDown();
|
|
|
|
|
2014-07-24 17:03:25 +00:00
|
|
|
// Helper for GetMinISize/GetPrefISize
|
2014-07-24 17:03:26 +00:00
|
|
|
nscoord GetIntrinsicISize(nsRenderingContext* aRenderingContext,
|
|
|
|
nsLayoutUtils::IntrinsicISizeType aType);
|
2006-05-10 17:30:15 +00:00
|
|
|
|
|
|
|
class RedisplayTextEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit RedisplayTextEvent(nsComboboxControlFrame *c) : mControlFrame(c) {}
|
2012-07-30 14:20:58 +00:00
|
|
|
void Revoke() { mControlFrame = nullptr; }
|
2006-05-10 17:30:15 +00:00
|
|
|
private:
|
|
|
|
nsComboboxControlFrame *mControlFrame;
|
|
|
|
};
|
|
|
|
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* Show or hide the dropdown list.
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
void ShowPopup(bool aShowPopup);
|
2007-05-17 11:12:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Show or hide the dropdown list.
|
2011-10-17 14:59:28 +00:00
|
|
|
* @param aShowList true to show, false to hide the dropdown.
|
2007-05-17 11:12:30 +00:00
|
|
|
* @note This method might destroy |this|.
|
2011-10-17 14:59:28 +00:00
|
|
|
* @return false if this frame is destroyed, true if still alive.
|
2007-05-17 11:12:30 +00:00
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ShowList(bool aShowList);
|
2002-06-14 06:50:22 +00:00
|
|
|
void CheckFireOnChange();
|
2005-02-07 23:11:30 +00:00
|
|
|
void FireValueChangeEvent();
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult RedisplayText(int32_t aIndex);
|
2005-06-21 00:00:14 +00:00
|
|
|
void HandleRedisplayTextEvent();
|
2011-09-29 06:19:26 +00:00
|
|
|
void ActuallyDisplayText(bool aNotify);
|
1999-01-18 15:14:00 +00:00
|
|
|
|
2011-09-18 18:16:47 +00:00
|
|
|
private:
|
|
|
|
// If our total transform to the root frame of the root document is only a 2d
|
|
|
|
// translation then return that translation, otherwise returns (0,0).
|
|
|
|
nsPoint GetCSSTransformTranslation();
|
|
|
|
|
|
|
|
protected:
|
2000-03-07 15:54:31 +00:00
|
|
|
nsFrameList mPopupFrames; // additional named child list
|
2006-07-19 04:36:36 +00:00
|
|
|
nsCOMPtr<nsIContent> mDisplayContent; // Anonymous content used to display the current selection
|
2007-02-18 17:34:09 +00:00
|
|
|
nsCOMPtr<nsIContent> mButtonContent; // Anonymous content for the button
|
2014-05-24 22:20:39 +00:00
|
|
|
nsContainerFrame* mDisplayFrame; // frame to display selection
|
2000-03-07 15:54:31 +00:00
|
|
|
nsIFrame* mButtonFrame; // button frame
|
|
|
|
nsIFrame* mDropdownFrame; // dropdown list frame
|
|
|
|
nsIListControlFrame * mListControlFrame; // ListControl Interface for the dropdown frame
|
1999-01-18 15:14:00 +00:00
|
|
|
|
2015-02-08 15:31:14 +00:00
|
|
|
// The inline size of our display area. Used by that frame's reflow
|
|
|
|
// to size to the full inline size except the drop-marker.
|
|
|
|
nscoord mDisplayISize;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
nsRevocableEventPtr<RedisplayTextEvent> mRedisplayTextEvent;
|
2000-05-08 20:32:11 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mRecentSelectedIndex;
|
|
|
|
int32_t mDisplayedIndex;
|
2005-06-21 00:00:14 +00:00
|
|
|
nsString mDisplayedOptionText;
|
2002-01-25 23:35:44 +00:00
|
|
|
|
2001-06-30 00:25:09 +00:00
|
|
|
// make someone to listen to the button. If its programmatically pressed by someone like Accessibility
|
|
|
|
// then open or close the combo box.
|
2011-06-29 18:07:25 +00:00
|
|
|
nsCOMPtr<nsIDOMEventListener> mButtonListener;
|
2001-06-30 00:25:09 +00:00
|
|
|
|
2015-02-08 15:31:14 +00:00
|
|
|
// The last y-positions used for estimating available space before and
|
|
|
|
// after for the dropdown list in GetAvailableDropdownSpace. These are
|
2012-09-06 00:17:57 +00:00
|
|
|
// reset to nscoord_MIN in AbsolutelyPositionDropDown when placing the
|
|
|
|
// dropdown at its actual position. The GetAvailableDropdownSpace call
|
|
|
|
// from nsListControlFrame::ReflowAsDropdown use the last position.
|
2015-02-08 15:31:14 +00:00
|
|
|
nscoord mLastDropDownBeforeScreenBCoord;
|
|
|
|
nscoord mLastDropDownAfterScreenBCoord;
|
2012-06-23 01:13:56 +00:00
|
|
|
// Current state of the dropdown list, true is dropped down.
|
|
|
|
bool mDroppedDown;
|
|
|
|
// See comment in HandleRedisplayTextEvent().
|
|
|
|
bool mInRedisplayText;
|
|
|
|
// Acting on ShowDropDown(true) is delayed until we're focused.
|
|
|
|
bool mDelayedShowDropDown;
|
|
|
|
|
2000-10-04 13:39:07 +00:00
|
|
|
// static class data member for Bug 32920
|
|
|
|
// only one control can be focused at a time
|
2012-06-23 01:13:56 +00:00
|
|
|
static nsComboboxControlFrame* sFocused;
|
2000-10-04 13:39:07 +00:00
|
|
|
|
2000-03-07 15:54:31 +00:00
|
|
|
#ifdef DO_REFLOW_COUNTER
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mReflowId;
|
2000-03-07 15:54:31 +00:00
|
|
|
#endif
|
1999-01-18 15:14:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|