AX: Mail attachments at the start of an email are not output by VoiceOver
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Nov 2013 00:47:32 +0000 (00:47 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Nov 2013 00:47:32 +0000 (00:47 +0000)
commit3337bdb2160b522aafe917a7476c46baf8d71986
tree835f296dbf34d8678af30483450f6443cf5df7cf
parent148f345f25ae0107b6fa6bd547c2a65b765b4922
AX: Mail attachments at the start of an email are not output by VoiceOver
https://bugs.webkit.org/show_bug.cgi?id=123697

Reviewed by Ryosuke Niwa.

Source/WebCore:

VoiceOver is expecting that "replaced elements" (attachments in a Mail message in this case) to be
represented by the replacement character when asking for a stringForRange.

However, when that replaced element is at the beginning of the document, the logic does not work because
there is a few code places that will take that first Position and advance it forward, not accounting for replaced elements.
When using the TextIterator normally, it does account for these, so that's why it's only affecting as at the beginning of the document.

Also a "replaced element" can be more than just renderer->isReplaced(), hence the externing of the isRendererReplacedElement method
and using that it in pertinent places.

Tests: platform/mac/accessibility/object-replacement-with-no-rendered-children-at-node-start.html
       platform/mac/accessibility/object-replacement-with-rendered-children-at-node-start.html

* accessibility/AccessibilityObject.cpp:
(WebCore::replacedNodeNeedsCharacter):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(nsStringForReplacedNode):
* dom/Position.cpp:
(WebCore::Position::isCandidate):
* dom/PositionIterator.cpp:
* dom/Range.cpp:
(WebCore::Range::firstNode):
* editing/TextIterator.cpp:
(WebCore::isRendererReplacedElement):
* editing/TextIterator.h:

LayoutTests:

Add two flavors of this. One where the replaced element has rendered children and one where it does not,
which go down two different code paths.

* platform/mac/accessibility/object-replacement-with-no-rendered-children-at-node-start-expected.txt: Added.
* platform/mac/accessibility/object-replacement-with-no-rendered-children-at-node-start.html: Added.
* platform/mac/accessibility/object-replacement-with-rendered-children-at-node-start-expected.txt: Added.
* platform/mac/accessibility/object-replacement-with-rendered-children-at-node-start.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/object-replacement-with-no-rendered-children-at-node-start-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/object-replacement-with-no-rendered-children-at-node-start.html [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/object-replacement-with-rendered-children-at-node-start-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/object-replacement-with-rendered-children-at-node-start.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/dom/Position.cpp
Source/WebCore/dom/PositionIterator.cpp
Source/WebCore/dom/Range.cpp
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/editing/TextIterator.h
Tools/DumpRenderTree/AccessibilityUIElement.cpp
Tools/DumpRenderTree/AccessibilityUIElement.h
Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm