Closed Bug 822983 Opened 11 years ago Closed 11 years ago

Map SVG graphic elements to accessibility API

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: surkov, Assigned: surkov)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

http://www.w3.org/TR/SVG/intro.html#TermGraphicsElement:

graphics element
    One of the element types that can cause graphics to be drawn onto the target canvas. Specifically: ‘circle’, ‘ellipse’, ‘image’, ‘line’, ‘path’, ‘polygon’, ‘polyline’, ‘rect’, ‘text’ and ‘use’.
Attached patch patch (obsolete) — Splinter Review
Attachment #693805 - Flags: review?(trev.saunders)
Btw, probably these elements should implement IA2 IAccessibleImage interface. I can do that as follow up if it's needed. Mick, let me know if NVDA relies on it.

And svg:image element should expose @src object attribute at least to be consistent with HTML/XUL images. I can do that if that's needed as well.
Comment on attachment 693805 [details] [diff] [review]
patch

>+      } else if (content->Tag() == nsGkAtoms::rect ||
>+                 content->Tag() == nsGkAtoms::circle ||
>+                 content->Tag() == nsGkAtoms::ellipse ||
>+                 content->Tag() == nsGkAtoms::line ||
>+                 content->Tag() == nsGkAtoms::path ||
>+                 content->Tag() == nsGkAtoms::polygon ||
>+                 content->Tag() == nsGkAtoms::polyline ||
>+                 content->Tag() == nsGkAtoms::image) {

Perhaps you should check that the frame is a nsGkAtoms::svgPathGeometryFrame instead?
(In reply to Robert Longson from comment #3)
> Comment on attachment 693805 [details] [diff] [review]
> patch
> 
> >+      } else if (content->Tag() == nsGkAtoms::rect ||
> >+                 content->Tag() == nsGkAtoms::circle ||
> >+                 content->Tag() == nsGkAtoms::ellipse ||
> >+                 content->Tag() == nsGkAtoms::line ||
> >+                 content->Tag() == nsGkAtoms::path ||
> >+                 content->Tag() == nsGkAtoms::polygon ||
> >+                 content->Tag() == nsGkAtoms::polyline ||
> >+                 content->Tag() == nsGkAtoms::image) {
> 
> Perhaps you should check that the frame is a nsGkAtoms::svgPathGeometryFrame
> instead?

is it equivalent to all these checks? (including imgage?)
image frames are nsGkAtoms::svgImageFrame but their implementation is basically

class nsSVGImageFrame : public nsSVGPathGeometryFrame 

So something like this should work

nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
if (pathGeometryFrame) {
}
Ok, nice, I will update the patch. Thanks!
(In reply to Robert Longson from comment #5)
> image frames are nsGkAtoms::svgImageFrame but their implementation is
> basically
> 
> class nsSVGImageFrame : public nsSVGPathGeometryFrame 
> 
> So something like this should work
> 
> nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
> if (pathGeometryFrame) {
> }

do_QueryFrame gives an error:

c:\mozilla\1912\obj-ff-dbg\dist\include\nsQueryFrame.h(69) : error C2385: ambiguous access of 'kFrameIID'
        could be the 'kFrameIID' in base 'nsIFrame'
        or could be the 'kFrameIID' in base 'nsISVGChildFrame'
        c:/mozilla/1912/accessible/src/base/nsAccessibilityService.cpp(920) : see reference to function template instantiation 'do_QueryFrame::operator Dest(void)<nsSVGPathGeometryFrame>' being compiled
        with
        [
            Dest=nsSVGPathGeometryFrame
        ] 

cause by missed NS_DECL_QUERYFRAME_TARGET(nsSVGPathGeometryFrame) I think.

Alternatively we could use nsIFrame::AccessibleType() approach.
Attached patch patch2Splinter Review
Attachment #693805 - Attachment is obsolete: true
Attachment #693805 - Flags: review?(trev.saunders)
Attachment #694231 - Flags: review?(trev.saunders)
Attachment #694231 - Flags: review?(longsonr)
Attachment #694231 - Flags: review?(longsonr) → review+
Comment on attachment 694231 [details] [diff] [review]
patch2

It might be nice to use tree test to make sure kids are correct to
Attachment #694231 - Flags: review?(trev.saunders) → review+
(In reply to Trevor Saunders (:tbsaunde) from comment #9)

> It might be nice to use tree test to make sure kids are correct to

they don't really have kids and don't expose hierarchies. that's why I pushed them as plain roles check.
(In reply to alexander :surkov from comment #2)
> Btw, probably these elements should implement IA2 IAccessibleImage
> interface. I can do that as follow up if it's needed. Mick, let me know if
> NVDA relies on it.
> And svg:image element should expose @src object attribute at least to be
> consistent with HTML/XUL images. I can do that if that's needed as well.
We do not make use of IAccessibleImage in NVDA. However, src attribute might be nice.
bug 824320 filed for scr object attribute
https://hg.mozilla.org/mozilla-central/rev/cf9f18d9c698
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.