Closed
Bug 852129
Opened 12 years ago
Closed 12 years ago
"ASSERTION: Text leaf parent is not hypertext" with text node child of <img>
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: jruderman, Assigned: tbsaunde)
References
(Blocks 1 open bug)
Details
(Keywords: assertion, testcase)
Attachments
(3 files)
1. Enable accessibility.
2. Load the testcase.
###!!! ASSERTION: Text leaf parent is not hypertext!: 'Error', file accessible/src/base/TextUpdater.cpp, line 49
Reporter | ||
Comment 1•12 years ago
|
||
Assignee | ||
Comment 2•12 years ago
|
||
it looks like the issue here is just that ImgeAccessible doesn't block having kids I wonder if we should make LinkbleAccessible inherit from LefAccessible?
Comment 3•12 years ago
|
||
What is a purpose of text node inside img element? Does it have any semantic?
(In reply to Trevor Saunders (:tbsaunde) from comment #2)
> it looks like the issue here is just that ImgeAccessible doesn't block
> having kids I wonder if we should make LinkbleAccessible inherit from
> LefAccessible?
No, the text is rendered. I guess the image should be an ordinal hypertext (not an image accessible).
Assignee | ||
Comment 4•12 years ago
|
||
(In reply to alexander :surkov from comment #3)
> What is a purpose of text node inside img element? Does it have any semantic?
>
> (In reply to Trevor Saunders (:tbsaunde) from comment #2)
> > it looks like the issue here is just that ImgeAccessible doesn't block
> > having kids I wonder if we should make LinkbleAccessible inherit from
> > LefAccessible?
>
> No, the text is rendered. I guess the image should be an ordinal hypertext
> (not an image accessible).
and the image is ignored? weird that is not what I expected, but ok. I gues it should be ordinary HyperText then yes. That'll make treeupdate suck even more but owe well :/
Reporter | ||
Comment 5•12 years ago
|
||
> What is a purpose of text node inside img element? Does it have any semantic?
It's the DOM fuzzer's way of saying hi.
Assignee | ||
Comment 6•12 years ago
|
||
(In reply to Jesse Ruderman from comment #5)
> > What is a purpose of text node inside img element? Does it have any semantic?
>
> It's the DOM fuzzer's way of saying hi.
"hi, I'm from the department of DOM fuzzing and I just wanted to make sure you were aware you can put text within a <img>" ;)
Comment 7•12 years ago
|
||
it shouldn't stuck tree update we just should tweak accessible creation. I'm curious why image frame is in use.
Comment 8•12 years ago
|
||
(In reply to Jesse Ruderman from comment #5)
> > What is a purpose of text node inside img element? Does it have any semantic?
>
> It's the DOM fuzzer's way of saying hi.
DOM is usually smart. For example, if you do HTML tables wrong then DOM is built correct. I'd guess that visible elements inside of HTML img having no src is just a fallback content. But it's better to check with DOM guru
Assignee | ||
Comment 9•12 years ago
|
||
Boris, can you answer comments 7 and 8?
![]() |
||
Comment 10•12 years ago
|
||
So all that's going on here from the DOM/layout point of view is this:
1) DOM doesn't prevent <img> having child nodes. You can't get there via the HTML parser,
but either the XML parser or direct DOM manipulation will let it happen.
2) When layout creates frames for an <img>, if the image is judged as "broken" (and a few
other conditions to do with quirks mode, styling, etc) it will be treated just like a
<span>, with ::before { content: attr(alt); } styling on it or some such. Which means
that kids of the <img> will render at that point...
Comment 11•12 years ago
|
||
how we can detect the image is "broken" and where we should add hooks to notify a11y the image changes its "brokenness" state?
![]() |
||
Comment 12•12 years ago
|
||
See what nsImageFrame::ShouldCreateImageFrameFor looks at in terms of deciding what sort of image to create?
When the brokenness state changes, the image is reframed; this should already notify a11y, right?
Comment 13•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #12)
> See what nsImageFrame::ShouldCreateImageFrameFor looks at in terms of
> deciding what sort of image to create?
ok
> When the brokenness state changes, the image is reframed; this should
> already notify a11y, right?
then yes
Assignee | ||
Comment 14•12 years ago
|
||
If the img is not valid then its children will be rendered, and the
sensible way to handle that is by giving the img a HyperTextAccessible
instead of a ImageAccessible. Since the accessible name of such an img
should be the value of the alt attribute we add similar as
ImageAccessible::NativeName() to HyperTextAccessible::NativeName()
conditioned on the tag being img.
Attachment #761340 -
Flags: review?(surkov.alexander)
Attachment #761340 -
Flags: review?(bzbarsky)
Comment 15•12 years ago
|
||
Comment on attachment 761340 [details] [diff] [review]
bug 852129 - use HyperTextAccessible for invalid img
Review of attachment 761340 [details] [diff] [review]:
-----------------------------------------------------------------
::: accessible/src/generic/HyperTextAccessible.cpp
@@ +2111,5 @@
> // Accessible protected
> ENameValueFlag
> HyperTextAccessible::NativeName(nsString& aName)
> {
> + // check alt attribute for invalid img elements
nit: check -> Check, alt -> @alt. Dot in the end
@@ +2112,5 @@
> ENameValueFlag
> HyperTextAccessible::NativeName(nsString& aName)
> {
> + // check alt attribute for invalid img elements
> + bool hasAlt = false;
maybe hasImgAlt
::: accessible/tests/mochitest/tree/test_invalid_img.xhtml
@@ +16,5 @@
> + <script>
> + <![CDATA[
> + function doTest()
> + {
> + document.getElementsByTagName("img")[0].firstChild.data = "2";
what is it for?
@@ +34,5 @@
> +</head>
> +<body>
> +
> + <a target="_blank"
> + title="test tree for invalid img"
maybe: use hypertext accessible for broken HTML img
@@ +44,5 @@
> + <div id="content" style="display: none"></div>
> + <pre id="test">
> + </pre>
> +
> +<img id="the_img">1</img>
nit: indent it
Attachment #761340 -
Flags: review?(surkov.alexander) → review+
![]() |
||
Comment 16•12 years ago
|
||
Comment on attachment 761340 [details] [diff] [review]
bug 852129 - use HyperTextAccessible for invalid img
Seems fine to me if we're not worrying about <svg:image> and <input type="image">.
Attachment #761340 -
Flags: review?(bzbarsky) → review+
Comment 17•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #16)
> Comment on attachment 761340 [details] [diff] [review]
> bug 852129 - use HyperTextAccessible for invalid img
>
> Seems fine to me if we're not worrying about <svg:image> and <input
> type="image">.
what's special about them?
![]() |
||
Comment 18•12 years ago
|
||
They behave generally just like <html:img> but are not IsHTML(nsGkAtoms::img).
Assignee | ||
Comment 19•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #16)
> Comment on attachment 761340 [details] [diff] [review]
> bug 852129 - use HyperTextAccessible for invalid img
>
> Seems fine to me if we're not worrying about <svg:image> and <input
> type="image">.
We don't need to worry about svg images because they don't get HyperTextAccessibles atm. The same is true for input type=image, though I'm less clear on why they get HTMLButtonAccessibles even when the input is invalid.
I added a test for the type=image case to test_general.html since I didn't immediately find one though I thought we already had test cases for that.
Assignee | ||
Comment 20•12 years ago
|
||
> ::: accessible/tests/mochitest/tree/test_invalid_img.xhtml
> @@ +16,5 @@
> > + <script>
> > + <![CDATA[
> > + function doTest()
> > + {
> > + document.getElementsByTagName("img")[0].firstChild.data = "2";
>
> what is it for?
just coppying test case, seems safer but I'm not really sure why we need it.
Assignee | ||
Comment 21•12 years ago
|
||
Comment 22•12 years ago
|
||
Assignee: nobody → trev.saunders
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in
before you can comment on or make changes to this bug.
Description
•