Closed Bug 285703 Opened 20 years ago Closed 20 years ago

Incorrect behavior for images with no ALT attribute or ALT=""

Categories

(Core :: Disability Access APIs, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: aaronlev, Assigned: aaronlev)

Details

(Keywords: access)

Attachments

(1 file)

To match IE: - return "" when ALT="". This indicates to the AT that it should not attempt to repair the ALT text, and that an empty string is intentional. - return null when no ALT or TITLE attribute present. This indicates to the AT that it may attempt to repair the missing ALT text
This patch is a small step torward the ALT text repair patch from bug 277469, because of the AppendFlatStringFromContentNode() cleanup and moving the GetName() logic to nsHTMLImageAccessible.
Attachment #177102 - Flags: review?(pkwarren)
Attachment #177102 - Flags: review?(pkwarren) → review?(timeless)
Attachment #177102 - Flags: superreview?(Henry.Jia)
Attachment #177102 - Flags: superreview?(Henry.Jia)
Attachment #177102 - Flags: superreview?(Henry.Jia)
Comment on attachment 177102 [details] [diff] [review] 1) Put logic for GetName() in nsHTMLImageAccessible 2) Clean up AppendFlatStringFromContentNode(), 3) Return null if name.IsVoid() r=me with a few minor fixes
Attachment #177102 - Flags: review?(timeless) → review+
Attachment #177102 - Flags: superreview?(Henry.Jia) → superreview?(darin)
Comment on attachment 177102 [details] [diff] [review] 1) Put logic for GetName() in nsHTMLImageAccessible 2) Clean up AppendFlatStringFromContentNode(), 3) Return null if name.IsVoid() >Index: accessible/src/base/nsAccessible.cpp > nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString) > { >+ if (aContent->IsContentOfType(nsIContent::eTEXT)) { nit: I strongly recommend breaking this block out into a subroutine. I think it would help readability. Long functions are a pain ;) >+ return NS_OK; // Not HTML and not XUL -- we don't handle it yet >+ } >+ else if (aContent->Tag() == nsAccessibilityAtoms::img) { nit: else after return is a non-sequitor >+ nsCOMPtr<nsIAccessibilityService> accService = >+ do_GetService("@mozilla.org/accessibilityService;1"); >+ nsCOMPtr<nsIAccessible> accessible; >+ accService->GetAccessibleInWeakShell(domNode, mWeakShell, getter_AddRefs(accessible)); nit: null check accService in case do_GetService fails? (e.g., like if this code happens to run after xpcom has shutdown.) sr=darin
Attachment #177102 - Flags: superreview?(darin) → superreview+
Checking in src/base/nsAccessibilityAtomList.h; /cvsroot/mozilla/accessible/src/base/nsAccessibilityAtomList.h,v <-- nsAccessibilityAtomList.h new revision: 1.16; previous revision: 1.15 done Checking in src/base/nsAccessible.cpp; /cvsroot/mozilla/accessible/src/base/nsAccessible.cpp,v <-- nsAccessible.cpp new revision: 1.136; previous revision: 1.135 done Checking in src/html/nsHTMLImageAccessible.cpp; /cvsroot/mozilla/accessible/src/html/nsHTMLImageAccessible.cpp,v <-- nsHTMLImageAccessible.cpp new revision: 1.26; previous revision: 1.25 done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: