Bug 727940 - Windows app can't read Firefox setting for hardware acceleration (D2D), r=marcoz, tbsaunde

This commit is contained in:
Alexander Surkov 2012-03-03 21:09:46 +09:00
parent 614603a7a2
commit e08f8dd3b6
3 changed files with 39 additions and 0 deletions

View File

@ -42,6 +42,8 @@
#include "AccessibleApplication_i.c"
#include "nsIGfxInfo.h"
#include "nsIPersistentProperties2.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
@ -49,6 +51,31 @@
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessibleWrap,
nsApplicationAccessible)
NS_IMETHODIMP
nsApplicationAccessibleWrap::GetAttributes(nsIPersistentProperties** aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
*aAttributes = nsnull;
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
NS_ENSURE_STATE(attributes);
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
bool isD2DEnabled = false;
gfxInfo->GetD2DEnabled(&isD2DEnabled);
nsAutoString unused;
attributes->SetStringProperty(
NS_LITERAL_CSTRING("D2D"),
isD2DEnabled ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"),
unused);
}
attributes.swap(*aAttributes);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// IUnknown

View File

@ -52,6 +52,9 @@ public:
// nsISupporst
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetAttributes(nsIPersistentProperties** aAttributes);
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);

View File

@ -96,6 +96,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAttrs("th2", { "abbr": "SS#" }, true);
testAttrs("th2", { "axis": "social" }, true);
// application accessible
if (WIN) {
var gfxInfo = Components.classes["@mozilla.org/gfx/info;1"].
getService(Components.interfaces.nsIGfxInfo);
var attrs = {
"D2D": (gfxInfo.D2DEnabled ? "true" : "false")
}
testAttrs(getApplicationAccessible(), attrs, false);
}
SimpleTest.finish();
}