summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebView
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-01-05 12:15:11 +0000
committerSteve Block <steveblock@google.com>2011-01-06 14:14:00 +0000
commitd06194330da2bb8da887d2e1adeacb3a5c1504b2 (patch)
treee0af8413af65a8e30630563441af7bdb8478e513 /WebKit/mac/WebView
parent419a5cf2f8db6ca014df624865197ffb82caad37 (diff)
downloadexternal_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.zip
external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.gz
external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.bz2
Merge WebKit at r72805: Initial merge by Git
Note that this is a backwards merge from Chromium release 9.0.600.0 to 9.0.597.0, to align with the Chromium 9 stable release branch. Change-Id: I5d2bb4e8cee9d39ae8485abf48bdb55ecf8b3790
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r--WebKit/mac/WebView/WebDocumentInternal.h9
-rw-r--r--WebKit/mac/WebView/WebDynamicScrollBarsView.h6
-rw-r--r--WebKit/mac/WebView/WebDynamicScrollBarsView.mm73
-rw-r--r--WebKit/mac/WebView/WebFrameView.mm4
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm38
-rw-r--r--WebKit/mac/WebView/WebPDFView.mm10
-rw-r--r--WebKit/mac/WebView/WebView.mm82
-rw-r--r--WebKit/mac/WebView/WebViewPrivate.h46
8 files changed, 77 insertions, 191 deletions
diff --git a/WebKit/mac/WebView/WebDocumentInternal.h b/WebKit/mac/WebView/WebDocumentInternal.h
index 0b86ba8..0f63d75 100644
--- a/WebKit/mac/WebView/WebDocumentInternal.h
+++ b/WebKit/mac/WebView/WebDocumentInternal.h
@@ -28,7 +28,6 @@
#import <WebKit/WebDocumentPrivate.h>
#import <WebKit/WebHTMLView.h>
-#import <WebKit/WebViewPrivate.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
#define WebNSUInteger unsigned int
@@ -62,14 +61,12 @@
@protocol WebMultipleTextMatches <NSObject>
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue;
- (BOOL)markedTextMatchesAreHighlighted;
-- (WebNSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
+- (WebNSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(WebNSUInteger)limit;
+- (WebNSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
- (void)unmarkAllTextMatches;
- (NSArray *)rectsForTextMatches;
@end
-@protocol WebDocumentOptionsSearching <NSObject>
-- (BOOL)findString:(NSString *)string options:(WebFindOptions)options;
-@end
/* Used to save and restore state in the view, typically when going back/forward */
@protocol _WebDocumentViewState <NSObject>
@@ -79,7 +76,7 @@
- (void)setViewState:(id)statePList;
@end
-@interface WebHTMLView (WebDocumentInternalProtocols) <WebDocumentElement, WebMultipleTextMatches, WebDocumentOptionsSearching>
+@interface WebHTMLView (WebDocumentInternalProtocols) <WebDocumentElement, WebMultipleTextMatches>
@end
#undef WebNSUInteger
diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.h b/WebKit/mac/WebView/WebDynamicScrollBarsView.h
index b89462d..c289a04 100644
--- a/WebKit/mac/WebView/WebDynamicScrollBarsView.h
+++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.h
@@ -58,10 +58,4 @@ struct WebDynamicScrollBarsViewPrivate;
// visible is that they have been suppressed by setAlwaysHideHorizontal/VerticalScroller:.
- (BOOL)horizontalScrollingAllowed;
- (BOOL)verticalScrollingAllowed;
-
-// Returns YES if we're currently in the middle of programmatically moving the
-// scrollbar.
-// NOTE: As opposed to other places in the code, programmatically moving the
-// scrollers from inside this class should not fire JS events.
-- (BOOL)inProgramaticScroll;
@end
diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
index 1c6980f..74439dd 100644
--- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
+++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm
@@ -62,17 +62,6 @@ struct WebDynamicScrollBarsViewPrivate {
bool alwaysHideVerticalScroller;
bool horizontalScrollingAllowedButScrollerHidden;
bool verticalScrollingAllowedButScrollerHidden;
-
- // scrollOrigin is set for various combinations of writing mode and direction.
- // See the comment next to the corresponding member in ScrollView.h.
- NSPoint scrollOrigin;
-
- // Flag to indicate that the scrollbar thumb's initial position needs to
- // be manually set.
- bool scrollOriginChanged;
- NSPoint scrollPositionExcludingOrigin;
-
- bool inProgrammaticScroll;
};
@implementation WebDynamicScrollBarsView
@@ -160,11 +149,6 @@ struct WebDynamicScrollBarsViewPrivate {
return _private->verticalScrollingAllowedButScrollerHidden || [self hasVerticalScroller];
}
-- (BOOL)inProgramaticScroll
-{
- return _private->inProgrammaticScroll;
-}
-
@end
@implementation WebDynamicScrollBarsView (WebInternal)
@@ -217,24 +201,6 @@ struct WebDynamicScrollBarsViewPrivate {
#endif
}
-- (void)adjustForScrollOriginChange
-{
- if (!_private->scrollOriginChanged)
- return;
-
- _private->scrollOriginChanged = false;
-
- NSView *documentView = [self documentView];
- NSRect documentRect = [documentView bounds];
-
- // The call to [NSView scrollPoint:] fires off notification the handler for which needs to know that
- // we're setting the initial scroll position so it doesn't interpret this as a user action and
- // fire off a JS event.
- _private->inProgrammaticScroll = true;
- [documentView scrollPoint:NSMakePoint(_private->scrollPositionExcludingOrigin.x + documentRect.origin.x, _private->scrollPositionExcludingOrigin.y + documentRect.origin.y)];
- _private->inProgrammaticScroll = false;
-}
-
static const unsigned cMaxUpdateScrollbarsPass = 2;
- (void)updateScrollers
@@ -338,10 +304,6 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
[self setHasHorizontalScroller:newHasHorizontalScroller];
_private->inUpdateScrollers = NO;
needsLayout = YES;
- NSView *documentView = [self documentView];
- NSRect documentRect = [documentView bounds];
- if (documentRect.origin.y < 0 && !newHasHorizontalScroller)
- [documentView setBoundsOrigin:NSMakePoint(documentRect.origin.x, documentRect.origin.y + 15)];
}
if (hasVerticalScroller != newHasVerticalScroller) {
@@ -349,10 +311,6 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
[self setHasVerticalScroller:newHasVerticalScroller];
_private->inUpdateScrollers = NO;
needsLayout = YES;
- NSView *documentView = [self documentView];
- NSRect documentRect = [documentView bounds];
- if (documentRect.origin.x < 0 && !newHasVerticalScroller)
- [documentView setBoundsOrigin:NSMakePoint(documentRect.origin.x + 15, documentRect.origin.y)];
}
if (needsLayout && _private->inUpdateScrollersLayoutPass < cMaxUpdateScrollbarsPass &&
@@ -406,11 +364,6 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
}
#endif
- // The call to [NSView reflectScrolledClipView] sets the scrollbar thumb
- // position to 0 (the left) when the view is initially displayed.
- // This call updates the initial position correctly.
- [self adjustForScrollOriginChange];
-
#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD)
NSView *documentView = [self documentView];
if ([documentView isKindOfClass:[WebHTMLView class]]) {
@@ -572,30 +525,4 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
return [super accessibilityIsIgnored];
}
-- (void)setScrollOrigin:(NSPoint)scrollOrigin updatePosition:(BOOL)updatePosition
-{
- // The cross-platform ScrollView call already checked to see if the old/new scroll origins were the same or not
- // so we don't have to check for equivalence here.
- _private->scrollOrigin = scrollOrigin;
- id docView = [self documentView];
- NSPoint docOrigin = [docView bounds].origin;
-
- NSRect visibleRect = [self documentVisibleRect];
-
- [docView setBoundsOrigin:NSMakePoint(-scrollOrigin.x, -scrollOrigin.y)];
-
- _private->scrollOriginChanged = true;
-
- // Maintain our original position in the presence of the new scroll origin.
- _private->scrollPositionExcludingOrigin = NSMakePoint(visibleRect.origin.x + scrollOrigin.x, visibleRect.origin.y + scrollOrigin.y);
-
- if (updatePosition) // Otherwise we'll just let the snap happen when we update for the resize.
- [self adjustForScrollOriginChange];
-}
-
-- (NSPoint)scrollOrigin
-{
- return _private->scrollOrigin;
-}
-
@end
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index 20905d0..0db12c0 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -536,8 +536,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
if (![self _isScrollable])
return NO;
NSPoint point = [[[self _scrollView] documentView] frame].origin;
- point.x += [[self _scrollView] scrollOrigin].x;
- point.y += [[self _scrollView] scrollOrigin].y;
return [[self _contentView] _scrollTo:&point animate:YES];
}
@@ -549,8 +547,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
return NO;
NSRect frame = [[[self _scrollView] documentView] frame];
NSPoint point = NSMakePoint(frame.origin.x, NSMaxY(frame));
- point.x += [[self _scrollView] scrollOrigin].x;
- point.y += [[self _scrollView] scrollOrigin].y;
return [[self _contentView] _scrollTo:&point animate:YES];
}
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index db78c37..ec2473f 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -525,16 +525,6 @@ static NSCellStateValue kit(TriState state)
return NSOffState;
}
-static FindOptions coreOptions(WebFindOptions options)
-{
- return (options & WebFindOptionsCaseInsensitive ? CaseInsensitive : 0)
- | (options & WebFindOptionsAtWordStarts ? AtWordStarts : 0)
- | (options & WebFindOptionsTreatMedialCapitalAsWordStart ? TreatMedialCapitalAsWordStart : 0)
- | (options & WebFindOptionsBackwards ? Backwards : 0)
- | (options & WebFindOptionsWrapAround ? WrapAround : 0)
- | (options & WebFindOptionsStartInSelection ? StartInSelection : 0);
-}
-
@implementation WebHTMLViewPrivate
+ (void)initialize
@@ -1208,11 +1198,8 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
- (void)_frameOrBoundsChanged
{
- WebView *webView = [self _webView];
- WebDynamicScrollBarsView *scrollView = [[[webView mainFrame] frameView] _scrollView];
-
NSPoint origin = [[self superview] bounds].origin;
- if (!NSEqualPoints(_private->lastScrollPosition, origin) && ![scrollView inProgramaticScroll]) {
+ if (!NSEqualPoints(_private->lastScrollPosition, origin)) {
if (Frame* coreFrame = core([self _frame])) {
if (FrameView* coreView = coreFrame->view()) {
#ifndef BUILDING_ON_TIGER
@@ -1227,6 +1214,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
[_private->completionController endRevertingChange:NO moveLeft:NO];
+ WebView *webView = [self _webView];
[[webView _UIDelegateForwarder] webView:webView didScrollDocumentInFrameView:[self _frameView]];
}
_private->lastScrollPosition = origin;
@@ -6208,7 +6196,10 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection
{
- return [self findString:string options:(forward ? 0 : WebFindOptionsBackwards) | (caseFlag ? 0 : WebFindOptionsCaseInsensitive) | (startInSelection ? WebFindOptionsStartInSelection : 0)];
+ if (![string length])
+ return NO;
+ Frame* coreFrame = core([self _frame]);
+ return coreFrame && coreFrame->editor()->findString(string, forward, caseFlag, wrapFlag, startInSelection);
}
@end
@@ -6228,12 +6219,17 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
return [[[WebElementDictionary alloc] initWithHitTestResult:coreFrame->eventHandler()->hitTestResultAtPoint(IntPoint(point), allow)] autorelease];
}
-- (NSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options limit:(NSUInteger)limit markMatches:(BOOL)markMatches
+- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit
+{
+ return [self countMatchesForText:string caseSensitive:caseFlag limit:limit markMatches:YES];
+}
+
+- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit markMatches:(BOOL)markMatches
{
Frame* coreFrame = core([self _frame]);
if (!coreFrame)
return 0;
- return coreFrame->editor()->countMatchesForText(string, coreOptions(options), limit, markMatches);
+ return coreFrame->editor()->countMatchesForText(string, caseFlag, limit, markMatches);
}
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
@@ -6278,14 +6274,6 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
return result;
}
-- (BOOL)findString:(NSString *)string options:(WebFindOptions)options
-{
- if (![string length])
- return NO;
- Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->editor()->findString(string, coreOptions(options));
-}
-
@end
// This is used by AppKit and is included here so that WebDataProtocolScheme is only defined once.
diff --git a/WebKit/mac/WebView/WebPDFView.mm b/WebKit/mac/WebView/WebPDFView.mm
index 35d44f7..70fceb6 100644
--- a/WebKit/mac/WebView/WebPDFView.mm
+++ b/WebKit/mac/WebView/WebPDFView.mm
@@ -626,13 +626,19 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
return NO;
}
-- (NSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options limit:(NSUInteger)limit markMatches:(BOOL)markMatches
+- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit
+{
+ return [self countMatchesForText:string caseSensitive:caseFlag limit:limit markMatches:YES];
+}
+
+- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit markMatches:(BOOL)markMatches
{
PDFSelection *previousMatch = nil;
+ PDFSelection *nextMatch = nil;
NSMutableArray *matches = [[NSMutableArray alloc] initWithCapacity:limit];
for (;;) {
- PDFSelection *nextMatch = [self _nextMatchFor:string direction:YES caseSensitive:!(options & WebFindOptionsCaseInsensitive) wrap:NO fromSelection:previousMatch startInSelection:NO];
+ nextMatch = [self _nextMatchFor:string direction:YES caseSensitive:caseFlag wrap:NO fromSelection:previousMatch startInSelection:NO];
if (!nextMatch)
break;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index c57bf38..0498554 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -2645,21 +2645,6 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
return coreFrame->pageScaleFactor();
}
-- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit
-{
- return [self countMatchesForText:string options:(caseFlag ? 0 : WebFindOptionsCaseInsensitive) highlight:highlight limit:limit markMatches:YES];
-}
-
-- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches
-{
- return [self countMatchesForText:string options:(caseFlag ? 0 : WebFindOptionsCaseInsensitive) highlight:highlight limit:limit markMatches:markMatches];
-}
-
-- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection
-{
- return [self findString:string options:((forward ? 0 : WebFindOptionsBackwards) | (caseFlag ? 0 : WebFindOptionsCaseInsensitive) | (wrapFlag ? WebFindOptionsWrapAround : 0) | (startInSelection ? WebFindOptionsStartInSelection : 0))];
-}
-
@end
@implementation _WebSafeForwarder
@@ -3839,12 +3824,12 @@ static bool needsWebViewInitThreadWorkaround()
[super setNextKeyView:view];
}
-static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0)
+static WebFrame *incrementFrame(WebFrame *frame, BOOL forward, BOOL wrapFlag)
{
Frame* coreFrame = core(frame);
- return kit((options & WebFindOptionsBackwards)
- ? coreFrame->tree()->traversePreviousWithWrap(options & WebFindOptionsWrapAround)
- : coreFrame->tree()->traverseNextWithWrap(options & WebFindOptionsWrapAround));
+ return kit(forward
+ ? coreFrame->tree()->traverseNextWithWrap(wrapFlag)
+ : coreFrame->tree()->traversePreviousWithWrap(wrapFlag));
}
- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag
@@ -4270,16 +4255,7 @@ static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0)
core(self)->removeSchedulePair(SchedulePair::create(runLoop, (CFStringRef)mode));
}
-static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *string, WebFindOptions options)
-{
- if ([searchView conformsToProtocol:@protocol(WebDocumentOptionsSearching)])
- return [(NSView <WebDocumentOptionsSearching> *)searchView findString:string options:options];
- if ([searchView conformsToProtocol:@protocol(WebDocumentIncrementalSearching)])
- return [(NSView <WebDocumentIncrementalSearching> *)searchView searchFor:string direction:!(options & WebFindOptionsBackwards) caseSensitive:!(options & WebFindOptionsCaseInsensitive) wrap:!!(options & WebFindOptionsWrapAround) startInSelection:!!(options & WebFindOptionsStartInSelection)];
- return [searchView searchFor:string direction:!(options & WebFindOptionsBackwards) caseSensitive:!(options & WebFindOptionsCaseInsensitive) wrap:!!(options & WebFindOptionsWrapAround)];
-}
-
-- (BOOL)findString:(NSString *)string options:(WebFindOptions)options
+- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection
{
if (_private->closed)
return NO;
@@ -4291,7 +4267,7 @@ static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *stri
NSView <WebDocumentSearching> *startSearchView = nil;
WebFrame *frame = startFrame;
do {
- WebFrame *nextFrame = incrementFrame(frame, options);
+ WebFrame *nextFrame = incrementFrame(frame, forward, wrapFlag);
BOOL onlyOneFrame = (frame == nextFrame);
ASSERT(!onlyOneFrame || frame == startFrame);
@@ -4303,13 +4279,18 @@ static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *stri
if (frame == startFrame)
startSearchView = searchView;
+ BOOL foundString;
// In some cases we have to search some content twice; see comment later in this method.
- // We can avoid ever doing this in the common one-frame case by passing the wrap option through
+ // We can avoid ever doing this in the common one-frame case by passing YES for wrapFlag
// here, and then bailing out before we get to the code that would search again in the
// same content.
- WebFindOptions optionsForThisPass = onlyOneFrame ? options : (options & ~WebFindOptionsWrapAround);
-
- if (findString(searchView, string, optionsForThisPass)) {
+ BOOL wrapOnThisPass = wrapFlag && onlyOneFrame;
+ if ([searchView conformsToProtocol:@protocol(WebDocumentIncrementalSearching)])
+ foundString = [(NSView <WebDocumentIncrementalSearching> *)searchView searchFor:string direction:forward caseSensitive:caseFlag wrap:wrapOnThisPass startInSelection:startInSelection];
+ else
+ foundString = [searchView searchFor:string direction:forward caseSensitive:caseFlag wrap:wrapOnThisPass];
+
+ if (foundString) {
if (frame != startFrame)
[startFrame _clearSelection];
[[self window] makeFirstResponder:searchView];
@@ -4322,13 +4303,18 @@ static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *stri
frame = nextFrame;
} while (frame && frame != startFrame);
- // If there are multiple frames and WebFindOptionsWrapAround is set and we've visited each one without finding a result, we still need to search in the
+ // If there are multiple frames and wrapFlag is true and we've visited each one without finding a result, we still need to search in the
// first-searched frame up to the selection. However, the API doesn't provide a way to search only up to a particular point. The only
- // way to make sure the entire frame is searched is to pass WebFindOptionsWrapAround. When there are no matches, this will search
+ // way to make sure the entire frame is searched is to pass YES for the wrapFlag. When there are no matches, this will search again
// some content that we already searched on the first pass. In the worst case, we could search the entire contents of this frame twice.
// To fix this, we'd need to add a mechanism to specify a range in which to search.
- if ((options & WebFindOptionsWrapAround) && startSearchView) {
- if (findString(startSearchView, string, options)) {
+ if (wrapFlag && startSearchView) {
+ BOOL foundString;
+ if ([startSearchView conformsToProtocol:@protocol(WebDocumentIncrementalSearching)])
+ foundString = [(NSView <WebDocumentIncrementalSearching> *)startSearchView searchFor:string direction:forward caseSensitive:caseFlag wrap:YES startInSelection:startInSelection];
+ else
+ foundString = [startSearchView searchFor:string direction:forward caseSensitive:caseFlag wrap:YES];
+ if (foundString) {
[[self window] makeFirstResponder:startSearchView];
return YES;
}
@@ -4510,13 +4496,21 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
if (view && ![view conformsToProtocol:@protocol(WebMultipleTextMatches)])
return NO;
- frame = incrementFrame(frame);
+ frame = incrementFrame(frame, YES, NO);
} while (frame);
return YES;
}
-- (NSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches
+- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit
+{
+ if (_private->closed)
+ return 0;
+
+ return [self countMatchesForText:string caseSensitive:caseFlag highlight:highlight limit:limit markMatches:YES];
+}
+
+- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches
{
if (_private->closed)
return 0;
@@ -4530,14 +4524,14 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
[(NSView <WebMultipleTextMatches>*)view setMarkedTextMatchesAreHighlighted:highlight];
ASSERT(limit == 0 || matchCount < limit);
- matchCount += [(NSView <WebMultipleTextMatches>*)view countMatchesForText:string options:options limit:(limit == 0 ? 0 : limit - matchCount) markMatches:markMatches];
+ matchCount += [(NSView <WebMultipleTextMatches>*)view countMatchesForText:string caseSensitive:caseFlag limit:limit == 0 ? 0 : limit - matchCount markMatches:markMatches];
// Stop looking if we've reached the limit. A limit of 0 means no limit.
if (limit > 0 && matchCount >= limit)
break;
}
- frame = incrementFrame(frame);
+ frame = incrementFrame(frame, YES, NO);
} while (frame);
return matchCount;
@@ -4554,7 +4548,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
if ([view conformsToProtocol:@protocol(WebMultipleTextMatches)])
[(NSView <WebMultipleTextMatches>*)view unmarkAllTextMatches];
- frame = incrementFrame(frame);
+ frame = incrementFrame(frame, YES, NO);
} while (frame);
}
@@ -4592,7 +4586,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
[pool drain];
}
- frame = incrementFrame(frame);
+ frame = incrementFrame(frame, YES, NO);
} while (frame);
return result;
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 5b995e9..af594d9 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -70,7 +70,7 @@ extern NSString *WebElementIsContentEditableKey; // NSNumber indicating whether
extern NSString *WebElementMediaURLKey; // NSURL of the media element
// other WebElementDictionary keys
-extern NSString *WebElementLinkIsLiveKey; // NSNumber of BOOL indicating whether the link is live or not
+extern NSString *WebElementLinkIsLiveKey; // NSNumber of BOOL indictating whether the link is live or not
extern NSString *WebElementIsInScrollBarKey;
// One of the subviews of the WebView entered compositing mode.
@@ -96,16 +96,6 @@ typedef enum {
WebInjectInTopFrameOnly
} WebUserContentInjectedFrames;
-enum {
- WebFindOptionsCaseInsensitive = 1 << 0,
- WebFindOptionsAtWordStarts = 1 << 1,
- WebFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
- WebFindOptionsBackwards = 1 << 3,
- WebFindOptionsWrapAround = 1 << 4,
- WebFindOptionsStartInSelection = 1 << 5
-};
-typedef NSUInteger WebFindOptions;
-
@interface WebController : NSTreeController {
IBOutlet WebView *webView;
}
@@ -124,7 +114,18 @@ typedef NSUInteger WebFindOptions;
- (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
- (void)unscheduleFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
-- (BOOL)findString:(NSString *)string options:(WebFindOptions)options;
+/*!
+@method searchFor:direction:caseSensitive:wrap:startInSelection:
+ @abstract Searches a document view for a string and highlights the string if it is found.
+ Starts the search from the current selection. Will search across all frames.
+ @param string The string to search for.
+ @param forward YES to search forward, NO to seach backwards.
+ @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
+ @param wrapFlag YES to wrap around, NO to avoid wrapping.
+ @param startInSelection YES to begin search in the selected text (useful for incremental searching), NO to begin search after the selected text.
+ @result YES if found, NO if not found.
+ */
+- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection;
- (void)setMainFrameDocumentReady:(BOOL)mainFrameDocumentReady;
@@ -181,7 +182,8 @@ typedef NSUInteger WebFindOptions;
// 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.
- (BOOL)canMarkAllTextMatches;
-- (WebNSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
+- (WebNSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit;
+- (WebNSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
- (void)unmarkAllTextMatches;
- (NSArray *)rectsForTextMatches;
@@ -543,24 +545,6 @@ Could be worth adding to the API.
- (void)_scaleWebView:(float)scale atOrigin:(NSPoint)origin;
- (float)_viewScaleFactor;
-// Deprecated. Use the methods in pending public above instead.
-- (WebNSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit;
-- (WebNSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
-
-/*!
- @method searchFor:direction:caseSensitive:wrap:startInSelection:
- @abstract Searches a document view for a string and highlights the string if it is found.
- Starts the search from the current selection. Will search across all frames.
- @param string The string to search for.
- @param forward YES to search forward, NO to seach backwards.
- @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
- @param wrapFlag YES to wrap around, NO to avoid wrapping.
- @param startInSelection YES to begin search in the selected text (useful for incremental searching), NO to begin search after the selected text.
- @result YES if found, NO if not found.
- */
-// Deprecated. Use findString.
-- (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection;
-
@end
@interface WebView (WebViewPrintingPrivate)