Commit caf3550b authored by sullivan's avatar sullivan
Browse files

WebCore:

        Reviewed by Darin

        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge markAllMatchesForText:caseSensitive:limit:]):
        Added limit parameter, passed down to Frame
        
        * page/Frame.h:
        * page/Frame.cpp:
        (WebCore::Frame::markAllMatchesForText):
        Added limit parameter. Stop the search if it hits limit.

WebKit:

        Reviewed by Darin

        * WebView/WebHTMLViewPrivate.h:
        * WebView/WebHTMLView.m:
        (-[WebHTMLView markAllMatchesForText:caseSensitive:limit:]):
        Added limit parameter, passed over the bridge. Stop the search if it hits limit.

        * WebView/WebViewPrivate.h:
        * WebView/WebView.m:
        (-[WebView markAllMatchesForText:caseSensitive:highlight:limit:]):
        Added limit parameter, passed to WebHTMLView.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent baf40fdf
2006-09-26 John Sullivan <sullivan@apple.com>
Reviewed by Darin
* bridge/mac/WebCoreFrameBridge.h:
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge markAllMatchesForText:caseSensitive:limit:]):
Added limit parameter, passed down to Frame
* page/Frame.h:
* page/Frame.cpp:
(WebCore::Frame::markAllMatchesForText):
Added limit parameter. Stop the search if it hits limit.
2006-09-26 Sean Gies <seangies@apple.com>
 
Reviewed by Brady Eidson.
......@@ -309,7 +309,7 @@ typedef enum {
- (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag;
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(unsigned)limit;
- (BOOL)markedTextMatchesAreHighlighted;
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)doHighlight;
- (void)unmarkAllTextMatches;
......
......@@ -1228,9 +1228,9 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
return m_frame->findString(String(string), forward, caseFlag, wrapFlag);
}
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(unsigned)limit
{
return m_frame->markAllMatchesForText(string, caseFlag);
return m_frame->markAllMatchesForText(string, caseFlag, limit);
}
- (BOOL)markedTextMatchesAreHighlighted
......
......@@ -3493,7 +3493,7 @@ bool Frame::findString(const String& target, bool forward, bool caseFlag, bool w
return true;
}
unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag)
unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsigned limit)
{
if (target.isEmpty())
return 0;
......@@ -3514,8 +3514,13 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag)
break;
++matchCount;
document()->addMarker(resultRange.get(), DocumentMarker::TextMatch);
// Stop looking if we hit the specified limit. A limit of 0 means no limit.
if (limit > 0 && matchCount >= limit)
break;
setStart(searchRange.get(), newStart);
} while (true);
......
......@@ -732,7 +732,7 @@ private:
const Vector<MarkedTextUnderline>& markedTextUnderlines() const;
bool markedTextUsesUnderlines() const;
unsigned markAllMatchesForText(const String&, bool caseFlag);
unsigned markAllMatchesForText(const String&, bool caseFlag, unsigned limit);
bool markedTextMatchesAreHighlighted() const;
void setMarkedTextMatchesAreHighlighted(bool flag);
......
2006-09-26 John Sullivan <sullivan@apple.com>
Reviewed by Darin
* WebView/WebHTMLViewPrivate.h:
* WebView/WebHTMLView.m:
(-[WebHTMLView markAllMatchesForText:caseSensitive:limit:]):
Added limit parameter, passed over the bridge. Stop the search if it hits limit.
* WebView/WebViewPrivate.h:
* WebView/WebView.m:
(-[WebView markAllMatchesForText:caseSensitive:highlight:limit:]):
Added limit parameter, passed to WebHTMLView.
2006-09-26 David Harrison <harrison@apple.com>
Reviewed by John and TimH.
......
......@@ -1845,9 +1845,9 @@ - (void)_updateActiveState
[[self _bridge] setIsActive:isActive];
}
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(unsigned)limit
{
return [[self _bridge] markAllMatchesForText:string caseSensitive:caseFlag];
return [[self _bridge] markAllMatchesForText:string caseSensitive:caseFlag limit:limit];
}
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
......
......@@ -118,7 +118,7 @@
// These methods might end up moving into a protocol, so different document types can specify
// whether or not they implement the protocol.
// These methods are still in flux; don't rely on them yet.
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag;
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(unsigned)limit;
- (void)unmarkAllTextMatches;
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue;
- (BOOL)markedTextMatchesAreHighlighted;
......
......@@ -2862,7 +2862,7 @@ - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)s
return [[[self mainFrame] _bridge] aeDescByEvaluatingJavaScriptFromString:script];
}
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(unsigned)limit
{
WebFrame *frame = [self mainFrame];
unsigned matchCount = 0;
......@@ -2871,8 +2871,14 @@ - (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFla
// FIXME: introduce a protocol, or otherwise make this work with other types
if ([view isKindOfClass:[WebHTMLView class]])
[(WebHTMLView *)view setMarkedTextMatchesAreHighlighted:highlight];
matchCount += [(WebHTMLView *)view markAllMatchesForText:string caseSensitive:caseFlag];
ASSERT(limit == 0 || matchCount < limit);
matchCount += [(WebHTMLView *)view markAllMatchesForText:string caseSensitive:caseFlag limit:limit == 0 ? 0 : limit - matchCount];
// Stop looking if we've reached the limit. A limit of 0 means no limit.
if (limit > 0 && matchCount >= limit)
break;
frame = incrementFrame(frame, YES, NO);
} while (frame);
......
......@@ -105,7 +105,7 @@ typedef enum {
// 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.
// These methods are still in flux; don't rely on them yet.
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight;
- (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(unsigned)limit;
- (void)unmarkAllTextMatches;
- (NSArray *)rectsForTextMatches;
......
Supports Markdown
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