Title: [150145] trunk/Source/WebCore
Revision
150145
Author
[email protected]
Date
2013-05-15 13:51:02 -0700 (Wed, 15 May 2013)

Log Message

AX: Use caching when requesting children object on iOS
https://bugs.webkit.org/show_bug.cgi?id=116112

Reviewed by David Kilzer.

Building up the children list in the AX hierarchy can be time consuming. On iOS, this
is now much more noticeable (I believe due to the way tables calculate their AX ignored flag).

We can speed everything up if we just cache the isIgnored() attribute while building up children.

* accessibility/AXObjectCache.cpp:
(WebCore::AXAttributeCacheEnabler::AXAttributeCacheEnabler):
(WebCore):
(WebCore::AXAttributeCacheEnabler::~AXAttributeCacheEnabler):
* accessibility/AXObjectCache.h:
(AXAttributeCacheEnabler):
(WebCore):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
(-[WebAccessibilityObjectWrapper accessibilityElementCount]):
(-[WebAccessibilityObjectWrapper accessibilityElementAtIndex:]):
(-[WebAccessibilityObjectWrapper indexOfAccessibilityElement:]):
(-[WebAccessibilityObjectWrapper accessibilityContainer]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150144 => 150145)


--- trunk/Source/WebCore/ChangeLog	2013-05-15 20:43:40 UTC (rev 150144)
+++ trunk/Source/WebCore/ChangeLog	2013-05-15 20:51:02 UTC (rev 150145)
@@ -1,3 +1,29 @@
+2013-05-15  Chris Fleizach  <[email protected]>
+
+        AX: Use caching when requesting children object on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=116112
+
+        Reviewed by David Kilzer.
+
+        Building up the children list in the AX hierarchy can be time consuming. On iOS, this
+        is now much more noticeable (I believe due to the way tables calculate their AX ignored flag).
+
+        We can speed everything up if we just cache the isIgnored() attribute while building up children.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXAttributeCacheEnabler::AXAttributeCacheEnabler):
+        (WebCore):
+        (WebCore::AXAttributeCacheEnabler::~AXAttributeCacheEnabler):
+        * accessibility/AXObjectCache.h:
+        (AXAttributeCacheEnabler):
+        (WebCore):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
+        (-[WebAccessibilityObjectWrapper accessibilityElementCount]):
+        (-[WebAccessibilityObjectWrapper accessibilityElementAtIndex:]):
+        (-[WebAccessibilityObjectWrapper indexOfAccessibilityElement:]):
+        (-[WebAccessibilityObjectWrapper accessibilityContainer]):
+
 2013-05-15  Anders Carlsson  <[email protected]>
 
         Remove WebSocketHandshakeRequest class

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (150144 => 150145)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2013-05-15 20:43:40 UTC (rev 150144)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2013-05-15 20:51:02 UTC (rev 150145)
@@ -954,6 +954,19 @@
     return equalIgnoringCase(toElement(node)->getAttribute(aria_hiddenAttr), "false");
 }
 
+AXAttributeCacheEnabler::AXAttributeCacheEnabler(AXObjectCache* cache)
+    : m_cache(cache)
+{
+    if (m_cache)
+        m_cache->startCachingComputedObjectAttributesUntilTreeMutates();
+}
+    
+AXAttributeCacheEnabler::~AXAttributeCacheEnabler()
+{
+    if (m_cache)
+        m_cache->stopCachingComputedObjectAttributes();
+}
+    
 } // namespace WebCore
 
 #endif // HAVE(ACCESSIBILITY)

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (150144 => 150145)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2013-05-15 20:43:40 UTC (rev 150144)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2013-05-15 20:51:02 UTC (rev 150145)
@@ -240,6 +240,16 @@
     AXID getAXID(AccessibilityObject*);
 };
 
+class AXAttributeCacheEnabler
+{
+public:
+    explicit AXAttributeCacheEnabler(AXObjectCache *cache);
+    ~AXAttributeCacheEnabler();
+    
+private:
+    AXObjectCache* m_cache;
+};
+    
 bool nodeHasRole(Node*, const String& role);
 // This will let you know if aria-hidden was explicitly set to false.
 bool isNodeAriaVisible(Node*);

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (150144 => 150145)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2013-05-15 20:43:40 UTC (rev 150144)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2013-05-15 20:51:02 UTC (rev 150145)
@@ -302,7 +302,12 @@
         return nil;
     
     // Try a fuzzy hit test first to find an accessible element.
-    RefPtr<AccessibilityObject> axObject = m_object->accessibilityHitTest(IntPoint(point));
+    RefPtr<AccessibilityObject> axObject;
+    {
+        AXAttributeCacheEnabler enableCache(m_object->axObjectCache());
+        axObject = m_object->accessibilityHitTest(IntPoint(point));
+    }
+
     if (!axObject)
         return nil;
     
@@ -324,6 +329,7 @@
     if (![self _prepareAccessibilityCall])
         return nil;
 
+    AXAttributeCacheEnabler enableCache(m_object->axObjectCache());
     if ([self isAttachment])
         return [[self attachmentView] accessibilityElementCount];
     
@@ -335,6 +341,7 @@
     if (![self _prepareAccessibilityCall])
         return nil;
 
+    AXAttributeCacheEnabler enableCache(m_object->axObjectCache());
     if ([self isAttachment])
         return [[self attachmentView] accessibilityElementAtIndex:index];
     
@@ -354,6 +361,7 @@
     if (![self _prepareAccessibilityCall])
         return NSNotFound;
     
+    AXAttributeCacheEnabler enableCache(m_object->axObjectCache());
     if ([self isAttachment])
         return [[self attachmentView] indexOfAccessibilityElement:element];
     
@@ -1071,6 +1079,8 @@
 {
     if (![self _prepareAccessibilityCall])
         return nil;
+
+    AXAttributeCacheEnabler enableCache(m_object->axObjectCache());
     
     // As long as there's a parent wrapper, that's the correct chain to climb.
     AccessibilityObject* parent = m_object->parentObjectUnignored(); 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to