Bug 305160. Target viewport scroll events at the document, not the root element (they will bubble to the window from there). Always stop bubbling of scroll events out of an element. r+sr=jst
git-svn-id: svn://10.0.0.236/trunk@181748 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2144,11 +2144,6 @@ nsGenericElement::HandleDOMEvent(nsPresContext* aPresContext,
|
||||
aEventStatus);
|
||||
|
||||
aEvent->flags &= ~aFlags;
|
||||
|
||||
// We don't want scroll events to bubble further after it has been
|
||||
// handled at the local stage.
|
||||
if (aEvent->message == NS_SCROLL_EVENT && aFlags & NS_EVENT_FLAG_BUBBLE)
|
||||
aEvent->flags |= NS_EVENT_FLAG_CANT_BUBBLE;
|
||||
}
|
||||
|
||||
if (retarget) {
|
||||
@@ -2165,8 +2160,9 @@ nsGenericElement::HandleDOMEvent(nsPresContext* aPresContext,
|
||||
if (NS_EVENT_FLAG_BUBBLE & aFlags && IsInDoc() &&
|
||||
aEvent->message != NS_PAGE_LOAD && aEvent->message != NS_SCRIPT_LOAD &&
|
||||
aEvent->message != NS_IMAGE_ERROR && aEvent->message != NS_IMAGE_LOAD &&
|
||||
!(aEvent->message == NS_SCROLL_EVENT &&
|
||||
aEvent->flags & NS_EVENT_FLAG_CANT_BUBBLE)) {
|
||||
// scroll events fired at elements don't bubble (although scroll events
|
||||
// fired at documents do, to the window)
|
||||
aEvent->message != NS_SCROLL_EVENT) {
|
||||
if (parent) {
|
||||
// If there's a parent we pass the event to the parent...
|
||||
|
||||
|
||||
@@ -1824,13 +1824,23 @@ void
|
||||
nsGfxScrollFrameInner::FireScrollEvent()
|
||||
{
|
||||
mScrollEventQueue = nsnull;
|
||||
nsIPresShell *presShell = mOuter->GetPresContext()->GetPresShell();
|
||||
if (!presShell)
|
||||
return;
|
||||
|
||||
nsScrollbarEvent event(PR_TRUE, NS_SCROLL_EVENT, nsnull);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
presShell->HandleEventWithTarget(&event, mOuter, mOuter->GetContent(),
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
nsIContent* content = mOuter->GetContent();
|
||||
nsPresContext* prescontext = mOuter->GetPresContext();
|
||||
// Fire viewport scroll events at the document (where they
|
||||
// will bubble to the window)
|
||||
if (mIsRoot) {
|
||||
nsIDocument* doc = content->GetCurrentDoc();
|
||||
if (doc) {
|
||||
doc->HandleDOMEvent(prescontext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
} else {
|
||||
content->HandleDOMEvent(prescontext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user