зеркало из https://github.com/mozilla/gecko-dev.git
Fix multiple event targetting bugs (23161, 10514, 13213, 16548, 19496, 12231) and reinstate the onchange event for text fields (bug 22472). r:rods
This commit is contained in:
Родитель
a20a8e867b
Коммит
a6880e49d9
|
@ -5984,7 +5984,15 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
nsresult rv;
|
||||
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5994,12 +6002,6 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -5984,7 +5984,15 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
nsresult rv;
|
||||
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5994,12 +6002,6 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -5984,7 +5984,15 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
nsresult rv;
|
||||
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5994,12 +6002,6 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -269,18 +269,13 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && *aFrame) {
|
||||
// We found the target frame somewhere in the child frame.
|
||||
childFrame = *aFrame;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// We didn't find the target frame in any of the children,
|
||||
// but save the fact that this kid contains the point.
|
||||
childFrame = kid;
|
||||
}
|
||||
|
||||
// We need to break out of this loop and look elsewhere so that
|
||||
// situations where overlap occurs (e.g. floaters overlapping
|
||||
// the background of a block element) find the floater.
|
||||
|
||||
break;
|
||||
}
|
||||
kid->GetNextSibling(&kid);
|
||||
}
|
||||
|
|
|
@ -5984,7 +5984,15 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
nsresult rv;
|
||||
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5994,12 +6002,6 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -5984,7 +5984,15 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
nsresult rv;
|
||||
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5994,12 +6002,6 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -5984,7 +5984,15 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
const nsPoint& aPoint,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
nsresult rv;
|
||||
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5994,12 +6002,6 @@ nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (mFloaters.NotEmpty()) {
|
||||
rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -269,18 +269,13 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && *aFrame) {
|
||||
// We found the target frame somewhere in the child frame.
|
||||
childFrame = *aFrame;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// We didn't find the target frame in any of the children,
|
||||
// but save the fact that this kid contains the point.
|
||||
childFrame = kid;
|
||||
}
|
||||
|
||||
// We need to break out of this loop and look elsewhere so that
|
||||
// situations where overlap occurs (e.g. floaters overlapping
|
||||
// the background of a block element) find the floater.
|
||||
|
||||
break;
|
||||
}
|
||||
kid->GetNextSibling(&kid);
|
||||
}
|
||||
|
|
|
@ -3731,6 +3731,14 @@ nsEnderEventListener::MouseOut(nsIDOMEvent* aEvent)
|
|||
nsresult
|
||||
nsEnderEventListener::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
//Need to set text value for onchange
|
||||
nsGfxTextControlFrame *gfxFrame = mFrame.Reference();
|
||||
|
||||
if (gfxFrame && mContent && mView) {
|
||||
mTextValue = "";
|
||||
gfxFrame->GetText(&mTextValue, PR_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
// In this case, the focus has all ready been set because of the mouse down
|
||||
// and setting it on the native widget causes an event to be dispatched
|
||||
|
@ -3802,7 +3810,7 @@ nsEnderEventListener::Focus(nsIDOMEvent* aEvent)
|
|||
nsresult
|
||||
nsEnderEventListener::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
/*
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent>uiEvent;
|
||||
uiEvent = do_QueryInterface(aEvent);
|
||||
if (!uiEvent) {
|
||||
|
@ -3811,16 +3819,14 @@ nsEnderEventListener::Blur(nsIDOMEvent* aEvent)
|
|||
|
||||
nsGfxTextControlFrame *gfxFrame = mFrame.Reference();
|
||||
|
||||
if (gfxFrame && mContent && mView)
|
||||
{
|
||||
if (gfxFrame && mContent && mView) {
|
||||
nsString currentValue;
|
||||
gfxFrame->GetText(¤tValue, PR_FALSE);
|
||||
if (PR_FALSE==currentValue.Equals(mTextValue))
|
||||
{
|
||||
if (PR_FALSE==currentValue.Equals(mTextValue)) {
|
||||
// Dispatch the change event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsGUIEvent event;
|
||||
event.eventStructType = NS_GUI_EVENT;
|
||||
nsInputEvent event;
|
||||
event.eventStructType = NS_INPUT_EVENT;
|
||||
event.widget = nsnull;
|
||||
event.message = NS_FORM_CHANGE;
|
||||
event.flags = NS_EVENT_FLAG_INIT;
|
||||
|
@ -3832,7 +3838,8 @@ nsEnderEventListener::Blur(nsIDOMEvent* aEvent)
|
|||
// Have the content handle the event.
|
||||
mContent->HandleDOMEvent(mContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
// XXX No longer dispatching event
|
||||
// this notification has already taken place
|
||||
// this causes two blur notifcations to be sent
|
||||
|
|
Загрузка…
Ссылка в новой задаче