Revision: 3794
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3794&view=rev
Author:   hofman
Date:     2008-04-22 14:49:11 -0700 (Tue, 22 Apr 2008)

Log Message:
-----------
Also cache children for notes and links for smaller page ranges, as assistive 
devices can request the children several times in a row. Invalidate in some 
more cases, eg when changing displaymode.

Modified Paths:
--------------
    trunk/SKPDFView.m

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2008-04-22 21:38:30 UTC (rev 3793)
+++ trunk/SKPDFView.m   2008-04-22 21:49:11 UTC (rev 3794)
@@ -562,6 +562,8 @@
     if (mode != [self displayMode]) {
         [super setDisplayMode:mode];
         [self relayoutEditField];
+        [accessibilityChildren release];
+        accessibilityChildren = nil;
         [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewDisplayModeChangedNotification object:self 
userInfo:nil];
     }
 }
@@ -2154,28 +2156,27 @@
 }
 
 - (NSArray *)accessibilityChildren {
-    if ([self displayMode] == kPDFDisplaySinglePage || [self displayMode] == 
kPDFDisplayTwoUp) {
+    if (accessibilityChildren == nil) {
         unsigned pageCount = [[self document] pageCount];
-        NSRange range = pageCount ? NSMakeRange([[self currentPage] 
pageIndex], 1) : NSMakeRange(NSNotFound, 0);
-        if (pageCount && [self displayMode] == kPDFDisplayTwoUp) {
-            range.length = 2;
-            if ((unsigned)[self displaysAsBook] != (range.location % 2)) {
-                if (range.location == 0)
+        NSRange range = NSMakeRange(0, pageCount);
+        if (pageCount && ([self displayMode] == kPDFDisplaySinglePage || [self 
displayMode] == kPDFDisplayTwoUp)) {
+            NSRange range = NSMakeRange([[self currentPage] pageIndex], 1);
+            if ([self displayMode] == kPDFDisplayTwoUp) {
+                range.length = 2;
+                if ((unsigned)[self displaysAsBook] != (range.location % 2)) {
+                    if (range.location == 0)
+                        range.length = 1;
+                    else
+                        range.location -= 1;
+                }
+                if (NSMaxRange(range) == pageCount)
                     range.length = 1;
-                else
-                    range.location -= 1;
             }
-            if (NSMaxRange(range) == pageCount)
-                range.length = 1;
+            return [self accessibilityChildrenForPageRange:range visible:NO];
         }
-        return [self accessibilityChildrenForPageRange:range visible:NO];
-    } else {
-        if (accessibilityChildren == nil) {
-            NSRange range = NSMakeRange(0, [[self document] pageCount]);
-            accessibilityChildren = [[self 
accessibilityChildrenForPageRange:range visible:NO] mutableCopy];
-        }
-        return accessibilityChildren;
+        accessibilityChildren = [[self accessibilityChildrenForPageRange:range 
visible:NO] mutableCopy];
     }
+    return accessibilityChildren;
 }
 
 - (NSArray *)accessibilityVisibleChildren {
@@ -2226,8 +2227,12 @@
 #pragma mark Notification handling
 
 - (void)handlePageChangedNotification:(NSNotification *)notification {
-    if ([self isEditing] && [self displayMode] != 
kPDFDisplaySinglePageContinuous && [self displayMode] != 
kPDFDisplayTwoUpContinuous)
-        [self relayoutEditField];
+    if ([self displayMode] == kPDFDisplaySinglePage || [self displayMode] == 
kPDFDisplayTwoUp) {
+        if ([self isEditing])
+            [self relayoutEditField];
+        [accessibilityChildren release];
+        accessibilityChildren = nil;
+    }
     if ([self toolMode] == SKSelectToolMode && NSIsEmptyRect(selectionRect) == 
NO)
         [self setNeedsDisplay:YES];
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to