Bug 49106

Summary: Include the FrameView widget of a RenderWidget in the accessibility tree.
Product: WebKit Reporter: Chris Guillory <ctguil>
Component: AccessibilityAssignee: Chris Guillory <ctguil>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: abarth, cfleizach, commit-queue, dglazkov, eric, fishd, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 49994, 50499    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch.
none
Proposed patch.
none
Proposed patch.
cfleizach: review-
Proposed patch.
cfleizach: review-
Proposed patch.
cfleizach: review-
Added early return statements in AccessibilityRenderObject::addRenderWidgetChildren
none
Fix Mac Build
none
Patch
none
Not passing 0 to RenderWidget::find
none
Patch none

Description Chris Guillory 2010-11-05 15:52:33 PDT
During investigation of a Chromium bug I noticed that the RenderView of an iFrame is not included in the top document AX tree hierarchy.
http://code.google.com/p/chromium/issues/detail?id=57727

Perhaps we can include the RenderView of the iFrame in the main AX tree similar to Firefox.
Comment 1 Chris Guillory 2010-11-05 16:08:23 PDT
Created attachment 73135 [details]
Proposed patch.
Comment 2 WebKit Review Bot 2010-11-05 16:12:43 PDT
Attachment 73135 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/accessibility/iframe-has-document-expected.txt', u'LayoutTests/accessibility/iframe-has-document.html', u'LayoutTests/platform/win/Skipped', u'WebCore/ChangeLog', u'WebCore/accessibility/AccessibilityRenderObject.cpp', u'WebKitTools/ChangeLog', u'WebKitTools/DumpRenderTree/AccessibilityUIElement.h', u'WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp']" exit_code: 1
WebCore/accessibility/AccessibilityRenderObject.cpp:3375:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp:62:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 2 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 chris fleizach 2010-11-05 16:14:04 PDT
what did the AX hiearchy look like, and what does it look like after this patch
Comment 4 Chris Guillory 2010-11-05 16:32:43 PDT
Created attachment 73138 [details]
Proposed patch.

