summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/WebView
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-08 12:18:00 +0100
committerKristian Monsen <kristianm@google.com>2010-09-11 12:08:58 +0100
commit5ddde30071f639962dd557c453f2ad01f8f0fd00 (patch)
tree775803c4ab35af50aa5f5472cd1fb95fe9d5152d /WebKit/mac/WebView
parent3e63d9b33b753ca86d0765d1b3d711114ba9e34f (diff)
downloadexternal_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.zip
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.gz
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.bz2
Merge WebKit at r66666 : Initial merge by git.
Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r--WebKit/mac/WebView/WebDocumentInternal.h1
-rw-r--r--WebKit/mac/WebView/WebFrame.mm116
-rw-r--r--WebKit/mac/WebView/WebFrameInternal.h4
-rw-r--r--WebKit/mac/WebView/WebFramePrivate.h13
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm92
-rw-r--r--WebKit/mac/WebView/WebHTMLViewInternal.h2
-rw-r--r--WebKit/mac/WebView/WebPDFView.mm5
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h1
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm11
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h6
-rw-r--r--WebKit/mac/WebView/WebUIDelegatePrivate.h15
-rw-r--r--WebKit/mac/WebView/WebView.mm17
-rw-r--r--WebKit/mac/WebView/WebViewPrivate.h1
13 files changed, 163 insertions, 121 deletions
diff --git a/WebKit/mac/WebView/WebDocumentInternal.h b/WebKit/mac/WebView/WebDocumentInternal.h
index 191264b..0f63d75 100644
--- a/WebKit/mac/WebView/WebDocumentInternal.h
+++ b/WebKit/mac/WebView/WebDocumentInternal.h
@@ -62,6 +62,7 @@
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue;
- (BOOL)markedTextMatchesAreHighlighted;
- (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
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index dff9ff7..1feb97e 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -824,64 +824,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return kit(range.get());
}
-// Determines whether whitespace needs to be added around aString to preserve proper spacing and
-// punctuation when it’s inserted into the receiver’s text over charRange. Returns by reference
-// in beforeString and afterString any whitespace that should be added, unless either or both are
-// nil. Both are returned as nil if aString is nil or if smart insertion and deletion are disabled.
-- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString
-{
- // give back nil pointers in case of early returns
- if (beforeString)
- *beforeString = nil;
- if (afterString)
- *afterString = nil;
-
- // inspect destination
- Node *startContainer = core([rangeToReplace startContainer]);
- Node *endContainer = core([rangeToReplace endContainer]);
-
- Position startPos(startContainer, [rangeToReplace startOffset]);
- Position endPos(endContainer, [rangeToReplace endOffset]);
-
- VisiblePosition startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY);
- VisiblePosition endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY);
-
- // this check also ensures startContainer, startPos, endContainer, and endPos are non-null
- if (startVisiblePos.isNull() || endVisiblePos.isNull())
- return;
-
- bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos);
- if (addLeadingSpace)
- if (UChar previousChar = startVisiblePos.previous().characterAfter())
- addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true);
-
- bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos);
- if (addTrailingSpace)
- if (UChar thisChar = endVisiblePos.characterAfter())
- addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false);
-
- // inspect source
- bool hasWhitespaceAtStart = false;
- bool hasWhitespaceAtEnd = false;
- unsigned pasteLength = [pasteString length];
- if (pasteLength > 0) {
- NSCharacterSet *whiteSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
-
- if ([whiteSet characterIsMember:[pasteString characterAtIndex:0]]) {
- hasWhitespaceAtStart = YES;
- }
- if ([whiteSet characterIsMember:[pasteString characterAtIndex:(pasteLength - 1)]]) {
- hasWhitespaceAtEnd = YES;
- }
- }
-
- // issue the verdict
- if (beforeString && addLeadingSpace && !hasWhitespaceAtStart)
- *beforeString = @" ";
- if (afterString && addTrailingSpace && !hasWhitespaceAtEnd)
- *afterString = @" ";
-}
-
- (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString
{
if (!_private->coreFrame || !_private->coreFrame->document())
@@ -1240,6 +1182,64 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
[self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO];
}
+// Determines whether whitespace needs to be added around aString to preserve proper spacing and
+// punctuation when it's inserted into the receiver's text over charRange. Returns by reference
+// in beforeString and afterString any whitespace that should be added, unless either or both are
+// nil. Both are returned as nil if aString is nil or if smart insertion and deletion are disabled.
+- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString
+{
+ // give back nil pointers in case of early returns
+ if (beforeString)
+ *beforeString = nil;
+ if (afterString)
+ *afterString = nil;
+
+ // inspect destination
+ Node *startContainer = core([rangeToReplace startContainer]);
+ Node *endContainer = core([rangeToReplace endContainer]);
+
+ Position startPos(startContainer, [rangeToReplace startOffset]);
+ Position endPos(endContainer, [rangeToReplace endOffset]);
+
+ VisiblePosition startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY);
+ VisiblePosition endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY);
+
+ // this check also ensures startContainer, startPos, endContainer, and endPos are non-null
+ if (startVisiblePos.isNull() || endVisiblePos.isNull())
+ return;
+
+ bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos);
+ if (addLeadingSpace)
+ if (UChar previousChar = startVisiblePos.previous().characterAfter())
+ addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true);
+
+ bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos);
+ if (addTrailingSpace)
+ if (UChar thisChar = endVisiblePos.characterAfter())
+ addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false);
+
+ // inspect source
+ bool hasWhitespaceAtStart = false;
+ bool hasWhitespaceAtEnd = false;
+ unsigned pasteLength = [pasteString length];
+ if (pasteLength > 0) {
+ NSCharacterSet *whiteSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
+
+ if ([whiteSet characterIsMember:[pasteString characterAtIndex:0]]) {
+ hasWhitespaceAtStart = YES;
+ }
+ if ([whiteSet characterIsMember:[pasteString characterAtIndex:(pasteLength - 1)]]) {
+ hasWhitespaceAtEnd = YES;
+ }
+ }
+
+ // issue the verdict
+ if (beforeString && addLeadingSpace && !hasWhitespaceAtStart)
+ *beforeString = @" ";
+ if (afterString && addTrailingSpace && !hasWhitespaceAtEnd)
+ *afterString = @" ";
+}
+
- (NSMutableDictionary *)_cacheabilityDictionary
{
NSMutableDictionary *result = [NSMutableDictionary dictionary];
diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h
index 240b09c..dc3de21 100644
--- a/WebKit/mac/WebView/WebFrameInternal.h
+++ b/WebKit/mac/WebView/WebFrameInternal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +30,6 @@
#import "WebFramePrivate.h"
#import "WebPreferencesPrivate.h"
-
#import <WebCore/EditAction.h>
#import <WebCore/FrameLoaderTypes.h>
#import <WebCore/SelectionController.h>
@@ -142,7 +141,6 @@ WebView *getWebView(WebFrame *webFrame);
- (id)_accessibilityTree;
- (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionController::EDirection)direction granularity:(WebCore::TextGranularity)granularity;
-- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
- (NSRange)_convertToNSRange:(WebCore::Range*)range;
- (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
- (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range;
diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h
index 3556ad8..a1031f3 100644
--- a/WebKit/mac/WebView/WebFramePrivate.h
+++ b/WebKit/mac/WebView/WebFramePrivate.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@
@class DOMDocumentFragment;
@class DOMNode;
+@class DOMRange;
@class WebIconFetcher;
@class WebScriptObject;
@class WebScriptWorld;
@@ -84,7 +85,7 @@ typedef enum {
- (BOOL)_isDisplayingStandaloneImage;
-- (unsigned) _pendingFrameUnloadEventCount;
+- (unsigned)_pendingFrameUnloadEventCount;
- (WebIconFetcher *)fetchApplicationIcon:(id)target
selector:(SEL)selector;
@@ -111,16 +112,18 @@ typedef enum {
- (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time;
// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
-- (unsigned) _numberOfActiveAnimations;
+- (unsigned)_numberOfActiveAnimations;
// Suspend and resume animations (includes both CSS transitions and CSS animations).
-- (void) _suspendAnimations;
-- (void) _resumeAnimations;
+- (void)_suspendAnimations;
+- (void)_resumeAnimations;
- (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
- (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
- (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
+- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
+
- (NSMutableDictionary *)_cacheabilityDictionary;
- (BOOL)_allowsFollowingLink:(NSURL *)URL;
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index a619f18..34745a1 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -443,7 +443,6 @@ struct WebHTMLViewInterpretKeyEventsParameters {
@interface WebHTMLViewPrivate : NSObject {
@public
BOOL closed;
- BOOL needsToApplyStyles;
BOOL ignoringMouseDraggedEvents;
BOOL printing;
BOOL avoidingPrintOrphan;
@@ -1290,7 +1289,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
- (void)_propagateDirtyRectsToOpaqueAncestors
{
if (![[self _webView] drawsBackground])
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
[super _propagateDirtyRectsToOpaqueAncestors];
}
@@ -1302,7 +1301,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
// So check if the dataSource is nil before calling [self _isTopHTMLView], this can be removed
// once the FIXME in _isTopHTMLView is fixed.
if (_private->dataSource && [self _isTopHTMLView])
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
[super viewWillDraw];
}
@@ -1320,7 +1319,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
[self _web_setPrintingModeRecursive];
#ifndef BUILDING_ON_TIGER
else
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
#endif
} else if (wasInPrintingMode)
[self _web_clearPrintingModeRecursive];
@@ -1336,12 +1335,12 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
[self getRectsBeingDrawn:0 count:&rectCount];
if (rectCount) {
LOG_ERROR("View needs layout. Either -viewWillDraw wasn't called or layout was invalidated during the display operation. Performing layout now.");
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
}
}
#else
// Because Tiger does not have viewWillDraw we need to do layout here.
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
[_subviews makeObjectsPerformSelector:@selector(_propagateDirtyRectsToOpaqueAncestors)];
#endif
@@ -1373,7 +1372,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
[self _web_setPrintingModeRecursive];
#ifndef BUILDING_ON_TIGER
else
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
#endif
} else if (wasInPrintingMode)
[self _web_clearPrintingModeRecursive];
@@ -1383,7 +1382,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
// Because Tiger does not have viewWillDraw we need to do layout here.
NSRect boundsBeforeLayout = [self bounds];
if (!NSIsEmptyRect(visRect))
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
// If layout changes the view's bounds, then we need to recompute the visRect.
// That's because the visRect passed to us was based on the bounds at the time
@@ -1416,7 +1415,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
{
#ifdef BUILDING_ON_TIGER
// Because Tiger does not have viewWillDraw we need to do layout here.
- [self _web_layoutIfNeededRecursive];
+ [self _web_updateLayoutAndStyleIfNeededRecursive];
#endif
[self _setAsideSubviews];
@@ -3117,37 +3116,23 @@ WEBCORE_COMMAND(yankAndSelect)
- (void)reapplyStyles
{
- if (!_private->needsToApplyStyles)
- return;
-
#ifdef LOG_TIMES
double start = CFAbsoluteTimeGetCurrent();
#endif
- if (Frame* coreFrame = core([self _frame])) {
- if (FrameView* coreView = coreFrame->view())
- coreView->setMediaType(_private->printing ? "print" : "screen");
- if (Document* document = coreFrame->document()) {
- document->setPaginatedForScreen(_private->paginateScreenContent);
- document->setPrinting(_private->printing);
- }
- coreFrame->reapplyStyles();
- }
+ if (Frame* coreFrame = core([self _frame]))
+ coreFrame->document()->styleSelectorChanged(RecalcStyleImmediately);
#ifdef LOG_TIMES
double thisTime = CFAbsoluteTimeGetCurrent() - start;
LOG(Timing, "%s apply style seconds = %f", [self URL], thisTime);
#endif
-
- _private->needsToApplyStyles = NO;
}
// Do a layout, but set up a new fixed width for the purposes of doing printing layout.
// minPageWidth==0 implies a non-printing layout
- (void)layoutToMinimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize
-{
- [self reapplyStyles];
-
+{
if (![self _needsLayout])
return;
@@ -3308,7 +3293,13 @@ WEBCORE_COMMAND(yankAndSelect)
- (void)setNeedsToApplyStyles: (BOOL)flag
{
LOG(View, "%@ setNeedsToApplyStyles:%@", self, flag ? @"YES" : @"NO");
- _private->needsToApplyStyles = flag;
+ if (!flag)
+ return; // There's no way to say you don't need a style recalc.
+ if (Frame* frame = core([self _frame])) {
+ if (frame->document() && frame->document()->inPageCache())
+ return;
+ frame->document()->scheduleForcedStyleRecalc();
+ }
}
- (void)drawSingleRect:(NSRect)rect
@@ -3883,7 +3874,18 @@ static BOOL isInPasswordField(Frame* coreFrame)
_private->paginateScreenContent = paginateScreenContent;
if (!printing && !paginateScreenContent)
_private->avoidingPrintOrphan = NO;
- [self setNeedsToApplyStyles:YES];
+
+ Frame* coreFrame = core([self _frame]);
+ if (coreFrame) {
+ if (FrameView* coreView = coreFrame->view())
+ coreView->setMediaType(_private->printing ? "print" : "screen");
+ if (Document* document = coreFrame->document()) {
+ document->setPaginatedForScreen(_private->paginateScreenContent);
+ document->setPrinting(_private->printing);
+ document->styleSelectorChanged(RecalcStyleImmediately);
+ }
+ }
+
[self setNeedsLayout:YES];
[self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize];
if (!printing) {
@@ -5507,31 +5509,16 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
{
ASSERT(!_private->subviewsSetAside);
- if (_private->needsToApplyStyles || [self _needsLayout])
+ if ([self _needsLayout])
[self layout];
}
-- (void)_web_layoutIfNeededRecursive
+- (void)_web_updateLayoutAndStyleIfNeededRecursive
{
- [self _layoutIfNeeded];
-
-#ifndef NDEBUG
- _private->enumeratingSubviews = YES;
-#endif
-
- NSMutableArray *descendantWebHTMLViews = [[NSMutableArray alloc] init];
-
- [self _web_addDescendantWebHTMLViewsToArray:descendantWebHTMLViews];
-
- unsigned count = [descendantWebHTMLViews count];
- for (unsigned i = 0; i < count; ++i)
- [[descendantWebHTMLViews objectAtIndex:i] _layoutIfNeeded];
-
- [descendantWebHTMLViews release];
-
-#ifndef NDEBUG
- _private->enumeratingSubviews = NO;
-#endif
+ WebFrame *webFrame = [self _frame];
+ Frame* coreFrame = core(webFrame);
+ if (coreFrame && coreFrame->view())
+ coreFrame->view()->updateLayoutAndStyleIfNeededRecursive();
}
- (void) _destroyAllWebPlugins
@@ -6202,10 +6189,15 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
- (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->markAllMatchesForText(string, caseFlag, limit);
+ return coreFrame->countMatchesForText(string, caseFlag, limit, markMatches);
}
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
diff --git a/WebKit/mac/WebView/WebHTMLViewInternal.h b/WebKit/mac/WebView/WebHTMLViewInternal.h
index 3f1f50d..2d9e2a9 100644
--- a/WebKit/mac/WebView/WebHTMLViewInternal.h
+++ b/WebKit/mac/WebView/WebHTMLViewInternal.h
@@ -59,7 +59,7 @@ namespace WebCore {
#endif
- (WebCore::CachedImage*)promisedDragTIFFDataSource;
- (void)setPromisedDragTIFFDataSource:(WebCore::CachedImage*)source;
-- (void)_web_layoutIfNeededRecursive;
+- (void)_web_updateLayoutAndStyleIfNeededRecursive;
- (void)_destroyAllWebPlugins;
- (BOOL)_needsLayout;
diff --git a/WebKit/mac/WebView/WebPDFView.mm b/WebKit/mac/WebView/WebPDFView.mm
index 5e7b73c..70fceb6 100644
--- a/WebKit/mac/WebView/WebPDFView.mm
+++ b/WebKit/mac/WebView/WebPDFView.mm
@@ -628,6 +628,11 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
- (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];
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index 86f6d85..3b750ff 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -97,6 +97,7 @@
#define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled"
#define WebKitPaginateDuringLayoutEnabledPreferenceKey @"WebKitPaginateDuringLayoutEnabled"
#define WebKitDNSPrefetchingEnabledPreferenceKey @"WebKitDNSPrefetchingEnabled"
+#define WebKitFullScreenEnabledPreferenceKey @"WebKitFullScreenEnabled"
#define WebKitMemoryInfoEnabledPreferenceKey @"WebKitMemoryInfoEnabled"
// These are private both because callers should be using the cover methods and because the
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index eae2d8d..a4a5383 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -365,6 +365,7 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey,
[NSNumber numberWithBool:NO], WebKitFrameFlatteningEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey,
+ [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey,
[NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
[NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
@@ -1346,6 +1347,16 @@ static NSString *classIBCreatorID = nil;
[self _setStringValue:value forKey:key];
}
+- (void)setFullScreenEnabled:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey];
+}
+
+- (BOOL)fullScreenEnabled
+{
+ return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey];
+}
+
@end
@implementation WebPreferences (WebInternal)
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 45c2a24..783038d 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -206,4 +206,10 @@ extern NSString *WebPreferencesRemovedNotification;
// For WebView's use only.
- (void)willAddToWebView;
- (void)didRemoveFromWebView;
+
+// Full screen support is dependent on WebCore/WebKit being
+// compiled with ENABLE_FULLSCREEN_API.
+- (void)setFullScreenEnabled:(BOOL)flag;
+- (BOOL)fullScreenEnabled;
+
@end
diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h
index 0fb120c..22752ae 100644
--- a/WebKit/mac/WebView/WebUIDelegatePrivate.h
+++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h
@@ -95,6 +95,15 @@ enum {
- (void)deny;
@end
+#if ENABLE(FULLSCREEN_API)
+@protocol WebKitFullScreenListener<NSObject>
+- (void)webkitWillEnterFullScreen;
+- (void)webkitDidEnterFullScreen;
+- (void)webkitWillExitFullScreen;
+- (void)webkitDidExitFullScreen;
+@end
+#endif
+
@interface NSObject (WebUIDelegatePrivate)
- (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message;
@@ -164,4 +173,10 @@ enum {
*/
- (void)webView:(WebView *)sender printFrame:(WebFrame *)frame;
+#if ENABLE(FULLSCREEN_API)
+- (BOOL)webView:(WebView *)sender supportsFullScreenForElement:(DOMElement *)element;
+- (void)webView:(WebView *)sender enterFullScreenForElement:(DOMElement *)element;
+- (void)webView:(WebView *)sender exitFullScreenForElement:(DOMElement *)element;
+#endif
+
@end
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 2d3dbfa..f2e76c1 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -842,7 +842,7 @@ static bool shouldEnableLoadDeferring()
{
Frame* frame = [self _mainCoreFrame];
if (frame && frame->view())
- frame->view()->layoutIfNeededRecursive();
+ frame->view()->updateLayoutAndStyleIfNeededRecursive();
}
#endif
@@ -1425,7 +1425,7 @@ static bool fastDocumentTeardownEnabled()
settings->setZoomMode([preferences zoomsTextOnly] ? ZoomTextOnly : ZoomPage);
settings->setJavaScriptCanAccessClipboard([preferences javaScriptCanAccessClipboard]);
settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]);
- settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1));
+ settings->setEnforceCSSMIMETypeInNoQuirksMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1));
settings->setDNSPrefetchingEnabled([preferences isDNSPrefetchingEnabled]);
// FIXME: Enabling accelerated compositing when WebGL is enabled causes tests to fail on Leopard which expect HW compositing to be disabled.
@@ -1438,6 +1438,9 @@ static bool fastDocumentTeardownEnabled()
settings->setLoadDeferringEnabled(shouldEnableLoadDeferring());
settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]);
settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]);
+#if ENABLE(FULLSCREEN_API)
+ settings->setFullScreenEnabled([preferences fullScreenEnabled]);
+#endif
settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]);
// Application Cache Preferences are stored on the global cache storage manager, not in Settings.
@@ -4372,15 +4375,21 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit
{
+ 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
+{
WebFrame *frame = [self mainFrame];
unsigned matchCount = 0;
do {
id <WebDocumentView> view = [[frame frameView] documentView];
if ([view conformsToProtocol:@protocol(WebMultipleTextMatches)]) {
- [(NSView <WebMultipleTextMatches>*)view setMarkedTextMatchesAreHighlighted:highlight];
+ if (markMatches)
+ [(NSView <WebMultipleTextMatches>*)view setMarkedTextMatchesAreHighlighted:highlight];
ASSERT(limit == 0 || matchCount < limit);
- matchCount += [(NSView <WebMultipleTextMatches>*)view markAllMatchesForText:string caseSensitive:caseFlag limit:limit == 0 ? 0 : limit - matchCount];
+ 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)
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 9d47a4d..28348cc 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -180,6 +180,7 @@ typedef enum {
// These methods are still in flux; don't rely on them yet.
- (BOOL)canMarkAllTextMatches;
- (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;