Changeset 457
- Timestamp:
- 03/28/08 21:52:35 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEWebKit.m
r456 r457 79 79 } 80 80 81 82 static BOOL ICCF_DOMParentOfClass(DOMNode *node, Class cls) { 83 do { 84 if ([node isKindOfClass: cls]) 85 return YES; 86 } while ( (node = [node parentNode]) != nil); 87 88 return NO; 89 } 90 #define ICCF_NodeIs(elt) [clickedNode isKindOfClass: NSClassFromString(@"DOMHTML"elt"Element")] 91 #define ICCF_DOMParentIs(elt) ICCF_DOMParentOfClass(clickedNode, NSClassFromString(@"DOMHTML"elt"Element")) 92 81 93 - (void)mouseUp:(NSEvent *)e; 82 94 { … … 132 144 133 145 DOMNode *clickedNode = [elementDict objectForKey: @"WebElementDOMNode"]; 134 135 if (!elementIsEditable && ([clickedNode isKindOfClass: NSClassFromString(@"DOMHTMLInputElement")] ||136 [clickedNode isKindOfClass: NSClassFromString(@"DOMHTMLFieldSetElement")])) {146 BOOL elementIsHTMLInput = ICCF_NodeIs("Input"); 147 148 if (!elementIsEditable && (elementIsHTMLInput || ICCF_DOMParentIs("Button") || ICCF_NodeIs("FieldSet"))) { 137 149 ICLog(@"got an uneditable form field (e.g., button)"); 138 150 return; … … 169 181 // XXX limit to a reasonable size 170 182 NSString *s; 171 if (elementIsEditable) // for form fields, range will be field-relative rather than document-relative 183 if (elementIsHTMLInput || ICCF_NodeIs("TextArea") || (elementIsEditable && !webViewIsEditable)) { 184 // for form fields, range will be field-relative rather than document-relative 185 ICLog(@"Using attributedSubstringFromRange:"); 172 186 s = [[(NSView<NSTextInput> *)self attributedSubstringFromRange: NSMakeRange(0, UINT_MAX)] string]; 173 else { // sometimes attributedSubstringFromRange: returns nil 187 } else { // sometimes attributedSubstringFromRange: returns nil 188 ICLog(@"Using stringForRange:"); 174 189 domRange = [(WebHTMLView *)self _documentRange]; 175 190 if (bridge != nil)
Note:
See TracChangeset
for help on using the changeset viewer.