AX: <attachment> element not accessible
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Apr 2016 06:31:37 +0000 (06:31 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Apr 2016 06:31:37 +0000 (06:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156045

Reviewed by Joanmarie Diggs.

Source/WebCore:

Make this element accessible by exposing title, subtitle, action, progress to accessibility.

Test: accessibility/attachment-element.html

* accessibility/AXObjectCache.cpp:
(WebCore::createFromRenderer):
* accessibility/AccessibilityAttachment.cpp: Added.
(WebCore::AccessibilityAttachment::AccessibilityAttachment):
(WebCore::AccessibilityAttachment::create):
(WebCore::AccessibilityAttachment::hasProgress):
(WebCore::AccessibilityAttachment::valueForRange):
(WebCore::AccessibilityAttachment::attachmentElement):
(WebCore::AccessibilityAttachment::roleDescription):
(WebCore::AccessibilityAttachment::computeAccessibilityIsIgnored):
(WebCore::AccessibilityAttachment::accessibilityText):
(WebCore::AccessibilityAttachment::accessibilityDescription):
* accessibility/AccessibilityAttachment.h: Added.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::hasHighlighting):
(WebCore::AccessibilityObject::roleDescription):
(WebCore::AccessibilityObject::supportsRangeValue):
(WebCore::AccessibilityObject::supportsARIASetSize):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isAttachmentElement):
(WebCore::AccessibilityObject::isHeading):
(WebCore::AccessibilityObject::isLink):
(WebCore::AccessibilityObject::isImage):
(WebCore::AccessibilityObject::isRadioButton):
(WebCore::AccessibilityObject::isListBox):
(WebCore::AccessibilityObject::isListBoxOption):
(WebCore::AccessibilityObject::isAttachment):
(WebCore::AccessibilityObject::isMediaTimeline):
(WebCore::AccessibilityObject::isMenuRelated):
(WebCore::AccessibilityObject::isMenu):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityValue]):

LayoutTests:

* accessibility/attachment-element-expected.txt: Added.
* accessibility/attachment-element.html: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198942 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/attachment-element-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/attachment-element.html [new file with mode: 0644]
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AccessibilityAllInOne.cpp
Source/WebCore/accessibility/AccessibilityAttachment.cpp [new file with mode: 0644]
Source/WebCore/accessibility/AccessibilityAttachment.h [new file with mode: 0644]
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h

index fe9cf4b..68a8800 100644 (file)
@@ -1,3 +1,15 @@
+2016-03-31  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: <attachment> element not accessible
+        https://bugs.webkit.org/show_bug.cgi?id=156045
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/attachment-element-expected.txt: Added.
+        * accessibility/attachment-element.html: Added.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+
 2016-03-31  Nan Wang  <n_wang@apple.com>
 
         AX: AX hit-testing does not work on WebKit video playback buttons
diff --git a/LayoutTests/accessibility/attachment-element-expected.txt b/LayoutTests/accessibility/attachment-element-expected.txt
new file mode 100644 (file)
index 0000000..4b08210
--- /dev/null
@@ -0,0 +1,12 @@
+This tests that attachment elements are accessible.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Attachment description: AXDescription: title, subtitle, action
+Attachment value: AXValue: 0.5
+Attachment role: AXRoleDescription: attachment
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/attachment-element.html b/LayoutTests/accessibility/attachment-element.html
new file mode 100644 (file)
index 0000000..6680c58
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../resources/js-test-pre.js"></script>
+<script>
+    if (window.internals)
+        window.internals.settings.setAttachmentElementEnabled(true)
+</script>
+</head>
+<body id="body">
+
+<attachment id="attachment" title="title" subtitle="subtitle" action="action" progress="0.5"></attachment>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that attachment elements are accessible.");
+
+    if (window.accessibilityController) {
+        var content = accessibilityController.accessibleElementById("attachment");
+        debug("Attachment description: " + content.description);
+        debug("Attachment value: " + content.stringValue);
+        debug("Attachment role: " + content.roleDescription);
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index e39c423..b70268a 100644 (file)
@@ -2104,6 +2104,7 @@ webkit.org/b/112014 accessibility/textarea-insertion-point-line-number.html [ Fa
 webkit.org/b/112018 accessibility/th-as-title-ui.html [ Failure ]
 webkit.org/b/112021 accessibility/visible-elements.html [ Failure Crash ]
 webkit.org/b/133148 accessibility/set-selected-text-range-contenteditable.html [ Skip ]
+webkit.org/b/156045 accessibility/attachment-element.html [ Skip ]
 
 # New accessibility test added in r151079 that is failing for EFL.
 webkit.org/b/117182 accessibility/text-role-with-aria-hidden-inside.html [ Failure ]
index 7113f6b..1ac7836 100644 (file)
@@ -89,6 +89,7 @@ webkit.org/b/98348 accessibility/radio-button-group-members.html [ Skip ]
 webkit.org/b/141074 accessibility/auto-filled-value.html [ Skip ]
 webkit.org/b/133148 accessibility/content-editable-as-textarea.html [ Skip ]
 webkit.org/b/133148 accessibility/set-selected-text-range-contenteditable.html [ Skip ]
+webkit.org/b/156045 accessibility/attachment-element.html [ Skip ]
 
 # Feature disabled, see: https://bugs.webkit.org/show_bug.cgi?id=85425
 webkit.org/b/98925 fast/viewport/viewport-legacy-handheldfriendly.html [ Skip ]
index 8510b57..daafb7d 100644 (file)
@@ -1043,6 +1043,7 @@ set(WebCore_SOURCES
     accessibility/AccessibilityARIAGrid.cpp
     accessibility/AccessibilityARIAGridCell.cpp
     accessibility/AccessibilityARIAGridRow.cpp
+    accessibility/AccessibilityAttachment.cpp
     accessibility/AccessibilityImageMapLink.cpp
     accessibility/AccessibilityList.cpp
     accessibility/AccessibilityListBox.cpp
index 7c138f0..67b6121 100644 (file)
@@ -1,3 +1,47 @@
+2016-03-31  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: <attachment> element not accessible
+        https://bugs.webkit.org/show_bug.cgi?id=156045
+
+        Reviewed by Joanmarie Diggs.
+
+        Make this element accessible by exposing title, subtitle, action, progress to accessibility.
+
+        Test: accessibility/attachment-element.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::createFromRenderer):
+        * accessibility/AccessibilityAttachment.cpp: Added.
+        (WebCore::AccessibilityAttachment::AccessibilityAttachment):
+        (WebCore::AccessibilityAttachment::create):
+        (WebCore::AccessibilityAttachment::hasProgress):
+        (WebCore::AccessibilityAttachment::valueForRange):
+        (WebCore::AccessibilityAttachment::attachmentElement):
+        (WebCore::AccessibilityAttachment::roleDescription):
+        (WebCore::AccessibilityAttachment::computeAccessibilityIsIgnored):
+        (WebCore::AccessibilityAttachment::accessibilityText):
+        (WebCore::AccessibilityAttachment::accessibilityDescription):
+        * accessibility/AccessibilityAttachment.h: Added.
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::hasHighlighting):
+        (WebCore::AccessibilityObject::roleDescription):
+        (WebCore::AccessibilityObject::supportsRangeValue):
+        (WebCore::AccessibilityObject::supportsARIASetSize):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isAttachmentElement):
+        (WebCore::AccessibilityObject::isHeading):
+        (WebCore::AccessibilityObject::isLink):
+        (WebCore::AccessibilityObject::isImage):
+        (WebCore::AccessibilityObject::isRadioButton):
+        (WebCore::AccessibilityObject::isListBox):
+        (WebCore::AccessibilityObject::isListBoxOption):
+        (WebCore::AccessibilityObject::isAttachment):
+        (WebCore::AccessibilityObject::isMediaTimeline):
+        (WebCore::AccessibilityObject::isMenuRelated):
+        (WebCore::AccessibilityObject::isMenu):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityValue]):
+
 2016-03-31  Nan Wang  <n_wang@apple.com>
 
         AX: AX hit-testing does not work on WebKit video playback buttons
index 69cb08e..0912b9b 100644 (file)
 /* An ARIA accessibility group that acts as an article. */
 "article" = "article";
 
+/* accessibility role description for an attachment element */
+"attachment" = "attachment";
+
 /* accessibility help text for audio element controller */
 "audio element playback controls and status display" = "audio element playback controls and status display";
 
index 381b60e..4661db0 100644 (file)
                26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */; };
                26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */; };
                26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */; };
+               2914E3071CAB5A440049966F /* AccessibilityAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */; };
+               2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */; };
                2917B5611473496C0052C9D0 /* LayerFlushScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */; };
                2917B5621473496C0052C9D0 /* LayerFlushScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2917B5631473496C0052C9D0 /* LayerFlushSchedulerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; };
                26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; };
                26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronousResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; };
+               2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityAttachment.cpp; sourceTree = "<group>"; };
+               2914E3061CAB5A440049966F /* AccessibilityAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityAttachment.h; sourceTree = "<group>"; };
                2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerFlushScheduler.cpp; sourceTree = "<group>"; };
                2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFlushScheduler.h; sourceTree = "<group>"; };
                2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFlushSchedulerClient.h; sourceTree = "<group>"; };
                                29A812100FBB9C1D00510293 /* AccessibilityARIAGridCell.h */,
                                2981CA9F131822EC00D12F2A /* AccessibilityARIAGridRow.cpp */,
                                29A812150FBB9C1D00510293 /* AccessibilityARIAGridRow.h */,
+                               2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */,
+                               2914E3061CAB5A440049966F /* AccessibilityAttachment.h */,
                                2981CAA0131822EC00D12F2A /* AccessibilityImageMapLink.cpp */,
                                29A8121D0FBB9C1D00510293 /* AccessibilityImageMapLink.h */,
                                2981CAA1131822EC00D12F2A /* AccessibilityList.cpp */,
                                C58361A91744523F00173511 /* FontServicesIOS.h in Headers */,
                                C2015C0A1BE6FEB200822389 /* FontVariantBuilder.h in Headers */,
                                4A0DA2FF129B241900AB61E1 /* FormAssociatedElement.h in Headers */,
+                               2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */,
                                D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */,
                                7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */,
                                F50664F8157F52DC00AC226F /* FormController.h in Headers */,
                                F55B3DDD1251F12D003EF269 /* URLInputType.cpp in Sources */,
                                6593923A09AE435C002C531F /* URLMac.mm in Sources */,
                                A769E96A16689D0C005D4529 /* UserActionElementSet.cpp in Sources */,
+                               2914E3071CAB5A440049966F /* AccessibilityAttachment.cpp in Sources */,
                                868160D418766A0A0021E79D /* UserActivity.cpp in Sources */,
                                868160D518766A0E0021E79D /* UserActivityMac.mm in Sources */,
                                5D5975B71963637B00D00878 /* UserAgent.mm in Sources */,
index 8cef1af..d1c8f32 100644 (file)
@@ -35,6 +35,7 @@
 #include "AccessibilityARIAGrid.h"
 #include "AccessibilityARIAGridCell.h"
 #include "AccessibilityARIAGridRow.h"
+#include "AccessibilityAttachment.h"
 #include "AccessibilityImageMapLink.h"
 #include "AccessibilityList.h"
 #include "AccessibilityListBox.h"
@@ -71,6 +72,7 @@
 #include "HTMLMeterElement.h"
 #include "HTMLNames.h"
 #include "Page.h"
+#include "RenderAttachment.h"
 #include "RenderListBox.h"
 #include "RenderMenuList.h"
 #include "RenderMeter.h"
@@ -428,6 +430,10 @@ static Ref<AccessibilityObject> createFromRenderer(RenderObject* renderer)
         if (is<RenderProgress>(cssBox))
             return AccessibilityProgressIndicator::create(&downcast<RenderProgress>(cssBox));
 
+#if ENABLE(ATTACHMENT_ELEMENT)
+        if (is<RenderAttachment>(cssBox))
+            return AccessibilityAttachment::create(&downcast<RenderAttachment>(cssBox));
+#endif
 #if ENABLE(METER_ELEMENT)
         if (is<RenderMeter>(cssBox))
             return AccessibilityProgressIndicator::create(&downcast<RenderMeter>(cssBox));
index 1bb76ea..454bc44 100644 (file)
@@ -29,6 +29,7 @@
 #include "AccessibilityARIAGrid.cpp"
 #include "AccessibilityARIAGridCell.cpp"
 #include "AccessibilityARIAGridRow.cpp"
+#include "AccessibilityAttachment.cpp"
 #include "AccessibilityImageMapLink.cpp"
 #include "AccessibilityList.cpp"
 #include "AccessibilityListBox.cpp"
diff --git a/Source/WebCore/accessibility/AccessibilityAttachment.cpp b/Source/WebCore/accessibility/AccessibilityAttachment.cpp
new file mode 100644 (file)
index 0000000..2f3f3e9
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AccessibilityAttachment.h"
+
+#include "HTMLAttachmentElement.h"
+#include "HTMLNames.h"
+#include "LocalizedStrings.h"
+#include "RenderAttachment.h"
+
+#if ENABLE(ATTACHMENT_ELEMENT)
+
+namespace WebCore {
+    
+using namespace HTMLNames;
+
+AccessibilityAttachment::AccessibilityAttachment(RenderAttachment* renderer)
+    : AccessibilityRenderObject(renderer)
+{
+}
+
+Ref<AccessibilityAttachment> AccessibilityAttachment::create(RenderAttachment* renderer)
+{
+    return adoptRef(*new AccessibilityAttachment(renderer));
+}
+
+bool AccessibilityAttachment::hasProgress(float* progress) const
+{
+    auto& progressString = getAttribute(progressAttr);
+    bool validProgress;
+    float result = std::max<float>(std::min<float>(progressString.toFloat(&validProgress), 1), 0);
+    if (progress)
+        *progress = result;
+    return validProgress;
+}
+
+float AccessibilityAttachment::valueForRange() const
+{
+    float progress = 0;
+    hasProgress(&progress);
+    return progress;
+}
+    
+HTMLAttachmentElement* AccessibilityAttachment::attachmentElement() const
+{
+    ASSERT(is<HTMLAttachmentElement>(node()));
+    if (!is<HTMLAttachmentElement>(node()))
+        return nullptr;
+    
+    return downcast<HTMLAttachmentElement>(node());
+}
+    
+String AccessibilityAttachment::roleDescription() const
+{
+    return AXAttachmentRoleText();
+}
+
+bool AccessibilityAttachment::computeAccessibilityIsIgnored() const
+{
+    return false;
+}
+    
+void AccessibilityAttachment::accessibilityText(Vector<AccessibilityText>& textOrder)
+{
+    HTMLAttachmentElement* attachmentElement = this->attachmentElement();
+    if (!attachmentElement)
+        return;
+    
+    auto title = attachmentElement->attachmentTitle();
+    auto& subtitle = getAttribute(subtitleAttr);
+    auto& action = getAttribute(actionAttr);
+    
+    if (title.length())
+        textOrder.append(AccessibilityText(title, TitleText));
+
+    if (subtitle.length())
+        textOrder.append(AccessibilityText(subtitle, SubtitleText));
+    
+    if (action.length())
+        textOrder.append(AccessibilityText(action, ActionText));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(ATTACHMENT_ELEMENT)
+
diff --git a/Source/WebCore/accessibility/AccessibilityAttachment.h b/Source/WebCore/accessibility/AccessibilityAttachment.h
new file mode 100644 (file)
index 0000000..30a7c68
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityAttachment_h
+#define AccessibilityAttachment_h
+
+#if ENABLE(ATTACHMENT_ELEMENT)
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+    
+class HTMLAttachmentElement;
+class RenderAttachment;
+    
+class AccessibilityAttachment final : public AccessibilityRenderObject {
+public:
+    static Ref<AccessibilityAttachment> create(RenderAttachment*);
+    HTMLAttachmentElement* attachmentElement() const;
+    bool hasProgress(float* progress = nullptr) const;
+    
+private:
+    AccessibilityRole roleValue() const override { return ButtonRole; }
+    bool isAttachmentElement() const override { return true; }
+
+    String roleDescription() const override;
+    float valueForRange() const override;
+    bool computeAccessibilityIsIgnored() const override;
+    void accessibilityText(Vector<AccessibilityText>&) override;
+    explicit AccessibilityAttachment(RenderAttachment*);
+};
+    
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AccessibilityAttachment, isAttachmentElement())
+
+#endif // ENABLE(ATTACHMENT_ELEMENT)
+
+#endif // AccessibilityAttachment_h
index 23c7eb7..9526728 100644 (file)
@@ -2153,7 +2153,7 @@ bool AccessibilityObject::hasHighlighting() const
     return false;
 }
 
-const AtomicString& AccessibilityObject::roleDescription() const
+String AccessibilityObject::roleDescription() const
 {
     return getAttribute(aria_roledescriptionAttr);
 }
@@ -2347,7 +2347,8 @@ bool AccessibilityObject::supportsRangeValue() const
     return isProgressIndicator()
         || isSlider()
         || isScrollbar()
-        || isSpinButton();
+        || isSpinButton()
+        || isAttachmentElement();
 }
     
 bool AccessibilityObject::supportsARIASetSize() const
index 5436f3a..0272195 100644 (file)
@@ -237,6 +237,9 @@ enum AccessibilityTextSource {
     TitleTagText,
     PlaceholderText,
     LabelByElementText,
+    TitleText,
+    SubtitleText,
+    ActionText,
 };
     
 struct AccessibilityText {
@@ -473,7 +476,7 @@ public:
 
     bool accessibilityObjectContainsText(String *) const;
 
-    virtual bool isAttachment() const { return false; }
+    virtual bool isAttachmentElement() const { return false; }
     virtual bool isHeading() const { return false; }
     virtual bool isLink() const { return false; }
     virtual bool isImage() const { return false; }
@@ -490,6 +493,7 @@ public:
     virtual bool isRadioButton() const { return roleValue() == RadioButtonRole; }
     virtual bool isListBox() const { return roleValue() == ListBoxRole; }
     virtual bool isListBoxOption() const { return false; }
+    virtual bool isAttachment() const { return false; }
     virtual bool isMediaTimeline() const { return false; }
     virtual bool isMenuRelated() const { return false; }
     virtual bool isMenu() const { return false; }
@@ -634,7 +638,7 @@ public:
     bool supportsRangeValue() const;
     String identifierAttribute() const;
     void classList(Vector<String>&) const;
-    const AtomicString& roleDescription() const;
+    virtual String roleDescription() const;
     AccessibilityARIACurrentState ariaCurrentState() const;
     
     // This function checks if the object should be ignored when there's a modal dialog displayed.
index 5c99fb7..c20a8c0 100644 (file)
@@ -28,6 +28,7 @@
 
 #if HAVE(ACCESSIBILITY) && PLATFORM(IOS)
 
+#import "AccessibilityAttachment.h"
 #import "AccessibilityRenderObject.h"
 #import "AccessibilityScrollView.h"
 #import "AccessibilityTable.h"
@@ -1252,6 +1253,9 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
         return [NSString stringWithFormat:@"%.2f", m_object->valueForRange()];
     }
 
+    if (is<AccessibilityAttachment>(m_object) && downcast<AccessibilityAttachment>(m_object)->hasProgress())
+        return [NSString stringWithFormat:@"%.2f", m_object->valueForRange()];
+    
     if (m_object->isHeading())
         return [NSString stringWithFormat:@"%d", m_object->headingLevel()];
     
index 2afc8bd..2c92688 100644 (file)
@@ -189,13 +189,27 @@ static NSArray *convertMathPairsToNSArray(const AccessibilityObject::Accessibili
     
     Vector<AccessibilityText> textOrder;
     m_object->accessibilityText(textOrder);
-    
+
+    NSMutableString *returnText = [NSMutableString string];
     bool visibleTextAvailable = false;
     for (const auto& text : textOrder) {
-        if (text.textSource == AlternativeText)
-            return text.text;
+        if (text.textSource == AlternativeText) {
+            [returnText appendString:text.text];
+            break;
+        }
         
         switch (text.textSource) {
+        // These are sub-components of one element (Attachment) that are re-combined in OSX and iOS.
+        case TitleText:
+        case SubtitleText:
+        case ActionText: {
+            if (!text.text.length())
+                break;
+            if ([returnText length])
+                [returnText appendString:@", "];
+            [returnText appendString:text.text];
+            break;
+        }
         case VisibleText:
         case ChildrenText:
         case LabelByElementText:
@@ -205,11 +219,13 @@ static NSArray *convertMathPairsToNSArray(const AccessibilityObject::Accessibili
             break;
         }
         
-        if (text.textSource == TitleTagText && !visibleTextAvailable)
-            return text.text;
+        if (text.textSource == TitleTagText && !visibleTextAvailable) {
+            [returnText appendString:text.text];
+            break;
+        }
     }
     
-    return [NSString string];
+    return returnText;
 }
 
 - (NSString *)baseAccessibilityHelpText
index 16d22d6..f503fcd 100644 (file)
@@ -619,6 +619,11 @@ String AXFileUploadButtonText()
     return WEB_UI_STRING("file upload button", "accessibility role description for a file upload button");
 }
 
+String AXAttachmentRoleText()
+{
+    return WEB_UI_STRING("attachment", "accessibility role description for an attachment element");
+}
+    
 String AXSearchFieldCancelButtonText()
 {
     return WEB_UI_STRING("cancel", "accessibility description for a search field cancel button");
index 9f5915c..54c3eb4 100644 (file)
@@ -167,6 +167,7 @@ namespace WebCore {
     String AXFooterRoleDescriptionText();
     String AXFileUploadButtonText();
     String AXSearchFieldCancelButtonText();
+    String AXAttachmentRoleText();
     
     String AXButtonActionVerb();
     String AXRadioButtonActionVerb();