Index: trunk/ICeCoffEE/ICeCoffEE/APEMain.m
===================================================================
--- trunk/ICeCoffEE/ICeCoffEE/APEMain.m	(revision 455)
+++ trunk/ICeCoffEE/ICeCoffEE/APEMain.m	(revision 456)
@@ -156,13 +156,12 @@
 	} else if (ICCF_CFBundleIDMatches(bundleID, CFSTR("org.mozilla.camino"))) {
             ICCF_PatchMethod("ChildView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:");
-            ICapeprintf("ICeCoffEE APE: loaded in ChildView for Camino\n");
+	    ICapeprintf("ICeCoffEE APE: loaded in ChildView for Camino\n");
         }
     }
 
-    objc_getClass("WebCoreFrameBridge") != NULL /* require Safari 3 */ &&
-	ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseUp:") &&
-        ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseDown:") &&
-        ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "menuForEvent:");
-        ICapeprintf("ICeCoffEE APE: loaded in WebHTMLView for WebKit/Safari 3\n");
+    ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseUp:") &&
+	ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseDown:") &&
+	ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "menuForEvent:");
+    ICapeprintf("ICeCoffEE APE: loaded in WebHTMLView for WebKit/Safari 3\n");
     
     if (shouldLoadInNSTextView) {
@@ -172,4 +171,7 @@
         ICapeprintf("ICeCoffEE APE: loaded generic NSTextView support\n");
     }
+    
+    ICCF_PatchMethod("PDFView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:");
+    ICapeprintf("ICeCoffEE APE: loaded in PDFView for PDFKit\n");
 
     ICCF_ReloadPrefs();
Index: trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEWebKit.m
===================================================================
--- trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEWebKit.m	(revision 455)
+++ trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEWebKit.m	(revision 456)
@@ -21,4 +21,10 @@
 @end
 
+// r31014 and later; likely to move again
+@interface WebFrame (WebFrameInternal)
+- (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
+- (NSString *)_stringForRange:(DOMRange *)range;
+@end
+
 // XXX WebHTMLView is going away
 @interface WebHTMLView : NSObject
@@ -28,5 +34,6 @@
 
 - (WebView *)_webView;
-- (WebCoreFrameBridge *)_bridge;
+- (WebCoreFrameBridge *)_bridge; // moved from WebNSViewExtras in r14032; removed in r31014
+- (WebFrame *)_frame; // moved from WebNSViewExtras in r14032
 
 @end
@@ -142,5 +149,4 @@
 	    ICLog(@"got a link");
 	    if (!elementIsEditable) {
-		ICCF_StopIC();
 		return;
 	    }
@@ -156,5 +162,8 @@
 	    NSAssert(range.location != NSNotFound, ICCF_LocalizedString(@"Sorry, ICeCoffEE was unable to find anything to select"));
 
-	    WebCoreFrameBridge *bridge = [(WebHTMLView *)self _bridge];
+	    WebFrame *frame = [(WebHTMLView *)self _frame];
+	    WebCoreFrameBridge *bridge = nil;
+	    if ([self respondsToSelector: @selector(_bridge)])
+		bridge = [(WebHTMLView *)self _bridge];
 
 	    // XXX limit to a reasonable size
@@ -162,14 +171,27 @@
 	    if (elementIsEditable) // for form fields, range will be field-relative rather than document-relative
 		s = [[(NSView<NSTextInput> *)self attributedSubstringFromRange: NSMakeRange(0, UINT_MAX)] string];
-	    else // sometimes attributedSubstringFromRange: returns nil
-		s = [bridge stringForRange: [(WebHTMLView *)self _documentRange]];
-	    
+	    else { // sometimes attributedSubstringFromRange: returns nil
+		domRange = [(WebHTMLView *)self _documentRange];
+		if (bridge != nil)
+		    s = [bridge stringForRange: domRange];
+		else if (![frame respondsToSelector: @selector(_stringForRange:)])
+		    return; // WebKit too new?
+		else
+		    s = [frame _stringForRange: domRange];
+	    }
+	    
+	    if (bridge == nil && ![frame respondsToSelector: @selector(_convertNSRangeToDOMRange:)]) {
+		return; // WebKit too new?
+	    }
+		
 	    if (range.length == 0) {
 		range.length = 1;
 		range = ICCF_URLEnclosingRange(s, range);
-		domRange = [bridge convertNSRangeToDOMRange: range];
+		domRange = bridge ? [bridge convertNSRangeToDOMRange: range] :
+				    [frame _convertNSRangeToDOMRange: range];
 		[webView setSelectedDOMRange: domRange affinity: NSSelectionAffinityDownstream];
 	    } else {
-		domRange = [bridge convertNSRangeToDOMRange: range];
+		domRange = bridge ? [bridge convertNSRangeToDOMRange: range] :
+				    [frame _convertNSRangeToDOMRange: range];
 	    }
 	    
@@ -202,7 +224,6 @@
 		[webView setGrammarCheckingEnabled: YES];
 	}
+	ICCF_StopIC();
     }
-
-    ICCF_StopIC();
 }
 
