Closed Bug 98781 Opened 23 years ago Closed 23 years ago

Active Accessibility: Implement support for XUL images

Categories

(Core :: XUL, defect, P1)

x86
Windows 2000
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.5

People

(Reporter: mozilla, Assigned: aaronlev)

References

()

Details

(Keywords: access)

Attachments

(6 files)

Need to hook up through XBL an implementation of nsIAccessibleProvider support for MSAA. From the url above: interface XULImageElement : XULElement { attribute DOMString src; };
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla0.9.5
Blocks: 82207
Comment on attachment 50056 [details] [diff] [review] XUL Images supporting MSAA - ready for r=/sr= looks fine, r=jgaunt needs hyatt's ( or someone's ) ok for the idl and the xpfe stuff.
Attachment #50056 - Flags: review+
oh, there should also be some mac changes for the idl right? I need to look into that for my own fixed too.
I believe mac changes go into mozilla/dom/macbuild/dom_xulIDL.mcp
Comment on attachment 50109 [details] [diff] [review] improves AppendFlatStringFromContentNode to use the value attributes of XUL elements. Helpful for jgaunt'sXUL description work in bug 98777. >Index: mozilla/accessible/public/nsIAccessibilityService.idl >=================================================================== >RCS file: /cvsroot/mozilla/accessible/public/nsIAccessibilityService.idl,v >retrieving revision 1.13 >diff -u -r1.13 nsIAccessibilityService.idl >--- nsIAccessibilityService.idl 2001/09/18 03:08:55 1.13 >+++ nsIAccessibilityService.idl 2001/09/20 19:08:55 >@@ -43,6 +43,7 @@ > nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame); > nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame); > nsIAccessible createHTMLTextAccessible(in nsISupports aFrame); >+ nsIAccessible createXULImageAccessible(in nsIDOMNode aNode); > nsIAccessible createHTMLImageAccessible(in nsISupports aFrame); > nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent); > nsIAccessible createHTMLTableAccessible(in nsISupports aFrame); >Index: mozilla/accessible/src/nsAccessibilityService.cpp >=================================================================== >RCS file: /cvsroot/mozilla/accessible/src/nsAccessibilityService.cpp,v >retrieving revision 1.15 >diff -u -r1.15 nsAccessibilityService.cpp >--- nsAccessibilityService.cpp 2001/09/18 03:08:57 1.15 >+++ nsAccessibilityService.cpp 2001/09/20 19:08:56 >@@ -300,6 +300,19 @@ > return NS_OK; > } > >+NS_IMETHODIMP nsAccessibilityService::CreateXULImageAccessible(nsIDOMNode *aNode, nsIAccessible **_retval) >+{ >+ nsCOMPtr<nsIWeakReference> weakShell; >+ GetShellFromNode(aNode, getter_AddRefs(weakShell)); >+ >+ *_retval = new nsHTMLImageAccessible(aNode, weakShell); >+ if (! *_retval) >+ return NS_ERROR_OUT_OF_MEMORY; >+ >+ NS_ADDREF(*_retval); >+ return NS_OK; >+} >+ > /* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */ > NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFrame, nsIAccessible **_retval) > { >@@ -309,15 +322,8 @@ > nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node)); > if (NS_FAILED(rv)) > return rv; >- nsIImageFrame* imageFrame = nsnull; >- >- // not using a nsCOMPtr frames don't support them. >- aFrame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame); >- >- if (!imageFrame) >- return NS_ERROR_FAILURE; > >- *_retval = new nsHTMLImageAccessible(node, imageFrame, weakShell); >+ *_retval = new nsHTMLImageAccessible(node, weakShell); > if (! *_retval) > return NS_ERROR_OUT_OF_MEMORY; > >Index: mozilla/accessible/src/nsAccessible.cpp >=================================================================== >RCS file: /cvsroot/mozilla/accessible/src/nsAccessible.cpp,v >retrieving revision 1.20 >diff -u -r1.20 nsAccessible.cpp >--- nsAccessible.cpp 2001/09/18 03:08:57 1.20 >+++ nsAccessible.cpp 2001/09/20 19:08:58 >@@ -50,6 +50,7 @@ > #include "nsIDOMHTMLImageElement.h" > #include "nsIDOMHTMLInputElement.h" > #include "nsIDOMHTMLBRElement.h" >+#include "nsIDOMXULElement.h" > #include "nsIAtom.h" > #include "nsHTMLAtoms.h" > #include "nsLayoutAtoms.h" >@@ -1362,11 +1363,11 @@ > return NS_OK; > } > >+ nsAutoString textEquivalent; > nsCOMPtr<nsIDOMHTMLImageElement> imageContent(do_QueryInterface(aContent)); > nsCOMPtr<nsIDOMHTMLInputElement> inputContent(do_QueryInterface(aContent)); > if (imageContent || inputContent) { > nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContent)); >- nsAutoString textEquivalent; > elt->GetAttribute(NS_LITERAL_STRING("alt"), textEquivalent); > if (textEquivalent.IsEmpty()) > elt->GetAttribute(NS_LITERAL_STRING("title"), textEquivalent); >@@ -1374,13 +1375,25 @@ > elt->GetAttribute(NS_LITERAL_STRING("name"), textEquivalent); > if (textEquivalent.IsEmpty()) > elt->GetAttribute(NS_LITERAL_STRING("src"), textEquivalent); >- if (!textEquivalent.IsEmpty()) { >- aFlatString->Append(NS_LITERAL_STRING(" ")); >- aFlatString->Append(textEquivalent); >- aFlatString->Append(NS_LITERAL_STRING(" ")); >- return NS_OK; >+ } >+ else { >+ // tooltiptext will be visually shown for all XUL elements - bug 93839 >+ nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aContent)); >+ if (xulElement) { >+ nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContent)); >+ elt->GetAttribute(NS_LITERAL_STRING("tooltiptext"), textEquivalent); >+ if (textEquivalent.IsEmpty()) >+ elt->GetAttribute(NS_LITERAL_STRING("value"), textEquivalent); > } > } >+ >+ if (!textEquivalent.IsEmpty()) { >+ aFlatString->Append(NS_LITERAL_STRING(" ")); >+ aFlatString->Append(textEquivalent); >+ aFlatString->Append(NS_LITERAL_STRING(" ")); >+ return NS_OK; >+ } >+ > return NS_OK; > } > >Index: mozilla/accessible/src/nsHTMLImageAccessible.cpp >=================================================================== >RCS file: /cvsroot/mozilla/accessible/src/nsHTMLImageAccessible.cpp,v >retrieving revision 1.7 >diff -u -r1.7 nsHTMLImageAccessible.cpp >--- nsHTMLImageAccessible.cpp 2001/08/14 02:27:30 1.7 >+++ nsHTMLImageAccessible.cpp 2001/09/20 19:08:58 >@@ -36,7 +36,7 @@ > > // --- image ----- > >-nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIImageFrame *aImageFrame, nsIWeakReference* aShell): >+nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): > nsLinkableAccessible(aDOMNode, aShell) > { > nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode)); >Index: mozilla/accessible/src/nsHTMLImageAccessible.h >=================================================================== >RCS file: /cvsroot/mozilla/accessible/src/nsHTMLImageAccessible.h,v >retrieving revision 1.4 >diff -u -r1.4 nsHTMLImageAccessible.h >--- nsHTMLImageAccessible.h 2001/08/14 00:18:04 1.4 >+++ nsHTMLImageAccessible.h 2001/09/20 19:08:59 >@@ -38,7 +38,7 @@ > { > > public: >- nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIImageFrame *imageFrame, nsIWeakReference* aShell); >+ nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell); > NS_IMETHOD GetAccName(nsAWritableString& _retval); > NS_IMETHOD GetAccState(PRUint32 *_retval); > NS_IMETHOD GetAccRole(PRUint32 *_retval); >Index: mozilla/xpfe/global/resources/content/xul.css >=================================================================== >RCS file: /cvsroot/mozilla/xpfe/global/resources/content/xul.css,v >retrieving revision 1.79 >diff -u -r1.79 xul.css >--- xul.css 2001/09/20 07:08:16 1.79 >+++ xul.css 2001/09/20 19:09:16 >@@ -131,6 +131,12 @@ > -moz-binding: url("chrome://global/content/bindings/general.xml#iframe"); > } > >+/********** image **********/ >+ >+image { >+ -moz-binding: url("chrome://global/content/bindings/general.xml#image"); >+} >+ > /********** checkbox **********/ > > checkbox { >Index: mozilla/xpfe/global/resources/content/bindings/general.xml >=================================================================== >RCS file: /cvsroot/mozilla/xpfe/global/resources/content/bindings/general.xml,v >retrieving revision 1.10 >diff -u -r1.10 general.xml >--- general.xml 2001/08/21 06:41:19 1.10 >+++ general.xml 2001/09/20 19:09:16 >@@ -225,5 +225,24 @@ > </implementation> > </binding> > >+ <binding id="image"> >+ <handlers> >+ <handler event="click" button="0" action="if (!this.disabled) this.checked = !this.checked;"/> >+ </handlers> >+ <implementation implements="nsIDOMXULImageElement, nsIAccessibleProvider"> >+ <property name="src" >+ onget="return this.getAttribute('src');" >+ onset="this.setAttribute('src',val); return val;"/> >+ <property name="accessible"> >+ <getter> >+ <![CDATA[ >+ var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService); >+ return (accService? accService.createXULImageAccessible(this): null); >+ ]]> >+ </getter> >+ </property> >+ </implementation> >+ </binding> >+ > </bindings> > >Index: mozilla/dom/public/idl/xul/nsIDOMXULImageElement.idl >=================================================================== >RCS file: nsIDOMXULImageElement.idl >diff -N nsIDOMXULImageElement.idl >--- /dev/null Wed Apr 26 15:53:02 2000 >+++ nsIDOMXULImageElement.idl Thu Sep 20 12:09:19 2001 >@@ -0,0 +1,32 @@ >+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ >+/* >+ * The contents of this file are subject to the Netscape Public >+ * License Version 1.1 (the "License"); you may not use this file >+ * except in compliance with the License. You may obtain a copy of >+ * the License at http://www.mozilla.org/NPL/ >+ * >+ * Software distributed under the License is distributed on an "AS >+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or >+ * implied. See the License for the specific language governing >+ * rights and limitations under the License. >+ * >+ * The Original Code is mozilla.org code. >+ * >+ * The Initial Developer of the Original Code is Netscape >+ * Communications Corporation. Portions created by Netscape are >+ * Copyright (C) 2000 Netscape Communications Corporation. All >+ * Rights Reserved. >+ * >+ * Contributor(s): >+ * David Hyatt <hyatt@netscape.com> (original author) >+ * Johnny Stenback <jst@netscape.com> >+ */ >+ >+#include "nsIDOMElement.idl" >+#include "nsIDOMXULElement.idl" >+ >+[scriptable, uuid(f73f4d77-a6fb-4ab5-b41e-15045a0cc6ff)] >+interface nsIDOMXULImageElement : nsIDOMXULElement { >+ attribute DOMString src; >+}; >+
Comment on attachment 50109 [details] [diff] [review] improves AppendFlatStringFromContentNode to use the value attributes of XUL elements. Helpful for jgaunt'sXUL description work in bug 98777. Might want to change this comment to better explain this area for XUL. Question: we know for sure that the QI to a nsIDOMElement will work? What if we have an element that has tooltip text, but we want the value of the node? I think there needs to be more clarity as to who calls this method and why. >+ else { >+ // tooltiptext will be visually shown for all XUL elements - bug 93839 >+ nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aContent)); >+ if (xulElement) { >+ nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContent)); >+ elt->GetAttribute(NS_LITERAL_STRING("tooltiptext"), textEquivalent); >+ if (textEquivalent.IsEmpty()) >+ elt->GetAttribute(NS_LITERAL_STRING("value"), textEquivalent); > } > } >+ >+ if (!textEquivalent.IsEmpty()) { >+ aFlatString->Append(NS_LITERAL_STRING(" ")); >+ aFlatString->Append(textEquivalent); >+ aFlatString->Append(NS_LITERAL_STRING(" ")); >+ return NS_OK; >+ } >+ > return NS_OK; > }
Attachment #50109 - Flags: needs-work+
Blocks: 98777
Keywords: access, fcc508
Whiteboard: seeking sr=
Remove the <handlers> section from the image XBL. Other than that, sr=hyatt
Comment on attachment 50289 [details] [diff] [review] Final version of patch r=jgaunt, fwiw. great comments, you rock
Attachment #50289 - Flags: review+
Whiteboard: seeking sr=
-> checked it in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Summary: Implement accessibility support for XUL images → Active Accessibility: Implement support for XUL images
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: