Commit 94a64228 authored by sullivan's avatar sullivan

Reviewed by Tim Omernick and Dave Hyatt.

        WebKit support for computing but not highlighting rects for text matches.

        * WebView/WebHTMLViewPrivate.h:
        added markedTextMatchesAreHighlighted/setMarkedTextMatchesAreHighlighted and
        rectsForTextMatches, and renamed related methods for clarity/consistency
        * WebView/WebHTMLView.m:
        (-[WebHTMLView markAllMatchesForText:caseSensitive:]):
        renamed, calls similarly-renamed method
        (-[WebHTMLView setMarkedTextMatchesAreHighlighted:]):
        new method, calls through to bridge
        (-[WebHTMLView markedTextMatchesAreHighlighted]):
        ditto
        (-[WebHTMLView unmarkAllTextMatches]):
        renamed
        (-[WebHTMLView rectsForTextMatches]):
        new method, calls through to bridge

        * WebView/WebViewPrivate.h:
        added rectsForTextMatches, renamed other methods (and added highlight: parameter)
        * WebView/WebView.m:
        (-[WebView markAllMatchesForText:caseSensitive:highlight:]):
        renamed for clarity/consistency, and now has highlight: parameter, which is passed down
        (-[WebView unmarkAllTextMatches]):
        renamed for clarity/consistency, and calls similarly-renamed method lower down. diff got
        confused with the end of this and the end of the next method.
        (-[WebView rectsForTextMatches]):
        new method, calls through to WebHTMLView as related methods currently do



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6b99ea1e
2006-06-09 John Sullivan <sullivan@apple.com>
Reviewed by Tim Omernick and Dave Hyatt.
WebKit support for computing but not highlighting rects for text matches.
* WebView/WebHTMLViewPrivate.h:
added markedTextMatchesAreHighlighted/setMarkedTextMatchesAreHighlighted and
rectsForTextMatches, and renamed related methods for clarity/consistency
* WebView/WebHTMLView.m:
(-[WebHTMLView markAllMatchesForText:caseSensitive:]):
renamed, calls similarly-renamed method
(-[WebHTMLView setMarkedTextMatchesAreHighlighted:]):
new method, calls through to bridge
(-[WebHTMLView markedTextMatchesAreHighlighted]):
ditto
(-[WebHTMLView unmarkAllTextMatches]):
renamed
(-[WebHTMLView rectsForTextMatches]):
new method, calls through to bridge
* WebView/WebViewPrivate.h:
added rectsForTextMatches, renamed other methods (and added highlight: parameter)
* WebView/WebView.m:
(-[WebView markAllMatchesForText:caseSensitive:highlight:]):
renamed for clarity/consistency, and now has highlight: parameter, which is passed down
(-[WebView unmarkAllTextMatches]):
renamed for clarity/consistency, and calls similarly-renamed method lower down. diff got
confused with the end of this and the end of the next method.
(-[WebView rectsForTextMatches]):
new method, calls through to WebHTMLView as related methods currently do
2006-06-10 Graham Dennis <Graham.Dennis@gmail.com>
<http://bugzilla.opendarwin.org/show_bug.cgi?id=9384>
......
......@@ -1785,17 +1785,31 @@ - (void)_updateActiveState
[[self _bridge] setIsActive:isActive];
}
- (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)caseFlag
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag
{
[[self _bridge] setMarkedTextMatchesAreHighlighted:YES];
return [[self _bridge] markAllMatchesForText:string caseSensitive:caseFlag];
}
- (void)clearHighlightedMatches
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
{
[[self _bridge] setMarkedTextMatchesAreHighlighted:newValue];
}
- (BOOL)markedTextMatchesAreHighlighted
{
return [[self _bridge] markedTextMatchesAreHighlighted];
}
- (void)unmarkAllTextMatches
{
return [[self _bridge] unmarkAllTextMatches];
}
- (NSArray *)rectsForTextMatches
{
return [[self _bridge] rectsForTextMatches];
}
- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard
{
ASSERT([self _hasSelection]);
......
......@@ -110,9 +110,14 @@
// SPI for DumpRenderTree
- (void)_updateActiveState;
// Support for displaying multiple text matches.
// These methods might end up moving into a protocol, so different document types can specify
// whether or not they implement the protocol.
- (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)caseFlag;
- (void)clearHighlightedMatches;
// These methods are still in flux; don't rely on them yet.
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag;
- (void)unmarkAllTextMatches;
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue;
- (BOOL)markedTextMatchesAreHighlighted;
- (NSArray *)rectsForTextMatches;
@end
......@@ -2635,7 +2635,7 @@ - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)s
return [[[self mainFrame] _bridge] aeDescByEvaluatingJavaScriptFromString:script];
}
- (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)caseFlag
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight
{
WebFrame *frame = [self mainFrame];
unsigned matchCount = 0;
......@@ -2643,7 +2643,8 @@ - (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)
id <WebDocumentView> view = [[frame frameView] documentView];
// FIXME: introduce a protocol, or otherwise make this work with other types
if ([view isKindOfClass:[WebHTMLView class]])
matchCount += [(WebHTMLView *)view highlightAllMatchesForString:string caseSensitive:caseFlag];
[(WebHTMLView *)view setMarkedTextMatchesAreHighlighted:highlight];
matchCount += [(WebHTMLView *)view markAllMatchesForText:string caseSensitive:caseFlag];
frame = incrementFrame(frame, YES, NO);
} while (frame);
......@@ -2651,17 +2652,33 @@ - (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)
return matchCount;
}
- (void)clearHighlightedMatches
- (void)unmarkAllTextMatches
{
WebFrame *frame = [self mainFrame];
do {
id <WebDocumentView> view = [[frame frameView] documentView];
// FIXME: introduce a protocol, or otherwise make this work with other types
if ([view isKindOfClass:[WebHTMLView class]])
[(WebHTMLView *)view clearHighlightedMatches];
[(WebHTMLView *)view unmarkAllTextMatches];
frame = incrementFrame(frame, YES, NO);
} while (frame);
}
- (NSArray *)rectsForTextMatches
{
NSMutableArray *result = [NSMutableArray array];
WebFrame *frame = [self mainFrame];
do {
id <WebDocumentView> view = [[frame frameView] documentView];
// FIXME: introduce a protocol, or otherwise make this work with other types
if ([view isKindOfClass:[WebHTMLView class]])
[result addObjectsFromArray:[(WebHTMLView *)view rectsForTextMatches]];
frame = incrementFrame(frame, YES, NO);
} while (frame);
return result;
}
@end
......
......@@ -125,10 +125,13 @@ typedef enum {
*/
- (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)script;
// Support for displaying multiple text matches.
// These methods might end up moving into a protocol, so different document types can specify
// whether or not they implement the protocol. For now we'll just deal with HTML.
- (unsigned)highlightAllMatchesForString:(NSString *)string caseSensitive:(BOOL)caseFlag;
- (void)clearHighlightedMatches;
// These methods are still in flux; don't rely on them yet.
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight;
- (void)unmarkAllTextMatches;
- (NSArray *)rectsForTextMatches;
@end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment