2 * Copyright (C) 2010 Apple Inc. All Rights Reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef AccessibilityTextMarker_h
27 #define AccessibilityTextMarker_h
29 #include <JavaScriptCore/JSObjectRef.h>
32 #define SUPPORTS_AX_TEXTMARKERS 1
34 #define SUPPORTS_AX_TEXTMARKERS 0
38 #include <wtf/RetainPtr.h>
39 typedef CFTypeRef PlatformTextMarker;
40 typedef CFTypeRef PlatformTextMarkerRange;
42 typedef void* PlatformTextMarker;
43 typedef void* PlatformTextMarkerRange;
46 class AccessibilityUIElement;
48 class AccessibilityTextMarker {
50 AccessibilityTextMarker(PlatformTextMarker);
51 AccessibilityTextMarker(const AccessibilityTextMarker&);
52 ~AccessibilityTextMarker();
54 PlatformTextMarker platformTextMarker() const;
56 static JSObjectRef makeJSAccessibilityTextMarker(JSContextRef, const AccessibilityTextMarker&);
57 bool isEqual(AccessibilityTextMarker*);
60 static JSClassRef getJSClass();
62 RetainPtr<PlatformTextMarker> m_textMarker;
64 PlatformTextMarker m_textMarker;
68 class AccessibilityTextMarkerRange {
70 AccessibilityTextMarkerRange(PlatformTextMarkerRange);
71 AccessibilityTextMarkerRange(const AccessibilityTextMarkerRange&);
72 ~AccessibilityTextMarkerRange();
74 PlatformTextMarkerRange platformTextMarkerRange() const;
76 static JSObjectRef makeJSAccessibilityTextMarkerRange(JSContextRef, const AccessibilityTextMarkerRange&);
77 bool isEqual(AccessibilityTextMarkerRange*);
80 static JSClassRef getJSClass();
82 RetainPtr<PlatformTextMarkerRange> m_textMarkerRange;
84 PlatformTextMarkerRange m_textMarkerRange;
88 AccessibilityTextMarker* toTextMarker(JSObjectRef object);
89 AccessibilityTextMarkerRange* toTextMarkerRange(JSObjectRef object);
91 #if !SUPPORTS_AX_TEXTMARKERS
92 inline AccessibilityTextMarker::AccessibilityTextMarker(PlatformTextMarker) { }
93 inline AccessibilityTextMarker::AccessibilityTextMarker(const AccessibilityTextMarker&) { }
94 inline AccessibilityTextMarker::~AccessibilityTextMarker() { }
95 inline bool AccessibilityTextMarker::isEqual(AccessibilityTextMarker*) { return false; }
96 inline PlatformTextMarker AccessibilityTextMarker::platformTextMarker() const { return m_textMarker; }
98 inline AccessibilityTextMarkerRange::AccessibilityTextMarkerRange(PlatformTextMarkerRange) { }
99 inline AccessibilityTextMarkerRange::AccessibilityTextMarkerRange(const AccessibilityTextMarkerRange&) { }
100 inline AccessibilityTextMarkerRange::~AccessibilityTextMarkerRange() { }
101 inline bool AccessibilityTextMarkerRange::isEqual(AccessibilityTextMarkerRange*) { return false; }
102 inline PlatformTextMarkerRange AccessibilityTextMarkerRange::platformTextMarkerRange() const { return m_textMarkerRange; }
105 #endif // AccessibilityUIElement_h