mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Fix for bug 89528 and 89450. r=cls, sr=waterson
This commit is contained in:
parent
da57450dfd
commit
1f9d8e17d1
@ -39,6 +39,7 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsString.h"
|
||||
@ -55,7 +56,7 @@
|
||||
// Header for this class
|
||||
#include "nsAccessProxy.h"
|
||||
|
||||
#define NS_DEBUG_ACCESS_BUILTIN 1
|
||||
// #define NS_DEBUG_ACCESS_BUILTIN 1
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -72,6 +73,7 @@ nsAccessProxy::nsAccessProxy()
|
||||
|
||||
nsAccessProxy::~nsAccessProxy()
|
||||
{
|
||||
printf("%s","\n\n\n\nBYE BYE BYE BYE \n\n\n\n");
|
||||
}
|
||||
|
||||
nsAccessProxy *nsAccessProxy::GetInstance()
|
||||
@ -89,11 +91,10 @@ nsAccessProxy *nsAccessProxy::GetInstance()
|
||||
void nsAccessProxy::ReleaseInstance()
|
||||
{
|
||||
NS_IF_RELEASE(nsAccessProxy::mInstance);
|
||||
//return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsAccessProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
NS_IMETHODIMP nsAccessProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -126,9 +127,10 @@ nsresult nsAccessProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
domNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if (domDoc) {
|
||||
doc = do_QueryInterface(domDoc);
|
||||
if (doc && doc->GetNumberOfShells()>0)
|
||||
if (doc && doc->GetNumberOfShells()>0) {
|
||||
doc->GetShellAt(0, getter_AddRefs(presShell));
|
||||
}
|
||||
}
|
||||
//return NS_OK;
|
||||
/*
|
||||
if (presShell && eventNameStr.EqualsWithConversion("click")) {
|
||||
@ -203,8 +205,18 @@ NS_IMETHODIMP nsAccessProxy::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
*
|
||||
*/
|
||||
|
||||
nsresult rv;
|
||||
if ((aStateFlags & (STATE_STOP|STATE_START)) && (aStateFlags & STATE_IS_DOCUMENT)) {
|
||||
// Test for built in text to speech or braille display usage preference
|
||||
// If so, attach event handlers to window. If not, don't.
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
|
||||
nsXPIDLCString textToSpeechEngine, brailleDisplayEngine;
|
||||
if (prefs) {
|
||||
prefs->CopyCharPref("accessibility.usetexttospeech", getter_Copies(textToSpeechEngine));
|
||||
prefs->CopyCharPref("accessibility.usebrailledisplay", getter_Copies(brailleDisplayEngine));
|
||||
}
|
||||
|
||||
if ((textToSpeechEngine && *textToSpeechEngine) || (brailleDisplayEngine && *brailleDisplayEngine)) {
|
||||
// Yes, prefs say we will need handlers for this
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
|
||||
|
||||
@ -223,6 +235,7 @@ NS_IMETHODIMP nsAccessProxy::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
//NS_DECL_NSIACCESSPROXY
|
||||
virtual nsresult HandleEvent(nsIDOMEvent *event); // This compiles on Windows
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent *event);
|
||||
|
||||
static nsAccessProxy *GetInstance();
|
||||
static void ReleaseInstance(void);
|
||||
|
@ -29,9 +29,9 @@
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsAccessProxy.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIAppShellComponent.h"
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "prprf.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
@ -38,7 +38,8 @@
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#define NS_ACCESSPROXY_CID \
|
||||
{ 0x7cb5b7a0, 0x7d7, 0x11d3, { 0xbd, 0xe2, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
{ 0x28c13ee3, 0xca0c, 0x4395, { 0xbe, 0x98, 0xd1, 0x26, 0xea, 0xd3, 0xb9, 0x41 } };
|
||||
|
||||
|
||||
#define NS_ACCESSPROXY_CONTRACTID NS_IAPPSHELLCOMPONENT_CONTRACTID "/accessproxy;1"
|
||||
%}
|
||||
|
Loading…
Reference in New Issue
Block a user