зеркало из https://github.com/mozilla/gecko-dev.git
add OptionDisabled so the nsHTMLOptionElement can notify a select that an option
has just been disabled
This commit is contained in:
Родитель
4a8f41d458
Коммит
e61ef4520c
|
@ -1319,6 +1319,8 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
|
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
|
||||||
nsIScrollableFrame * scrollFrame;
|
nsIScrollableFrame * scrollFrame;
|
||||||
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
|
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
|
||||||
|
nsIFrame * incrementalChild;
|
||||||
|
aReflowState.reflowCommand->GetNext(incrementalChild);
|
||||||
nsRect rect;
|
nsRect rect;
|
||||||
plainLstFrame->GetRect(rect);
|
plainLstFrame->GetRect(rect);
|
||||||
nsresult rvv = plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
nsresult rvv = plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||||
|
@ -1979,6 +1981,20 @@ nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsComboboxControlFrame::OptionDisabled(nsIContent * aContent)
|
||||||
|
{
|
||||||
|
nsISelectControlFrame* listFrame = nsnull;
|
||||||
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
||||||
|
nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame),
|
||||||
|
(void**)&listFrame);
|
||||||
|
if (NS_SUCCEEDED(rv) && listFrame) {
|
||||||
|
rv = listFrame->OptionDisabled(aContent);
|
||||||
|
NS_RELEASE(listFrame);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
nsGUIEvent* aEvent,
|
nsGUIEvent* aEvent,
|
||||||
|
@ -2403,9 +2419,9 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
|
||||||
#endif
|
#endif
|
||||||
nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
|
nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
|
||||||
|
|
||||||
if (kGoodToGo) {
|
//if (kGoodToGo) {
|
||||||
return NS_OK;
|
// return NS_OK;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||||
if (mDisplayFrame) {
|
if (mDisplayFrame) {
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_rods
|
#ifdef DEBUG_rods
|
||||||
//#define DO_REFLOW_DEBUG
|
#define DO_REFLOW_DEBUG
|
||||||
//#define DO_REFLOW_COUNTER
|
#define DO_REFLOW_COUNTER
|
||||||
//#define DO_UNCONSTRAINED_CHECK
|
//#define DO_UNCONSTRAINED_CHECK
|
||||||
//#define DO_PIXELS
|
//#define DO_PIXELS
|
||||||
//#define DO_NEW_REFLOW
|
//#define DO_NEW_REFLOW
|
||||||
|
@ -170,6 +170,7 @@ public:
|
||||||
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
||||||
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent);
|
||||||
|
|
||||||
//nsIStatefulFrame
|
//nsIStatefulFrame
|
||||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
||||||
|
|
|
@ -66,6 +66,12 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification that an option has been disabled
|
||||||
|
*/
|
||||||
|
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2341,6 +2341,16 @@ nsListControlFrame::GetOptionsContainer(nsIPresContext* aPresContext, nsIFrame**
|
||||||
return FirstChild(aPresContext, nsnull, aFrame);
|
return FirstChild(aPresContext, nsnull, aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsListControlFrame::OptionDisabled(nsIContent * aContent)
|
||||||
|
{
|
||||||
|
if (IsContentSelected(aContent)) {
|
||||||
|
PRInt32 inx = GetSelectedIndexFromContent(aContent);
|
||||||
|
SetOptionSelected(inx, PR_FALSE);
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Send out an onchange notification.
|
// Send out an onchange notification.
|
||||||
nsresult
|
nsresult
|
||||||
nsListControlFrame::SelectionChanged(nsIContent* aContent)
|
nsListControlFrame::SelectionChanged(nsIContent* aContent)
|
||||||
|
|
|
@ -150,6 +150,7 @@ public:
|
||||||
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
||||||
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent);
|
||||||
|
|
||||||
//nsIStatefulFrame
|
//nsIStatefulFrame
|
||||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
||||||
|
|
|
@ -66,6 +66,12 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification that an option has been disabled
|
||||||
|
*/
|
||||||
|
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1319,6 +1319,8 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
|
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
|
||||||
nsIScrollableFrame * scrollFrame;
|
nsIScrollableFrame * scrollFrame;
|
||||||
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
|
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
|
||||||
|
nsIFrame * incrementalChild;
|
||||||
|
aReflowState.reflowCommand->GetNext(incrementalChild);
|
||||||
nsRect rect;
|
nsRect rect;
|
||||||
plainLstFrame->GetRect(rect);
|
plainLstFrame->GetRect(rect);
|
||||||
nsresult rvv = plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
nsresult rvv = plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||||
|
@ -1979,6 +1981,20 @@ nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsComboboxControlFrame::OptionDisabled(nsIContent * aContent)
|
||||||
|
{
|
||||||
|
nsISelectControlFrame* listFrame = nsnull;
|
||||||
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
||||||
|
nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame),
|
||||||
|
(void**)&listFrame);
|
||||||
|
if (NS_SUCCEEDED(rv) && listFrame) {
|
||||||
|
rv = listFrame->OptionDisabled(aContent);
|
||||||
|
NS_RELEASE(listFrame);
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
nsGUIEvent* aEvent,
|
nsGUIEvent* aEvent,
|
||||||
|
@ -2403,9 +2419,9 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
|
||||||
#endif
|
#endif
|
||||||
nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
|
nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
|
||||||
|
|
||||||
if (kGoodToGo) {
|
//if (kGoodToGo) {
|
||||||
return NS_OK;
|
// return NS_OK;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||||
if (mDisplayFrame) {
|
if (mDisplayFrame) {
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_rods
|
#ifdef DEBUG_rods
|
||||||
//#define DO_REFLOW_DEBUG
|
#define DO_REFLOW_DEBUG
|
||||||
//#define DO_REFLOW_COUNTER
|
#define DO_REFLOW_COUNTER
|
||||||
//#define DO_UNCONSTRAINED_CHECK
|
//#define DO_UNCONSTRAINED_CHECK
|
||||||
//#define DO_PIXELS
|
//#define DO_PIXELS
|
||||||
//#define DO_NEW_REFLOW
|
//#define DO_NEW_REFLOW
|
||||||
|
@ -170,6 +170,7 @@ public:
|
||||||
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
||||||
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent);
|
||||||
|
|
||||||
//nsIStatefulFrame
|
//nsIStatefulFrame
|
||||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
||||||
|
|
|
@ -356,6 +356,11 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
|
nsFrameState state;
|
||||||
|
GetFrameState(&state);
|
||||||
|
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||||
|
SetFrameState(state);
|
||||||
|
|
||||||
DO_GLOBAL_REFLOW_COUNT("nsGfxListControlFrame", aReflowState.reason);
|
DO_GLOBAL_REFLOW_COUNT("nsGfxListControlFrame", aReflowState.reason);
|
||||||
|
|
||||||
REFLOW_COUNTER_REQUEST();
|
REFLOW_COUNTER_REQUEST();
|
||||||
|
@ -2561,6 +2566,16 @@ nsGfxListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGfxListControlFrame::OptionDisabled(nsIContent * aContent)
|
||||||
|
{
|
||||||
|
if (IsContentSelected(aContent)) {
|
||||||
|
PRInt32 inx = GetSelectedIndexFromContent(aContent);
|
||||||
|
SetOptionSelected(inx, PR_FALSE);
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// End nsISelectControlFrame
|
// End nsISelectControlFrame
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -3154,7 +3169,23 @@ nsGfxListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
} else {
|
} else {
|
||||||
nsIFrame * parentFrame;
|
nsIFrame * parentFrame;
|
||||||
frame->GetParent(&parentFrame);
|
frame->GetParent(&parentFrame);
|
||||||
stateManager->GetEventTarget(&frame);
|
#if 0
|
||||||
|
nsCOMPtr<nsIScrollableFrame> scrollable(do_QueryInterface(parentFrame));
|
||||||
|
if (scrollable) {
|
||||||
|
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nsIFrame * parentsParentFrame;
|
||||||
|
frame->GetParent(&parentsParentFrame);
|
||||||
|
nsCOMPtr<nsIScrollableFrame> parentScrollable(do_QueryInterface(parentsParentFrame));
|
||||||
|
if (parentScrollable) {
|
||||||
|
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//stateManager->GetEventTarget(&frame);
|
||||||
|
#endif
|
||||||
listFrame = do_QueryInterface(frame);
|
listFrame = do_QueryInterface(frame);
|
||||||
if (listFrame) {
|
if (listFrame) {
|
||||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_rods
|
#ifdef DEBUG_rods
|
||||||
#define DO_REFLOW_DEBUG
|
//#define DO_REFLOW_DEBUG
|
||||||
#define DO_REFLOW_COUNTER
|
//#define DO_REFLOW_COUNTER
|
||||||
//#define DO_UNCONSTRAINED_CHECK
|
//#define DO_UNCONSTRAINED_CHECK
|
||||||
//#define DO_PIXELS
|
//#define DO_PIXELS
|
||||||
#define DO_DRAGGING
|
#define DO_DRAGGING
|
||||||
|
@ -249,6 +249,7 @@ public:
|
||||||
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
||||||
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent);
|
||||||
|
|
||||||
//nsIStatefulFrame
|
//nsIStatefulFrame
|
||||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
||||||
|
|
|
@ -2341,6 +2341,16 @@ nsListControlFrame::GetOptionsContainer(nsIPresContext* aPresContext, nsIFrame**
|
||||||
return FirstChild(aPresContext, nsnull, aFrame);
|
return FirstChild(aPresContext, nsnull, aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsListControlFrame::OptionDisabled(nsIContent * aContent)
|
||||||
|
{
|
||||||
|
if (IsContentSelected(aContent)) {
|
||||||
|
PRInt32 inx = GetSelectedIndexFromContent(aContent);
|
||||||
|
SetOptionSelected(inx, PR_FALSE);
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Send out an onchange notification.
|
// Send out an onchange notification.
|
||||||
nsresult
|
nsresult
|
||||||
nsListControlFrame::SelectionChanged(nsIContent* aContent)
|
nsListControlFrame::SelectionChanged(nsIContent* aContent)
|
||||||
|
|
|
@ -150,6 +150,7 @@ public:
|
||||||
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
|
||||||
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
||||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
|
||||||
|
NS_IMETHOD OptionDisabled(nsIContent * aContent);
|
||||||
|
|
||||||
//nsIStatefulFrame
|
//nsIStatefulFrame
|
||||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче