[webkit-changes] cvs commit: WebKit/WebView.subproj WebHTMLView.m
Justin
justing at opensource.apple.com
Tue Dec 20 18:04:39 PST 2005
justing 05/12/20 18:04:39
Modified: . ChangeLog
WebView.subproj WebHTMLView.m
Log:
Reviewed by justin
<http://bugzilla.opendarwin.org/show_bug.cgi?id=4682>
-[WebHTMLView firstRectForCharacterRange:] is using _selectedRange instead of the given range if no marked text
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView firstRectForCharacterRange:]):
Handle some large unsigned values the way NSTextView does.
Actually use the range passed in instead of _selectedRange,
use of _selectedRange was a workaround that is no longer necessary.
Revision Changes Path
1.3423 +13 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3422
retrieving revision 1.3423
diff -u -r1.3422 -r1.3423
--- ChangeLog 21 Dec 2005 01:16:38 -0000 1.3422
+++ ChangeLog 21 Dec 2005 02:04:34 -0000 1.3423
@@ -1,3 +1,16 @@
+2005-12-20 Alexey Proskuryakov <ap at nypop.com>
+
+ Reviewed by justin
+
+ <http://bugzilla.opendarwin.org/show_bug.cgi?id=4682>
+ -[WebHTMLView firstRectForCharacterRange:] is using _selectedRange instead of the given range if no marked text
+
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView firstRectForCharacterRange:]):
+ Handle some large unsigned values the way NSTextView does.
+ Actually use the range passed in instead of _selectedRange,
+ use of _selectedRange was a workaround that is no longer necessary.
+
2005-12-20 John Sullivan <sullivan at apple.com>
Reviewed by Darin Adler.
1.494 +18 -15 WebKit/WebView.subproj/WebHTMLView.m
Index: WebHTMLView.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLView.m,v
retrieving revision 1.493
retrieving revision 1.494
diff -u -r1.493 -r1.494
--- WebHTMLView.m 21 Dec 2005 00:23:07 -0000 1.493
+++ WebHTMLView.m 21 Dec 2005 02:04:38 -0000 1.494
@@ -4993,23 +4993,26 @@
{
WebBridge *bridge = [self _bridge];
- DOMRange *range;
+ // Just to match NSTextView's behavior. Regression tests cannot detect this;
+ // to reproduce, use a test application from http://bugzilla.opendarwin.org/show_bug.cgi?id=4682
+ // (type something; try ranges (1, -1) and (2, -1).
+ if ((theRange.location + theRange.length < theRange.location) && (theRange.location + theRange.length != 0))
+ theRange.length = 0;
- if ([self hasMarkedText]) {
- range = [bridge convertNSRangeToDOMRange:theRange];
- }
- else {
- range = [self _selectedRange];
- }
+ DOMRange *range = [bridge convertNSRangeToDOMRange:theRange];
+ if (!range)
+ return NSMakeRect(0,0,0,0);
+
+ ASSERT([range startContainer]);
+ ASSERT([range endContainer]);
+
+ NSRect resultRect = [bridge firstRectForDOMRange:range];
+ resultRect = [self convertRect:resultRect toView:nil];
+
+ NSWindow *window = [self window];
+ if (window)
+ resultRect.origin = [window convertBaseToScreen:resultRect.origin];
- NSRect resultRect;
- if ([range startContainer]) {
- resultRect = [self convertRect:[bridge firstRectForDOMRange:range] toView:nil];
- resultRect.origin = [[self window] convertBaseToScreen:resultRect.origin];
- }
- else {
- resultRect = NSMakeRect(0,0,0,0);
- }
return resultRect;
}
More information about the webkit-changes
mailing list