Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Side by Side Diff: Source/modules/accessibility/AXObjectCacheImpl.h

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014, Google Inc. All rights reserved. 2 * Copyright (C) 2014, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class AXObjectCacheImpl : public AXObjectCache { 56 class AXObjectCacheImpl : public AXObjectCache {
57 WTF_MAKE_NONCOPYABLE(AXObjectCacheImpl); WTF_MAKE_FAST_ALLOCATED; 57 WTF_MAKE_NONCOPYABLE(AXObjectCacheImpl); WTF_MAKE_FAST_ALLOCATED;
58 public: 58 public:
59 explicit AXObjectCacheImpl(Document&); 59 explicit AXObjectCacheImpl(Document&);
60 ~AXObjectCacheImpl(); 60 ~AXObjectCacheImpl();
61 61
62 AXObject* focusedUIElementForPage(const Page*); 62 AXObject* focusedUIElementForPage(const Page*);
63 63
64 virtual void selectionChanged(Node*) override; 64 virtual void selectionChanged(Node*) override;
65 virtual void childrenChanged(Node*) override; 65 virtual void childrenChanged(Node*) override;
66 virtual void childrenChanged(RenderObject*) override; 66 virtual void childrenChanged(LayoutObject*) override;
67 virtual void checkedStateChanged(Node*) override; 67 virtual void checkedStateChanged(Node*) override;
68 virtual void selectedChildrenChanged(Node*) override; 68 virtual void selectedChildrenChanged(Node*) override;
69 69
70 virtual void remove(RenderObject*) override; 70 virtual void remove(LayoutObject*) override;
71 virtual void remove(Node*) override; 71 virtual void remove(Node*) override;
72 virtual void remove(Widget*) override; 72 virtual void remove(Widget*) override;
73 73
74 virtual const Element* rootAXEditableElement(const Node*) override; 74 virtual const Element* rootAXEditableElement(const Node*) override;
75 75
76 // Called by a node when text or a text equivalent (e.g. alt) attribute is c hanged. 76 // Called by a node when text or a text equivalent (e.g. alt) attribute is c hanged.
77 virtual void textChanged(RenderObject*) override; 77 virtual void textChanged(LayoutObject*) override;
78 // Called when a node has just been attached, so we can make sure we have th e right subclass of AXObject. 78 // Called when a node has just been attached, so we can make sure we have th e right subclass of AXObject.
79 virtual void updateCacheAfterNodeIsAttached(Node*) override; 79 virtual void updateCacheAfterNodeIsAttached(Node*) override;
80 80
81 virtual void handleAttributeChanged(const QualifiedName& attrName, Element*) override; 81 virtual void handleAttributeChanged(const QualifiedName& attrName, Element*) override;
82 virtual void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFo cusedNode) override; 82 virtual void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFo cusedNode) override;
83 virtual void handleInitialFocus() override; 83 virtual void handleInitialFocus() override;
84 virtual void handleTextFormControlChanged(Node*) override; 84 virtual void handleTextFormControlChanged(Node*) override;
85 virtual void handleEditableTextContentChanged(Node*) override; 85 virtual void handleEditableTextContentChanged(Node*) override;
86 virtual void handleValueChanged(Node*) override; 86 virtual void handleValueChanged(Node*) override;
87 virtual void handleUpdateActiveMenuOption(RenderMenuList*, int optionIndex) override; 87 virtual void handleUpdateActiveMenuOption(RenderMenuList*, int optionIndex) override;
88 virtual void handleLoadComplete(Document*) override; 88 virtual void handleLoadComplete(Document*) override;
89 virtual void handleLayoutComplete(Document*) override; 89 virtual void handleLayoutComplete(Document*) override;
90 90
91 virtual void setCanvasObjectBounds(Element*, const LayoutRect&) override; 91 virtual void setCanvasObjectBounds(Element*, const LayoutRect&) override;
92 92
93 virtual void clearWeakMembers(Visitor*) override; 93 virtual void clearWeakMembers(Visitor*) override;
94 94
95 virtual void inlineTextBoxesUpdated(RenderObject* renderer) override; 95 virtual void inlineTextBoxesUpdated(LayoutObject* renderer) override;
96 96
97 // Called when the scroll offset changes. 97 // Called when the scroll offset changes.
98 virtual void handleScrollPositionChanged(FrameView*) override; 98 virtual void handleScrollPositionChanged(FrameView*) override;
99 virtual void handleScrollPositionChanged(RenderObject*) override; 99 virtual void handleScrollPositionChanged(LayoutObject*) override;
100 100
101 // Called when scroll bars are added / removed (as the view resizes). 101 // Called when scroll bars are added / removed (as the view resizes).
102 void handleScrollbarUpdate(FrameView*) override; 102 void handleScrollbarUpdate(FrameView*) override;
103 void handleLayoutComplete(RenderObject*) override; 103 void handleLayoutComplete(LayoutObject*) override;
104 void handleScrolledToAnchor(const Node* anchorNode) override; 104 void handleScrolledToAnchor(const Node* anchorNode) override;
105 105
106 virtual const AtomicString& computedRoleForNode(Node*) override; 106 virtual const AtomicString& computedRoleForNode(Node*) override;
107 virtual String computedNameForNode(Node*) override; 107 virtual String computedNameForNode(Node*) override;
108 108
109 // Returns the root object for the entire document. 109 // Returns the root object for the entire document.
110 AXObject* rootObject(); 110 AXObject* rootObject();
111 111
112 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); } 112 AXObject* objectFromAXID(AXID id) const { return m_objects.get(id); }
113 AXObject* root(); 113 AXObject* root();
114 114
115 // used for objects without backing elements 115 // used for objects without backing elements
116 AXObject* getOrCreate(AccessibilityRole); 116 AXObject* getOrCreate(AccessibilityRole);
117 AXObject* getOrCreate(RenderObject*); 117 AXObject* getOrCreate(LayoutObject*);
118 AXObject* getOrCreate(Widget*); 118 AXObject* getOrCreate(Widget*);
119 AXObject* getOrCreate(Node*); 119 AXObject* getOrCreate(Node*);
120 AXObject* getOrCreate(AbstractInlineTextBox*); 120 AXObject* getOrCreate(AbstractInlineTextBox*);
121 121
122 // will only return the AXObject if it already exists 122 // will only return the AXObject if it already exists
123 AXObject* get(Node*); 123 AXObject* get(Node*);
124 AXObject* get(RenderObject*); 124 AXObject* get(LayoutObject*);
125 AXObject* get(Widget*); 125 AXObject* get(Widget*);
126 AXObject* get(AbstractInlineTextBox*); 126 AXObject* get(AbstractInlineTextBox*);
127 127
128 AXObject* firstAccessibleObjectFromNode(const Node*); 128 AXObject* firstAccessibleObjectFromNode(const Node*);
129 129
130 void remove(AXID); 130 void remove(AXID);
131 void remove(AbstractInlineTextBox*); 131 void remove(AbstractInlineTextBox*);
132 132
133 void childrenChanged(AXObject*); 133 void childrenChanged(AXObject*);
134 void selectedChildrenChanged(RenderObject*); 134 void selectedChildrenChanged(LayoutObject*);
135 135
136 void handleActiveDescendantChanged(Node*); 136 void handleActiveDescendantChanged(Node*);
137 void handleAriaRoleChanged(Node*); 137 void handleAriaRoleChanged(Node*);
138 void handleAriaExpandedChange(Node*); 138 void handleAriaExpandedChange(Node*);
139 139
140 void recomputeIsIgnored(RenderObject* renderer); 140 void recomputeIsIgnored(LayoutObject* renderer);
141 141
142 bool accessibilityEnabled(); 142 bool accessibilityEnabled();
143 bool inlineTextBoxAccessibilityEnabled(); 143 bool inlineTextBoxAccessibilityEnabled();
144 144
145 void removeAXID(AXObject*); 145 void removeAXID(AXObject*);
146 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } 146 bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); }
147 147
148 AXID platformGenerateAXID() const; 148 AXID platformGenerateAXID() const;
149 149
150 // Counts the number of times the document has been modified. Some attribute values are cached 150 // Counts the number of times the document has been modified. Some attribute values are cached
151 // as long as the modification count hasn't changed. 151 // as long as the modification count hasn't changed.
152 int modificationCount() const { return m_modificationCount; } 152 int modificationCount() const { return m_modificationCount; }
153 153
154 void postNotification(RenderObject*, AXNotification, bool postToElement); 154 void postNotification(LayoutObject*, AXNotification, bool postToElement);
155 void postNotification(Node*, AXNotification, bool postToElement); 155 void postNotification(Node*, AXNotification, bool postToElement);
156 void postNotification(AXObject*, Document*, AXNotification, bool postToEleme nt); 156 void postNotification(AXObject*, Document*, AXNotification, bool postToEleme nt);
157 157
158 protected: 158 protected:
159 void postPlatformNotification(AXObject*, AXNotification); 159 void postPlatformNotification(AXObject*, AXNotification);
160 void textChanged(AXObject*); 160 void textChanged(AXObject*);
161 void labelChanged(Element*); 161 void labelChanged(Element*);
162 162
163 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid. 163 // This is a weak reference cache for knowing if Nodes used by TextMarkers a re valid.
164 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); } 164 void setNodeInUse(Node* n) { m_textMarkerNodes.add(n); }
165 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); } 165 void removeNodeForUse(Node* n) { m_textMarkerNodes.remove(n); }
166 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); } 166 bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
167 167
168 PassRefPtr<AXObject> createFromRenderer(RenderObject*); 168 PassRefPtr<AXObject> createFromRenderer(LayoutObject*);
169 PassRefPtr<AXObject> createFromNode(Node*); 169 PassRefPtr<AXObject> createFromNode(Node*);
170 PassRefPtr<AXObject> createFromInlineTextBox(AbstractInlineTextBox*); 170 PassRefPtr<AXObject> createFromInlineTextBox(AbstractInlineTextBox*);
171 171
172 private: 172 private:
173 Document& m_document; 173 Document& m_document;
174 HashMap<AXID, RefPtr<AXObject>> m_objects; 174 HashMap<AXID, RefPtr<AXObject>> m_objects;
175 HashMap<RenderObject*, AXID> m_renderObjectMapping; 175 HashMap<LayoutObject*, AXID> m_layoutObjectMapping;
176 HashMap<Widget*, AXID> m_widgetObjectMapping; 176 HashMap<Widget*, AXID> m_widgetObjectMapping;
177 HashMap<Node*, AXID> m_nodeObjectMapping; 177 HashMap<Node*, AXID> m_nodeObjectMapping;
178 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping; 178 HashMap<AbstractInlineTextBox*, AXID> m_inlineTextBoxObjectMapping;
179 HashSet<Node*> m_textMarkerNodes; 179 HashSet<Node*> m_textMarkerNodes;
180 int m_modificationCount; 180 int m_modificationCount;
181 181
182 HashSet<AXID> m_idsInUse; 182 HashSet<AXID> m_idsInUse;
183 183
184 Timer<AXObjectCacheImpl> m_notificationPostTimer; 184 Timer<AXObjectCacheImpl> m_notificationPostTimer;
185 Vector<pair<RefPtr<AXObject>, AXNotification>> m_notificationsToPost; 185 Vector<pair<RefPtr<AXObject>, AXNotification>> m_notificationsToPost;
(...skipping 12 matching lines...) Expand all
198 // This is the only subclass of AXObjectCache. 198 // This is the only subclass of AXObjectCache.
199 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true); 199 DEFINE_TYPE_CASTS(AXObjectCacheImpl, AXObjectCache, cache, true, true);
200 200
201 bool nodeHasRole(Node*, const String& role); 201 bool nodeHasRole(Node*, const String& role);
202 // This will let you know if aria-hidden was explicitly set to false. 202 // This will let you know if aria-hidden was explicitly set to false.
203 bool isNodeAriaVisible(Node*); 203 bool isNodeAriaVisible(Node*);
204 204
205 } 205 }
206 206
207 #endif 207 #endif
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXObject.cpp ('k') | Source/modules/accessibility/AXObjectCacheImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698