зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1148083 - IPC Proxy for Document, r=davidb
--HG-- extra : rebase_source : a76972872a0ec398d2aba30a8c7051ef1de29dd4
This commit is contained in:
Родитель
f67f482c15
Коммит
4aa193a6b8
|
@ -10,6 +10,7 @@
|
|||
#include "AccessibleWrap.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "nsMai.h"
|
||||
#include "ProxyAccessible.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
@ -46,12 +47,14 @@ documentInterfaceInitCB(AtkDocumentIface *aIface)
|
|||
const gchar *
|
||||
getDocumentLocaleCB(AtkDocument *aDocument)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsAutoString locale;
|
||||
accWrap->Language(locale);
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
|
||||
if (accWrap) {
|
||||
accWrap->Language(locale);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aDocument))) {
|
||||
proxy->Language(locale);
|
||||
}
|
||||
|
||||
return locale.IsEmpty() ? nullptr : AccessibleWrap::ReturnString(locale);
|
||||
}
|
||||
|
||||
|
@ -71,24 +74,30 @@ prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue
|
|||
AtkAttributeSet *
|
||||
getDocumentAttributesCB(AtkDocument *aDocument)
|
||||
{
|
||||
nsAutoString url;
|
||||
nsAutoString w3cDocType;
|
||||
nsAutoString mimeType;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
|
||||
if (!accWrap || !accWrap->IsDoc())
|
||||
if (accWrap) {
|
||||
if (!accWrap->IsDoc()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DocAccessible* document = accWrap->AsDoc();
|
||||
document->URL(url);
|
||||
document->DocType(w3cDocType);
|
||||
document->MimeType(mimeType);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aDocument))) {
|
||||
proxy->URLDocTypeMimeType(url, w3cDocType, mimeType);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// according to atkobject.h, AtkAttributeSet is a GSList
|
||||
GSList* attributes = nullptr;
|
||||
DocAccessible* document = accWrap->AsDoc();
|
||||
nsAutoString aURL;
|
||||
document->URL(aURL);
|
||||
attributes = prependToList(attributes, kDocUrlName, aURL);
|
||||
|
||||
nsAutoString aW3CDocType;
|
||||
document->DocType(aW3CDocType);
|
||||
attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
|
||||
|
||||
nsAutoString aMimeType;
|
||||
document->MimeType(aMimeType);
|
||||
attributes = prependToList(attributes, kMimeTypeName, aMimeType);
|
||||
attributes = prependToList(attributes, kDocUrlName, url);
|
||||
attributes = prependToList(attributes, kDocTypeName, w3cDocType);
|
||||
attributes = prependToList(attributes, kMimeTypeName, mimeType);
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
@ -97,20 +106,44 @@ const gchar *
|
|||
getDocumentAttributeValueCB(AtkDocument *aDocument,
|
||||
const gchar *aAttrName)
|
||||
{
|
||||
ProxyAccessible* proxy = nullptr;
|
||||
DocAccessible* document = nullptr;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
|
||||
if (!accWrap || !accWrap->IsDoc())
|
||||
return nullptr;
|
||||
if (accWrap) {
|
||||
if (!accWrap->IsDoc()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
document = accWrap->AsDoc();
|
||||
} else {
|
||||
proxy = GetProxy(ATK_OBJECT(aDocument));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
DocAccessible* document = accWrap->AsDoc();
|
||||
nsAutoString attrValue;
|
||||
if (!strcasecmp(aAttrName, kDocTypeName))
|
||||
document->DocType(attrValue);
|
||||
else if (!strcasecmp(aAttrName, kDocUrlName))
|
||||
document->URL(attrValue);
|
||||
else if (!strcasecmp(aAttrName, kMimeTypeName))
|
||||
document->MimeType(attrValue);
|
||||
else
|
||||
if (!strcasecmp(aAttrName, kDocTypeName)) {
|
||||
if (document) {
|
||||
document->DocType(attrValue);
|
||||
} else {
|
||||
proxy->DocType(attrValue);
|
||||
}
|
||||
} else if (!strcasecmp(aAttrName, kDocUrlName)) {
|
||||
if (document) {
|
||||
document->URL(attrValue);
|
||||
} else {
|
||||
proxy->URL(attrValue);
|
||||
}
|
||||
} else if (!strcasecmp(aAttrName, kMimeTypeName)) {
|
||||
if (document) {
|
||||
document->MimeType(attrValue);
|
||||
} else {
|
||||
proxy->MimeType(attrValue);
|
||||
}
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return attrValue.IsEmpty() ? nullptr : AccessibleWrap::ReturnString(attrValue);
|
||||
}
|
||||
|
|
|
@ -1631,5 +1631,70 @@ DocAccessibleChild::RecvBounds(const uint64_t& aID,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvLanguage(const uint64_t& aID,
|
||||
nsString* aLocale)
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
if (acc) {
|
||||
acc->Language(*aLocale);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvDocType(const uint64_t& aID,
|
||||
nsString* aType)
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
if (acc && acc->IsDoc()) {
|
||||
acc->AsDoc()->DocType(*aType);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvURL(const uint64_t& aID,
|
||||
nsString* aURL)
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
if (acc && acc->IsDoc()) {
|
||||
acc->AsDoc()->URL(*aURL);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvMimeType(const uint64_t& aID,
|
||||
nsString* aMime)
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
if (acc && acc->IsDoc()) {
|
||||
acc->AsDoc()->MimeType(*aMime);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvURLDocTypeMimeType(const uint64_t& aID,
|
||||
nsString* aURL,
|
||||
nsString* aDocType,
|
||||
nsString* aMimeType)
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
if (acc && acc->IsDoc()) {
|
||||
DocAccessible* doc = acc->AsDoc();
|
||||
doc->URL(*aURL);
|
||||
doc->DocType(*aDocType);
|
||||
doc->MimeType(*aMimeType);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -401,6 +401,15 @@ public:
|
|||
bool* aOk) override;
|
||||
|
||||
virtual bool RecvBounds(const uint64_t& aID, nsIntRect* aRect) override;
|
||||
|
||||
virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
|
||||
virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
|
||||
virtual bool RecvURL(const uint64_t& aID, nsString* aURL) override;
|
||||
virtual bool RecvMimeType(const uint64_t& aID, nsString* aMime) override;
|
||||
virtual bool RecvURLDocTypeMimeType(const uint64_t& aID,
|
||||
nsString* aURL,
|
||||
nsString* aDocType,
|
||||
nsString* aMimeType) override;
|
||||
private:
|
||||
|
||||
Accessible* IdToAccessible(const uint64_t& aID) const;
|
||||
|
|
|
@ -209,6 +209,12 @@ child:
|
|||
prio(high) sync ChildAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aWhich)
|
||||
returns(uint64_t aChild, bool aOk);
|
||||
prio(high) sync Bounds(uint64_t aID) returns(nsIntRect aRect);
|
||||
|
||||
prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
|
||||
prio(high) sync DocType(uint64_t aID) returns(nsString aType);
|
||||
prio(high) sync URL(uint64_t aID) returns(nsString aURL);
|
||||
prio(high) sync MimeType(uint64_t aID) returns(nsString aMime);
|
||||
prio(high) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -911,5 +911,36 @@ ProxyAccessible::Bounds()
|
|||
return rect;
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::Language(nsString& aLocale)
|
||||
{
|
||||
unused << mDoc->SendLanguage(mID, &aLocale);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::DocType(nsString& aType)
|
||||
{
|
||||
unused << mDoc->SendDocType(mID, &aType);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::URL(nsString& aURL)
|
||||
{
|
||||
unused << mDoc->SendURL(mID, &aURL);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::MimeType(nsString aMime)
|
||||
{
|
||||
unused << mDoc->SendMimeType(mID, &aMime);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
||||
nsString& aMimeType)
|
||||
{
|
||||
unused << mDoc->SendURLDocTypeMimeType(mID, &aURL, &aDocType, &aMimeType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,6 +276,13 @@ public:
|
|||
Accessible::EWhichChildAtPoint aWhichChild);
|
||||
nsIntRect Bounds();
|
||||
|
||||
void Language(nsString& aLocale);
|
||||
void DocType(nsString& aType);
|
||||
void URL(nsString& aURL);
|
||||
void MimeType(nsString aMime);
|
||||
void URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
|
||||
nsString& aMimeType);
|
||||
|
||||
/**
|
||||
* Allow the platform to store a pointers worth of data on us.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче