diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 9df195890380..7239ec1d6924 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -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; } diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 9df195890380..7239ec1d6924 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -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; } diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index 9df195890380..7239ec1d6924 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -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; } diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index fdd097de3aaa..1520cfd7ae96 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -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); } diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 9df195890380..7239ec1d6924 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -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; } diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index 9df195890380..7239ec1d6924 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -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; } diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index 9df195890380..7239ec1d6924 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -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; } diff --git a/layout/html/base/src/nsContainerFrame.cpp b/layout/html/base/src/nsContainerFrame.cpp index fdd097de3aaa..1520cfd7ae96 100644 --- a/layout/html/base/src/nsContainerFrame.cpp +++ b/layout/html/base/src/nsContainerFrame.cpp @@ -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); } diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index 6ed2bd19c5b1..d2dada46a409 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -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) { -/* + nsCOMPtruiEvent; 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