[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:28:26 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit eb30d2b72c0a2c2e7b67d993869ae37f047b79c7
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 3 18:45:52 2004 +0000

    	Speed up access to the children arrays of accessibility objects by caching mutable arrays of children
    	and nulling them out only when the children change.
    
            Reviewed by john
    
            * khtml/rendering/render_container.cpp:
            (RenderContainer::removeChildNode):
            (RenderContainer::appendChildNode):
            (RenderContainer::insertChildNode):
            * kwq/KWQAccObject.h:
            * kwq/KWQAccObject.mm:
            (-[KWQAccObject detach]):
            (-[KWQAccObject accessibilityAttributeValue:]):
            (-[KWQAccObject childrenChanged]):
            (-[KWQAccObject clearChildren]):
            * kwq/KWQAccObjectCache.h:
            * kwq/KWQAccObjectCache.mm:
            (KWQAccObjectCache::childrenChanged):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6160 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0f25ae6..a69d76c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,24 @@
+2004-03-03  David Hyatt  <hyatt at apple.com>
+
+	Speed up access to the children arrays of accessibility objects by caching mutable arrays of children
+	and nulling them out only when the children change.
+	
+        Reviewed by john
+
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::removeChildNode):
+        (RenderContainer::appendChildNode):
+        (RenderContainer::insertChildNode):
+        * kwq/KWQAccObject.h:
+        * kwq/KWQAccObject.mm:
+        (-[KWQAccObject detach]):
+        (-[KWQAccObject accessibilityAttributeValue:]):
+        (-[KWQAccObject childrenChanged]):
+        (-[KWQAccObject clearChildren]):
+        * kwq/KWQAccObjectCache.h:
+        * kwq/KWQAccObjectCache.mm:
+        (KWQAccObjectCache::childrenChanged):
+
 2004-03-02  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Darin and me. Coding by Darin and me.
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index 3c45cd7..10292d3 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -35,6 +35,11 @@
 #include <kdebug.h>
 #include <assert.h>
 
+#if APPLE_CHANGES
+// For accessibility
+#include "KWQAccObjectCache.h" 
+#endif
+
 using namespace khtml;
 
 RenderContainer::RenderContainer(DOM::NodeImpl* node)
@@ -199,6 +204,12 @@ RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
     oldChild->setNextSibling(0);
     oldChild->setParent(0);
 
+#if APPLE_CHANGES
+    KWQAccObjectCache* cache = document()->getExistingAccObjectCache();
+    if (cache)
+        cache->childrenChanged(this);
+#endif
+    
     return oldChild;
 }
 
@@ -349,6 +360,12 @@ void RenderContainer::appendChildNode(RenderObject* newChild)
     
     if (!newChild->isFloatingOrPositioned() && childrenInline())
         dirtyLinesFromChangedChild(newChild);
+    
+#if APPLE_CHANGES
+    KWQAccObjectCache* cache = document()->getExistingAccObjectCache();
+    if (cache)
+        cache->childrenChanged(this);
+#endif
 }
 
 void RenderContainer::insertChildNode(RenderObject* child, RenderObject* beforeChild)
@@ -384,6 +401,12 @@ void RenderContainer::insertChildNode(RenderObject* child, RenderObject* beforeC
     
     if (!child->isFloatingOrPositioned() && childrenInline())
         dirtyLinesFromChangedChild(child);
+    
+#if APPLE_CHANGES
+    KWQAccObjectCache* cache = document()->getExistingAccObjectCache();
+    if (cache)
+        cache->childrenChanged(this);
+#endif    
 }
 
 
diff --git a/WebCore/kwq/KWQAccObject.h b/WebCore/kwq/KWQAccObject.h
index 27cab18..b852b12 100644
--- a/WebCore/kwq/KWQAccObject.h
+++ b/WebCore/kwq/KWQAccObject.h
@@ -33,6 +33,7 @@ namespace khtml {
 {
     khtml::RenderObject* m_renderer;
     id m_data;
+    NSMutableArray* m_children;
 }
 
 -(id)initWithRenderer:(khtml::RenderObject*)renderer;
@@ -49,4 +50,7 @@ namespace khtml {
 -(KWQAccObject*)nextSibling;
 -(KWQAccObject*)parentObject;
 
+-(void)childrenChanged;
+-(void)clearChildren;
+
 @end
diff --git a/WebCore/kwq/KWQAccObject.mm b/WebCore/kwq/KWQAccObject.mm
index 926c628..42c7acb 100644
--- a/WebCore/kwq/KWQAccObject.mm
+++ b/WebCore/kwq/KWQAccObject.mm
@@ -77,6 +77,7 @@ using khtml::RenderBlock;
     [m_data release];
     m_data = 0;
     m_renderer = 0;
+    [self clearChildren];
 }
 
 -(id)data
@@ -441,9 +442,12 @@ static QRect boundingBoxRect(RenderObject* obj)
     }
 
     if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute]) {
-        NSMutableArray* arr = [NSMutableArray arrayWithCapacity: 8];
-        [self addChildrenToArray: arr];
-        return arr;
+        if (!m_children) {
+            m_children = [NSMutableArray arrayWithCapacity: 8];
+            [m_children retain];
+            [self addChildrenToArray: m_children];
+        }
+        return m_children;
     }
 
     if ([attributeName isEqualToString: NSAccessibilityTitleAttribute])
@@ -487,4 +491,19 @@ static QRect boundingBoxRect(RenderObject* obj)
         return self;
     return obj->document()->getOrCreateAccObjectCache()->accObject(obj);
 }
+
+- (void)childrenChanged
+{
+    [self clearChildren];
+    
+    if ([self accessibilityIsIgnored])
+        [[self parentObject] childrenChanged];
+}
+
+- (void)clearChildren
+{
+    [m_children release];
+    m_children = nil;
+}
+
 @end
diff --git a/WebCore/kwq/KWQAccObjectCache.h b/WebCore/kwq/KWQAccObjectCache.h
index 7320ad7..698d029 100644
--- a/WebCore/kwq/KWQAccObjectCache.h
+++ b/WebCore/kwq/KWQAccObjectCache.h
@@ -46,7 +46,9 @@ public:
     void removeAccObject(khtml::RenderObject* renderer);
     
     void detach(khtml::RenderObject* renderer);
-        
+    
+    void childrenChanged(khtml::RenderObject* renderer);
+    
 private:
     CFMutableDictionaryRef accCache;
 };
diff --git a/WebCore/kwq/KWQAccObjectCache.mm b/WebCore/kwq/KWQAccObjectCache.mm
index 65e073b..2775007 100644
--- a/WebCore/kwq/KWQAccObjectCache.mm
+++ b/WebCore/kwq/KWQAccObjectCache.mm
@@ -80,3 +80,15 @@ void KWQAccObjectCache::detach(khtml::RenderObject* renderer)
 {
     removeAccObject(renderer);
 }
+
+void KWQAccObjectCache::childrenChanged(khtml::RenderObject* renderer)
+{
+    if (!accCache)
+        return;
+    
+    KWQAccObject* obj = (KWQAccObject*)CFDictionaryGetValue(accCache, renderer);
+    if (!obj)
+        return;
+    
+    [obj childrenChanged];
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list