WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 160705
AX: @alt and bounds ignored when using img[src] points to an inaccessible SVG
https://bugs.webkit.org/show_bug.cgi?id=160705
Summary
AX: @alt and bounds ignored when using img[src] points to an inaccessible SVG
James Craig
Reported
2016-08-09 13:11:18 PDT
Test case from Deque
http://a11yideas.com/testcode/mwp/iOSsvg.html
If you link an entirely inaccessible SVG (no accessible contents), WebKit should respect the @alt attribute from the linking HTML, use the outer bounds of the SVG canvas as the image bounds, and use the AXImage role instead of AXGroup.
Attachments
Patch
(14.43 KB, patch)
2021-01-22 14:32 PST
,
Andres Gonzalez
no flags
Details
Formatted Diff
Diff
Patch
(14.95 KB, patch)
2021-01-23 11:28 PST
,
Andres Gonzalez
no flags
Details
Formatted Diff
Diff
Patch
(17.33 KB, patch)
2021-01-25 07:57 PST
,
Andres Gonzalez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-08-09 13:11:37 PDT
<
rdar://problem/27771579
>
James Craig
Comment 2
2016-08-09 13:18:28 PDT
See related discussion from
bug 145263
.
Andres Gonzalez
Comment 3
2021-01-22 14:32:55 PST
Created
attachment 418181
[details]
Patch
chris fleizach
Comment 4
2021-01-22 14:38:18 PST
Comment on
attachment 418181
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 > + for (const auto& child : childrenOfType<SVGElement>(element)) {
the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again
chris fleizach
Comment 5
2021-01-22 14:57:31 PST
Comment on
attachment 418181
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:72 > + // If the role or aria-label attributes are specified, this is accessible.
are there other attributes we need to check like "alt"
Darin Adler
Comment 6
2021-01-22 16:04:19 PST
Comment on
attachment 418181
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >> + for (const auto& child : childrenOfType<SVGElement>(element)) { > > the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again
Using descendantsOfType instead, only at the top level, should resolve that cleanly.
Darin Adler
Comment 7
2021-01-22 16:18:17 PST
Comment on
attachment 418181
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >>> + for (const auto& child : childrenOfType<SVGElement>(element)) { >> >> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again > > Using descendantsOfType instead, only at the top level, should resolve that cleanly.
But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once.
chris fleizach
Comment 8
2021-01-22 16:23:45 PST
(In reply to Darin Adler from
comment #7
)
> Comment on
attachment 418181
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
> > >>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 > >>> + for (const auto& child : childrenOfType<SVGElement>(element)) { > >> > >> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again > > > > Using descendantsOfType instead, only at the top level, should resolve that cleanly. > > But on reflection, I don’t think it will be n! or n^2; even in this code > every descendant is visited only once.
yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot
Darin Adler
Comment 9
2021-01-22 16:29:54 PST
Comment on
attachment 418181
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
>>>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >>>>> + for (const auto& child : childrenOfType<SVGElement>(element)) { >>>> >>>> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again >>> >>> Using descendantsOfType instead, only at the top level, should resolve that cleanly. >> >> But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once. > > yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot
Oh, yes this is O(descendants) and it’s *not* OK to call something like that for all elements. Could be a real challenge to deal with that.
chris fleizach
Comment 10
2021-01-22 17:19:35 PST
Comment on
attachment 418181
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
>>>>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >>>>>> + for (const auto& child : childrenOfType<SVGElement>(element)) { >>>>> >>>>> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again >>>> >>>> Using descendantsOfType instead, only at the top level, should resolve that cleanly. >>> >>> But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once. >> >> yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot > > Oh, yes this is O(descendants) and it’s *not* OK to call something like that for all elements. > > Could be a real challenge to deal with that.
talking to Andres offline we determined this would only be called once and only on the root. he had some ideas on how to make that more clear in the code
Andres Gonzalez
Comment 11
2021-01-23 11:28:10 PST
Created
attachment 418229
[details]
Patch
Andres Gonzalez
Comment 12
2021-01-23 11:33:02 PST
(In reply to chris fleizach from
comment #10
)
> Comment on
attachment 418181
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
> > >>>>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 > >>>>>> + for (const auto& child : childrenOfType<SVGElement>(element)) { > >>>>> > >>>>> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again > >>>> > >>>> Using descendantsOfType instead, only at the top level, should resolve that cleanly. > >>> > >>> But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once. > >> > >> yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot > > > > Oh, yes this is O(descendants) and it’s *not* OK to call something like that for all elements. > > > > Could be a real challenge to deal with that. > > talking to Andres offline we determined this would only be called once and > only on the root. he had some ideas on how to make that more clear in the > code
I moved the hasAccessibleContent method to the AccessibilitySVGRoot class which makes it clearer that this method would be called only on the SVG root. Also used the descendantsOfType function suggested by Darin that makes it a lot cleaner. Thank you both very much for the feedback.
Andres Gonzalez
Comment 13
2021-01-23 11:36:16 PST
(In reply to chris fleizach from
comment #5
)
> Comment on
attachment 418181
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=418181&action=review
> > > Source/WebCore/accessibility/AccessibilitySVGElement.cpp:72 > > + // If the role or aria-label attributes are specified, this is accessible. > > are there other attributes we need to check like "alt"
Investigating this. have to consult the ARIA and SVG accessibility specs.
chris fleizach
Comment 14
2021-01-24 23:29:20 PST
One new test failure
https://ews-build.s3-us-west-2.amazonaws.com/macOS-Mojave-Release-WK1-Tests-EWS/r418229-26105/results.html
Andres Gonzalez
Comment 15
2021-01-25 07:57:49 PST
Created
attachment 418295
[details]
Patch
EWS
Comment 16
2021-01-25 08:52:57 PST
Committed
r271796
: <
https://trac.webkit.org/changeset/271796
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 418295
[details]
.
chris fleizach
Comment 17
2021-03-15 12:31:45 PDT
***
Bug 202431
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug