diff options
Diffstat (limited to 'WebKit/mac')
46 files changed, 976 insertions, 171 deletions
diff --git a/WebKit/mac/Carbon/CarbonWindowAdapter.mm b/WebKit/mac/Carbon/CarbonWindowAdapter.mm index ba1da71..c57bc37 100644 --- a/WebKit/mac/Carbon/CarbonWindowAdapter.mm +++ b/WebKit/mac/Carbon/CarbonWindowAdapter.mm @@ -74,6 +74,7 @@ #import <WebCore/WebCoreObjCExtras.h> #import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> #import "WebKitLogging.h" #import "WebNSObjectExtras.h" @@ -269,6 +270,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index e45527f..d7aa5bf 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,546 @@ +2010-05-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler and Dan Bernstein.. + + REGRESSION (r51617): when plugins are disabled, plugins show up as garbage characters + https://bugs.webkit.org/show_bug.cgi?id=38698 + <rdar://problem/7942075> + + When the plug-in database is initialized, we will register all the MIME types it supports with the global + WebView dictionary. When plug-ins are disabled for a single web view, the MIME types still need to be + in the global mapping (because other web views might still have plug-ins enabled). + + Prior to r51617 we would always look at the plug-in database to determine that the MIME type belongs to a + plug-in, but now we won't even touch the plug-in database when plug-ins are disabled. + + In order to fix this, a new set of registered MIME types that are known to be plug-ins is added. When + +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:] is called and allowingPlugins is FALSE + we check if the MIME type is a known plug-in MIME type and return false in that case. + + * Plugins/WebPluginDatabase.mm: + (-[WebPluginDatabase refresh]): + (-[WebPluginDatabase _removePlugin:]): + * WebView/WebView.mm: + (knownPluginMIMETypes): + (+[WebView _registerPluginMIMEType:]): + (+[WebView _unregisterPluginMIMEType:]): + (+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]): + * WebView/WebViewInternal.h: + +2010-05-06 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7951285> REGRESSION (r58847): Composited iframe content obscures Safari's application chrome + + Fixed this other regression from r58847. The regression was caused by overriding -visibleRect to + return the WebClipView’s full bounds. AppKit uses -visibleRect to determine the geometry + of the surface for the child WebFrameView. The fix is to restrict the special behavior of + -[WebClipView visibleRect] to when AppKit is consulting it for the purpose of invalidating + areas while scrolling. + + * WebView/WebClipView.h: + * WebView/WebClipView.mm: + (-[WebClipView visibleRect]): If the WebClipView is not scrolling, always return + [super visibleRect]. + (-[WebClipView _immediateScrollToPoint:]): Override this internal NSClipView method + to set a flag telling -visibleRect that the view is scrolling. + * WebView/WebView.mm: + (layerSyncRunLoopObserverCallBack): Ensure that screen updates, disabled by AppKit + when it thinks an upcoming window flush will re-enable them, are enabled here in + case the -setNeedsDisplayInRect: override has prevented the window from needing to be + flushed. + +2010-05-06 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + MAC_JAVA_BRIDGE should be renamed JAVA_BRIDGE + https://bugs.webkit.org/show_bug.cgi?id=38544 + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + +2010-05-05 Dan Bernstein <mitz@apple.com> + + Reviewed by Mark Rowe. + + Fixed a crash when closing Top Sites after r58847. + + * WebView/WebFrameView.mm: + (-[WebFrameView webFrame]): Null-check _private. + +2010-05-05 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Mark Rowe. + + Fixed test crashes after r58847. + + * WebView/WebHTMLView.mm: + (setNeedsDisplayInRect): Null-check the frame. + +2010-05-05 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1) + https://bugs.webkit.org/show_bug.cgi?id=38427 + + * WebView/WebClipView.m: Renamed to WebClipView.mm. + * WebView/WebClipView.mm: + (-[WebClipView visibleRect]): Added this override, which for instances used for WebFrameViews in + composited layers, returns the clip view’s entire bounds. This prevents drawing from being clipped to + AppKit’s idea of what part of the view would be visible if it was drawn as part of the view hierarchy. + Since it is drawn into a compositing layer, that’s irrelevant, and we should not be clipping. + * WebView/WebHTMLView.mm: + (setCursor): Style tweak. + (setNeedsDisplayInRect): Added. Replaces the default implementation of -[NSView setNeedsDisplayInRect:], + so that if the receiver is a descendant of a WebFrameView that draws into a composited layer, the invalidation + is routed back through the WebCore FrameView, which propagates it to the layer. + (+[WebHTMLViewPrivate initialize]): Swizzle the setNeedsDisplayInRect: override in. + (-[WebHTMLView visibleRect]): Removed whitespace. + * WebView/WebView.mm: + (layerSyncRunLoopObserverCallBack): If we bailed out on syncing, due to pending layout, do an eager layout + in preparation for the displaying of compositing layers. + +2010-05-05 John Sullivan <sullivan@apple.com> + + <rdar://problem/7942606> Output appears in Console when exiting Safari with multiple windows opened + + Reviewed by Mark Rowe. + + * WebView/WebView.mm: + (+[WebView closeAllWebViews]): + Make copy of allWebViewsSet to avoid mutating it while iterating through it. + +2010-05-04 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Improve check for drawing into the window that was added in r58623 + https://bugs.webkit.org/show_bug.cgi?id=38562 + + Rather than assuming that any non-bitmap context is the window's context, + compare the current graphics context with -[NSWindow graphicsContext] to + determine that we're drawing into the window. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + +2010-05-04 Ada Chan <adachan@apple.com> + + Reviewed by David Kilzer. + + https://bugs.webkit.org/show_bug.cgi?id=38555 + + Small code refactoring: move the logic to figure out the path to the + databases directory to another method. + + * Storage/WebDatabaseManager.mm: + (databasesDirectoryPath): + (WebKitInitializeDatabasesIfNecessary): + +2010-05-04 Beth Dakin <bdakin@apple.com> + + Reviewed by Mike Thole. + + Fix for <rdar://problem/7818509> Crash occurs when exiting Safari + + We can avoid this crash if we call [self _removeFromAllWebViewsSet] + even in the case when we are doing a fastDocumentTeardown. This is + a much safer approach. + * WebView/WebView.mm: + (-[WebView _close]): + +2010-05-03 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences javaScriptCanAccessClipboard]): + (-[WebPreferences setJavaScriptCanAccessClipboard:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * WebCoreSupport/WebFrameLoaderClient.h: + (WebFrameLoaderClient::dispatchWillSendSubmitEvent): + +2010-04-30 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/7477071> REGRESSION: Bad flicker when wheel-scrolling Google Maps, iPad gallery and other sites + + Sites that frequently toggle content in and out of compositing layers (like http://www.tumblr.com/boothed) + can cause flickering because of unsychronized compositing layer and view-based updates. There were two + underlying issues: + + 1. On SnowLeopard, AppKit can throttle window updates, thus breaking an assumption that + NSView drawing will happen on the runloop cycle after a repaint. This provided a window + for the layerSyncRunLoopObserver to fire and commit layer changes too early. + + Fix this by having the layerSyncRunLoopObserver in WebView check to see if a display is pending, + and not commit layer changes in that case. We'll commit layer changes later when we + finally draw. + + 2. The change in r49269 was wrong; it was attempting to fix an issue that was actually caused + by -drawRects: coming in for page snapshots. The correct approach is to avoid hitting the + synchronization and update disabling code in WebHTMLView for draws that are not to the screen. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + * WebView/WebView.mm: + (layerSyncRunLoopObserverCallBack): + (-[WebView _scheduleCompositingLayerSync]): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Part of the previous part (forgot to save). + + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView stopTimers]): + (-[WebNetscapePluginView startTimers]): + (-[WebNetscapePluginView checkIfAllowedToLoadURL:frame:callbackFunc:context:]): + (-[WebNetscapePluginView _containerCheckResult:contextInfo:]): + (-[WebNetscapePluginView cancelCheckIfAllowedToLoadURL:]): + (-[WebNetscapePluginView scheduleTimerWithInterval:repeat:timerFunc:]): + (-[WebNetscapePluginView unscheduleTimer:]): + (-[WebNetscapePluginView getVariable:forURL:value:length:]): + (-[WebNetscapePluginView setVariable:forURL:value:length:]): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Use C99 integer types in more places. + + * Plugins/WebNetscapePluginView.mm: + (getNPRect): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Fix Tiger build. + + * Plugins/WebBaseNetscapePluginStream.h: + * Plugins/WebBaseNetscapePluginStream.mm: + (WebNetscapePluginStream::startStream): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Another 32-bit build fix. + + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Fix 32-bit build (again). + + * Plugins/WebNetscapeContainerCheckContextInfo.h: + * Plugins/WebNetscapeContainerCheckContextInfo.mm: + (-[WebNetscapeContainerCheckContextInfo initWithCheckRequestID:callbackFunc:context:]): + (-[WebNetscapeContainerCheckContextInfo checkRequestID]): + (-[WebNetscapeContainerCheckContextInfo callback]): + * Plugins/WebNetscapePluginPackage.h: + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Fix 32-bit build. + + * Plugins/WebNetscapeContainerCheckContextInfo.h: + * Plugins/WebNetscapeContainerCheckContextInfo.mm: + (-[WebNetscapeContainerCheckContextInfo initWithCheckRequestID:callbackFunc:context:]): + * Plugins/WebNetscapeContainerCheckPrivate.h: + * Plugins/WebNetscapePluginPackage.mm: + (functionPointerForTVector): + * Plugins/WebNetscapePluginView.mm: + (PluginTimer::PluginTimer): + (-[WebNetscapePluginView checkIfAllowedToLoadURL:frame:callbackFunc:context:]): + (-[WebNetscapePluginView scheduleTimerWithInterval:repeat:timerFunc:]): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Timothy Hatcher. + + Next step towards fixing + + https://bugs.webkit.org/show_bug.cgi?id=20784 + move npapi.h to C99 integer types + + Use the C99 types everywhere. The "old" types are still around but will be removed + in a subsequent commit. + + * Plugins/WebBaseNetscapePluginStream.h: + * Plugins/WebBaseNetscapePluginStream.mm: + (WebNetscapePluginStream::deliverData): + * Plugins/WebNetscapePluginView.h: + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): + (-[WebNetscapePluginView getAuthenticationInfoWithProtocol:host:port:scheme:realm:username:usernameLength:password:passwordLength:]): + * Plugins/npapi.mm: + (NPN_MemAlloc): + (NPN_MemFlush): + (NPN_PostURLNotify): + (NPN_PostURL): + (NPN_Write): + (NPN_ScheduleTimer): + (NPN_UnscheduleTimer): + (NPN_GetValueForURL): + (NPN_SetValueForURL): + (NPN_GetAuthenticationInfo): + (WKN_CheckIfAllowedToLoadURL): + (WKN_CancelCheckIfAllowedToLoadURL): + +2010-04-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + First part of + https://bugs.webkit.org/show_bug.cgi?id=20784 + move npapi.h to C99 integer types. + + * MigrateHeaders.make: + +2010-04-28 Mike Thole <mthole@apple.com> + + Reviewed by David Kilzer. + + Add canAuthenticateAgainstProtectionSpace() to frame loader so that a protection space + can be inspected before attempting to authenticate against it + https://bugs.webkit.org/show_bug.cgi?id=38271 + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace): + Added. If the resource load delegate implements the callback, use its answer. If it does + not, then only send authentication challenges for pre-10.6 protection spaces, which matches + CFNetwork's default behavior. + * WebView/WebDelegateImplementationCaching.h: + * WebView/WebDelegateImplementationCaching.mm: + (CallResourceLoadDelegateReturningBoolean): Added case for passing three objects. + * WebView/WebResourceLoadDelegatePrivate.h: + Added private SPI definition: webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource: + * WebView/WebView.mm: + (-[WebView _cacheResourceLoadDelegateImplementations]): + +2010-04-28 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7918719> ASSERT(isMainThread()) from Font::setShouldUseSmoothing() + + Ensure that the WebView +initialize method initializes threading, so that things are correctly + initialized when the first call into the WebKit framework is via a WebView class method. + + * WebView/WebView.mm: + (+[WebView initialize]): + +2010-04-28 Darin Adler <darin@apple.com> + + Reviewed by Adele Peterson. + + REGRESSION: Autoscroll does not work in Mail messages + https://bugs.webkit.org/show_bug.cgi?id=38267 + rdar://problem/7559799 + + The machinery to make autoscrolling work on Mac OS X when a WebView is embedded in another + view had gotten broken in multiple ways. For some reason, a combination of bugs made it + partly work until around r48064. This brings it back. + + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::scrollRectIntoView): When converting coordinates, use the document view + rather than the WebView itself. This logic may not be correct for the case where + usesDocumentViews is NO, but that is currently an experimental mode and can be fixed later. + +2010-04-27 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler and Eric Seidel. + + Add layoutTestController.setPrinting() + https://bugs.webkit.org/show_bug.cgi?id=37203 + + * Misc/WebCoreStatistics.h: + * Misc/WebCoreStatistics.mm: + (-[WebFrame renderTreeAsExternalRepresentationForPrinting:]): + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + Calls initializeMainThreadToProcessMainThread since there is no way to ensure + that the initialize method will be called on the main thread. + + * Carbon/CarbonWindowAdapter.mm: + (+[CarbonWindowAdapter initialize]): Add call to initializeMainThreadToProcessMainThread. + * History/WebBackForwardList.mm: + (+[WebBackForwardList initialize]): Ditto. + * History/WebHistoryItem.mm: + (+[WebHistoryItem initialize]): Ditto. + * Misc/WebElementDictionary.mm: + (+[WebElementDictionary initialize]): Ditto. + * Misc/WebIconDatabase.mm: + (+[WebIconDatabase initialize]): Ditto. + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (+[WebHostedNetscapePluginView initialize]): Ditto. + * Plugins/WebBaseNetscapePluginView.mm: + (+[WebBaseNetscapePluginView initialize]): Ditto. + * Plugins/WebBasePluginPackage.mm: + (+[WebBasePluginPackage initialize]): Ditto. + * Plugins/WebNetscapePluginView.mm: + (+[WebNetscapePluginView initialize]): Ditto. + * WebCoreSupport/WebEditorClient.mm: + (+[WebEditCommand initialize]): Ditto. + * WebCoreSupport/WebFrameLoaderClient.mm: + (+[WebFramePolicyListener initialize]): Ditto. + * WebView/WebArchive.mm: + (+[WebArchivePrivate initialize]): Ditto. + * WebView/WebDataSource.mm: + (+[WebDataSourcePrivate initialize]): Ditto. + * WebView/WebHTMLView.mm: + (+[WebHTMLViewPrivate initialize]): Ditto. + (+[WebHTMLView initialize]): Ditto. + * WebView/WebResource.mm: + (+[WebResourcePrivate initialize]): Ditto. + * WebView/WebTextIterator.mm: + (+[WebTextIteratorPrivate initialize]): Ditto. + * WebView/WebView.mm: + * WebView/WebViewData.mm: Ditto. + (+[WebViewPrivate initialize]): Ditto. + +2010-04-24 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/7903728> REGRESSION (r51617): WebView fails to load plug-in MIME types + https://bugs.webkit.org/show_bug.cgi?id=38085 + + WebView was calling -_webView in a few places where it should have just used itself. It never + makes sense for WebView to call -_webView on itself, and these calls look like they were copied + from similar code in WebHTMLView, WebFrameView and WebDataSource, where -_webView has a different, + useful meaning. + + * WebView/WebView.mm: + (-[WebView drawSingleRect:]): Replaced [self _webView] with self. + (-[WebView _viewClass:andRepresentationClass:forMIMEType:]): Replaced [[self _webView] preferences] + with _private->preferences. + (-[WebView _canShowMIMEType:]): Ditto. + +2010-04-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/7894489> When printing Flash, send a drawRect event, rather than NPPrint + + When printing Flash plug-ins in 32-bit, send a drawRect event with a CGContextRef, rather than calling + NPPrint with a GWorldPtr, since Flash prefers the CGContext path. + + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView drawRect:]): + +2010-04-22 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/38029> +[WebTextIteratorPrivate initialize] is missing call to JSC::initializeThreading() + + Reviewed by Timothy Hatcher. + + Every other Objective-C class that calls + WebCoreObjCFinalizeOnMainThread(self) in +initialize also calls + JSC::initializeThreading(). The WebTextIteratorPrivate class + was the only one missing this call. + + * WebView/WebTextIterator.mm: + (+[WebTextIteratorPrivate initialize]): Added call to + JSC::initializeThreading(). + +2010-04-22 Alexey Proskuryakov <ap@apple.com> + + Rubber-stamped by Mark Rowe. + + <rdar://problem/7805969> REGRESSION: iTunes unable to play trailers + + Undo the changes made for https://bugs.webkit.org/show_bug.cgi?id=35215 (<rdar://problem/7673157>) + for now. Clients rely on the old behavior, so a fix that changes it will need to account for + those. + + * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::createPlugin): Pass pluginURL + instead of baseURL again. + +2010-04-22 Dave Moore <davemoore@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added notification when the favicons for a page are changed + from a script. + The Document object will notify the frame loader, which will + notify the client. Implementations of FrameLoaderClient will + have to add one method; dispatchDidChangeIcons(). + + https://bugs.webkit.org/show_bug.cgi?id=33812 + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidChangeIcons): + +2010-04-22 Adam Barth <abarth@webkit.org> + + Unreviewed, rolling out r58069. + http://trac.webkit.org/changeset/58069 + https://bugs.webkit.org/show_bug.cgi?id=27751 + + Broke compile on Windows. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-04-22 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences javaScriptCanAccessClipboard]): + (-[WebPreferences setJavaScriptCanAccessClipboard:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-04-21 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Shinichiro Hamaji. + + https://bugs.webkit.org/show_bug.cgi?id=37964 + Fix a typo in comments - Korean encoding name is windows-949, not windows-939 + + * WebView/WebPreferences.mm: (+[WebPreferences _setInitialDefaultTextEncodingToSystemEncoding]): + 2010-04-21 Mark Rowe <mrowe@apple.com> Tiger build fix. diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index 6aeb263..cc5943e 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 533; -MINOR_VERSION = 6; +MINOR_VERSION = 9; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/History/WebBackForwardList.mm b/WebKit/mac/History/WebBackForwardList.mm index f206fda..6d9e998 100644 --- a/WebKit/mac/History/WebBackForwardList.mm +++ b/WebKit/mac/History/WebBackForwardList.mm @@ -49,6 +49,7 @@ #import <wtf/Assertions.h> #import <wtf/RetainPtr.h> #import <wtf/StdLibExtras.h> +#import <wtf/Threading.h> using namespace WebCore; @@ -100,6 +101,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/History/WebHistoryItem.mm b/WebKit/mac/History/WebHistoryItem.mm index 91bc610..48baa7c 100644 --- a/WebKit/mac/History/WebHistoryItem.mm +++ b/WebKit/mac/History/WebHistoryItem.mm @@ -53,6 +53,7 @@ #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> #import <wtf/StdLibExtras.h> +#import <wtf/Threading.h> // Private keys used in the WebHistoryItem's dictionary representation. // see 3245793 for explanation of "lastVisitedDate" @@ -95,6 +96,7 @@ void WKNotifyHistoryItemChanged(HistoryItem*) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/MigrateHeaders.make b/WebKit/mac/MigrateHeaders.make index 061169e..96c0a71 100644 --- a/WebKit/mac/MigrateHeaders.make +++ b/WebKit/mac/MigrateHeaders.make @@ -185,6 +185,7 @@ all : \ $(PUBLIC_HEADERS_DIR)/npapi.h \ $(PUBLIC_HEADERS_DIR)/npfunctions.h \ $(PUBLIC_HEADERS_DIR)/npruntime.h \ + $(PUBLIC_HEADERS_DIR)/nptypes.h \ # ifeq ($(findstring ENABLE_SVG_DOM_OBJC_BINDINGS,$(FEATURE_DEFINES)), ENABLE_SVG_DOM_OBJC_BINDINGS) diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h index d205083..a11c064 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.h +++ b/WebKit/mac/Misc/WebCoreStatistics.h @@ -83,7 +83,7 @@ @end @interface WebFrame (WebKitDebug) -- (NSString *)renderTreeAsExternalRepresentation; +- (NSString *)renderTreeAsExternalRepresentationForPrinting:(BOOL)forPrinting; - (NSString *)counterValueForElement:(DOMElement*)element; - (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels; - (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels; diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index 1351fe5..c3fc23e 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -255,9 +255,9 @@ using namespace WebCore; @implementation WebFrame (WebKitDebug) -- (NSString *)renderTreeAsExternalRepresentation +- (NSString *)renderTreeAsExternalRepresentationForPrinting:(BOOL)forPrinting { - return externalRepresentation(_private->coreFrame); + return externalRepresentation(_private->coreFrame, forPrinting ? RenderAsTextPrintingMode : RenderAsTextBehaviorNormal); } - (NSString *)counterValueForElement:(DOMElement*)element diff --git a/WebKit/mac/Misc/WebElementDictionary.mm b/WebKit/mac/Misc/WebElementDictionary.mm index 7779392..6b2eb3d 100644 --- a/WebKit/mac/Misc/WebElementDictionary.mm +++ b/WebKit/mac/Misc/WebElementDictionary.mm @@ -43,6 +43,7 @@ #import <WebKit/DOMCore.h> #import <WebKit/DOMExtensions.h> #import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> using namespace WebCore; @@ -64,6 +65,7 @@ static void cacheValueForKey(const void *key, const void *value, void *self) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/Misc/WebIconDatabase.mm b/WebKit/mac/Misc/WebIconDatabase.mm index 0ded0d5..f53bffa 100644 --- a/WebKit/mac/Misc/WebIconDatabase.mm +++ b/WebKit/mac/Misc/WebIconDatabase.mm @@ -42,6 +42,8 @@ #import <WebCore/IntSize.h> #import <WebCore/SharedBuffer.h> #import <WebCore/ThreadCheck.h> +#import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> using namespace WebCore; @@ -88,6 +90,12 @@ static WebIconDatabaseClient* defaultClient() @implementation WebIconDatabase ++ (void)initialize +{ + JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); +} + + (WebIconDatabase *)sharedIconDatabase { static WebIconDatabase *database = nil; diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index cd3724e..9da1b53 100644 --- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -46,6 +46,7 @@ #import <WebCore/runtime_root.h> #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> +#import <wtf/Threading.h> using namespace WebCore; using namespace WebKit; @@ -60,6 +61,7 @@ extern "C" { + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h index a28793a..8fbe262 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h @@ -104,8 +104,8 @@ private: RetainPtr<NSString> m_mimeType; NPP m_plugin; - uint16 m_transferMode; - int32 m_offset; + uint16_t m_transferMode; + int32_t m_offset; NPStream m_stream; RetainPtr<NSString> m_path; int m_fileDescriptor; diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm index 232a6c4..7322d31 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm @@ -220,8 +220,8 @@ void WebNetscapePluginStream::startStream(NSURL *url, long long expectedContentL m_stream.url = strdup([m_responseURL.get() _web_URLCString]); m_stream.ndata = this; - m_stream.end = expectedContentLength > 0 ? (uint32)expectedContentLength : 0; - m_stream.lastmodified = (uint32)[lastModifiedDate timeIntervalSince1970]; + m_stream.end = expectedContentLength > 0 ? (uint32_t)expectedContentLength : 0; + m_stream.lastmodified = (uint32_t)[lastModifiedDate timeIntervalSince1970]; m_stream.notifyData = m_notifyData; if (headers) { @@ -507,12 +507,12 @@ void WebNetscapePluginStream::deliverData() RefPtr<WebNetscapePluginStream> protect(this); - int32 totalBytes = [m_deliveryData.get() length]; - int32 totalBytesDelivered = 0; + int32_t totalBytes = [m_deliveryData.get() length]; + int32_t totalBytesDelivered = 0; while (totalBytesDelivered < totalBytes) { PluginStopDeferrer deferrer(m_pluginView.get()); - int32 deliveryBytes = m_pluginFuncs->writeready(m_plugin, &m_stream); + int32_t deliveryBytes = m_pluginFuncs->writeready(m_plugin, &m_stream); LOG(Plugins, "NPP_WriteReady responseURL=%@ bytes=%d", m_responseURL.get(), deliveryBytes); if (m_isTerminated) @@ -533,7 +533,7 @@ void WebNetscapePluginStream::deliverData() cancelLoadAndDestroyStreamWithError(pluginCancelledConnectionError()); return; } - deliveryBytes = min<int32>(deliveryBytes, [subdata length]); + deliveryBytes = min<int32_t>(deliveryBytes, [subdata length]); m_offset += deliveryBytes; totalBytesDelivered += deliveryBytes; LOG(Plugins, "NPP_Write responseURL=%@ bytes=%d total-delivered=%d/%d", m_responseURL.get(), deliveryBytes, m_offset, m_stream.end); diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index eec80f8..acd5152 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -41,7 +41,6 @@ #import "WebView.h" #import "WebViewInternal.h" -#import <WebCore/WebCoreObjCExtras.h> #import <WebCore/AuthenticationMac.h> #import <WebCore/BitmapImage.h> #import <WebCore/Credential.h> @@ -56,9 +55,11 @@ #import <WebCore/ProtectionSpace.h> #import <WebCore/RenderView.h> #import <WebCore/RenderWidget.h> +#import <WebCore/WebCoreObjCExtras.h> #import <WebKit/DOMPrivate.h> #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> +#import <wtf/Threading.h> #import <wtf/text/CString.h> #define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification" @@ -115,6 +116,7 @@ String WebHaltablePlugin::pluginName() const + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/Plugins/WebBasePluginPackage.mm b/WebKit/mac/Plugins/WebBasePluginPackage.mm index 1bddbcf..f186b81 100644 --- a/WebKit/mac/Plugins/WebBasePluginPackage.mm +++ b/WebKit/mac/Plugins/WebBasePluginPackage.mm @@ -28,13 +28,14 @@ #import <WebKit/WebBasePluginPackage.h> +#import <WebCore/WebCoreObjCExtras.h> #import <WebKit/WebKitNSStringExtras.h> -#import <WebKit/WebNetscapePluginPackage.h> #import <WebKit/WebNSObjectExtras.h> +#import <WebKit/WebNetscapePluginPackage.h> #import <WebKit/WebPluginPackage.h> -#import <WebCore/WebCoreObjCExtras.h> #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> +#import <wtf/Threading.h> #import <wtf/Vector.h> #import <WebKitSystemInterface.h> @@ -63,6 +64,7 @@ + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.h b/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.h index e9b14a7..dcd4dd4 100644 --- a/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.h +++ b/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.h @@ -31,14 +31,14 @@ #if ENABLE(NETSCAPE_PLUGIN_API) @interface WebNetscapeContainerCheckContextInfo : NSObject { - uint32 _checkRequestID; - void (*_callback)(NPP npp, uint32, NPBool, void *); + uint32_t _checkRequestID; + void (*_callback)(NPP npp, uint32_t, NPBool, void *); void *_context; } -- (id)initWithCheckRequestID:(uint32)checkRequestID callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context; -- (uint32)checkRequestID; -- (void (*)(NPP npp, uint32, NPBool, void*))callback; +- (id)initWithCheckRequestID:(uint32_t)checkRequestID callbackFunc:(void (*)(NPP npp, uint32_t checkID, NPBool allowed, void* context))callbackFunc context:(void*)context; +- (uint32_t)checkRequestID; +- (void (*)(NPP npp, uint32_t, NPBool, void*))callback; - (void*)context; @end diff --git a/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.mm b/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.mm index 34a0ec1..8991c95 100644 --- a/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.mm +++ b/WebKit/mac/Plugins/WebNetscapeContainerCheckContextInfo.mm @@ -29,7 +29,7 @@ @implementation WebNetscapeContainerCheckContextInfo -- (id)initWithCheckRequestID:(uint32)checkRequestID callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context +- (id)initWithCheckRequestID:(uint32_t)checkRequestID callbackFunc:(void (*)(NPP npp, uint32_t checkID, NPBool allowed, void* context))callbackFunc context:(void*)context { self = [super init]; if (!self) @@ -41,12 +41,12 @@ return self; } -- (uint32)checkRequestID +- (uint32_t)checkRequestID { return _checkRequestID; } -- (void (*)(NPP npp, uint32, NPBool, void*))callback +- (void (*)(NPP npp, uint32_t, NPBool, void*))callback { return _callback; } diff --git a/WebKit/mac/Plugins/WebNetscapeContainerCheckPrivate.h b/WebKit/mac/Plugins/WebNetscapeContainerCheckPrivate.h index dfde2f7..799680b 100644 --- a/WebKit/mac/Plugins/WebNetscapeContainerCheckPrivate.h +++ b/WebKit/mac/Plugins/WebNetscapeContainerCheckPrivate.h @@ -40,17 +40,17 @@ extern "C" { #define WKNVBrowserContainerCheckFuncsVersionHasGetLocation 2 -typedef uint32 (*WKN_CheckIfAllowedToLoadURLProcPtr)(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool allowed, void* context), void* context); -typedef void (*WKN_CancelCheckIfAllowedToLoadURLProcPtr)(NPP npp, uint32); +typedef uint32_t (*WKN_CheckIfAllowedToLoadURLProcPtr)(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32_t, NPBool allowed, void* context), void* context); +typedef void (*WKN_CancelCheckIfAllowedToLoadURLProcPtr)(NPP npp, uint32_t); typedef char* (*WKN_ResolveURLProcPtr)(NPP npp, const char* url, const char* target); -uint32 WKN_CheckIfAllowedToLoadURL(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool allowed, void* context), void* context); -void WKN_CancelCheckIfAllowedToLoadURL(NPP npp, uint32); +uint32_t WKN_CheckIfAllowedToLoadURL(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32_t, NPBool allowed, void* context), void* context); +void WKN_CancelCheckIfAllowedToLoadURL(NPP npp, uint32_t); char* WKN_ResolveURL(NPP npp, const char* url, const char* target); typedef struct _WKNBrowserContainerCheckFuncs { - uint16 size; - uint16 version; + uint16_t size; + uint16_t version; WKN_CheckIfAllowedToLoadURLProcPtr checkIfAllowedToLoadURL; WKN_CancelCheckIfAllowedToLoadURLProcPtr cancelCheckIfAllowedToLoadURL; diff --git a/WebKit/mac/Plugins/WebNetscapePluginPackage.h b/WebKit/mac/Plugins/WebNetscapePluginPackage.h index 010956d..1d4c893 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginPackage.h +++ b/WebKit/mac/Plugins/WebNetscapePluginPackage.h @@ -47,8 +47,8 @@ typedef enum { NPPluginFuncs pluginFuncs; NPNetscapeFuncs browserFuncs; - uint16 pluginSize; - uint16 pluginVersion; + uint16_t pluginSize; + uint16_t pluginVersion; ResFileRefNum resourceRef; diff --git a/WebKit/mac/Plugins/WebNetscapePluginPackage.mm b/WebKit/mac/Plugins/WebNetscapePluginPackage.mm index 5c10d95..5651e7e 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginPackage.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginPackage.mm @@ -697,11 +697,11 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); FunctionPointer functionPointerForTVector(TransitionVector tvp) { - const uint32 temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; - uint32 *newGlue = NULL; + const uint32_t temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; + uint32_t *newGlue = NULL; if (tvp != NULL) { - newGlue = (uint32 *)malloc(sizeof(temp)); + newGlue = (uint32_t *)malloc(sizeof(temp)); if (newGlue != NULL) { unsigned i; for (i = 0; i < 6; i++) newGlue[i] = temp[i]; diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.h b/WebKit/mac/Plugins/WebNetscapePluginView.h index 5bc4467..b2debfa 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.h +++ b/WebKit/mac/Plugins/WebNetscapePluginView.h @@ -89,13 +89,13 @@ typedef union PluginPort { BOOL inSetWindow; BOOL shouldStopSoon; - uint32 currentTimerID; - HashMap<uint32, PluginTimer*>* timers; + uint32_t currentTimerID; + HashMap<uint32_t, PluginTimer*>* timers; unsigned pluginFunctionCallDepth; - int32 specifiedHeight; - int32 specifiedWidth; + int32_t specifiedHeight; + int32_t specifiedWidth; HashSet<RefPtr<WebNetscapePluginStream> > streams; RetainPtr<NSMutableDictionary> _pendingFrameLoads; @@ -104,7 +104,7 @@ typedef union PluginPort { BOOL _isSilverlight; NSMutableDictionary *_containerChecksInProgress; - uint32 _currentContainerCheckRequestID; + uint32_t _currentContainerCheckRequestID; } + (WebNetscapePluginView *)currentPluginView; @@ -146,8 +146,8 @@ typedef union PluginPort { - (void)handleMouseEntered:(NSEvent *)event; - (void)handleMouseExited:(NSEvent *)event; -- (uint32)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context; -- (void)cancelCheckIfAllowedToLoadURL:(uint32)checkID; +- (uint32_t)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString callbackFunc:(void (*)(NPP npp, uint32_t checkID, NPBool allowed, void* context))callbackFunc context:(void*)context; +- (void)cancelCheckIfAllowedToLoadURL:(uint32_t)checkID; @end @@ -172,14 +172,14 @@ typedef union PluginPort { - (void)forceRedraw; - (NPError)getVariable:(NPNVariable)variable value:(void *)value; - (NPError)setVariable:(NPPVariable)variable value:(void *)value; -- (uint32)scheduleTimerWithInterval:(uint32)interval repeat:(NPBool)repeat timerFunc:(void (*)(NPP npp, uint32 timerID))timerFunc; -- (void)unscheduleTimer:(uint32)timerID; +- (uint32_t)scheduleTimerWithInterval:(uint32_t)interval repeat:(NPBool)repeat timerFunc:(void (*)(NPP npp, uint32_t timerID))timerFunc; +- (void)unscheduleTimer:(uint32_t)timerID; - (NPError)popUpContextMenu:(NPMenu *)menu; -- (NPError)getVariable:(NPNURLVariable)variable forURL:(const char*)url value:(char**)value length:(uint32*)length; -- (NPError)setVariable:(NPNURLVariable)variable forURL:(const char*)url value:(const char*)value length:(uint32)length; -- (NPError)getAuthenticationInfoWithProtocol:(const char*) protocol host:(const char*)host port:(int32)port scheme:(const char*)scheme realm:(const char*)realm - username:(char**)username usernameLength:(uint32*)usernameLength - password:(char**)password passwordLength:(uint32*)passwordLength; +- (NPError)getVariable:(NPNURLVariable)variable forURL:(const char*)url value:(char**)value length:(uint32_t*)length; +- (NPError)setVariable:(NPNURLVariable)variable forURL:(const char*)url value:(const char*)value length:(uint32_t)length; +- (NPError)getAuthenticationInfoWithProtocol:(const char*) protocol host:(const char*)host port:(int32_t)port scheme:(const char*)scheme realm:(const char*)realm + username:(char**)username usernameLength:(uint32_t*)usernameLength + password:(char**)password passwordLength:(uint32_t*)passwordLength; - (char*)resolveURL:(const char*)url forTarget:(const char*)target; @end diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index 388b84b..ebc3f85 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -30,13 +30,13 @@ #import "WebNetscapePluginView.h" +#import "WebBaseNetscapePluginStream.h" #import "WebDataSourceInternal.h" #import "WebDefaultUIDelegate.h" #import "WebFrameInternal.h" #import "WebFrameView.h" #import "WebKitErrorsPrivate.h" #import "WebKitLogging.h" -#import "WebNetscapeContainerCheckPrivate.h" #import "WebKitNSStringExtras.h" #import "WebKitSystemInterface.h" #import "WebNSDataExtras.h" @@ -45,18 +45,16 @@ #import "WebNSURLExtras.h" #import "WebNSURLRequestExtras.h" #import "WebNSViewExtras.h" -#import "WebNetscapePluginPackage.h" -#import "WebBaseNetscapePluginStream.h" -#import "WebPluginContainerCheck.h" #import "WebNetscapeContainerCheckContextInfo.h" +#import "WebNetscapeContainerCheckPrivate.h" #import "WebNetscapePluginEventHandler.h" -#import "WebPreferences.h" +#import "WebNetscapePluginPackage.h" +#import "WebPluginContainerCheck.h" #import "WebPluginRequest.h" -#import "WebViewInternal.h" +#import "WebPreferences.h" #import "WebUIDelegatePrivate.h" +#import "WebViewInternal.h" #import <Carbon/Carbon.h> -#import <runtime/JSLock.h> -#import <WebCore/npruntime_impl.h> #import <WebCore/CookieJar.h> #import <WebCore/DocumentLoader.h> #import <WebCore/Element.h> @@ -71,12 +69,15 @@ #import <WebCore/SoftLinking.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebCoreURLResponse.h> +#import <WebCore/npruntime_impl.h> #import <WebKit/DOMPrivate.h> #import <WebKit/WebUIDelegate.h> +#import <objc/objc-runtime.h> #import <runtime/InitializeThreading.h> +#import <runtime/JSLock.h> #import <wtf/Assertions.h> +#import <wtf/Threading.h> #import <wtf/text/CString.h> -#import <objc/objc-runtime.h> #define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification" #define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification" @@ -112,9 +113,9 @@ static const double ThrottledTimerInterval = 0.25; class PluginTimer : public TimerBase { public: - typedef void (*TimerFunc)(NPP npp, uint32 timerID); + typedef void (*TimerFunc)(NPP npp, uint32_t timerID); - PluginTimer(NPP npp, uint32 timerID, uint32 interval, NPBool repeat, TimerFunc timerFunc) + PluginTimer(NPP npp, uint32_t timerID, uint32_t interval, NPBool repeat, TimerFunc timerFunc) : m_npp(npp) , m_timerID(timerID) , m_interval(interval) @@ -147,8 +148,8 @@ private: } NPP m_npp; - uint32 m_timerID; - uint32 m_interval; + uint32_t m_timerID; + uint32_t m_interval; NPBool m_repeat; TimerFunc m_timerFunc; }; @@ -188,6 +189,7 @@ typedef struct { + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif @@ -252,20 +254,20 @@ static UInt32 getQDPixelFormatForBitmapContext(CGContextRef context) static inline void getNPRect(const CGRect& cgr, NPRect& npr) { - npr.top = static_cast<uint16>(cgr.origin.y); - npr.left = static_cast<uint16>(cgr.origin.x); - npr.bottom = static_cast<uint16>(CGRectGetMaxY(cgr)); - npr.right = static_cast<uint16>(CGRectGetMaxX(cgr)); + npr.top = static_cast<uint16_t>(cgr.origin.y); + npr.left = static_cast<uint16_t>(cgr.origin.x); + npr.bottom = static_cast<uint16_t>(CGRectGetMaxY(cgr)); + npr.right = static_cast<uint16_t>(CGRectGetMaxX(cgr)); } #endif static inline void getNPRect(const NSRect& nr, NPRect& npr) { - npr.top = static_cast<uint16>(nr.origin.y); - npr.left = static_cast<uint16>(nr.origin.x); - npr.bottom = static_cast<uint16>(NSMaxY(nr)); - npr.right = static_cast<uint16>(NSMaxX(nr)); + npr.top = static_cast<uint16_t>(nr.origin.y); + npr.left = static_cast<uint16_t>(nr.origin.x); + npr.bottom = static_cast<uint16_t>(NSMaxY(nr)); + npr.right = static_cast<uint16_t>(NSMaxX(nr)); } - (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate @@ -304,10 +306,10 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) #endif window.type = NPWindowTypeWindow; - window.x = (int32)boundsInWindow.origin.x; - window.y = (int32)boundsInWindow.origin.y; - window.width = static_cast<uint32>(NSWidth(boundsInWindow)); - window.height = static_cast<uint32>(NSHeight(boundsInWindow)); + window.x = (int32_t)boundsInWindow.origin.x; + window.y = (int32_t)boundsInWindow.origin.y; + window.width = static_cast<uint32_t>(NSWidth(boundsInWindow)); + window.height = static_cast<uint32_t>(NSHeight(boundsInWindow)); // "Clip-out" the plug-in when: // 1) it's not really in a window or off-screen or has no height or width. @@ -353,8 +355,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) CGrafPtr port = GetWindowPort(windowRef); GetPortBounds(port, &portBounds); nPort.qdPort.port = port; - nPort.qdPort.portx = (int32)-boundsInWindow.origin.x; - nPort.qdPort.porty = (int32)-boundsInWindow.origin.y; + nPort.qdPort.portx = (int32_t)-boundsInWindow.origin.x; + nPort.qdPort.porty = (int32_t)-boundsInWindow.origin.y; window.window = &nPort; PortState_QD *qdPortState = (PortState_QD*)malloc(sizeof(PortState_QD)); @@ -417,8 +419,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) origin.x = offscreenBounds.left - origin.x * (axisFlip.x - origin.x); origin.y = offscreenBounds.bottom + origin.y * (axisFlip.y - origin.y); - nPort.qdPort.portx = static_cast<int32>(-boundsInWindow.origin.x + origin.x); - nPort.qdPort.porty = static_cast<int32>(-boundsInWindow.origin.y - origin.y); + nPort.qdPort.portx = static_cast<int32_t>(-boundsInWindow.origin.x + origin.x); + nPort.qdPort.porty = static_cast<int32_t>(-boundsInWindow.origin.y - origin.y); window.x = 0; window.y = 0; window.window = &nPort; @@ -697,8 +699,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) if (!timers) return; - HashMap<uint32, PluginTimer*>::const_iterator end = timers->end(); - for (HashMap<uint32, PluginTimer*>::const_iterator it = timers->begin(); it != end; ++it) { + HashMap<uint32_t, PluginTimer*>::const_iterator end = timers->end(); + for (HashMap<uint32_t, PluginTimer*>::const_iterator it = timers->begin(); it != end; ++it) { PluginTimer* timer = it->second; timer->stop(); } @@ -715,8 +717,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) if (!timers) return; - HashMap<uint32, PluginTimer*>::const_iterator end = timers->end(); - for (HashMap<uint32, PluginTimer*>::const_iterator it = timers->begin(); it != end; ++it) { + HashMap<uint32_t, PluginTimer*>::const_iterator end = timers->end(); + for (HashMap<uint32_t, PluginTimer*>::const_iterator it = timers->begin(); it != end; ++it) { PluginTimer* timer = it->second; ASSERT(!timer->isActive()); timer->start(_isCompletelyObscured); @@ -1235,9 +1237,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) } } -- (uint32)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString - callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc - context:(void*)context +- (uint32_t)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString + callbackFunc:(void (*)(NPP npp, uint32_t checkID, NPBool allowed, void* context))callbackFunc + context:(void*)context { if (!_containerChecksInProgress) _containerChecksInProgress = [[NSMutableDictionary alloc] init]; @@ -1266,7 +1268,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) - (void)_containerCheckResult:(PolicyAction)policy contextInfo:(id)contextInfo { ASSERT([contextInfo isKindOfClass:[WebNetscapeContainerCheckContextInfo class]]); - void (*pluginCallback)(NPP npp, uint32, NPBool, void*) = [contextInfo callback]; + void (*pluginCallback)(NPP npp, uint32_t, NPBool, void*) = [contextInfo callback]; if (!pluginCallback) { ASSERT_NOT_REACHED(); @@ -1276,7 +1278,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) pluginCallback([self plugin], [contextInfo checkRequestID], (policy == PolicyUse), [contextInfo context]); } -- (void)cancelCheckIfAllowedToLoadURL:(uint32)checkID +- (void)cancelCheckIfAllowedToLoadURL:(uint32_t)checkID { WebPluginContainerCheck *check = (WebPluginContainerCheck *)[_containerChecksInProgress objectForKey:[NSNumber numberWithInt:checkID]]; @@ -1402,7 +1404,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) if (!_isStarted) return; - if ([NSGraphicsContext currentContextDrawingToScreen]) + if ([NSGraphicsContext currentContextDrawingToScreen] || _isFlash) [self sendDrawRectEvent:rect]; else { NSBitmapImageRep *printedPluginBitmap = [self _printedPluginBitmap]; @@ -2131,15 +2133,15 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) } } -- (uint32)scheduleTimerWithInterval:(uint32)interval repeat:(NPBool)repeat timerFunc:(void (*)(NPP npp, uint32 timerID))timerFunc +- (uint32_t)scheduleTimerWithInterval:(uint32_t)interval repeat:(NPBool)repeat timerFunc:(void (*)(NPP npp, uint32_t timerID))timerFunc { if (!timerFunc) return 0; if (!timers) - timers = new HashMap<uint32, PluginTimer*>; + timers = new HashMap<uint32_t, PluginTimer*>; - uint32 timerID; + uint32_t timerID; do { timerID = ++currentTimerID; @@ -2154,7 +2156,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return timerID; } -- (void)unscheduleTimer:(uint32)timerID +- (void)unscheduleTimer:(uint32_t)timerID { if (!timers) return; @@ -2175,7 +2177,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return NPERR_NO_ERROR; } -- (NPError)getVariable:(NPNURLVariable)variable forURL:(const char*)url value:(char**)value length:(uint32*)length +- (NPError)getVariable:(NPNURLVariable)variable forURL:(const char*)url value:(char**)value length:(uint32_t*)length { switch (variable) { case NPNURLVCookie: { @@ -2227,7 +2229,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return NPERR_GENERIC_ERROR; } -- (NPError)setVariable:(NPNURLVariable)variable forURL:(const char*)url value:(const char*)value length:(uint32)length +- (NPError)setVariable:(NPNURLVariable)variable forURL:(const char*)url value:(const char*)value length:(uint32_t)length { switch (variable) { case NPNURLVCookie: { @@ -2253,9 +2255,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return NPERR_GENERIC_ERROR; } -- (NPError)getAuthenticationInfoWithProtocol:(const char*)protocolStr host:(const char*)hostStr port:(int32)port scheme:(const char*)schemeStr realm:(const char*)realmStr - username:(char**)usernameStr usernameLength:(uint32*)usernameLength - password:(char**)passwordStr passwordLength:(uint32*)passwordLength +- (NPError)getAuthenticationInfoWithProtocol:(const char*)protocolStr host:(const char*)hostStr port:(int32_t)port scheme:(const char*)schemeStr realm:(const char*)realmStr + username:(char**)usernameStr usernameLength:(uint32_t*)usernameLength + password:(char**)passwordStr passwordLength:(uint32_t*)passwordLength { if (!protocolStr || !hostStr || !schemeStr || !realmStr || !usernameStr || !usernameLength || !passwordStr || !passwordLength) return NPERR_GENERIC_ERROR; diff --git a/WebKit/mac/Plugins/WebPluginDatabase.mm b/WebKit/mac/Plugins/WebPluginDatabase.mm index 1856fe1..34f5e0f 100644 --- a/WebKit/mac/Plugins/WebPluginDatabase.mm +++ b/WebKit/mac/Plugins/WebPluginDatabase.mm @@ -35,13 +35,13 @@ #import "WebFrameViewInternal.h" #import "WebHTMLRepresentation.h" #import "WebHTMLView.h" -#import "WebHTMLView.h" #import "WebKitLogging.h" #import "WebNSFileManagerExtras.h" #import "WebNetscapePluginPackage.h" #import "WebPluginController.h" #import "WebPluginPackage.h" #import "WebViewPrivate.h" +#import "WebViewInternal.h" #import <WebKitSystemInterface.h> #import <wtf/Assertions.h> @@ -296,7 +296,7 @@ static NSArray *additionalWebPlugInPaths; continue; if (self == sharedDatabase) - [WebView registerViewClass:[WebHTMLView class] representationClass:[WebHTMLRepresentation class] forMIMEType:MIMEType]; + [WebView _registerPluginMIMEType:MIMEType]; } [MIMETypes release]; @@ -415,7 +415,7 @@ static NSArray *additionalWebPlugInPaths; while ((MIMEType = [MIMETypeEnumerator nextObject])) { if ([registeredMIMETypes containsObject:MIMEType]) { if (self == sharedDatabase) - [WebView _unregisterViewClassAndRepresentationClassForMIMEType:MIMEType]; + [WebView _unregisterPluginMIMEType:MIMEType]; [registeredMIMETypes removeObject:MIMEType]; } } diff --git a/WebKit/mac/Plugins/npapi.mm b/WebKit/mac/Plugins/npapi.mm index 51c37ae..8b1cfd6 100644 --- a/WebKit/mac/Plugins/npapi.mm +++ b/WebKit/mac/Plugins/npapi.mm @@ -39,7 +39,7 @@ WebNetscapePluginView *pluginViewForInstance(NPP instance); // general plug-in to browser functions -void* NPN_MemAlloc(uint32 size) +void* NPN_MemAlloc(uint32_t size) { return malloc(size); } @@ -49,7 +49,7 @@ void NPN_MemFree(void* ptr) free(ptr); } -uint32 NPN_MemFlush(uint32 size) +uint32_t NPN_MemFlush(uint32_t size) { LOG(Plugins, "NPN_MemFlush"); return size; @@ -89,12 +89,12 @@ NPError NPN_GetURL(NPP instance, const char* URL, const char* target) return [pluginViewForInstance(instance) getURL:URL target:target]; } -NPError NPN_PostURLNotify(NPP instance, const char* URL, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData) +NPError NPN_PostURLNotify(NPP instance, const char* URL, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData) { return [pluginViewForInstance(instance) postURLNotify:URL target:target len:len buf:buf file:file notifyData:notifyData]; } -NPError NPN_PostURL(NPP instance, const char* URL, const char* target, uint32 len, const char* buf, NPBool file) +NPError NPN_PostURL(NPP instance, const char* URL, const char* target, uint32_t len, const char* buf, NPBool file) { return [pluginViewForInstance(instance) postURL:URL target:target len:len buf:buf file:file]; } @@ -104,7 +104,7 @@ NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStrea return [pluginViewForInstance(instance) newStream:type target:target stream:stream]; } -int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) +int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer) { return [pluginViewForInstance(instance) write:stream len:len buffer:buffer]; } @@ -176,12 +176,12 @@ void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userDa PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData); } -uint32 NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)) +uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)) { return [pluginViewForInstance(instance) scheduleTimerWithInterval:interval repeat:repeat timerFunc:timerFunc]; } -void NPN_UnscheduleTimer(NPP instance, uint32 timerID) +void NPN_UnscheduleTimer(NPP instance, uint32_t timerID) { [pluginViewForInstance(instance) unscheduleTimer:timerID]; } @@ -191,17 +191,17 @@ NPError NPN_PopUpContextMenu(NPP instance, NPMenu *menu) return [pluginViewForInstance(instance) popUpContextMenu:menu]; } -NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32* len) +NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len) { return [pluginViewForInstance(instance) getVariable:variable forURL:url value:value length:len]; } -NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32 len) +NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32_t len) { return [pluginViewForInstance(instance) setVariable:variable forURL:url value:value length:len]; } -NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32 port, const char* scheme, const char *realm, char** username, uint32* ulen, char** password, uint32* plen) +NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme, const char *realm, char** username, uint32_t* ulen, char** password, uint32_t* plen) { return [pluginViewForInstance(instance) getAuthenticationInfoWithProtocol:protocol host:host @@ -217,12 +217,12 @@ NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordina return [pluginViewForInstance(instance) convertFromX:sourceX andY:sourceY space:sourceSpace toX:destX andY:destY space:destSpace]; } -uint32 WKN_CheckIfAllowedToLoadURL(NPP instance, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool, void*), void* context) +uint32_t WKN_CheckIfAllowedToLoadURL(NPP instance, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32_t, NPBool, void*), void* context) { return [pluginViewForInstance(instance) checkIfAllowedToLoadURL:url frame:frame callbackFunc:callbackFunc context:context]; } -void WKN_CancelCheckIfAllowedToLoadURL(NPP instance, uint32 checkID) +void WKN_CancelCheckIfAllowedToLoadURL(NPP instance, uint32_t checkID) { [pluginViewForInstance(instance) cancelCheckIfAllowedToLoadURL:checkID]; } diff --git a/WebKit/mac/Storage/WebDatabaseManager.mm b/WebKit/mac/Storage/WebDatabaseManager.mm index 2c58889..782f422 100644 --- a/WebKit/mac/Storage/WebDatabaseManager.mm +++ b/WebKit/mac/Storage/WebDatabaseManager.mm @@ -49,6 +49,8 @@ NSString *WebDatabaseDidModifyOriginNotification = @"WebDatabaseDidModifyOriginN NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification"; NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey"; +static NSString *databasesDirectoryPath(); + @implementation WebDatabaseManager + (WebDatabaseManager *) sharedWebDatabaseManager @@ -119,6 +121,16 @@ NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey"; @end +static NSString *databasesDirectoryPath() +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; + if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) + databasesDirectory = @"~/Library/WebKit/Databases"; + + return [databasesDirectory stringByStandardizingPath]; +} + void WebKitInitializeDatabasesIfNecessary() { static BOOL initialized = NO; @@ -126,13 +138,7 @@ void WebKitInitializeDatabasesIfNecessary() return; // Set the database root path in WebCore - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; - if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) - databasesDirectory = @"~/Library/WebKit/Databases"; - - DatabaseTracker::tracker().setDatabaseDirectoryPath([databasesDirectory stringByStandardizingPath]); + DatabaseTracker::tracker().setDatabaseDirectoryPath(databasesDirectoryPath()); // Set the DatabaseTrackerClient DatabaseTracker::tracker().setClient(WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient()); diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index d27a19c..4e65751 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without @@ -54,15 +54,14 @@ #import <WebCore/Frame.h> #import <WebCore/FrameLoadRequest.h> #import <WebCore/Geolocation.h> -#import <WebCore/HitTestResult.h> #import <WebCore/HTMLNames.h> +#import <WebCore/HitTestResult.h> #import <WebCore/Icon.h> #import <WebCore/IntRect.h> #import <WebCore/Page.h> #import <WebCore/PlatformScreen.h> #import <WebCore/PlatformString.h> #import <WebCore/ResourceRequest.h> -#import <WebCore/ScrollView.h> #import <WebCore/Widget.h> #import <WebCore/WindowFeatures.h> #import <wtf/PassRefPtr.h> @@ -499,17 +498,18 @@ void WebChromeClient::contentsSizeChanged(Frame*, const IntSize&) const { } -void WebChromeClient::scrollRectIntoView(const IntRect& r, const ScrollView* scrollView) const +void WebChromeClient::scrollRectIntoView(const IntRect& r, const ScrollView*) const { - // FIXME: This scrolling behavior should be under the control of the embedding client (rather than something - // we just do ourselves). - + // FIXME: This scrolling behavior should be under the control of the embedding client, + // perhaps in a delegate method, rather than something WebKit does unconditionally. + NSView *coordinateView = [m_webView _usesDocumentViews] + ? [[[m_webView mainFrame] frameView] documentView] : m_webView; NSRect rect = r; for (NSView *view = m_webView; view; view = [view superview]) { if ([view isKindOfClass:[NSClipView class]]) { NSClipView *clipView = (NSClipView *)view; NSView *documentView = [clipView documentView]; - [documentView scrollRectToVisible:[documentView convertRect:rect fromView:m_webView]]; + [documentView scrollRectToVisible:[documentView convertRect:rect fromView:coordinateView]]; } } } diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm index 1e03d88..ec9024a 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -62,6 +62,7 @@ #import <WebCore/WebCoreObjCExtras.h> #import <runtime/InitializeThreading.h> #import <wtf/PassRefPtr.h> +#import <wtf/Threading.h> using namespace WebCore; using namespace WTF; @@ -94,6 +95,7 @@ static WebViewInsertAction kit(EditorInsertAction coreAction) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index d497513..60b1fbf 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -42,6 +42,7 @@ namespace WebCore { class AuthenticationChallenge; class CachedFrame; class HistoryItem; + class ProtectionSpace; class String; class ResourceLoader; class ResourceRequest; @@ -79,6 +80,9 @@ private: virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&); +#endif virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); @@ -99,6 +103,7 @@ private: virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); virtual void dispatchDidReceiveTitle(const WebCore::String& title); + virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); virtual void dispatchDidFailLoad(const WebCore::ResourceError&); @@ -120,6 +125,7 @@ private: virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) { } virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>); virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); @@ -204,7 +210,7 @@ private: virtual void registerForIconNotification(bool listen); -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) virtual jobject javaApplet(NSView*); #endif diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 0088eae..cf4b03c 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -50,16 +50,16 @@ #import "WebFrameViewInternal.h" #import "WebHTMLRepresentationPrivate.h" #import "WebHTMLViewInternal.h" -#import "WebHistoryItemInternal.h" #import "WebHistoryInternal.h" +#import "WebHistoryItemInternal.h" #import "WebIconDatabaseInternal.h" #import "WebKitErrorsPrivate.h" #import "WebKitLogging.h" #import "WebKitNSStringExtras.h" -#import "WebNavigationData.h" #import "WebNSURLExtras.h" -#import "WebNetscapePluginView.h" +#import "WebNavigationData.h" #import "WebNetscapePluginPackage.h" +#import "WebNetscapePluginView.h" #import "WebPanelAuthenticationHandler.h" #import "WebPluginController.h" #import "WebPluginPackage.h" @@ -73,7 +73,6 @@ #import "WebUIDelegate.h" #import "WebUIDelegatePrivate.h" #import "WebViewInternal.h" -#import <WebKitSystemInterface.h> #import <WebCore/AuthenticationMac.h> #import <WebCore/BlockExceptions.h> #import <WebCore/CachedFrame.h> @@ -89,10 +88,10 @@ #import <WebCore/FrameTree.h> #import <WebCore/FrameView.h> #import <WebCore/HTMLAppletElement.h> -#import <WebCore/HTMLHeadElement.h> #import <WebCore/HTMLFormElement.h> #import <WebCore/HTMLFrameElement.h> #import <WebCore/HTMLFrameOwnerElement.h> +#import <WebCore/HTMLHeadElement.h> #import <WebCore/HTMLNames.h> #import <WebCore/HTMLPlugInElement.h> #import <WebCore/HistoryItem.h> @@ -115,10 +114,12 @@ #import <WebCore/Widget.h> #import <WebKit/DOMElement.h> #import <WebKit/DOMHTMLFormElement.h> +#import <WebKitSystemInterface.h> #import <runtime/InitializeThreading.h> #import <wtf/PassRefPtr.h> +#import <wtf/Threading.h> -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #import "WebJavaPlugIn.h" #endif @@ -131,7 +132,7 @@ using namespace WebCore; using namespace HTMLNames; using namespace std; -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) @interface NSView (WebJavaPluginDetails) - (jobject)pollForAppletInWindow:(NSWindow *)window; @end @@ -413,6 +414,27 @@ void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoa [[WebPanelAuthenticationHandler sharedHandler] startAuthentication:webChallenge window:window]; } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) +bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader* loader, unsigned long identifier, const ProtectionSpace& protectionSpace) +{ + WebView *webView = getWebView(m_webFrame.get()); + WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView); + + NSURLProtectionSpace *webProtectionSpace = mac(protectionSpace); + + if (implementations->canAuthenticateAgainstProtectionSpaceFunc) { + if (id resource = [webView _objectForIdentifier:identifier]) { + return CallResourceLoadDelegateReturningBoolean(NO, implementations->canAuthenticateAgainstProtectionSpaceFunc, webView, @selector(webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource:), resource, webProtectionSpace, dataSource(loader)); + } + } + + // If our resource load delegate doesn't handle the question, then only send authentication + // challenges for pre-10.6 protection spaces. This is the same as the default implementation + // in CFNetwork. + return (protectionSpace.authenticationScheme() < ProtectionSpaceAuthenticationSchemeClientCertificateRequested); +} +#endif + void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge&challenge) { WebView *webView = getWebView(m_webFrame.get()); @@ -593,6 +615,11 @@ void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) CallFrameLoadDelegate(implementations->didReceiveTitleForFrameFunc, webView, @selector(webView:didReceiveTitle:forFrame:), (NSString *)title, m_webFrame.get()); } +void WebFrameLoaderClient::dispatchDidChangeIcons() +{ + // FIXME: Implement this to allow container to update favicon. +} + void WebFrameLoaderClient::dispatchDidCommitLoad() { // Tell the client we've committed this URL. @@ -1531,7 +1558,8 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP [NSNumber numberWithInt:loadManually ? WebPlugInModeFull : WebPlugInModeEmbed], WebPlugInModeKey, [NSNumber numberWithBool:!loadManually], WebPlugInShouldLoadMainResourceKey, kit(element), WebPlugInContainingElementKey, - baseURL, WebPlugInBaseURLKey, + // FIXME: We should be passing base URL, see <https://bugs.webkit.org/show_bug.cgi?id=35215>. + pluginURL, WebPlugInBaseURLKey, // pluginURL might be nil, so add it last nil]; NSView *view = CallUIDelegate(webView, selector, arguments); @@ -1647,7 +1675,7 @@ void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) BEGIN_BLOCK_OBJC_EXCEPTIONS; NSView *view = nil; @@ -1708,7 +1736,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s return adoptRef(new PluginWidget); #else return 0; -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) } String WebFrameLoaderClient::overrideMediaType() const @@ -1767,7 +1795,7 @@ void WebFrameLoaderClient::didPerformFirstNavigation() const [preferences setCacheModel:WebCacheModelDocumentBrowser]; } -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) jobject WebFrameLoaderClient::javaApplet(NSView* view) { if ([view respondsToSelector:@selector(webPlugInGetApplet)]) @@ -1786,6 +1814,7 @@ jobject WebFrameLoaderClient::javaApplet(NSView* view) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebView/WebArchive.mm b/WebKit/mac/WebView/WebArchive.mm index 86e29c8..f07b51b 100644 --- a/WebKit/mac/WebView/WebArchive.mm +++ b/WebKit/mac/WebView/WebArchive.mm @@ -38,6 +38,7 @@ #import <WebCore/LegacyWebArchive.h> #import <WebCore/ThreadCheck.h> #import <WebCore/WebCoreObjCExtras.h> +#import <wtf/Threading.h> using namespace WebCore; @@ -66,6 +67,7 @@ static NSString * const WebSubframeArchivesKey = @"WebSubframeArchives"; + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebView/WebClipView.h b/WebKit/mac/WebView/WebClipView.h index 76cc50c..968d2de 100644 --- a/WebKit/mac/WebView/WebClipView.h +++ b/WebKit/mac/WebView/WebClipView.h @@ -31,6 +31,7 @@ @interface WebClipView : NSClipView { BOOL _haveAdditionalClip; + BOOL _isScrolling; NSRect _additionalClip; } diff --git a/WebKit/mac/WebView/WebClipView.m b/WebKit/mac/WebView/WebClipView.mm index b551145..ced5d8d 100644 --- a/WebKit/mac/WebView/WebClipView.m +++ b/WebKit/mac/WebView/WebClipView.mm @@ -28,10 +28,10 @@ #import "WebClipView.h" -#import <WebKit/WebHTMLView.h> -#import <WebKit/WebNSViewExtras.h> -#import <WebKit/WebViewPrivate.h> -#import <wtf/Assertions.h> +#import "WebFrameInternal.h" +#import "WebFrameView.h" +#import "WebViewPrivate.h" +#import <WebCore/FrameView.h> // WebClipView's entire reason for existing is to set the clip used by focus ring redrawing. // There's no easy way to prevent the focus ring from drawing outside the passed-in clip rectangle @@ -41,10 +41,16 @@ // FIXME: Change terminology from "additional clip" to "focus ring clip". +using namespace WebCore; + @interface NSView (WebViewMethod) - (WebView *)_webView; @end +@interface NSClipView (WebNSClipViewDetails) +- (void)_immediateScrollToPoint:(NSPoint)newOrigin; +@end + @implementation WebClipView - (id)initWithFrame:(NSRect)frame @@ -67,6 +73,34 @@ return self; } +#if USE(ACCELERATED_COMPOSITING) +- (NSRect)visibleRect +{ + if (!_isScrolling) + return [super visibleRect]; + + WebFrameView *webFrameView = (WebFrameView *)[[self superview] superview]; + if (![webFrameView isKindOfClass:[WebFrameView class]]) + return [super visibleRect]; + + if (Frame* coreFrame = core([webFrameView webFrame])) { + if (FrameView* frameView = coreFrame->view()) { + if (frameView->isEnclosedInCompositingLayer()) + return [self bounds]; + } + } + + return [super visibleRect]; +} + +- (void)_immediateScrollToPoint:(NSPoint)newOrigin +{ + _isScrolling = YES; + [super _immediateScrollToPoint:newOrigin]; + _isScrolling = NO; +} +#endif + - (void)resetAdditionalClip { ASSERT(_haveAdditionalClip); diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm index d9622b3..b16aaa8 100644 --- a/WebKit/mac/WebView/WebDataSource.mm +++ b/WebKit/mac/WebView/WebDataSource.mm @@ -60,6 +60,7 @@ #import <WebKit/DOMPrivate.h> #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> +#import <wtf/Threading.h> using namespace WebCore; @@ -79,6 +80,7 @@ using namespace WebCore; + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/WebKit/mac/WebView/WebDelegateImplementationCaching.h index 3ad064c..2aadc83 100644 --- a/WebKit/mac/WebView/WebDelegateImplementationCaching.h +++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.h @@ -35,6 +35,9 @@ struct WebResourceDelegateImplementationCache { IMP didCancelAuthenticationChallengeFunc; IMP didReceiveAuthenticationChallengeFunc; +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + IMP canAuthenticateAgainstProtectionSpaceFunc; +#endif IMP identifierForRequestFunc; IMP willSendRequestFunc; IMP didReceiveResponseFunc; @@ -130,6 +133,7 @@ id CallResourceLoadDelegate(IMP, WebView *, SEL, id, NSInteger, id); id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id); BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id); +BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id, id); id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id); id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id); diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm index 54c4c33..d00d60b 100644 --- a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm +++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm @@ -547,6 +547,18 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, W return result; } +BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3) +{ + if (!self->_private->catchesDelegateExceptions) + return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3); + @try { + return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3); + } @catch(id exception) { + ReportDiscardedDelegateException(selector, exception); + } + return result; +} + id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3) { return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, object2, integer, object3); diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm index 9ded8e1..e76e3ca 100644 --- a/WebKit/mac/WebView/WebFrameView.mm +++ b/WebKit/mac/WebView/WebFrameView.mm @@ -372,7 +372,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl - (WebFrame *)webFrame { - return _private->webFrame; + // This method can be called beneath -[NSView dealloc] after _private has been cleared. + return _private ? _private->webFrame : nil; } - (void)setAllowsScrolling:(BOOL)flag diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index daeeb10..83d2e7b 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -118,6 +118,7 @@ #import <dlfcn.h> #import <limits> #import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> #if USE(ACCELERATED_COMPOSITING) #import <QuartzCore/QuartzCore.h> @@ -179,7 +180,7 @@ static bool needsCursorRectsSupportAtPoint(NSWindow* window, NSPoint point) static IMP oldSetCursorForMouseLocationIMP; // Overriding an internal method is a hack; <rdar://problem/7662987> tracks finding a better solution. -static void setCursor(NSWindow* self, SEL cmd, NSPoint point) +static void setCursor(NSWindow *self, SEL cmd, NSPoint point) { if (needsCursorRectsSupportAtPoint(self, point)) oldSetCursorForMouseLocationIMP(self, cmd, point); @@ -221,6 +222,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; - (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView; - (NSRect)_dirtyRect; - (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants; +- (BOOL)_drawnByAncestor; - (void)_propagateDirtyRectsToOpaqueAncestors; - (void)_windowChangedKeyState; #if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) @@ -228,6 +230,42 @@ extern NSString *NSTextInputReplacementRangeAttributeName; #endif @end +#if USE(ACCELERATED_COMPOSITING) +static IMP oldSetNeedsDisplayInRectIMP; + +static void setNeedsDisplayInRect(NSView *self, SEL cmd, NSRect invalidRect) +{ + if (![self _drawnByAncestor]) { + oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect); + return; + } + + static Class webFrameViewClass = [WebFrameView class]; + WebFrameView *enclosingWebFrameView = (WebFrameView *)self; + while (enclosingWebFrameView && ![enclosingWebFrameView isKindOfClass:webFrameViewClass]) + enclosingWebFrameView = (WebFrameView *)[enclosingWebFrameView superview]; + + if (!enclosingWebFrameView) { + oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect); + return; + } + + Frame* coreFrame = core([enclosingWebFrameView webFrame]); + FrameView* frameView = coreFrame ? coreFrame->view() : 0; + if (!frameView || !frameView->isEnclosedInCompositingLayer()) { + oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect); + return; + } + + NSRect invalidRectInWebFrameViewCoordinates = [enclosingWebFrameView convertRect:invalidRect fromView:self]; + IntRect invalidRectInFrameViewCoordinates(invalidRectInWebFrameViewCoordinates); + if (![enclosingWebFrameView isFlipped]) + invalidRectInFrameViewCoordinates.setY(frameView->frameRect().size().height() - invalidRectInFrameViewCoordinates.bottom()); + + frameView->invalidateRect(invalidRectInFrameViewCoordinates); +} +#endif // USE(ACCELERATED_COMPOSITING) + @interface NSApplication (WebNSApplicationDetails) - (void)speakString:(NSString *)string; @end @@ -490,6 +528,7 @@ static NSCellStateValue kit(TriState state) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif @@ -501,7 +540,17 @@ static NSCellStateValue kit(TriState state) oldSetCursorForMouseLocationIMP = method_setImplementation(setCursorMethod, (IMP)setCursor); ASSERT(oldSetCursorForMouseLocationIMP); } -#else + +#if USE(ACCELERATED_COMPOSITING) + if (!oldSetNeedsDisplayInRectIMP) { + Method setNeedsDisplayInRectMethod = class_getInstanceMethod([NSView class], @selector(setNeedsDisplayInRect:)); + ASSERT(setNeedsDisplayInRectMethod); + oldSetNeedsDisplayInRectIMP = method_setImplementation(setNeedsDisplayInRectMethod, (IMP)setNeedsDisplayInRect); + ASSERT(oldSetNeedsDisplayInRectIMP); + } +#endif // USE(ACCELERATED_COMPOSITING) + +#else // defined(BUILDING_ON_TIGER) if (!oldSetCursorIMP) { Method setCursorMethod = class_getInstanceMethod([NSCursor class], @selector(set)); ASSERT(setCursorMethod); @@ -2317,6 +2366,7 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension [NSApp registerServicesMenuSendTypes:[[self class] _selectionPasteboardTypes] returnTypes:[[self class] _insertablePasteboardTypes]]; JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif @@ -3308,16 +3358,14 @@ WEBCORE_COMMAND(yankAndSelect) if (subviewsWereSetAside) [self _setAsideSubviews]; - + #if USE(ACCELERATED_COMPOSITING) - if ([webView _needsOneShotDrawingSynchronization]) { - // Disable screen updates so that any layer changes committed here - // don't show up on the screen before the window flush at the end - // of the current window display, but only if a window flush is actually - // going to happen. - NSWindow *window = [self window]; - if ([window viewsNeedDisplay]) - [window disableScreenUpdatesUntilFlush]; + // Only do the synchronization dance if we're drawing into the window, otherwise + // we risk disabling screen updates when no flush is pending. + if ([NSGraphicsContext currentContext] == [[self window] graphicsContext] && [webView _needsOneShotDrawingSynchronization]) { + // Disable screen updates to minimize the chances of the race between the CA + // display link and AppKit drawing causing flashes. + [[self window] disableScreenUpdatesUntilFlush]; // Make sure any layer changes that happened as a result of layout // via -viewWillDraw are committed. @@ -3332,7 +3380,7 @@ WEBCORE_COMMAND(yankAndSelect) { if (!([[self superview] isKindOfClass:[WebClipView class]])) return [super visibleRect]; - + WebClipView *clipView = (WebClipView *)[self superview]; BOOL hasAdditionalClip = [clipView hasAdditionalClip]; diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index e74d0e5..f4ae333 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -84,6 +84,7 @@ #define WebKitEnableFullDocumentTeardownPreferenceKey @"WebKitEnableFullDocumentTeardown" #define WebKitOfflineWebApplicationCacheEnabledPreferenceKey @"WebKitOfflineWebApplicationCacheEnabled" #define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly" +#define WebKitJavaScriptCanAccessClipboardPreferenceKey @"WebKitJavaScriptCanAccessClipboard" #define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled" #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled" #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders" diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 84a6e9e..9de8495 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -350,6 +350,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitLocalFileContentSniffingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitOfflineWebApplicationCacheEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey, + [NSNumber numberWithBool:NO], WebKitJavaScriptCanAccessClipboardPreferenceKey, [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, @@ -831,6 +832,16 @@ static WebCacheModel cacheModelForMainBundle(void) [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey]; } +- (BOOL)javaScriptCanAccessClipboard +{ + return [self _boolValueForKey:WebKitJavaScriptCanAccessClipboardPreferenceKey]; +} + +- (void)setJavaScriptCanAccessClipboard:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitJavaScriptCanAccessClipboardPreferenceKey]; +} + - (BOOL)isXSSAuditorEnabled { return [self _boolValueForKey:WebKitXSSAuditorEnabledPreferenceKey]; @@ -1097,8 +1108,8 @@ static WebCacheModel cacheModelForMainBundle(void) { NSString *systemEncodingName = (NSString *)CFStringConvertEncodingToIANACharSetName([self _systemCFStringEncoding]); - // CFStringConvertEncodingToIANACharSetName() returns cp949 for kTextEncodingDOSKorean AKA "extended EUC-KR" AKA windows-939. - // ICU uses this name for a different encoding, so we need to change the name to a value that actually gives us windows-939. + // CFStringConvertEncodingToIANACharSetName() returns cp949 for kTextEncodingDOSKorean AKA "extended EUC-KR" AKA windows-949. + // ICU uses this name for a different encoding, so we need to change the name to a value that actually gives us windows-949. // In addition, this value must match what is used in Safari, see <rdar://problem/5579292>. // On some OS versions, the result is CP949 (uppercase). if ([systemEncodingName _webkit_isCaseInsensitiveEqualToString:@"cp949"]) diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index 0b5f969..ee785e9 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -107,6 +107,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)zoomsTextOnly; - (void)setZoomsTextOnly:(BOOL)zoomsTextOnly; +- (BOOL)javaScriptCanAccessClipboard; +- (void)setJavaScriptCanAccessClipboard:(BOOL)flag; + - (BOOL)isXSSAuditorEnabled; - (void)setXSSAuditorEnabled:(BOOL)flag; diff --git a/WebKit/mac/WebView/WebResource.mm b/WebKit/mac/WebView/WebResource.mm index 735e213..73c0118 100644 --- a/WebKit/mac/WebView/WebResource.mm +++ b/WebKit/mac/WebView/WebResource.mm @@ -43,6 +43,7 @@ #import <WebCore/ThreadCheck.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebCoreURLResponse.h> +#import <wtf/Threading.h> using namespace WebCore; @@ -65,6 +66,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse" + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h b/WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h index 6dc3f2d..45d9c09 100644 --- a/WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h +++ b/WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h @@ -43,6 +43,16 @@ - (void)webView:(WebView *)webView didLoadResourceFromMemoryCache:(NSURLRequest *)request response:(NSURLResponse *)response length:(WebNSInteger)length fromDataSource:(WebDataSource *)dataSource; - (BOOL)webView:(WebView *)webView resource:(id)identifier shouldUseCredentialStorageForDataSource:(WebDataSource *)dataSource; +#if WEBKIT_VERSION_MAX_ALLOWED > WEBKIT_VERSION_4_0 +/*! + @method webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource: + @abstract Inspect an NSURLProtectionSpace before an authentication attempt is made. Only used on Snow Leopard or newer. + @param protectionSpace an NSURLProtectionSpace that will be used to generate an authentication challenge + @result Return YES if the resource load delegate is prepared to respond to an authentication challenge generated with protectionSpace, NO otherwise + */ +- (BOOL)webView:(WebView *)sender resource:(id)identifier canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace forDataSource:(WebDataSource *)dataSource; +#endif + @end #undef WebNSInteger diff --git a/WebKit/mac/WebView/WebTextIterator.mm b/WebKit/mac/WebView/WebTextIterator.mm index 457bece..6029faa 100644 --- a/WebKit/mac/WebView/WebTextIterator.mm +++ b/WebKit/mac/WebView/WebTextIterator.mm @@ -31,6 +31,8 @@ #import <JavaScriptCore/Vector.h> #import <WebCore/TextIterator.h> #import <WebCore/WebCoreObjCExtras.h> +#import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> using namespace JSC; using namespace WebCore; @@ -45,6 +47,8 @@ using namespace WebCore; + (void)initialize { + JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index b1b5c38..2442846 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -166,6 +166,7 @@ #import <wtf/RefCountedLeakCounter.h> #import <wtf/RefPtr.h> #import <wtf/StdLibExtras.h> +#import <wtf/Threading.h> #if ENABLE(DASHBOARD_SUPPORT) #import <WebKit/WebDashboardRegion.h> @@ -188,6 +189,7 @@ @interface NSWindow (WebNSWindowDetails) - (id)_oldFirstResponderBeforeBecoming; +- (void)_enableScreenUpdatesIfNeeded; @end using namespace WebCore; @@ -758,10 +760,9 @@ static bool shouldEnableLoadDeferring() @try { [[self mainFrame] _drawRect:rect contentsOnly:NO]; - WebView *webView = [self _webView]; - [[webView _UIDelegateForwarder] webView:webView didDrawRect:rect]; + [[self _UIDelegateForwarder] webView:self didDrawRect:rect]; - if (WebNodeHighlight *currentHighlight = [webView currentNodeHighlight]) + if (WebNodeHighlight *currentHighlight = [self currentNodeHighlight]) [currentHighlight setNeedsUpdateInTargetViewRect:rect]; [NSGraphicsContext restoreGraphicsState]; @@ -860,6 +861,25 @@ static bool shouldEnableLoadDeferring() return uniqueExtensions; } +static NSMutableSet *knownPluginMIMETypes() +{ + static NSMutableSet *mimeTypes = [[NSMutableSet alloc] init]; + + return mimeTypes; +} + ++ (void)_registerPluginMIMEType:(NSString *)MIMEType +{ + [WebView registerViewClass:[WebHTMLView class] representationClass:[WebHTMLRepresentation class] forMIMEType:MIMEType]; + [knownPluginMIMETypes() addObject:MIMEType]; +} + ++ (void)_unregisterPluginMIMEType:(NSString *)MIMEType +{ + [self _unregisterViewClassAndRepresentationClassForMIMEType:MIMEType]; + [knownPluginMIMETypes() removeObject:MIMEType]; +} + + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins { MIMEType = [MIMEType lowercaseString]; @@ -880,11 +900,20 @@ static bool shouldEnableLoadDeferring() } if (viewClass && repClass) { - // Special-case WebHTMLView for text types that shouldn't be shown. - if (viewClass == [WebHTMLView class] && - repClass == [WebHTMLRepresentation class] && - [[WebHTMLView unsupportedTextMIMETypes] containsObject:MIMEType]) { - return NO; + if (viewClass == [WebHTMLView class] && repClass == [WebHTMLRepresentation class]) { + // Special-case WebHTMLView for text types that shouldn't be shown. + if ([[WebHTMLView unsupportedTextMIMETypes] containsObject:MIMEType]) + return NO; + + // If the MIME type is a known plug-in we might not want to load it. + if (!allowPlugins && [knownPluginMIMETypes() containsObject:MIMEType]) { + BOOL isSupportedByWebKit = [[WebHTMLView supportedNonImageMIMETypes] containsObject:MIMEType] || + [[WebHTMLView supportedMIMETypes] containsObject:MIMEType]; + + // If this is a known plug-in MIME type and WebKit can't show it natively, we don't want to show it. + if (!isSupportedByWebKit) + return NO; + } } if (vClass) *vClass = viewClass; @@ -898,7 +927,7 @@ static bool shouldEnableLoadDeferring() - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType { - if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]) + if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType allowingPlugins:[_private->preferences arePlugInsEnabled]]) return YES; if (_private->pluginDatabase) { @@ -935,7 +964,9 @@ static bool shouldEnableLoadDeferring() DOMWindow::dispatchAllPendingUnloadEvents(); // This will close the WebViews in a random order. Change this if close order is important. - NSEnumerator *enumerator = [(NSMutableSet *)allWebViewsSet objectEnumerator]; + // Make a new set to avoid mutating the set we are enumerating. + NSSet *webViewsToClose = [NSSet setWithSet:(NSSet *)allWebViewsSet]; + NSEnumerator *enumerator = [webViewsToClose objectEnumerator]; while (WebView *webView = [enumerator nextObject]) [webView close]; } @@ -1013,6 +1044,7 @@ static bool fastDocumentTeardownEnabled() return; _private->closed = YES; + [self _removeFromAllWebViewsSet]; [self _closingEventHandling]; @@ -1034,7 +1066,6 @@ static bool fastDocumentTeardownEnabled() if (Frame* mainFrame = [self _mainCoreFrame]) mainFrame->loader()->detachFromParent(); - [self _removeFromAllWebViewsSet]; [self setHostWindow:nil]; [self setDownloadDelegate:nil]; @@ -1345,6 +1376,7 @@ static bool fastDocumentTeardownEnabled() settings->setLocalFileContentSniffingEnabled([preferences localFileContentSniffingEnabled]); settings->setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]); settings->setZoomMode([preferences zoomsTextOnly] ? ZoomTextOnly : ZoomPage); + settings->setJavaScriptCanAccessClipboard([preferences javaScriptCanAccessClipboard]); settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]); settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1)); @@ -1379,6 +1411,9 @@ static inline IMP getMethod(id o, SEL s) cache->didFinishLoadingFromDataSourceFunc = getMethod(delegate, @selector(webView:resource:didFinishLoadingFromDataSource:)); cache->didLoadResourceFromMemoryCacheFunc = getMethod(delegate, @selector(webView:didLoadResourceFromMemoryCache:response:length:fromDataSource:)); cache->didReceiveAuthenticationChallengeFunc = getMethod(delegate, @selector(webView:resource:didReceiveAuthenticationChallenge:fromDataSource:)); +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + cache->canAuthenticateAgainstProtectionSpaceFunc = getMethod(delegate, @selector(webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource:)); +#endif cache->didReceiveContentLengthFunc = getMethod(delegate, @selector(webView:resource:didReceiveContentLength:fromDataSource:)); cache->didReceiveResponseFunc = getMethod(delegate, @selector(webView:resource:didReceiveResponse:fromDataSource:)); cache->identifierForRequestFunc = getMethod(delegate, @selector(webView:identifierForInitialRequest:fromDataSource:)); @@ -2460,6 +2495,8 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) initialized = YES; InitWebCoreSystemInterface(); + JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) name:WebPreferencesChangedNotification object:nil]; @@ -2504,7 +2541,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) - (BOOL)_canShowMIMEType:(NSString *)MIMEType { - return [[self class] _canShowMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; + return [[self class] _canShowMIMEType:MIMEType allowingPlugins:[_private->preferences arePlugInsEnabled]]; } - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType @@ -5604,9 +5641,27 @@ static WebFrameView *containingFrameView(NSView *view) static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActivity, void* info) { - WebView* webView = reinterpret_cast<WebView*>(info); - if ([webView _syncCompositingChanges]) + WebView *webView = reinterpret_cast<WebView*>(info); + NSWindow *window = [webView window]; + + // An NSWindow may not display in the next runloop cycle after dirtying due to delayed window display logic, + // in which case this observer can fire first. So if the window is due for a display, don't commit + // layer changes, otherwise they'll show on screen before the view drawing. + if ([window viewsNeedDisplay]) + return; + + if ([webView _syncCompositingChanges]) { [webView _clearLayerSyncLoopObserver]; + // AppKit may have disabled screen updates, thinking an upcoming window flush will re-enable them. + // In case setNeedsDisplayInRect() has prevented the window from needing to be flushed, re-enable screen + // updates here. + if (![window isFlushWindowDisabled]) + [window _enableScreenUpdatesIfNeeded]; + } else { + // Since the WebView does not need display, -viewWillDraw will not be called. Perform pending layout now, + // so that the layers draw with up-to-date layout. + [webView _viewWillDrawInternal]; + } } - (void)_scheduleCompositingLayerSync diff --git a/WebKit/mac/WebView/WebViewData.mm b/WebKit/mac/WebView/WebViewData.mm index bf81dad..06da58f 100644 --- a/WebKit/mac/WebView/WebViewData.mm +++ b/WebKit/mac/WebView/WebViewData.mm @@ -34,6 +34,7 @@ #import <WebCore/WebCoreObjCExtras.h> #import <objc/objc-auto.h> #import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> BOOL applicationIsTerminating = NO; int pluginDatabaseClientCount = 0; @@ -43,6 +44,7 @@ int pluginDatabaseClientCount = 0; + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h index a2ce646..4643573 100644 --- a/WebKit/mac/WebView/WebViewInternal.h +++ b/WebKit/mac/WebView/WebViewInternal.h @@ -117,6 +117,8 @@ namespace WebCore { - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame; + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType; ++ (void)_registerPluginMIMEType:(NSString *)MIMEType; ++ (void)_unregisterPluginMIMEType:(NSString *)MIMEType; + (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; - (BOOL)_canShowMIMEType:(NSString *)MIMEType; + (NSString *)_MIMETypeForFile:(NSString *)path; |