diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index c2ce3dda58b..1de67bffc0b 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -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... diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index ef925ac4ab6..68086e00d6c 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -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