Before this patch the AX tree of the top document would not include any children for a RenderIFrame render object (firstChild() doesn't return any renderer children).

After this patch the AX tree of the top document will include the RenderView of a RenderIFrame as a child. The RenderView document of the iFrame already includes all of that document's children. Also calling AccessibilityRenderObject::parentObject() on the RenderView document of an iFrame will return the RenderIFrame of the parent document; previously calling parentObject() repeatedly on a sub-document wouldn't walk all the way up to the top document.
Comment 5 chris fleizach 2010-11-05 17:21:29 PDT
(In reply to comment #4)
> Created an attachment (id=73138) [details]
> Proposed patch.
> 
> Before this patch the AX tree of the top document would not include any children for a RenderIFrame render object (firstChild() doesn't return any renderer children).
> 
> After this patch the AX tree of the top document will include the RenderView of a RenderIFrame as a child. The RenderView document of the iFrame already includes all of that document's children. Also calling AccessibilityRenderObject::parentObject() on the RenderView document of an iFrame will return the RenderIFrame of the parent document; previously calling parentObject() repeatedly on a sub-document wouldn't walk all the way up to the top document.

I'm worried that this will affect the AX hierarchy in undesired ways. Right now on the mac side, we see if the object has an attachment, then pass the call onto the attachment (you'll see that in AXObjectWrapperMac.mm). I suspect you'd want to do similar things on windows.
Comment 6 Chris Guillory 2010-11-05 17:34:21 PDT
Interesting, I'll look into doing something similar.
Comment 7 Chris Guillory 2010-11-12 18:19:07 PST
Created attachment 73803 [details]
Proposed patch.

Seems like the mac logic should be extended for all the ports. In this patch I'm specifically excluding the mac port in the added logic. Perhaps that mac attachment forwarding logic could be removed in favor of something like this?
Comment 8 Chris Guillory 2010-11-12 18:21:32 PST
Hey Dimitri, could you take a peek at WebKitTools/DumpRenderTree/chromium.
Comment 9 Dimitri Glazkov (Google) 2010-11-14 08:31:55 PST
Comment on attachment 73803 [details]
Proposed patch.

DRT changes are good.
Comment 10 chris fleizach 2010-11-15 09:41:02 PST
Comment on attachment 73803 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=73803&action=review

> WebCore/accessibility/AccessibilityRenderObject.cpp:416
> +    // On the mac port this parent logic is in AccessibleObjectWrapper.mm.

not the right name of the file.

> WebCore/accessibility/AccessibilityRenderObject.cpp:419
>      }

one line else if shouldn't have { }

> WebCore/accessibility/AccessibilityRenderObject.cpp:1879
> +#endif

shouldn't this go into accessibilityIgnoreAttachment() which can be customized per platform?

> WebCore/accessibility/AccessibilityRenderObject.cpp:3382
> +    // for RenderWidget, add frame's content renderer if the widget is a FramwView.

spelling

> WebCore/accessibility/AccessibilityRenderObject.cpp:3383
> +    // on the mac port this children logic is in AccessibleObjectWrapper.mm.

the file name is AccessibilityObjectWrapper.mm.
All comments should be full sentences
Comment 11 Chris Guillory 2010-11-15 11:49:17 PST
(In reply to comment #10)
> (From update of attachment 73803 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=73803&action=review
> 
> > WebCore/accessibility/AccessibilityRenderObject.cpp:416
> > +    // On the mac port this parent logic is in AccessibleObjectWrapper.mm.
> 
> not the right name of the file.
Fixed.

> 
> > WebCore/accessibility/AccessibilityRenderObject.cpp:419
> >      }
> 
> one line else if shouldn't have { }
> 
> > WebCore/accessibility/AccessibilityRenderObject.cpp:1879
> > +#endif
Fixed.

> shouldn't this go into accessibilityIgnoreAttachment() which can be customized per platform?
Seems like the iFrame renderer could always be ignored. It has an unknown role. For now I've moved this logic into AccessibilityObjectChromium.cpp.

> > WebCore/accessibility/AccessibilityRenderObject.cpp:3382
> > +    // for RenderWidget, add frame's content renderer if the widget is a FramwView.
> 
> spelling
Fixed.

> > WebCore/accessibility/AccessibilityRenderObject.cpp:3383
> > +    // on the mac port this children logic is in AccessibleObjectWrapper.mm.
> 
> the file name is AccessibilityObjectWrapper.mm.
> All comments should be full sentences
Fixed capitalization. Is that what you were referring to?
Comment 12 Chris Guillory 2010-11-15 12:07:16 PST
Created attachment 73921 [details]
Proposed patch.
Comment 13 Chris Guillory 2010-11-18 10:58:44 PST
WEBKIT API addition.
Comment 14 chris fleizach 2010-11-18 11:06:32 PST
Comment on attachment 73921 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=73921&action=review

some small changes

can you file a Mac bug asking to revisit why Mac can't use this code (and assign to me, and relate to this)

> WebCore/accessibility/AccessibilityRenderObject.cpp:3383
> +#endif

can you put this in a method like,

appendWidgetChildren or something

> WebCore/accessibility/chromium/AccessibilityObjectChromium.cpp:37
> +    // Ignore iframe renderers that have a content renderer.

can you explain why you're ignoring content renderers here. this comment states what the code does, but not why
Comment 15 Darin Fisher (:fishd, Google) 2010-11-18 11:34:55 PST
Comment on attachment 73921 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=73921&action=review

> WebKit/chromium/public/WebAccessibilityObject.h:66
> +    WEBKIT_API bool equals(const WebAccessibilityObject&) const;

This API change looks good to me.  Thanks!
Comment 16 Chris Guillory 2010-11-18 13:52:47 PST
> can you file a Mac bug asking to revisit why Mac can't use this code (and assign to me, and relate to this)
https://bugs.webkit.org/show_bug.cgi?id=49760
 
> > WebCore/accessibility/AccessibilityRenderObject.cpp:3383
> > +#endif
> 
> can you put this in a method like,
Added addRenderWidgetChildren

> 
> appendWidgetChildren or something
> 
> > WebCore/accessibility/chromium/AccessibilityObjectChromium.cpp:37
> > +    // Ignore iframe renderers that have a content renderer.
> 
> can you explain why you're ignoring content renderers here. this comment states what the code does, but not why
Updated comment.
Comment 17 Chris Guillory 2010-11-18 13:53:34 PST
Created attachment 74289 [details]
Proposed patch.
Comment 18 chris fleizach 2010-11-19 14:44:25 PST
Comment on attachment 74289 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=74289&action=review

sorry, chris. one more time

> WebCore/accessibility/AccessibilityRenderObject.cpp:3387
> +    }

now that we have our own method, we should use early return in the 3 levels of if here.
Comment 19 Chris Guillory 2010-11-19 15:10:13 PST
Created attachment 74427 [details]
Added early return statements in AccessibilityRenderObject::addRenderWidgetChildren
Comment 20 chris fleizach 2010-11-19 15:11:38 PST
Comment on attachment 74427 [details]
Added early return statements in AccessibilityRenderObject::addRenderWidgetChildren

r=me
Comment 21 WebKit Commit Bot 2010-11-20 00:03:31 PST
Comment on attachment 74427 [details]
Added early return statements in AccessibilityRenderObject::addRenderWidgetChildren

Rejecting patch 74427 from commit-queue.

Failed to run "['./WebKitTools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=eseidel-cq-sl', 'build', '--no-clean', '--no-update', '--build-style=both']" exit_code: 2
Last 500 characters of output:
ild/Script-5DF50887116F3077005202AB.sh

** BUILD FAILED **


The following build commands failed:
WebCore:
	CompileC /Projects/CommitQueue/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/x86_64/AccessibilityRenderObject.o /Projects/CommitQueue/WebCore/accessibility/AccessibilityRenderObject.cpp normal x86_64 c++ com.apple.compilers.gcc.4_2
(1 failure)


Failed to run "['WebKitTools/Scripts/build-webkit', '--debug']" exit_code: 1
l x86_64 c++ com.apple.compilers.gcc.4_2
(1 failure)


Full output: http://queues.webkit.org/results/6277014
Comment 22 Chris Guillory 2010-11-22 12:40:10 PST
Created attachment 74586 [details]
Fix Mac Build

Using early return in AccessibilityRenderObject::renderParentObject.
Comment 23 Chris Guillory 2010-11-23 11:07:08 PST
Hey Chris, if you're in can you take a look at this one. The previous change failed to commit because of a build error on mac.
Comment 24 WebKit Commit Bot 2010-11-23 14:34:09 PST
Comment on attachment 74586 [details]
Fix Mac Build

Clearing flags on attachment: 74586

Committed r72628: <http://trac.webkit.org/changeset/72628>
Comment 25 WebKit Commit Bot 2010-11-23 14:34:17 PST
All reviewed patches have been landed.  Closing bug.
Comment 26 WebKit Review Bot 2010-11-23 15:04:05 PST
http://trac.webkit.org/changeset/72628 might have broken GTK Linux 64-bit Debug
Comment 27 Chris Guillory 2010-11-23 15:16:51 PST
http://build.webkit.org/builders/GTK%20Linux%2064-bit%20Debug/builds/16298
GTK Linux 64-bit Debug: layout-test
editing/execCommand/4128080-1.html -> crashed
.................
editing/execCommand/4976800.html -> crashed
........................
editing/execCommand/5543472-1.html -> crashed
.....
editing/execCommand/5575101-1.html -> crashed
....................
editing/execCommand/break-out-of-empty-list-item.html -> crashed
......................
editing/execCommand/indent-node-to-split-to-crash.html -> crashed
................................................
editing/input ..
editing/inserting ..........................................
editing/inserting/insert-3907422-fix.html -> crashed
...........................
editing/pasteboard ............
editing/pasteboard/5032095.html -> crashed
...............................................................
editing/pasteboard/paste-text-003.html -> crashed
.........
editing/pasteboard/paste-text-events.html -> crashed
....
editing/selection ........................................................................
editing/selection/extend-selection-enclosing-block.html -> crashed
.............
editing/selection/home-end.html -> crashed
.................................................
editing/spelling ..
editing/style ......................
editing/style/inline-style-extend-run.html -> crashed
...
editing/style/push-down-font-styles.html -> crashed
......................
editing/text-iterator .
editing/undo .
editing/undo/4059423-1.html -> crashed
...........
editing/undo/redo-split-text-node.html -> crashed

Look like this change needs to be reverted. I'll have to investigate this failure.
Comment 28 Chris Guillory 2010-12-02 09:28:20 PST
Patch was reverted due to build failure.
http://trac.webkit.org/changeset/72628
Comment 29 Chris Guillory 2010-12-02 10:44:07 PST
Created attachment 75393 [details]
Patch

I ran the layout tests locally and didn't hit the crash issues. Not sure what the issue is.
Comment 30 chris fleizach 2010-12-02 10:46:10 PST
can you get a crash log from the crashing server
Comment 31 Chris Guillory 2010-12-02 10:54:06 PST
How would I do that? I can see the stdout which shows test cases crashing.
http://build.webkit.org/builders/GTK%20Linux%2064-bit%20Debug/builds/16603/steps/layout-test/logs/stdio
Comment 32 chris fleizach 2010-12-02 10:59:01 PST
yea it looks like if the tests aren't run to completion it doesn't collect crash logs unfortunately
Comment 33 chris fleizach 2010-12-03 12:52:33 PST
Comment on attachment 75393 [details]
Patch

yea it seems unlikely that this change caused tons of crashes. lets try again
Comment 34 WebKit Commit Bot 2010-12-03 14:07:34 PST
The commit-queue encountered the following flaky tests while processing attachment 75393 [details]:

http/tests/loading/load-javascript-after-many-xhrs.html
http/tests/security/xss-DENIED-mime-type-execute-as-html.html

Please file bugs against the tests.  These tests were authored by abarth@webkit.org, ddkilzer@webkit.org, hayato@chromium.org, inferno@chromium.org, and svillar@igalia.com.  The commit-queue is continuing to process your patch.
Comment 35 WebKit Commit Bot 2010-12-03 14:28:10 PST
Comment on attachment 75393 [details]
Patch

Clearing flags on attachment: 75393

Committed r73302: <http://trac.webkit.org/changeset/73302>
Comment 36 WebKit Commit Bot 2010-12-03 14:28:18 PST
All reviewed patches have been landed.  Closing bug.
Comment 37 chris fleizach 2010-12-03 14:45:02 PST
chris, does this fix also address
https://bugs.webkit.org/show_bug.cgi?id=49379
Comment 38 Chris Guillory 2010-12-03 14:47:50 PST
Yes.
Comment 39 Xan Lopez 2010-12-03 15:51:18 PST
I think this is causing crashes in the debug layout tests in GTK+, hitting an ASSERT. One trace: http://webkit-bots.igalia.com/amd64/svn_73312.core-when_1291419012-_-who_DumpRenderTree-_-why_11.trace.html
Comment 40 chris fleizach 2010-12-03 16:49:56 PST
(In reply to comment #39)
> I think this is causing crashes in the debug layout tests in GTK+, hitting an ASSERT. One trace: http://webkit-bots.igalia.com/amd64/svn_73312.core-when_1291419012-_-who_DumpRenderTree-_-why_11.trace.html

(In reply to comment #39)
> I think this is causing crashes in the debug layout tests in GTK+, hitting an ASSERT. One trace: http://webkit-bots.igalia.com/amd64/svn_73312.core-when_1291419012-_-who_DumpRenderTree-_-why_11.trace.html

So it looks like you can't pass in 0 to 
RenderWidget::find(frameViewIfRenderView())

and the other thing is that accessibility is always enabled on the GTK test bot, interestingly
Comment 41 Xan Lopez 2010-12-03 16:53:06 PST
(In reply to comment #40)
> and the other thing is that accessibility is always enabled on the GTK test bot, interestingly

a11y is enabled by default in the GTK+ port.
Comment 42 chris fleizach 2010-12-03 16:54:34 PST
(In reply to comment #41)
> (In reply to comment #40)
> > and the other thing is that accessibility is always enabled on the GTK test bot, interestingly
> 
> a11y is enabled by default in the GTK+ port.

good idea i think, helps catch more bugs
Comment 43 chris fleizach 2010-12-03 16:55:02 PST
changing resolved status back to unconfirmed
Comment 44 Chris Guillory 2010-12-06 16:13:03 PST
Created attachment 75746 [details]
Not passing 0 to RenderWidget::find
Comment 45 WebKit Review Bot 2010-12-06 16:16:15 PST
Attachment 75746 [details] did not pass style-queue:

Failed to run "[u'git', u'reset', u'--hard', u'HEAD']" exit_code: 128
error: Could not write new index file.
fatal: Could not reset index file to revision 'HEAD'.


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 46 chris fleizach 2010-12-13 12:25:26 PST
Comment on attachment 75746 [details]
Not passing 0 to RenderWidget::find

View in context: https://bugs.webkit.org/attachment.cgi?id=75746&action=review

> WebCore/accessibility/AccessibilityRenderObject.cpp:420
> +            return renderWidget;

since parent already is nil in this case, it probably doesn't matter if renderWidget is nil, so you could probably just do
if (frameView)
   return RenderWidget::find(frameView);
Comment 47 Chris Guillory 2010-12-13 19:13:27 PST
Created attachment 76485 [details]
Patch

- Using return RenderWidget::find(frameView) now.
- Added the iframe-has-document.html layout test back to the change.
Comment 48 Eric Seidel (no email) 2010-12-14 01:24:06 PST
Comment on attachment 74427 [details]
Added early return statements in AccessibilityRenderObject::addRenderWidgetChildren

Cleared Chris Fleizach's review+ from obsolete attachment 74427 [details] so that this bug does not appear in http://webkit.org/pending-commit.
Comment 49 Chris Guillory 2011-01-10 15:29:48 PST
Chris can you look this over when you get a chance?
Comment 50 chris fleizach 2011-01-10 15:30:39 PST
(In reply to comment #49)
> Chris can you look this over when you get a chance?

I made a bunch of changes to support WebKit2, one of which inserts the ScrollView widget into the AX tree. do you still need this patch in light of that?
Comment 51 Chris Guillory 2011-01-10 16:49:37 PST
That seems to resolve the original issue in Chromium. Thanks!