Fix for bug 157845: mCurrentTarget pointer should not be set in the ESM without setting the NS_FRAME_EXTERNAL_REFERENCE bit. r:saari, sr:jst, a:chofmann

This commit is contained in:
joki%netscape.com 2002-07-22 21:36:36 +00:00
parent 4b473c3708
commit 6be78dee05

View File

@ -3002,6 +3002,16 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
printf("focusing next focusable content: %p\n", nextFocus.get());
#endif
presShell->GetPrimaryFrameFor(nextFocus, &mCurrentTarget);
//This may be new frame that hasn't been through the ESM so we
//must set its NS_FRAME_EXTERNAL_REFERENCE bit.
if (mCurrentTarget) {
nsFrameState state;
mCurrentTarget->GetFrameState(&state);
state |= NS_FRAME_EXTERNAL_REFERENCE;
mCurrentTarget->SetFrameState(state);
}
ChangeFocus(nextFocus, eEventFocusedByKey);
NS_IF_RELEASE(mCurrentFocus);
@ -3471,6 +3481,15 @@ nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
nsresult rv = mPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell){
shell->GetPrimaryFrameFor(mCurrentTargetContent, &mCurrentTarget);
//This may be new frame that hasn't been through the ESM so we
//must set its NS_FRAME_EXTERNAL_REFERENCE bit.
if (mCurrentTarget) {
nsFrameState state;
mCurrentTarget->GetFrameState(&state);
state |= NS_FRAME_EXTERNAL_REFERENCE;
mCurrentTarget->SetFrameState(state);
}
}
}
}
@ -3480,6 +3499,15 @@ nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
presShell->GetEventTargetFrame(&mCurrentTarget);
//This may be new frame that hasn't been through the ESM so we
//must set its NS_FRAME_EXTERNAL_REFERENCE bit.
if (mCurrentTarget) {
nsFrameState state;
mCurrentTarget->GetFrameState(&state);
state |= NS_FRAME_EXTERNAL_REFERENCE;
mCurrentTarget->SetFrameState(state);
}
}
}
@ -3509,6 +3537,15 @@ nsEventStateManager::GetEventTargetContent(nsEvent* aEvent, nsIContent** aConten
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
presShell->GetEventTargetFrame(&mCurrentTarget);
//This may be new frame that hasn't been through the ESM so we
//must set its NS_FRAME_EXTERNAL_REFERENCE bit.
if (mCurrentTarget) {
nsFrameState state;
mCurrentTarget->GetFrameState(&state);
state |= NS_FRAME_EXTERNAL_REFERENCE;
mCurrentTarget->SetFrameState(state);
}
}
}