Bug 258006 Mouse-wheel scroll events does not propagate to viewport from fixed pos. elements r+sr=roc

This commit is contained in:
masayuki%d-toybox.com 2006-02-01 19:55:35 +00:00
Родитель 958c7f9c7f
Коммит 3deabd1ae2
3 изменённых файлов: 37 добавлений и 20 удалений

Просмотреть файл

@ -1644,6 +1644,18 @@ ShouldScrollRootView(nsPresContext* aPresContext)
return (aPresContext->Type() == nsPresContext::eContext_PrintPreview);
}
static nsIFrame*
GetParentFrameToScroll(nsPresContext* aPresContext, nsIFrame* aFrame)
{
if (!aPresContext || !aFrame)
return nsnull;
if (aFrame->GetStyleDisplay()->mPosition == NS_STYLE_POSITION_FIXED)
return aPresContext->GetPresShell()->GetRootScrollFrame();
return aFrame->GetParent();
}
nsresult
nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
nsIFrame* aTargetFrame,
@ -1750,7 +1762,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
nsIFrame* scrollFrame = aTargetFrame;
PRBool passToParent = !scrollRootView;
for( ; scrollFrame && passToParent; scrollFrame = scrollFrame->GetParent()) {
for (; scrollFrame && passToParent;
scrollFrame = GetParentFrameToScroll(aPresContext, scrollFrame)) {
// Check whether the frame wants to provide us with a scrollable view.
scrollView = nsnull;
nsCOMPtr<nsIScrollableViewProvider> svp = do_QueryInterface(scrollFrame);

Просмотреть файл

@ -93,8 +93,8 @@ class nsCSSFrameConstructor;
class nsISelection;
#define NS_IPRESSHELL_IID \
{ 0x775a6c25, 0x326f, 0x4a99, \
{ 0xbb, 0x9d, 0x65, 0xdf, 0x15, 0xb3, 0x06, 0xa3 } }
{ 0xcd6d6c1d, 0x4180, 0x432a, \
{ 0x83, 0xbb, 0x1f, 0xc6, 0x50, 0xd2, 0x11, 0xa7 } }
// Constants uses for ScrollFrameIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -291,6 +291,11 @@ public:
*/
virtual NS_HIDDEN_(nsIFrame*) GetRootFrame() const;
/*
* Get root scroll frame from FrameManager()->GetRootFrame().
*/
nsIFrame* GetRootScrollFrame() const;
/**
* Returns the page sequence frame associated with the frame hierarchy.
* Returns NULL if not a paginated view.

Просмотреть файл

@ -2658,19 +2658,6 @@ static void CheckForFocus(nsPIDOMWindow* aOurWindow,
aFocusController->SetFocusedWindow(ourWin);
}
static nsIFrame*
GetRootScrollFrame(nsIFrame* aRootFrame) {
// Ensure root frame is a viewport frame
if (aRootFrame && nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) {
nsIFrame* theFrame = aRootFrame->GetFirstChild(nsnull);
if (theFrame && nsLayoutAtoms::scrollFrame == theFrame->GetType()) {
return theFrame;
}
}
return nsnull;
}
NS_IMETHODIMP
PresShell::GetDidInitialReflow(PRBool *aDidInitialReflow)
{
@ -3409,6 +3396,19 @@ nsIPresShell::GetRootFrame() const
return FrameManager()->GetRootFrame();
}
nsIFrame*
nsIPresShell::GetRootScrollFrame() const
{
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
// Ensure root frame is a viewport frame
if (!rootFrame || nsLayoutAtoms::viewportFrame != rootFrame->GetType())
return nsnull;
nsIFrame* theFrame = rootFrame->GetFirstChild(nsnull);
if (!theFrame || nsLayoutAtoms::scrollFrame != theFrame->GetType())
return nsnull;
return theFrame;
}
NS_IMETHODIMP
PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
{
@ -3469,7 +3469,6 @@ PresShell::EndLoad(nsIDocument *aDocument)
{
// Restore frame state for the root scroll frame
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
nsCOMPtr<nsILayoutHistoryState> historyState =
aDocument->GetLayoutHistoryState();
// Make sure we don't reenter reflow via the sync paint that happens while
@ -3478,8 +3477,8 @@ PresShell::EndLoad(nsIDocument *aDocument)
// it'll get all confused.
++mChangeNestCount;
if (rootFrame && historyState) {
nsIFrame* scrollFrame = GetRootScrollFrame(rootFrame);
if (historyState) {
nsIFrame* scrollFrame = GetRootScrollFrame();
if (scrollFrame) {
nsIScrollableFrame* scrollableFrame;
CallQueryInterface(scrollFrame, &scrollableFrame);
@ -4545,7 +4544,7 @@ PresShell::CaptureHistoryState(nsILayoutHistoryState** aState, PRBool aLeavingPa
// As the scroll position is 0 and this will cause us to loose
// our previously saved place!
if (aLeavingPage) {
nsIFrame* scrollFrame = GetRootScrollFrame(rootFrame);
nsIFrame* scrollFrame = GetRootScrollFrame();
if (scrollFrame) {
FrameManager()->CaptureFrameStateFor(scrollFrame, historyState,
nsIStatefulFrame::eDocumentScrollState);