AX: Make video objects accessible on iOS
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 23:43:13 +0000 (23:43 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 23:43:13 +0000 (23:43 +0000)
commite458f3ad06bf95a63ec05fad40c16ce5e60faacc
tree6e049fe9b9944b3e9a9143e62a8bdf994b39aa7e
parent0bf4b7eb3fe3d4c4a97383300e0b564c51d1a81d
AX: Make video objects accessible on iOS
https://bugs.webkit.org/show_bug.cgi?id=177788
<rdar://problem/34778028>

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed certain <video> elements on iOS:
1. If they have no controls attribute set and have playsinline attribute set, that means
   normally there are custom controls provided.
2. Without autoplay attribute set. From iOS 10, with the motivation to improve performace by
   replacing GIF with <video>, elements will now honor the autoplay attribute if they
   have no audio. So normally those <video> elements are not interactive.

Also provided functions to let iOS users interact with the video elements:
- Play/Pause: accessibilityActivate
- Fast forward: accessibilityIncrement
- Rewind: accessibilityDecrement

Test: accessibility/ios-simulator/video-elements-ios.html

* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::createFromRenderer):
* accessibility/AccessibilityMediaObject.cpp: Added.
(WebCore::AccessibilityMediaObject::AccessibilityMediaObject):
(WebCore::AccessibilityMediaObject::~AccessibilityMediaObject):
(WebCore::AccessibilityMediaObject::create):
(WebCore::AccessibilityMediaObject::computeAccessibilityIsIgnored const):
(WebCore::AccessibilityMediaObject::mediaElement const):
(WebCore::AccessibilityMediaObject::stringValue const):
(WebCore::AccessibilityMediaObject::interactiveVideoDuration const):
(WebCore::AccessibilityMediaObject::mediaSeek):
(WebCore::AccessibilityMediaObject::toggleMute):
(WebCore::AccessibilityMediaObject::increment):
(WebCore::AccessibilityMediaObject::decrement):
(WebCore::AccessibilityMediaObject::press):
(WebCore::AccessibilityMediaObject::hasControlsAttributeSet const):
(WebCore::AccessibilityMediaObject::isPlaying const):
(WebCore::AccessibilityMediaObject::isMuted const):
(WebCore::AccessibilityMediaObject::isAutoplayEnabled const):
(WebCore::AccessibilityMediaObject::isPlayingInline const):
(WebCore::AccessibilityMediaObject::enterFullscreen const):
* accessibility/AccessibilityMediaObject.h: Added.
* accessibility/AccessibilityObject.cpp:
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isMediaObject const):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityIsWebInteractiveVideo]):
(-[WebAccessibilityObjectWrapper interactiveVideoDescription]):
(-[WebAccessibilityObjectWrapper accessibilityIsMediaPlaying]):
(-[WebAccessibilityObjectWrapper accessibilityIsMediaMuted]):
(-[WebAccessibilityObjectWrapper accessibilityToggleMuteForMedia]):
(-[WebAccessibilityObjectWrapper accessibilityVideoEnterFullscreen]):
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
(-[WebAccessibilityObjectWrapper stringValueShouldBeUsedInLabel]):
(-[WebAccessibilityObjectWrapper accessibilityLabel]):

LayoutTests:

* accessibility/ios-simulator/video-elements-ios-expected.txt: Added.
* accessibility/ios-simulator/video-elements-ios.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/video-elements-ios-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/video-elements-ios.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AccessibilityMediaObject.cpp [new file with mode: 0644]
Source/WebCore/accessibility/AccessibilityMediaObject.h [new file with mode: 0644]
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm