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

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

Issue 1175533004: Refactor: Clear m_axObjectCache when AXObject detaches (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added ASSERT Created 5 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nuanti Ltd. 3 * Copyright (C) 2008 Nuanti Ltd.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 PlainTextRange(unsigned s, unsigned l) 368 PlainTextRange(unsigned s, unsigned l)
369 : start(s) 369 : start(s)
370 , length(l) 370 , length(l)
371 { } 371 { }
372 372
373 bool isNull() const { return !start && !length; } 373 bool isNull() const { return !start && !length; }
374 }; 374 };
375 375
376 protected: 376 protected:
377 AXObject(AXObjectCacheImpl*); 377 AXObject(AXObjectCacheImpl&);
378 378
379 public: 379 public:
380 virtual ~AXObject(); 380 virtual ~AXObject();
381 381
382 // After constructing an AXObject, it must be given a 382 // After constructing an AXObject, it must be given a
383 // unique ID, then added to AXObjectCacheImpl, and finally init() must 383 // unique ID, then added to AXObjectCacheImpl, and finally init() must
384 // be called last. 384 // be called last.
385 void setAXObjectID(AXID axObjectID) { m_id = axObjectID; } 385 void setAXObjectID(AXID axObjectID) { m_id = axObjectID; }
386 virtual void init() { } 386 virtual void init() { }
387 387
388 // When the corresponding WebCore object that this AXObject 388 // When the corresponding WebCore object that this AXObject
389 // wraps is deleted, it must be detached. 389 // wraps is deleted, it must be detached.
390 virtual void detach(); 390 virtual void detach();
391 virtual bool isDetached() const; 391 virtual bool isDetached() const;
392 392
393 // If the parent of this object is known, this can be faster than using comp uteParent(). 393 // If the parent of this object is known, this can be faster than using comp uteParent().
394 virtual void setParent(AXObject* parent) { m_parent = parent; } 394 virtual void setParent(AXObject* parent) { m_parent = parent; }
395 395
396 // The AXObjectCacheImpl that owns this object, and its unique ID within thi s cache. 396 // The AXObjectCacheImpl that owns this object, and its unique ID within thi s cache.
397 AXObjectCacheImpl* axObjectCache() const { return m_axObjectCache; } 397 AXObjectCacheImpl& axObjectCache() const
398 {
399 ASSERT(m_axObjectCache);
400 return *m_axObjectCache;
401 }
398 402
399 AXID axObjectID() const { return m_id; } 403 AXID axObjectID() const { return m_id; }
400 404
401 // Determine subclass type. 405 // Determine subclass type.
402 virtual bool isAXNodeObject() const { return false; } 406 virtual bool isAXNodeObject() const { return false; }
403 virtual bool isAXLayoutObject() const { return false; } 407 virtual bool isAXLayoutObject() const { return false; }
404 virtual bool isAXListBox() const { return false; } 408 virtual bool isAXListBox() const { return false; }
405 virtual bool isAXListBoxOption() const { return false; } 409 virtual bool isAXListBoxOption() const { return false; }
406 virtual bool isAXScrollbar() const { return false; } 410 virtual bool isAXScrollbar() const { return false; }
407 virtual bool isAXScrollView() const { return false; } 411 virtual bool isAXScrollView() const { return false; }
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 LayoutRect m_explicitElementRect; 768 LayoutRect m_explicitElementRect;
765 769
766 virtual const AXObject* inheritsPresentationalRoleFrom() const { return 0; } 770 virtual const AXObject* inheritsPresentationalRoleFrom() const { return 0; }
767 771
768 bool nameFromContents() const; 772 bool nameFromContents() const;
769 773
770 AccessibilityRole buttonRoleType() const; 774 AccessibilityRole buttonRoleType() const;
771 775
772 unsigned getLengthForTextRange() const { return text().length(); } 776 unsigned getLengthForTextRange() const { return text().length(); }
773 777
774 bool m_detached;
775
776 mutable AXObject* m_parent; 778 mutable AXObject* m_parent;
777 779
778 // The following cached attribute values (the ones starting with m_cached*) 780 // The following cached attribute values (the ones starting with m_cached*)
779 // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modi ficationCount(). 781 // are only valid if m_lastModificationCount matches AXObjectCacheImpl::modi ficationCount().
780 mutable int m_lastModificationCount; 782 mutable int m_lastModificationCount;
781 mutable bool m_cachedIsIgnored : 1; 783 mutable bool m_cachedIsIgnored : 1;
782 mutable bool m_cachedIsInertOrAriaHidden : 1; 784 mutable bool m_cachedIsInertOrAriaHidden : 1;
783 mutable bool m_cachedIsDescendantOfLeafNode : 1; 785 mutable bool m_cachedIsDescendantOfLeafNode : 1;
784 mutable bool m_cachedIsDescendantOfDisabledNode : 1; 786 mutable bool m_cachedIsDescendantOfDisabledNode : 1;
785 mutable bool m_cachedHasInheritedPresentationalRole : 1; 787 mutable bool m_cachedHasInheritedPresentationalRole : 1;
(...skipping 10 matching lines...) Expand all
796 static bool includesARIAWidgetRole(const String&); 798 static bool includesARIAWidgetRole(const String&);
797 static bool hasInteractiveARIAAttribute(const Element&); 799 static bool hasInteractiveARIAAttribute(const Element&);
798 }; 800 };
799 801
800 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \ 802 #define DEFINE_AX_OBJECT_TYPE_CASTS(thisType, predicate) \
801 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred icate) 803 DEFINE_TYPE_CASTS(thisType, AXObject, object, object->predicate, object.pred icate)
802 804
803 } // namespace blink 805 } // namespace blink
804 806
805 #endif // AXObject_h 807 #endif // AXObject_h
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.cpp ('k') | Source/modules/accessibility/AXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698