2 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 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 COMPUTER, 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 COMPUTER, 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 AXObjectCache_h
27 #define AXObjectCache_h
29 #include "core/CoreExport.h"
30 #include "core/dom/Document.h"
32 typedef unsigned AXID
;
36 class AbstractInlineTextBox
;
39 class HTMLOptionElement
;
40 class HTMLSelectElement
;
45 class CORE_EXPORT AXObjectCache
: public GarbageCollectedFinalized
<AXObjectCache
> {
46 WTF_MAKE_NONCOPYABLE(AXObjectCache
);
48 static AXObjectCache
* create(Document
&);
50 static AXObject
* focusedUIElementForPage(const Page
*);
52 virtual ~AXObjectCache();
53 DEFINE_INLINE_VIRTUAL_TRACE() { }
56 AXActiveDescendantChanged
,
58 AXAriaAttributeChanged
,
59 AXAutocorrectionOccured
,
61 AXCheckedStateChanged
,
63 AXFocusedUIElementChanged
,
65 AXInvalidStatusChanged
,
70 AXMenuListItemSelected
,
71 AXMenuListItemUnselected
,
72 AXMenuListValueChanged
,
76 AXScrollPositionChanged
,
78 AXSelectedChildrenChanged
,
79 AXSelectedTextChanged
,
87 virtual void dispose() = 0;
89 virtual void selectionChanged(Node
*) = 0;
90 virtual void childrenChanged(Node
*) = 0;
91 virtual void childrenChanged(LayoutObject
*) = 0;
92 virtual void checkedStateChanged(Node
*) = 0;
93 virtual void listboxOptionStateChanged(HTMLOptionElement
*) = 0;
94 virtual void listboxSelectedChildrenChanged(HTMLSelectElement
*) = 0;
95 virtual void listboxActiveIndexChanged(HTMLSelectElement
*) = 0;
97 virtual void remove(LayoutObject
*) = 0;
98 virtual void remove(Node
*) = 0;
99 virtual void remove(Widget
*) = 0;
100 virtual void remove(AbstractInlineTextBox
*) = 0;
102 virtual const Element
* rootAXEditableElement(const Node
*) = 0;
104 // Called by a node when text or a text equivalent (e.g. alt) attribute is changed.
105 virtual void textChanged(LayoutObject
*) = 0;
106 // Called when a node has just been attached, so we can make sure we have the right subclass of AXObject.
107 virtual void updateCacheAfterNodeIsAttached(Node
*) = 0;
109 virtual void handleAttributeChanged(const QualifiedName
& attrName
, Element
*) = 0;
110 virtual void handleFocusedUIElementChanged(Node
* oldFocusedNode
, Node
* newFocusedNode
) = 0;
111 virtual void handleInitialFocus() = 0;
112 virtual void handleEditableTextContentChanged(Node
*) = 0;
113 virtual void handleTextFormControlChanged(Node
*) = 0;
114 virtual void handleValueChanged(Node
*) = 0;
115 virtual void handleUpdateActiveMenuOption(LayoutMenuList
*, int optionIndex
) = 0;
116 virtual void didShowMenuListPopup(LayoutMenuList
*) = 0;
117 virtual void didHideMenuListPopup(LayoutMenuList
*) = 0;
118 virtual void handleLoadComplete(Document
*) = 0;
119 virtual void handleLayoutComplete(Document
*) = 0;
122 virtual void setCanvasObjectBounds(Element
*, const LayoutRect
&) = 0;
124 virtual void inlineTextBoxesUpdated(LayoutObject
*) = 0;
126 // Called when the scroll offset changes.
127 virtual void handleScrollPositionChanged(FrameView
*) = 0;
128 virtual void handleScrollPositionChanged(LayoutObject
*) = 0;
130 // Called when scroll bars are added / removed (as the view resizes).
131 virtual void handleScrollbarUpdate(FrameView
*) = 0;
132 virtual void handleLayoutComplete(LayoutObject
*) = 0;
133 virtual void handleScrolledToAnchor(const Node
* anchorNode
) = 0;
135 virtual const AtomicString
& computedRoleForNode(Node
*) = 0;
136 virtual String
computedNameForNode(Node
*) = 0;
138 typedef AXObjectCache
* (*AXObjectCacheCreateFunction
)(Document
&);
139 static void init(AXObjectCacheCreateFunction
);
145 static AXObjectCacheCreateFunction m_createFunction
;
148 class CORE_EXPORT ScopedAXObjectCache
{
149 WTF_MAKE_FAST_ALLOCATED(ScopedAXObjectCache
);
150 WTF_MAKE_NONCOPYABLE(ScopedAXObjectCache
);
152 static PassOwnPtr
<ScopedAXObjectCache
> create(Document
&);
153 ~ScopedAXObjectCache();
155 AXObjectCache
* get();
158 explicit ScopedAXObjectCache(Document
&);
160 RefPtrWillBePersistent
<Document
> m_document
;
161 Persistent
<AXObjectCache
> m_cache
;