[webkit-changes] cvs commit: WebKit/WebView.subproj
WebDocumentPrivate.h WebHTMLView.m WebPDFView.m
John
sullivan at opensource.apple.com
Thu Dec 8 18:12:35 PST 2005
sullivan 05/12/08 18:12:35
Modified: . ChangeLog
Misc.subproj WebSearchableTextView.m
WebView.subproj WebDocumentPrivate.h WebHTMLView.m
WebPDFView.m
Log:
Reviewed by Tim Hatcher.
Some cleanup of how selection rects are associated with NSViews.
* WebView.subproj/WebDocumentPrivate.h:
Added a -selectionView method to <WebDocumentSelection>, and clarified that the
selectionRect is in the coordinate system of this view.
* Misc.subproj/WebSearchableTextView.m:
(-[WebSearchableTextView selectionView]):
new method, returns self
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView selectionView]):
new method, returns self
* WebView.subproj/WebPDFView.m:
(-[WebPDFView selectionRect]):
translate result into coordinate system of [PDFSubview documentView]
(-[WebPDFView selectionView]):
new method, returns [PDFSubview documentView]
Revision Changes Path
1.3392 +24 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3391
retrieving revision 1.3392
diff -u -r1.3391 -r1.3392
--- ChangeLog 9 Dec 2005 00:06:36 -0000 1.3391
+++ ChangeLog 9 Dec 2005 02:12:27 -0000 1.3392
@@ -1,5 +1,29 @@
2005-12-08 John Sullivan <sullivan at apple.com>
+ Reviewed by Tim Hatcher.
+
+ Some cleanup of how selection rects are associated with NSViews.
+
+ * WebView.subproj/WebDocumentPrivate.h:
+ Added a -selectionView method to <WebDocumentSelection>, and clarified that the
+ selectionRect is in the coordinate system of this view.
+
+ * Misc.subproj/WebSearchableTextView.m:
+ (-[WebSearchableTextView selectionView]):
+ new method, returns self
+
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView selectionView]):
+ new method, returns self
+
+ * WebView.subproj/WebPDFView.m:
+ (-[WebPDFView selectionRect]):
+ translate result into coordinate system of [PDFSubview documentView]
+ (-[WebPDFView selectionView]):
+ new method, returns [PDFSubview documentView]
+
+2005-12-08 John Sullivan <sullivan at apple.com>
+
Reviewed by Tim Omernick and Dave Hyatt.
- fixed these semi-legendary bugs:
1.9 +5 -0 WebKit/Misc.subproj/WebSearchableTextView.m
Index: WebSearchableTextView.m
===================================================================
RCS file: /cvs/root/WebKit/Misc.subproj/WebSearchableTextView.m,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WebSearchableTextView.m 9 Sep 2005 18:34:58 -0000 1.8
+++ WebSearchableTextView.m 9 Dec 2005 02:12:33 -0000 1.9
@@ -108,6 +108,11 @@
return result;
}
+- (NSView *)selectionView
+{
+ return self;
+}
+
- (NSArray *)pasteboardTypesForSelection
{
return [self writablePasteboardTypes];
1.10 +6 -0 WebKit/WebView.subproj/WebDocumentPrivate.h
Index: WebDocumentPrivate.h
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebDocumentPrivate.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WebDocumentPrivate.h 18 Jul 2005 18:02:21 -0000 1.9
+++ WebDocumentPrivate.h 9 Dec 2005 02:12:34 -0000 1.10
@@ -42,5 +42,11 @@
@protocol WebDocumentSelection <NSObject>
- (NSArray *)pasteboardTypesForSelection;
- (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
+
+// Rect tightly enclosing the selection, in coordinates of selectionView
- (NSRect)selectionRect;
+
+// View that draws the selection and can be made first responder. Often this is self but it could be
+// a nested view, as for example in the case of WebPDFView.
+- (NSView *)selectionView;
@end
1.488 +5 -0 WebKit/WebView.subproj/WebHTMLView.m
Index: WebHTMLView.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLView.m,v
retrieving revision 1.487
retrieving revision 1.488
diff -u -r1.487 -r1.488
--- WebHTMLView.m 8 Dec 2005 00:19:20 -0000 1.487
+++ WebHTMLView.m 9 Dec 2005 02:12:34 -0000 1.488
@@ -1838,6 +1838,11 @@
return [[self _bridge] selectionRect];
}
+- (NSView *)selectionView
+{
+ return self;
+}
+
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
{
SEL action = [item action];
1.31 +13 -6 WebKit/WebView.subproj/WebPDFView.m
Index: WebPDFView.m
===================================================================
RCS file: /cvs/root/WebKit/WebView.subproj/WebPDFView.m,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- WebPDFView.m 9 Dec 2005 00:06:45 -0000 1.30
+++ WebPDFView.m 9 Dec 2005 02:12:34 -0000 1.31
@@ -697,17 +697,24 @@
NSEnumerator *pages = [[selection pages] objectEnumerator];
PDFPage *page;
while ((page = [pages nextObject]) != nil) {
- NSRect selectionOnPageInViewCoordinates = [PDFSubview convertRect:[selection boundsForPage:page] fromPage:page];
- if (NSIsEmptyRect(result)) {
- result = selectionOnPageInViewCoordinates;
- } else {
- result = NSUnionRect(result, selectionOnPageInViewCoordinates);
- }
+ NSRect selectionOnPageInPDFViewCoordinates = [PDFSubview convertRect:[selection boundsForPage:page] fromPage:page];
+ if (NSIsEmptyRect(result))
+ result = selectionOnPageInPDFViewCoordinates;
+ else
+ result = NSUnionRect(result, selectionOnPageInPDFViewCoordinates);
}
+ // Convert result to be in documentView (selectionView) coordinates
+ result = [PDFSubview convertRect:result toView:[PDFSubview documentView]];
+
return result;
}
+- (NSView *)selectionView
+{
+ return [PDFSubview documentView];
+}
+
- (NSArray *)pasteboardTypesForSelection
{
return [NSArray arrayWithObjects:NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, nil];
More information about the webkit-changes
mailing list