From ca2893dfc20f978ac7f36510c630faad3ef03a30 Mon Sep 17 00:00:00 2001 From: "bryner%uiuc.edu" Date: Sun, 6 Aug 2000 04:15:02 +0000 Subject: [PATCH] Fixing bug 42294 - make mousewheel font size change always affect the document (not the chrome). r=saari. --- content/events/src/nsEventStateManager.cpp | 28 +++++++++++++++++++++- layout/events/src/nsEventStateManager.cpp | 28 +++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 04696bf9e306..ef49d2d84ac4 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -767,8 +767,34 @@ nsEventStateManager :: GenerateDragGesture ( nsIPresContext* aPresContext, nsGUI nsresult nsEventStateManager::ChangeTextSize(PRInt32 change) { + nsCOMPtr ourGlobal; + gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(ourGlobal)); + nsCOMPtr rootWindow; + nsCOMPtr ourWindow = do_QueryInterface(ourGlobal); + NS_ENSURE_TRUE(ourWindow, NS_ERROR_FAILURE); + + ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow)); + NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE); + + nsCOMPtr windowContent; + rootWindow->Get_content(getter_AddRefs(windowContent)); + NS_ENSURE_TRUE(windowContent, NS_ERROR_FAILURE); + + nsCOMPtr domDoc; + windowContent->GetDocument(getter_AddRefs(domDoc)); + NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE); + + nsCOMPtr doc = do_QueryInterface(domDoc); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + + nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); + nsCOMPtr presContext; + presShell->GetPresContext(getter_AddRefs(presContext)); + NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE); + nsCOMPtr pcContainer; - mPresContext->GetContainer(getter_AddRefs(pcContainer)); + presContext->GetContainer(getter_AddRefs(pcContainer)); NS_ENSURE_TRUE(pcContainer, NS_ERROR_FAILURE); nsCOMPtr docshell(do_QueryInterface(pcContainer)); diff --git a/layout/events/src/nsEventStateManager.cpp b/layout/events/src/nsEventStateManager.cpp index 04696bf9e306..ef49d2d84ac4 100644 --- a/layout/events/src/nsEventStateManager.cpp +++ b/layout/events/src/nsEventStateManager.cpp @@ -767,8 +767,34 @@ nsEventStateManager :: GenerateDragGesture ( nsIPresContext* aPresContext, nsGUI nsresult nsEventStateManager::ChangeTextSize(PRInt32 change) { + nsCOMPtr ourGlobal; + gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(ourGlobal)); + nsCOMPtr rootWindow; + nsCOMPtr ourWindow = do_QueryInterface(ourGlobal); + NS_ENSURE_TRUE(ourWindow, NS_ERROR_FAILURE); + + ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow)); + NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE); + + nsCOMPtr windowContent; + rootWindow->Get_content(getter_AddRefs(windowContent)); + NS_ENSURE_TRUE(windowContent, NS_ERROR_FAILURE); + + nsCOMPtr domDoc; + windowContent->GetDocument(getter_AddRefs(domDoc)); + NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE); + + nsCOMPtr doc = do_QueryInterface(domDoc); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + + nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); + nsCOMPtr presContext; + presShell->GetPresContext(getter_AddRefs(presContext)); + NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE); + nsCOMPtr pcContainer; - mPresContext->GetContainer(getter_AddRefs(pcContainer)); + presContext->GetContainer(getter_AddRefs(pcContainer)); NS_ENSURE_TRUE(pcContainer, NS_ERROR_FAILURE); nsCOMPtr docshell(do_QueryInterface(pcContainer));