diff --git a/mozilla/accessible/src/atk/nsAccessibleWrap.cpp b/mozilla/accessible/src/atk/nsAccessibleWrap.cpp index e5d8511a03e..a13c6589013 100644 --- a/mozilla/accessible/src/atk/nsAccessibleWrap.cpp +++ b/mozilla/accessible/src/atk/nsAccessibleWrap.cpp @@ -827,17 +827,13 @@ getRoleCB(AtkObject *aAtkObj) } AtkAttributeSet * -getAttributesCB(AtkObject *aAtkObj) +GetAttributeSet(nsIAccessible* aAccessible) { - NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), nsnull); - nsAccessibleWrap *accWrap = - NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap; - AtkAttributeSet *objAttributeSet = nsnull; nsCOMPtr attributes; - accWrap->GetAttributes(getter_AddRefs(attributes)); - if (attributes) { + aAccessible->GetAttributes(getter_AddRefs(attributes)); + if (attributes) { nsCOMPtr propEnum; nsresult rv = attributes->Enumerate(getter_AddRefs(propEnum)); NS_ENSURE_SUCCESS(rv, nsnull); @@ -867,6 +863,16 @@ getAttributesCB(AtkObject *aAtkObj) return objAttributeSet; } +AtkAttributeSet * +getAttributesCB(AtkObject *aAtkObj) +{ + NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), nsnull); + nsAccessibleWrap *accWrap = + NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap; + + return GetAttributeSet(accWrap); +} + AtkObject * getParentCB(AtkObject *aAtkObj) { diff --git a/mozilla/accessible/src/atk/nsMaiInterfaceText.cpp b/mozilla/accessible/src/atk/nsMaiInterfaceText.cpp index 4f03c3c3f3b..a92d38c9758 100644 --- a/mozilla/accessible/src/atk/nsMaiInterfaceText.cpp +++ b/mozilla/accessible/src/atk/nsMaiInterfaceText.cpp @@ -42,6 +42,8 @@ #include "nsMaiInterfaceText.h" #include "nsString.h" +AtkAttributeSet * GetAttributeSet(nsIAccessible* aAccessible); + void textInterfaceInitCB(AtkTextIface *aIface) { @@ -254,9 +256,7 @@ getRunAttributesCB(AtkText *aText, gint aOffset, *aEndOffset = endOffset; NS_ENSURE_SUCCESS(rv, nsnull); - // XXX Turn accessibleWithAttrs into AtkAttributeSet by getting CSS for it - // Look at nsAccessNodeWrap::get_computedStyle() for MSAA implementation - return nsnull; + return GetAttributeSet(accessibleWithAttrs); } AtkAttributeSet * diff --git a/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp b/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp index 7addae2f561..5dd4e1236f0 100644 --- a/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp @@ -47,6 +47,8 @@ #include "nsIPresShell.h" #include "nsISelection.h" #include "nsISelectionController.h" +#include "nsIPersistentProperties2.h" +#include "nsComponentManagerUtils.h" nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell, nsIFrame *aFrame): nsTextAccessibleWrap(aDomNode, aShell), mFrame(aFrame) @@ -97,6 +99,19 @@ NS_IMETHODIMP nsHTMLTextAccessible::FireToolkitEvent(PRUint32 aEvent, return nsTextAccessibleWrap::FireToolkitEvent(aEvent, aTarget, aData); } +NS_IMETHODIMP nsHTMLTextAccessible::GetRole(PRUint32 *aRole) +{ + nsIFrame *frame = GetFrame(); + NS_ENSURE_TRUE(frame, NS_ERROR_NULL_POINTER); + + if (frame->IsGeneratedContentFrame()) { + *aRole = ROLE_STATICTEXT; + return NS_OK; + } + + return nsTextAccessible::GetRole(aRole); +} + NS_IMETHODIMP nsHTMLTextAccessible::GetState(PRUint32 *aState) { nsTextAccessible::GetState(aState); @@ -114,6 +129,29 @@ NS_IMETHODIMP nsHTMLTextAccessible::GetState(PRUint32 *aState) return NS_OK; } +NS_IMETHODIMP nsHTMLTextAccessible::GetAttributes(nsIPersistentProperties **aAttributes) +{ + *aAttributes = nsnull; + + if (!mDOMNode) { + return NS_ERROR_FAILURE; // Node already shut down + } + + PRUint32 role; + GetRole(&role); + if (role == ROLE_STATICTEXT) { + nsCOMPtr attributes = + do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID); + NS_ENSURE_TRUE(attributes, NS_ERROR_NULL_POINTER); + nsAutoString oldValueUnused; + attributes->SetStringProperty(NS_LITERAL_CSTRING("static"), + NS_LITERAL_STRING("true"), oldValueUnused); + attributes.swap(*aAttributes); + } + + return NS_OK; +} + nsHTMLHRAccessible::nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell): nsLeafAccessible(aDomNode, aShell) { @@ -296,4 +334,3 @@ NS_IMETHODIMP nsHTMLListBulletAccessible::GetName(nsAString &aName) aName = mBulletText; return NS_OK; } - diff --git a/mozilla/accessible/src/html/nsHTMLTextAccessible.h b/mozilla/accessible/src/html/nsHTMLTextAccessible.h index 203fd5e8ba6..383738a9def 100644 --- a/mozilla/accessible/src/html/nsHTMLTextAccessible.h +++ b/mozilla/accessible/src/html/nsHTMLTextAccessible.h @@ -53,6 +53,8 @@ public: // nsIAccessible NS_IMETHOD GetName(nsAString& _retval); NS_IMETHOD GetState(PRUint32 *aState); + NS_IMETHOD GetRole(PRUint32 *aRole); + NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes); // nsPIAccessNode NS_IMETHOD_(nsIFrame *) GetFrame(void);