Fix bug 289022: every other click in a text field unfocusses it, so you can't type. Fixed by retargeting keyboard events to a parent view, if their target view has no frame. r=roc, sr=dbaron, a=dbaron.

This commit is contained in:
smfr%smfr.org 2005-04-13 04:35:13 +00:00
parent 5a9624f05e
commit ae9618de13

View File

@ -53,6 +53,7 @@
*/
#define PL_ARENA_CONST_ALIGN_MASK 3
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIContent.h"
@ -5977,6 +5978,22 @@ PresShell::HandleEvent(nsIView *aView,
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
// if this event has no frame, we need to retarget it at a parent
// view that has a frame.
if (!frame &&
((NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent)))) {
nsIView* targetView = aView;
while (targetView && !targetView->GetClientData()) {
targetView = targetView->GetParent();
}
if (targetView) {
aEvent->point += aView->GetOffsetTo(targetView);
aView = targetView;
frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
}
}
nsresult rv = NS_OK;
if (frame) {