Changeset 456
- Timestamp:
- 03/27/08 22:13:15 (17 years ago)
- Location:
- trunk/ICeCoffEE/ICeCoffEE
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/APEMain.m
r443 r456 156 156 } else if (ICCF_CFBundleIDMatches(bundleID, CFSTR("org.mozilla.camino"))) { 157 157 ICCF_PatchMethod("ChildView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:"); 158 158 ICapeprintf("ICeCoffEE APE: loaded in ChildView for Camino\n"); 159 159 } 160 160 } 161 161 162 objc_getClass("WebCoreFrameBridge") != NULL /* require Safari 3 */ && 163 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseUp:") && 164 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseDown:") && 165 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "menuForEvent:"); 166 ICapeprintf("ICeCoffEE APE: loaded in WebHTMLView for WebKit/Safari 3\n"); 162 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseUp:") && 163 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseDown:") && 164 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "menuForEvent:"); 165 ICapeprintf("ICeCoffEE APE: loaded in WebHTMLView for WebKit/Safari 3\n"); 167 166 168 167 if (shouldLoadInNSTextView) { … … 172 171 ICapeprintf("ICeCoffEE APE: loaded generic NSTextView support\n"); 173 172 } 173 174 ICCF_PatchMethod("PDFView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:"); 175 ICapeprintf("ICeCoffEE APE: loaded in PDFView for PDFKit\n"); 174 176 175 177 ICCF_ReloadPrefs(); -
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEWebKit.m
r455 r456 21 21 @end 22 22 23 // r31014 and later; likely to move again 24 @interface WebFrame (WebFrameInternal) 25 - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range; 26 - (NSString *)_stringForRange:(DOMRange *)range; 27 @end 28 23 29 // XXX WebHTMLView is going away 24 30 @interface WebHTMLView : NSObject … … 28 34 29 35 - (WebView *)_webView; 30 - (WebCoreFrameBridge *)_bridge; 36 - (WebCoreFrameBridge *)_bridge; // moved from WebNSViewExtras in r14032; removed in r31014 37 - (WebFrame *)_frame; // moved from WebNSViewExtras in r14032 31 38 32 39 @end … … 142 149 ICLog(@"got a link"); 143 150 if (!elementIsEditable) { 144 ICCF_StopIC();145 151 return; 146 152 } … … 156 162 NSAssert(range.location != NSNotFound, ICCF_LocalizedString(@"Sorry, ICeCoffEE was unable to find anything to select")); 157 163 158 WebCoreFrameBridge *bridge = [(WebHTMLView *)self _bridge]; 164 WebFrame *frame = [(WebHTMLView *)self _frame]; 165 WebCoreFrameBridge *bridge = nil; 166 if ([self respondsToSelector: @selector(_bridge)]) 167 bridge = [(WebHTMLView *)self _bridge]; 159 168 160 169 // XXX limit to a reasonable size … … 162 171 if (elementIsEditable) // for form fields, range will be field-relative rather than document-relative 163 172 s = [[(NSView<NSTextInput> *)self attributedSubstringFromRange: NSMakeRange(0, UINT_MAX)] string]; 164 else // sometimes attributedSubstringFromRange: returns nil 165 s = [bridge stringForRange: [(WebHTMLView *)self _documentRange]]; 166 173 else { // sometimes attributedSubstringFromRange: returns nil 174 domRange = [(WebHTMLView *)self _documentRange]; 175 if (bridge != nil) 176 s = [bridge stringForRange: domRange]; 177 else if (![frame respondsToSelector: @selector(_stringForRange:)]) 178 return; // WebKit too new? 179 else 180 s = [frame _stringForRange: domRange]; 181 } 182 183 if (bridge == nil && ![frame respondsToSelector: @selector(_convertNSRangeToDOMRange:)]) { 184 return; // WebKit too new? 185 } 186 167 187 if (range.length == 0) { 168 188 range.length = 1; 169 189 range = ICCF_URLEnclosingRange(s, range); 170 domRange = [bridge convertNSRangeToDOMRange: range]; 190 domRange = bridge ? [bridge convertNSRangeToDOMRange: range] : 191 [frame _convertNSRangeToDOMRange: range]; 171 192 [webView setSelectedDOMRange: domRange affinity: NSSelectionAffinityDownstream]; 172 193 } else { 173 domRange = [bridge convertNSRangeToDOMRange: range]; 194 domRange = bridge ? [bridge convertNSRangeToDOMRange: range] : 195 [frame _convertNSRangeToDOMRange: range]; 174 196 } 175 197 … … 202 224 [webView setGrammarCheckingEnabled: YES]; 203 225 } 226 ICCF_StopIC(); 204 227 } 205 206 ICCF_StopIC();207 228 } 208 229
Note:
See TracChangeset
for help on using the changeset viewer.