Chromium Code Reviews| Index: Source/modules/accessibility/AXObject.h |
| diff --git a/Source/modules/accessibility/AXObject.h b/Source/modules/accessibility/AXObject.h |
| index d3182fd4f02bdb7b9aee7bfb125e619efc32f8d8..0481038ebcbacfe41327a10258162329d867ea0c 100644 |
| --- a/Source/modules/accessibility/AXObject.h |
| +++ b/Source/modules/accessibility/AXObject.h |
| @@ -213,21 +213,36 @@ enum AccessibilityState { |
| AXVisitedState |
| }; |
| -struct AccessibilityText { |
| - String text; |
| - AccessibilityTextSource textSource; |
| - RefPtr<AXObject> textElement; |
| - |
| - AccessibilityText(const String& t, const AccessibilityTextSource& s) |
| - : text(t) |
| - , textSource(s) |
| - { } |
| +class AccessibilityText final : public NoBaseWillBeGarbageCollectedFinalized<AccessibilityText> { |
|
haraken
2015/06/09 02:25:45
Let's make this in a separate CL (before landing t
|
| +public: |
| + static PassOwnPtrWillBeRawPtr<AccessibilityText> create(const String& text, const AccessibilityTextSource& source) |
| + { |
| + return adoptPtrWillBeNoop(new AccessibilityText(text, source, nullptr)); |
| + } |
| + static PassOwnPtrWillBeRawPtr<AccessibilityText> create(const String& t, const AccessibilityTextSource& s, const RefPtrWillBeRawPtr<AXObject> element) |
| + { |
| + return adoptPtrWillBeNoop(new AccessibilityText(t, s, nullptr)); |
| + } |
| + |
| + String text() const { return m_text; } |
| + AccessibilityTextSource textSource() const { return m_textSource; } |
| + AXObject* textElement() const { return m_textElement.get(); } |
| + |
| + DEFINE_INLINE_TRACE() |
| + { |
| + visitor->trace(m_textElement); |
| + } |
| - AccessibilityText(const String& t, const AccessibilityTextSource& s, const RefPtr<AXObject> element) |
| - : text(t) |
| - , textSource(s) |
| - , textElement(element) |
| +private: |
| + AccessibilityText(const String& t, const AccessibilityTextSource& s, const PassRefPtrWillBeRawPtr<AXObject> element) |
| + : m_text(t) |
| + , m_textSource(s) |
| + , m_textElement(element) |
| { } |
| + |
| + String m_text; |
| + AccessibilityTextSource m_textSource; |
| + RefPtrWillBeMember<AXObject> m_textElement; |
| }; |
| enum AccessibilityOrientation { |
| @@ -350,9 +365,9 @@ struct IgnoredReason { |
| { } |
| }; |
| -class MODULES_EXPORT AXObject : public RefCounted<AXObject> { |
| +class MODULES_EXPORT AXObject : public RefCountedWillBeGarbageCollectedFinalized<AXObject> { |
| public: |
| - typedef Vector<RefPtr<AXObject>> AccessibilityChildrenVector; |
| + typedef WillBeHeapVector<RefPtrWillBeMember<AXObject>> AccessibilityChildrenVector; |
| struct PlainTextRange { |
| @@ -377,6 +392,7 @@ protected: |
| public: |
| virtual ~AXObject(); |
| + DECLARE_VIRTUAL_TRACE(); |
| // After constructing an AXObject, it must be given a |
| // unique ID, then added to AXObjectCacheImpl, and finally init() must |
| @@ -527,13 +543,13 @@ public: |
| // Retrieves the accessible name of the object, an enum indicating where the name |
| // was derived from, and a list of objects that were used to derive the name, if any. |
| - virtual String name(AXNameFrom&, Vector<AXObject*>& nameObjects); |
| + virtual String name(AXNameFrom&, WillBeHeapVector<RawPtrWillBeMember<AXObject>>& nameObjects); |
| // Takes the result of nameFrom from calling |name|, above, and retrieves the |
| // accessible description of the object, which is secondary to |name|, an enum indicating |
| // where the description was derived from, and a list of objects that were used to |
| // derive the description, if any. |
| - virtual String description(AXNameFrom, AXDescriptionFrom&, Vector<AXObject*>& descriptionObjects) { return String(); } |
| + virtual String description(AXNameFrom, AXDescriptionFrom&, WillBeHeapVector<RawPtrWillBeMember<AXObject>>& descriptionObjects) { return String(); } |
| // Takes the result of nameFrom and descriptionFrom from calling |name| and |description|, |
| // above, and retrieves the placeholder of the object, if present and if it wasn't already |
| @@ -541,7 +557,7 @@ public: |
| virtual String placeholder(AXNameFrom, AXDescriptionFrom) { return String(); } |
| // Internal function used by name and description, above. |
| - virtual String textAlternative(bool recursive, bool inAriaLabelledByTraversal, HashSet<AXObject*>& visited, AXNameFrom*, Vector<AXObject*>* nameObjects) { return String(); } |
| + virtual String textAlternative(bool recursive, bool inAriaLabelledByTraversal, WillBeHeapHashSet<RawPtrWillBeMember<AXObject>>& visited, AXNameFrom*, WillBeHeapVector<RawPtrWillBeMember<AXObject>>* nameObjects) { return String(); } |
| // Returns result of Accessible Name Calculation algorithm. |
| // This is a simpler high-level interface to |name| used by Inspector. |
| @@ -771,7 +787,7 @@ protected: |
| bool m_detached; |
| - mutable AXObject* m_parent; |
| + mutable RawPtrWillBeMember<AXObject> m_parent; |
| // The following cached attribute values (the ones starting with m_cached*) |
| // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modificationCount(). |
| @@ -782,9 +798,9 @@ protected: |
| mutable bool m_cachedIsDescendantOfDisabledNode : 1; |
| mutable bool m_cachedHasInheritedPresentationalRole : 1; |
| mutable bool m_cachedIsPresentationalChild : 1; |
| - mutable const AXObject* m_cachedLiveRegionRoot; |
| + mutable RawPtrWillBeMember<const AXObject> m_cachedLiveRegionRoot; |
| - AXObjectCacheImpl* m_axObjectCache; |
| + RawPtrWillBeMember<AXObjectCacheImpl> m_axObjectCache; |
| // Updates the cached attribute values. This may be recursive, so to prevent deadlocks, |
| // functions called here may only search up the tree (ancestors), not down. |