mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 14:15:30 +00:00
Fix for NT4 build hang
-r aaron
This commit is contained in:
parent
9760cb41ba
commit
ab6e318a64
@ -56,7 +56,7 @@ WIN_LIBS= \
|
||||
Uuid.lib \
|
||||
ole32.lib \
|
||||
shell32.lib \
|
||||
oleacc.lib \
|
||||
# oleacc.lib \
|
||||
oleaut32.lib
|
||||
|
||||
LLIBS= \
|
||||
|
@ -116,10 +116,58 @@ STDMETHODIMP_(ULONG) Accessible::Release()
|
||||
return 0;
|
||||
}
|
||||
|
||||
HINSTANCE Accessible::gmAccLib = 0;
|
||||
LPFNACCESSIBLEOBJECTFROMWINDOW Accessible::gmAccessibleObjectFromWindow = 0;
|
||||
LPFNLRESULTFROMOBJECT Accessible::gmLresultFromObject = 0;
|
||||
|
||||
//-----------------------------------------------------
|
||||
// IAccessible methods
|
||||
//-----------------------------------------------------
|
||||
|
||||
STDMETHODIMP Accessible::AccessibleObjectFromWindow(
|
||||
HWND hwnd,
|
||||
DWORD dwObjectID,
|
||||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
|
||||
// open the dll dynamically
|
||||
if (!gmAccLib)
|
||||
gmAccLib =::LoadLibrary("OLEACC.DLL");
|
||||
|
||||
if (gmAccLib) {
|
||||
if (!gmAccessibleObjectFromWindow)
|
||||
gmAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(gmAccLib,"AccessibleObjectFromWindow");
|
||||
|
||||
return gmAccessibleObjectFromWindow(hwnd, dwObjectID, riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
STDMETHODIMP_(LRESULT) Accessible::LresultFromObject(
|
||||
REFIID riid,
|
||||
WPARAM wParam,
|
||||
LPUNKNOWN pAcc)
|
||||
{
|
||||
// open the dll dynamically
|
||||
if (!gmAccLib)
|
||||
gmAccLib =::LoadLibrary("OLEACC.DLL");
|
||||
|
||||
if (gmAccLib) {
|
||||
if (!gmAccessibleObjectFromWindow)
|
||||
gmLresultFromObject = (LPFNLRESULTFROMOBJECT)GetProcAddress(gmAccLib,"LresultFromObject");
|
||||
|
||||
return gmLresultFromObject(riid,wParam,pAcc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP Accessible::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent(nsnull);
|
||||
@ -138,12 +186,13 @@ STDMETHODIMP Accessible::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispPa
|
||||
if (pWnd) {
|
||||
// get the accessible.
|
||||
void* ptr = nsnull;
|
||||
AccessibleObjectFromWindow(pWnd, OBJID_WINDOW, IID_IAccessible, &ptr);
|
||||
IAccessible* a = (IAccessible*)ptr;
|
||||
// got one? return it.
|
||||
if (a) {
|
||||
*ppdispParent = a;
|
||||
return NS_OK;
|
||||
if (AccessibleObjectFromWindow(pWnd, OBJID_WINDOW, IID_IAccessible, &ptr) != S_FALSE) {
|
||||
IAccessible* a = (IAccessible*)ptr;
|
||||
// got one? return it.
|
||||
if (a) {
|
||||
*ppdispParent = a;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,13 @@ class Accessible : public IAccessible
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
||||
|
||||
|
||||
// NT4 does not have the oleacc that defines these methods. So we define copies here that automatically
|
||||
// load the library only if needed.
|
||||
static STDMETHODIMP AccessibleObjectFromWindow(HWND hwnd,DWORD dwObjectID,REFIID riid,void **ppvObject);
|
||||
static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid,WPARAM wParam,LPUNKNOWN pAcc);
|
||||
|
||||
static ULONG g_cRef; // the cum reference count of all instances
|
||||
|
||||
static ULONG g_cRef; // the cum reference count of all instances
|
||||
ULONG m_cRef; // the reference count
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
nsCOMPtr<nsIAccessible> mCachedChild;
|
||||
@ -165,6 +170,12 @@ class Accessible : public IAccessible
|
||||
PRBool InState(const nsString& aStates, const char* aState);
|
||||
STDMETHODIMP GetAttribute(const char* aName, VARIANT varChild, BSTR __RPC_FAR *aString);
|
||||
|
||||
private:
|
||||
/// the accessible library and cached methods
|
||||
static HINSTANCE gmAccLib;
|
||||
static LPFNACCESSIBLEOBJECTFROMWINDOW gmAccessibleObjectFromWindow;
|
||||
static LPFNLRESULTFROMOBJECT gmLresultFromObject;
|
||||
|
||||
};
|
||||
|
||||
class nsAccessibleEventMap
|
||||
|
@ -3379,7 +3379,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||
mRootAccessible = new RootAccessible(acc, wnd); // ref is 0
|
||||
mRootAccessible->AddRef();
|
||||
}
|
||||
LRESULT lAcc = LresultFromObject(IID_IAccessible, wParam, mRootAccessible); // ref 1
|
||||
// ask accessible to do this do it loads the library dynamically
|
||||
LRESULT lAcc = Accessible::LresultFromObject(IID_IAccessible, wParam, mRootAccessible); // ref 1
|
||||
if (lAcc == 0) {
|
||||
*aRetValue = NULL;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
*aRetValue = lAcc;
|
||||
return PR_TRUE; // yes we handled it.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user