зеркало из https://github.com/mozilla/pjs.git
Bug 298648. Implement ISimpleDOMNode::get_language. r=timeless, sr=roc, a=bsmedberg
This commit is contained in:
Родитель
20bcfac0d4
Коммит
b408688e52
|
@ -121,6 +121,12 @@ cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
|
|||
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
|
||||
cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer")
|
||||
cpp_quote("//")
|
||||
cpp_quote("//")
|
||||
cpp_quote("// get_language(/* [out] */ BSTR *htmlText);")
|
||||
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
|
||||
cpp_quote("// Returns the computed language for this node, or empty string if unknown.")
|
||||
cpp_quote("//")
|
||||
cpp_quote("//")
|
||||
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
|
||||
cpp_quote("")
|
||||
cpp_quote("")
|
||||
|
@ -133,8 +139,9 @@ const long DISPID_NODE_ATTRIBUTES = -5901;
|
|||
const long DISPID_NODE_ATTRIBUTESFORNAMES = -5902;
|
||||
const long DISPID_NODE_COMPSTYLE = -5903;
|
||||
const long DISPID_NODE_COMPSTYLEFORPROPS = -5904;
|
||||
const long DISPID_NODE_LANGUAGE = -5905;
|
||||
|
||||
[object, uuid(261f5f21-c4ff-4d45-b4d9-ea7b59cc30f6)]
|
||||
[object, uuid(1814ceeb-49e2-407f-af99-fa755a7d2607)]
|
||||
interface ISimpleDOMNode : IUnknown
|
||||
{
|
||||
const unsigned short NODETYPE_ELEMENT = 1;
|
||||
|
@ -202,6 +209,8 @@ interface ISimpleDOMNode : IUnknown
|
|||
[propget] HRESULT innerHTML([out, retval] BSTR *innerHTML);
|
||||
|
||||
[propget, local] HRESULT localInterface([out][retval] void **localInterface);
|
||||
|
||||
[propget, id(DISPID_NODE_LANGUAGE)] HRESULT language([out, retval] BSTR *language);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ ACCESSIBILITY_ATOM(disabled, "disabled")
|
|||
ACCESSIBILITY_ATOM(_for, "for")
|
||||
ACCESSIBILITY_ATOM(href, "href")
|
||||
ACCESSIBILITY_ATOM(id, "id")
|
||||
ACCESSIBILITY_ATOM(lang, "lang")
|
||||
ACCESSIBILITY_ATOM(multiline, "multiline")
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
ACCESSIBILITY_ATOM(readonly, "readonly")
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "nsAccessNodeWrap.h"
|
||||
#include "ISimpleDOMNode_i.c"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -515,6 +516,27 @@ nsAccessNodeWrap::get_innerHTML(BSTR __RPC_FAR *aInnerHTML)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessNodeWrap::get_language(BSTR __RPC_FAR *aLanguage)
|
||||
{
|
||||
*aLanguage = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsAutoString language;
|
||||
for (nsIContent *walkUp = content; walkUp = walkUp->GetParent(); walkUp) {
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
walkUp->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::lang, language)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*aLanguage = ::SysAllocString(language.get());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessNodeWrap::get_localInterface(
|
||||
/* [out] */ void __RPC_FAR *__RPC_FAR *localInterface)
|
||||
|
|
|
@ -120,6 +120,9 @@ class nsAccessNodeWrap : public nsAccessNode, public ISimpleDOMNode
|
|||
virtual /* [local][propget] */ HRESULT STDMETHODCALLTYPE get_localInterface(
|
||||
/* [retval][out] */ void __RPC_FAR *__RPC_FAR *localInterface);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_language(
|
||||
/* [out][retval] */ BSTR __RPC_FAR *language);
|
||||
|
||||
static void InitAccessibility();
|
||||
static void ShutdownAccessibility();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче