1 | /* |
2 | * Copyright (C) 2011 Apple Inc. All Rights Reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #include "config.h" |
27 | #include "AccessibilityUIElement.h" |
28 | |
29 | #include "JSAccessibilityUIElement.h" |
30 | |
31 | namespace WTR { |
32 | |
33 | Ref<AccessibilityUIElement> AccessibilityUIElement::create(PlatformUIElement uiElement) |
34 | { |
35 | return adoptRef(*new AccessibilityUIElement(uiElement)); |
36 | } |
37 | |
38 | Ref<AccessibilityUIElement> AccessibilityUIElement::create(const AccessibilityUIElement& uiElement) |
39 | { |
40 | return adoptRef(*new AccessibilityUIElement(uiElement)); |
41 | } |
42 | |
43 | JSClassRef AccessibilityUIElement::wrapperClass() |
44 | { |
45 | return JSAccessibilityUIElement::accessibilityUIElementClass(); |
46 | } |
47 | |
48 | // Implementation |
49 | |
50 | bool AccessibilityUIElement::isValid() const |
51 | { |
52 | return m_element; |
53 | } |
54 | |
55 | // iOS specific methods |
56 | #if !PLATFORM(IOS_FAMILY) |
57 | JSRetainPtr<JSStringRef> AccessibilityUIElement::identifier() { return nullptr; } |
58 | JSRetainPtr<JSStringRef> AccessibilityUIElement::traits() { return nullptr; } |
59 | int AccessibilityUIElement::elementTextPosition() { return 0; } |
60 | int AccessibilityUIElement::elementTextLength() { return 0; } |
61 | JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForSelection() { return nullptr; } |
62 | JSValueRef AccessibilityUIElement::elementsForRange(unsigned, unsigned) { return nullptr; } |
63 | void AccessibilityUIElement::increaseTextSelection() { } |
64 | void AccessibilityUIElement::decreaseTextSelection() { } |
65 | RefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedElement() { return nullptr; } |
66 | RefPtr<AccessibilityUIElement> AccessibilityUIElement::(unsigned) { return nullptr; } |
67 | void AccessibilityUIElement::assistiveTechnologySimulatedFocus() { return; } |
68 | bool AccessibilityUIElement::scrollPageUp() { return false; } |
69 | bool AccessibilityUIElement::scrollPageDown() { return false; } |
70 | bool AccessibilityUIElement::scrollPageLeft() { return false; } |
71 | bool AccessibilityUIElement::() { return false; } |
72 | bool AccessibilityUIElement::hasContainedByFieldsetTrait() { return false; } |
73 | RefPtr<AccessibilityUIElement> AccessibilityUIElement::fieldsetAncestorElement() { return nullptr; } |
74 | bool AccessibilityUIElement::isSearchField() const { return false; } |
75 | bool AccessibilityUIElement::isTextArea() const { return false; } |
76 | RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers(JSStringRef, AccessibilityTextMarker*, AccessibilityTextMarker*) { return nullptr; } |
77 | bool AccessibilityUIElement::dismiss() { return false; } |
78 | JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForElement() { return nullptr; } |
79 | #endif |
80 | |
81 | // Unsupported methods on various platforms. As they're implemented on other platforms this list should be modified. |
82 | #if PLATFORM(COCOA) || !HAVE(ACCESSIBILITY) |
83 | JSRetainPtr<JSStringRef> AccessibilityUIElement::characterAtOffset(int) { return nullptr; } |
84 | JSRetainPtr<JSStringRef> AccessibilityUIElement::wordAtOffset(int) { return nullptr; } |
85 | JSRetainPtr<JSStringRef> AccessibilityUIElement::lineAtOffset(int) { return nullptr; } |
86 | JSRetainPtr<JSStringRef> AccessibilityUIElement::sentenceAtOffset(int) { return nullptr; } |
87 | #endif |
88 | |
89 | #if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY) |
90 | RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; } |
91 | void AccessibilityUIElement::resetSelectedTextMarkerRange() { } |
92 | void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { } |
93 | void AccessibilityUIElement::setValue(JSStringRef) { } |
94 | JSValueRef AccessibilityUIElement::searchTextWithCriteria(JSContextRef, JSValueRef, JSStringRef, JSStringRef) { return nullptr; } |
95 | #endif |
96 | |
97 | #if !PLATFORM(COCOA) || !HAVE(ACCESSIBILITY) |
98 | RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
99 | RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
100 | RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
101 | RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
102 | RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
103 | RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
104 | RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
105 | RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
106 | RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
107 | RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; } |
108 | #endif |
109 | |
110 | } // namespace WTR |
111 | |