Last Comment Bug 822983 - Map SVG graphic elements to accessibility API
: Map SVG graphic elements to accessibility API
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Disability Access APIs (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla20
Assigned To: alexander :surkov
:
Mentors:
Depends on:
Blocks: svga11y
  Show dependency treegraph
 
Reported: 2012-12-19 00:58 PST by alexander :surkov
Modified: 2013-01-04 09:49 PST (History)
5 users (show)
surkov.alexander: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (6.57 KB, patch)
2012-12-19 01:15 PST, alexander :surkov
no flags Details | Diff | Splinter Review
patch2 (8.83 KB, patch)
2012-12-19 22:19 PST, alexander :surkov
tbsaunde+mozbugs: review+
longsonr: review+
Details | Diff | Splinter Review

Description alexander :surkov 2012-12-19 00:58:20 PST
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’.
Comment 1 alexander :surkov 2012-12-19 01:15:35 PST
Created attachment 693805 [details] [diff] [review]
patch
Comment 2 alexander :surkov 2012-12-19 01:29:40 PST
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 3 Robert Longson 2012-12-19 03:22:25 PST
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?
Comment 4 alexander :surkov 2012-12-19 03:24:27 PST
(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?)
Comment 5 Robert Longson 2012-12-19 03:41:59 PST
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) {
}
Comment 6 alexander :surkov 2012-12-19 04:06:58 PST
Ok, nice, I will update the patch. Thanks!
Comment 7 alexander :surkov 2012-12-19 19:07:32 PST
(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.
Comment 8 alexander :surkov 2012-12-19 22:19:53 PST
Created attachment 694231 [details] [diff] [review]
patch2
Comment 9 Trevor Saunders (:tbsaunde) 2012-12-20 14:47:13 PST
Comment on attachment 694231 [details] [diff] [review]
patch2

It might be nice to use tree test to make sure kids are correct to
Comment 10 alexander :surkov 2012-12-20 18:02:40 PST
(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.
Comment 11 Michael Curran 2012-12-22 20:53:00 PST
(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.
Comment 12 alexander :surkov 2012-12-22 21:58:28 PST
bug 824320 filed for scr object attribute
Comment 14 Ed Morley [:emorley] 2013-01-04 09:49:31 PST
https://hg.mozilla.org/mozilla-central/rev/cf9f18d9c698

Note You need to log in before you can comment on or make changes to this bug.