summaryrefslogtreecommitdiff
path: root/Source/WebKit/mac
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/mac')
-rw-r--r--Source/WebKit/mac/ChangeLog430
-rw-r--r--Source/WebKit/mac/Configurations/FeatureDefines.xcconfig10
-rw-r--r--Source/WebKit/mac/Configurations/Version.xcconfig4
-rw-r--r--Source/WebKit/mac/Configurations/WebKit.xcconfig23
-rw-r--r--Source/WebKit/mac/DOM/WebDOMOperations.mm37
-rw-r--r--Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h6
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/ASCIICType.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/AlwaysInline.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Assertions.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Deque.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/DisallowCType.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/FastMalloc.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Forward.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/GetPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/HashCountedSet.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/HashMap.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/HashSet.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/ListHashSet.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Locker.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/MathExtras.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Noncopyable.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/OwnArrayPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtrCommon.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/PassOwnPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/PassRefPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Platform.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/RefCounted.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/RefCountedLeakCounter.h2
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/RefPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/RetainPtr.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/StdLibExtras.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/TemporaryChange.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Threading.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/UnusedParam.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/VMTags.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/Vector.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/VectorTraits.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/unicode/Unicode.h1
-rw-r--r--Source/WebKit/mac/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h1
-rw-r--r--Source/WebKit/mac/Misc/WebKitNSStringExtras.mm2
-rw-r--r--Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm2
-rw-r--r--Source/WebKit/mac/Misc/WebNSURLExtras.mm867
-rw-r--r--Source/WebKit/mac/Panels/WebAuthenticationPanel.m2
-rw-r--r--Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm2
-rw-r--r--Source/WebKit/mac/Plugins/WebNetscapePluginView.mm2
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebChromeClient.h4
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm31
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h1
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm29
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebEditorClient.h2
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm4
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm2
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h2
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm46
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h6
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm16
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm5
-rw-r--r--Source/WebKit/mac/WebView/WebArchiveInternal.h2
-rw-r--r--Source/WebKit/mac/WebView/WebFrame.mm9
-rw-r--r--Source/WebKit/mac/WebView/WebFullScreenController.h29
-rw-r--r--Source/WebKit/mac/WebView/WebFullScreenController.mm937
-rw-r--r--Source/WebKit/mac/WebView/WebHTMLView.mm13
-rw-r--r--Source/WebKit/mac/WebView/WebNotification.h1
-rw-r--r--Source/WebKit/mac/WebView/WebNotification.mm10
-rw-r--r--Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm4
-rw-r--r--Source/WebKit/mac/WebView/WebPDFRepresentation.mm2
-rw-r--r--Source/WebKit/mac/WebView/WebResource.mm2
-rw-r--r--Source/WebKit/mac/WebView/WebTextIterator.mm2
-rw-r--r--Source/WebKit/mac/WebView/WebView.mm11
-rw-r--r--Source/WebKit/mac/WebView/WebViewPrivate.h2
74 files changed, 995 insertions, 1602 deletions
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 898482ec1..cdef8f903 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,433 @@
+2012-03-11 Timothy Hatcher <timothy@apple.com>
+
+ Update how the Web Inspector resources are loaded.
+
+ https://bugs.webkit.org/show_bug.cgi?id=80798
+ rdar://problem/10359959
+
+ Reviewed by Brian Weinstein.
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (useWebKitWebInspector): Return if we are using the WebCore resources for compatibility
+ with local and nightly builds.
+ (WebInspectorFrontendClient::localizedStringsURL): Decide what path to use.
+ (-[WebInspectorWindowController init]): Ditto.
+ (-[WebInspectorWindowController window]): Decide if the window is textured or not.
+
+2012-03-09 Jon Lee <jonlee@apple.com>
+
+ Rename NotificationPresenter to NotificationClient
+ https://bugs.webkit.org/show_bug.cgi?id=80488
+ <rdar://problem/10965558>
+
+ Reviewed by Kentaro Hara.
+
+ Refactor to use renamed WebCore::NotificationClient.
+ * WebCoreSupport/WebNotificationClient.h:
+ * WebCoreSupport/WebNotificationClient.mm:
+ (WebNotificationClient::checkPermission):
+ * WebView/WebViewPrivate.h:
+
+2012-03-09 Enrica Casucci <enrica@apple.com>
+
+ Move WebNSURLExtras code down to WebCore.
+ https://bugs.webkit.org/show_bug.cgi?id=80611
+
+ Reviewed by Alexey Proskuryakov.
+
+ Changed the implementation to use newly moved WebCore functions.
+
+ * Misc/WebKitNSStringExtras.mm:
+ (-[NSString _webkit_hasCaseInsensitivePrefix:]):
+ * Misc/WebNSURLExtras.mm:
+ (+[NSURL _web_URLWithUserTypedString:]):
+ (+[NSURL _web_URLWithDataAsString:relativeToURL:]):
+ (+[NSURL _web_URLWithData:]):
+ (+[NSURL _web_URLWithData:relativeToURL:]):
+ (-[NSURL _web_originalData]):
+ (-[NSURL _web_originalDataAsString]):
+ (-[NSURL _web_userVisibleString]):
+ (-[NSURL _web_isEmpty]):
+ (-[NSURL _web_URLCString]):
+ (-[NSURL _web_URLByTruncatingOneCharacterBeforeComponent:]):
+ (-[NSURL _webkit_URLByRemovingFragment]):
+ (-[NSURL _webkit_URLByRemovingResourceSpecifier]):
+ (-[NSURL _web_URLByRemovingUserInfo]):
+ (-[NSURL _web_dataForURLComponentType:]):
+ (-[NSURL _web_schemeData]):
+ (-[NSURL _web_hostData]):
+ (-[NSString _web_isUserVisibleURL]):
+ (-[NSString _web_hostNameNeedsDecodingWithRange:]):
+ (-[NSString _web_hostNameNeedsEncodingWithRange:]):
+ (-[NSString _web_decodeHostNameWithRange:]):
+ (-[NSString _web_encodeHostNameWithRange:]):
+ (-[NSString _web_decodeHostName]):
+ (-[NSString _web_encodeHostName]):
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
+2012-03-09 Emil A Eklund <eae@chromium.org>
+
+ Add roundedPoint to HitTestResult and change platform code to use it
+ https://bugs.webkit.org/show_bug.cgi?id=80715
+
+ Reviewed by James Robinson.
+
+ Change ports to use roundedPoint to avoid exposing subpixel types to
+ platform code.
+
+ * WebCoreSupport/WebContextMenuClient.mm:
+ (WebContextMenuClient::showContextMenu):
+
+2012-03-09 Jon Lee <jonlee@apple.com>
+
+ Add support for ENABLE(LEGACY_NOTIFICATIONS)
+ https://bugs.webkit.org/show_bug.cgi?id=80497
+
+ Reviewed by Adam Barth.
+
+ Prep for b80472: Update API for Web Notifications
+ * Configurations/FeatureDefines.xcconfig:
+
+2012-03-08 Ryosuke Niwa <rniwa@webkit.org>
+
+ Mac build fix for micro data API.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2012-03-08 Jer Noble <jer.noble@apple.com>
+
+ Unreviewed Snow Leopard build fix.
+
+ On Leopard and Snow Leopard, provide an implementation for -[NSWindow convertRectToScreen:].
+
+ * WebView/WebFullScreenController.mm:
+ (-[NSWindow convertRectToScreen:]):
+
+2012-02-20 Jer Noble <jer.noble@apple.com>
+
+ Full Screen Refactor Part 4: Animate into Full Screen mode using new animation classes, WebKit edition.
+ https://bugs.webkit.org/show_bug.cgi?id=78930
+
+ Reviewed by Anders Carlsson.
+
+ Revise WebFullScreenController to have the same general functionality and code path as WKFullScreenWindowController
+ in WebKit2. As such, the following functions are copies of their equivalents in WKFullScreenWindowController:
+ * WebView/WebFullScreenController.mm:
+ (-[WebFullScreenController init]):
+ (-[WebFullScreenController dealloc]):
+ (-[WebFullScreenController windowDidLoad]):
+ (-[WebFullScreenController cancelOperation:]):
+ (-[WebFullScreenController applicationDidResignActive:]):
+ (-[WebFullScreenController applicationDidChangeScreenParameters:]):
+ (-[WebFullScreenController finishedEnterFullScreenAnimation:]):
+ (-[WebFullScreenController finishedExitFullScreenAnimation:]):
+ (-[WebFullScreenController close]):
+ (-[WebFullScreenController animationDidEnd:]):
+ (-[WebFullScreenController _updateMenuAndDockForFullScreen]):
+ (-[WebFullScreenController _swapView:with:]):
+ (createBackgroundFullscreenWindow):
+ (windowFrameFromApparentFrames):
+ (-[WebFullScreenController _startEnterFullScreenAnimationWithDuration:]):
+ (-[WebFullScreenController _startExitFullScreenAnimationWithDuration:]):
+
+ The following is a copy of the equivalent function in WebFullScreenManager:
+ * WebView/WebFullScreenController.mm:
+ (screenRectOfContents):
+
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::fullScreenRendererChanged): No longer tell the WebView the renderer changed (as it doesn't care.)
+ * WebView/WebFullScreenController.h:
+ * WebView/WebFullScreenController.mm:
+ (-[WebFullScreenController setElement:]): No need to add event listeners to the media element.
+ (-[WebFullScreenController enterFullScreen:]): Same as WKFullScreenWindowController, but not asynchronous.
+ (-[WebFullScreenController exitFullScreen]): Ditto.
+ * WebView/WebView.mm:
+ (-[WebView _enterFullScreenForElement:WebCore::]): Fullscreen -> FullScreen.
+ (-[WebView _exitFullScreenForElement:WebCore::]): Ditto.
+
+2012-03-08 Matt Lilek <mrl@apple.com>
+
+ Don't enable VIDEO_TRACK on all OS X platforms
+ https://bugs.webkit.org/show_bug.cgi?id=80635
+
+ Reviewed by Eric Carlson.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2012-03-07 Joseph Pecoraro <pecoraro@apple.com>
+
+ <http://webkit.org/b/80510> Web Inspector crash (iCab)
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::didResizeMainFrame):
+
+2012-03-06 Benjamin Poulain <bpoulain@apple.com>
+
+ [Mac] Update the configuration files for iOS
+ https://bugs.webkit.org/show_bug.cgi?id=80435
+
+ Reviewed by David Kilzer.
+
+ * Configurations/WebKit.xcconfig:
+
+2012-03-06 Eric Seidel <eric@webkit.org>
+
+ Make WTF public headers use fully-qualified include paths and remove ForwardingHeaders/wtf
+ https://bugs.webkit.org/show_bug.cgi?id=80363
+
+ Reviewed by Mark Rowe.
+
+ ForwardingHeaders/wtf is no longer necessary (or functional) now that JavaScriptCore
+ no longer includes the WTF headers as private headers.
+
+ * ForwardingHeaders/wtf/ASCIICType.h: Removed.
+ * ForwardingHeaders/wtf/AlwaysInline.h: Removed.
+ * ForwardingHeaders/wtf/Assertions.h: Removed.
+ * ForwardingHeaders/wtf/Deque.h: Removed.
+ * ForwardingHeaders/wtf/DisallowCType.h: Removed.
+ * ForwardingHeaders/wtf/FastMalloc.h: Removed.
+ * ForwardingHeaders/wtf/Forward.h: Removed.
+ * ForwardingHeaders/wtf/GetPtr.h: Removed.
+ * ForwardingHeaders/wtf/HashCountedSet.h: Removed.
+ * ForwardingHeaders/wtf/HashMap.h: Removed.
+ * ForwardingHeaders/wtf/HashSet.h: Removed.
+ * ForwardingHeaders/wtf/HashTraits.h: Removed.
+ * ForwardingHeaders/wtf/ListHashSet.h: Removed.
+ * ForwardingHeaders/wtf/ListRefPtr.h: Removed.
+ * ForwardingHeaders/wtf/Locker.h: Removed.
+ * ForwardingHeaders/wtf/MathExtras.h: Removed.
+ * ForwardingHeaders/wtf/Noncopyable.h: Removed.
+ * ForwardingHeaders/wtf/OwnArrayPtr.h: Removed.
+ * ForwardingHeaders/wtf/OwnPtr.h: Removed.
+ * ForwardingHeaders/wtf/OwnPtrCommon.h: Removed.
+ * ForwardingHeaders/wtf/PassOwnPtr.h: Removed.
+ * ForwardingHeaders/wtf/PassRefPtr.h: Removed.
+ * ForwardingHeaders/wtf/Platform.h: Removed.
+ * ForwardingHeaders/wtf/RefCounted.h: Removed.
+ * ForwardingHeaders/wtf/RefCountedLeakCounter.h: Removed.
+ * ForwardingHeaders/wtf/RefPtr.h: Removed.
+ * ForwardingHeaders/wtf/RetainPtr.h: Removed.
+ * ForwardingHeaders/wtf/StdLibExtras.h: Removed.
+ * ForwardingHeaders/wtf/TemporaryChange.h: Removed.
+ * ForwardingHeaders/wtf/Threading.h: Removed.
+ * ForwardingHeaders/wtf/UnusedParam.h: Removed.
+ * ForwardingHeaders/wtf/VMTags.h: Removed.
+ * ForwardingHeaders/wtf/ValueCheck.h: Removed.
+ * ForwardingHeaders/wtf/Vector.h: Removed.
+ * ForwardingHeaders/wtf/VectorTraits.h: Removed.
+ * ForwardingHeaders/wtf/unicode/Unicode.h: Removed.
+ * ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h: Removed.
+
+2012-03-05 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Hide dock button when not allowed to dock
+ https://bugs.webkit.org/show_bug.cgi?id=78575
+
+ Reviewed by Pavel Feldman.
+
+ * WebCoreSupport/WebInspectorClient.h:
+ (WebCore):
+ (WebInspectorClient):
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::didResizeMainFrame):
+
+2012-03-05 Gavin Barraclough <barraclough@apple.com>
+
+ putByIndex should throw in strict mode
+ https://bugs.webkit.org/show_bug.cgi?id=80335
+
+ Reviewed by Filip Pizlo.
+
+ Make the MethodTable PutByIndex trap take a boolean 'shouldThrow' parameter.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::setProperty):
+
+2012-03-05 Joseph Pecoraro <pecoraro@apple.com>
+
+ Unreviewed rollout of r109858 for restructuring.
+
+2012-03-05 Joseph Pecoraro <pecoraro@apple.com>
+
+ <http://webkit.org/b/78575> Web Inspector: Hide dock button when not allowed to dock
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/WebInspectorClient.h:
+ (WebInspectorClient):
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::updateDockingAvailability):
+
+2012-03-02 Jon Lee <jonlee@apple.com>
+
+ Add support for notification replaceId in Mac WebKit and WK2
+ https://bugs.webkit.org/show_bug.cgi?id=80206
+ <rdar://problem/10965574>
+
+ Reviewed by Sam Weinig.
+
+ * WebView/WebNotification.h: Add replaceID method.
+ * WebView/WebNotification.mm:
+ (-[WebNotification replaceID]):
+
+2012-03-05 Adam Barth <abarth@webkit.org>
+
+ Geolocation should use a ScriptExecutionContext as its context object
+ https://bugs.webkit.org/show_bug.cgi?id=80248
+
+ Reviewed by Kentaro Hara.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _cacheabilityDictionary]):
+ - We no longer special-case Geolocation.
+
+2012-03-03 Benjamin Poulain <benjamin@webkit.org>
+
+ Remove the redundant method KURL::protocolInHTTPFamily()
+ https://bugs.webkit.org/show_bug.cgi?id=80216
+
+ Reviewed by Anders Carlsson.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::createPlugin):
+
+2012-03-03 Hans Wennborg <hans@chromium.org>
+
+ Implement Speech JavaScript API
+ https://bugs.webkit.org/show_bug.cgi?id=80019
+
+ Reviewed by Adam Barth.
+
+ Add ENABLE_SCRIPTED_SPEECH.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2012-03-03 Anders Carlsson <andersca@apple.com>
+
+ Fix build with newer versions of clang.
+
+ * Panels/WebAuthenticationPanel.m:
+ (-[WebAuthenticationPanel setUpForChallenge:]):
+ Use %ld and cast to long.
+
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView getVariable:value:]):
+ Cast the switch parameter to unsigned to prevent warnings about case values not being part of the enum type.
+
+2012-03-01 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Unreviewed, rolling out r109255.
+ http://trac.webkit.org/changeset/109255
+ https://bugs.webkit.org/show_bug.cgi?id=79932
+
+ Breaks rounded rects with dashed strokes in SVG
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
+2012-02-29 Adam Barth <abarth@webkit.org>
+
+ ScriptExecutionContext has too many ifdef ENABLE(SQL_DATABASE)
+ https://bugs.webkit.org/show_bug.cgi?id=79633
+
+ Reviewed by Eric Seidel.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _cacheabilityDictionary]):
+
+2012-02-29 Tim Horton <timothy_horton@apple.com>
+
+ Make use of CG rounded-rect primitives
+ https://bugs.webkit.org/show_bug.cgi?id=79932
+ <rdar://problem/9274953>
+
+ Reviewed by Simon Fraser.
+
+ Add wkCGPathAddRoundedRect.
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
+2012-02-29 Enrica Casucci <enrica@apple.com>
+
+ Crash at -[WebFrame(WebInternal) _setTypingStyle:withUndoAction:]
+ https://bugs.webkit.org/show_bug.cgi?id=79937
+ <rdar://problem/10942936>
+
+ Reviewed by Dan Bernstein.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _setTypingStyle:withUndoAction:]): Adding a null check.
+
+2012-02-28 Simon Fraser <simon.fraser@apple.com>
+
+ Update WebKitSystemInterface.
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
+2012-02-28 Enrica Casucci <enrica@apple.com>
+
+ More Pasteboard code cleanup.
+ https://bugs.webkit.org/show_bug.cgi?id=79816
+
+ Removing the last references to NSPasteboard.
+
+ Reviewed by Alexey Proskuryakov.
+
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::setInsertionPasteboard):
+
+2012-02-26 Hajime Morrita <morrita@chromium.org>
+
+ Move ChromeClient::showContextMenu() to ContextMenuClient
+ https://bugs.webkit.org/show_bug.cgi?id=79427
+
+ Reviewed by Adam Barth.
+
+ * WebCoreSupport/WebContextMenuClient.h:
+ (WebContextMenuClient):
+ * WebCoreSupport/WebContextMenuClient.mm:
+ (WebContextMenuClient::showContextMenu): Moved from WebChromeClient
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+
+2012-02-25 Sam Weinig <sam@webkit.org>
+
+ QuickLook events don't make it to WebKit plugins.
+ <rdar://problem/10931721>
+
+ Reviewed by Anders Carlsson.
+
+ * WebView/WebHTMLView.mm:
+ (isQuickLookEvent):
+ (-[WebHTMLView hitTest:]):
+ Allow QuickLook events to hit test down to subviews.
+
+2012-02-24 Brady Eidson <beidson@apple.com>
+
+ <rdar://problem/10805709> and https://bugs.webkit.org/show_bug.cgi?id=79421
+ Need a WK1 Mac API to filter which subframes go into WebArchives as they are created
+
+ Reviewed by Sam Weinig (with additional comments by Adam Roben)
+
+ Add webArchiveByFilteringSubframes: which takes a callback block:
+ * DOM/WebDOMOperationsPrivate.h:
+
+ Add FrameFilter that adapts the block, and use it to implement the new SPI:
+ * DOM/WebDOMOperations.mm:
+ (WebFrameFilter):
+ (WebFrameFilter::WebFrameFilter):
+ (WebFrameFilter::~WebFrameFilter):
+ (WebFrameFilter::shouldIncludeSubframe):
+ (-[DOMNode webArchiveByFilteringSubframes:]):
+
2012-02-24 Shinya Kawanaka <shinyak@chromium.org>
SpellCheckRequest needs to know the context where the spellcheck happened.
diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
index 3e2090355..58a02f521 100644
--- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
+++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
@@ -90,12 +90,14 @@ ENABLE_INDEXED_DATABASE = ;
ENABLE_INPUT_COLOR = ;
ENABLE_INPUT_SPEECH = ;
ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER;
+ENABLE_LEGACY_NOTIFICATIONS = ENABLE_LEGACY_NOTIFICATIONS;
ENABLE_LINK_PREFETCH = ;
ENABLE_MATHML = ENABLE_MATHML;
ENABLE_MEDIA_SOURCE = ;
ENABLE_MEDIA_STATISTICS = ;
ENABLE_METER_TAG = ENABLE_METER_TAG;
ENABLE_MHTML = ;
+ENABLE_MICRODATA = ;
ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS;
ENABLE_NOTIFICATIONS = $(ENABLE_NOTIFICATIONS_$(REAL_PLATFORM_NAME));
@@ -109,6 +111,7 @@ ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG;
ENABLE_QUOTA = ;
ENABLE_REGISTER_PROTOCOL_HANDLER = ;
ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME;
+ENABLE_SCRIPTED_SPEECH = ;
ENABLE_SHADOW_DOM = ;
ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS;
ENABLE_SQL_DATABASE = ENABLE_SQL_DATABASE;
@@ -118,7 +121,10 @@ ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY;
ENABLE_TOUCH_ICON_LOADING = ;
ENABLE_VIDEO = ENABLE_VIDEO;
-ENABLE_VIDEO_TRACK = ENABLE_VIDEO_TRACK;
+
+ENABLE_VIDEO_TRACK = $(ENABLE_VIDEO_TRACK_$(REAL_PLATFORM_NAME));
+ENABLE_VIDEO_TRACK_macosx = ENABLE_VIDEO_TRACK;
+
ENABLE_WEBGL = ENABLE_WEBGL;
ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS;
@@ -126,4 +132,4 @@ ENABLE_WEB_TIMING = ;
ENABLE_WORKERS = ENABLE_WORKERS;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT);
diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig
index 5344a720d..be7e0399c 100644
--- a/Source/WebKit/mac/Configurations/Version.xcconfig
+++ b/Source/WebKit/mac/Configurations/Version.xcconfig
@@ -21,8 +21,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-MAJOR_VERSION = 535;
-MINOR_VERSION = 23;
+MAJOR_VERSION = 536;
+MINOR_VERSION = 3;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/Source/WebKit/mac/Configurations/WebKit.xcconfig b/Source/WebKit/mac/Configurations/WebKit.xcconfig
index 0a0cf9f41..41ab11f37 100644
--- a/Source/WebKit/mac/Configurations/WebKit.xcconfig
+++ b/Source/WebKit/mac/Configurations/WebKit.xcconfig
@@ -30,9 +30,8 @@ EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphone
EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH));
EXPORTED_SYMBOLS_FILE_ = mac/WebKit.exp;
-EXPORTED_SYMBOLS_FILE_armv5 = mac/WebKit.exp;
-EXPORTED_SYMBOLS_FILE_armv6 = mac/WebKit.exp;
-EXPORTED_SYMBOLS_FILE_armv7 = mac/WebKit.exp;
+EXPORTED_SYMBOLS_FILE_armv6 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
+EXPORTED_SYMBOLS_FILE_armv7 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
EXPORTED_SYMBOLS_FILE_i386 = mac/WebKit.exp;
EXPORTED_SYMBOLS_FILE_ppc = mac/WebKit.exp;
EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp;
@@ -54,15 +53,22 @@ GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAM
HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit" $(HEADER_SEARCH_PATHS);
INFOPLIST_FILE = mac/Info.plist;
INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME));
+INSTALL_PATH_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+INSTALL_PATH_iphonesimulator = $(INDIGO_INSTALL_PATH_PREFIX)$(INSTALL_PATH_ACTUAL);
INSTALL_PATH_macosx = $(WEBKIT_FRAMEWORKS_DIR);
-DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT_FRAMEWORKS_DIR);
+INSTALL_PATH_ACTUAL = $(INSTALL_PATH_ACTUAL_$(REAL_PLATFORM_NAME));
+INSTALL_PATH_ACTUAL_iphonesimulator = $(INSTALL_PATH_iphoneos);
+DYLIB_INSTALL_NAME_BASE = $(DYLIB_INSTALL_NAME_BASE_$(REAL_PLATFORM_NAME));
+DYLIB_INSTALL_NAME_BASE_macosx = $(NORMAL_WEBKIT_FRAMEWORKS_DIR);
+DYLIB_INSTALL_NAME_BASE_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+DYLIB_INSTALL_NAME_BASE_iphonesimulator = $(SDKROOT)$(DYLIB_INSTALL_NAME_BASE_iphoneos);
INSTALLHDRS_COPY_PHASE = YES;
INSTALLHDRS_SCRIPT_PHASE = YES;
PRODUCT_NAME = WebKit;
UMBRELLA_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR)/WebKit.framework/Versions/A/Frameworks;
OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME));
-OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework Foundation -framework GraphicsServices -framework ImageIO -framework WebCore;
+OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework QuartzCore;
OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos);
OTHER_LDFLAGS_macosx = -sub_umbrella WebCore $(OTHER_LDFLAGS) $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction;
@@ -83,7 +89,7 @@ WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO = $(NORMAL_WEBKIT_FRAME
WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_YES = $(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
NORMAL_PRODUCTION_FRAMEWORKS_DIR = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME));
-NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos);
NORMAL_PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks;
@@ -117,5 +123,8 @@ WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH = $(WEBKITSYSTEMINTERFA
WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_Debug = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering);
WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_Release = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering);
WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_Production = $(PRODUCTION_ROOT)/usr/local/include;
-WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering = $(BUILT_PRODUCTS_DIR)/usr/local/include;
+WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering_$(REAL_PLATFORM_NAME));
+WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering_iphoneos = $(BUILT_PRODUCTS_DIR)/usr/local/include;
+WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering_iphonesimulator = $(BUILT_PRODUCTS_DIR)$(PRODUCTION_ROOT_iphonesimulator)/usr/local/include;
+WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_engineering_macosx = $(BUILT_PRODUCTS_DIR)/usr/local/include;
diff --git a/Source/WebKit/mac/DOM/WebDOMOperations.mm b/Source/WebKit/mac/DOM/WebDOMOperations.mm
index 5ea99461f..d3b254500 100644
--- a/Source/WebKit/mac/DOM/WebDOMOperations.mm
+++ b/Source/WebKit/mac/DOM/WebDOMOperations.mm
@@ -35,10 +35,12 @@
#import "WebArchiveInternal.h"
#import "WebDataSourcePrivate.h"
#import "WebFrameInternal.h"
+#import "WebFrameLoaderClient.h"
#import "WebFramePrivate.h"
#import "WebKitNSStringExtras.h"
#import <JavaScriptCore/APICast.h>
#import <WebCore/Document.h>
+#import <WebCore/Frame.h>
#import <WebCore/HTMLInputElement.h>
#import <WebCore/HTMLParserIdioms.h>
#import <WebCore/JSElement.h>
@@ -76,6 +78,35 @@ using namespace JSC;
@end
+class WebFrameFilter : public WebCore::FrameFilter {
+public:
+ WebFrameFilter(WebArchiveSubframeFilter filterBlock);
+ ~WebFrameFilter();
+private:
+ virtual bool shouldIncludeSubframe(Frame*) const OVERRIDE;
+
+ WebArchiveSubframeFilter m_filterBlock;
+};
+
+WebFrameFilter::WebFrameFilter(WebArchiveSubframeFilter filterBlock)
+ : m_filterBlock(Block_copy(filterBlock))
+{
+}
+
+WebFrameFilter::~WebFrameFilter()
+{
+ Block_release(m_filterBlock);
+}
+
+bool WebFrameFilter::shouldIncludeSubframe(Frame* frame) const
+{
+ if (!m_filterBlock)
+ return true;
+
+ WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
+ return m_filterBlock(webFrame);
+}
+
@implementation DOMNode (WebDOMNodeOperations)
- (WebArchive *)webArchive
@@ -83,6 +114,12 @@ using namespace JSC;
return [[[WebArchive alloc] _initWithCoreLegacyWebArchive:LegacyWebArchive::create(core(self))] autorelease];
}
+- (WebArchive *)webArchiveByFilteringSubframes:(WebArchiveSubframeFilter)webArchiveSubframeFilter
+{
+ WebFrameFilter filter(webArchiveSubframeFilter);
+ return [[[WebArchive alloc] _initWithCoreLegacyWebArchive:LegacyWebArchive::create(core(self), &filter)] autorelease];
+}
+
@end
@implementation DOMNode (WebDOMNodeOperationsPendingPublic)
diff --git a/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h b/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h
index b579a6f87..d3bf68c52 100644
--- a/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h
+++ b/Source/WebKit/mac/DOM/WebDOMOperationsPrivate.h
@@ -47,3 +47,9 @@
- (NSString *)markupString;
- (NSRect)_renderRect:(bool *)isReplaced;
@end
+
+typedef BOOL (^WebArchiveSubframeFilter)(WebFrame* subframe);
+
+@interface DOMNode (WebDOMNodeOperationsPrivate)
+- (WebArchive *)webArchiveByFilteringSubframes:(WebArchiveSubframeFilter)webArchiveSubframeFilter;
+@end
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/ASCIICType.h b/Source/WebKit/mac/ForwardingHeaders/wtf/ASCIICType.h
deleted file mode 100644
index f2258d298..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/ASCIICType.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/ASCIICType.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/AlwaysInline.h b/Source/WebKit/mac/ForwardingHeaders/wtf/AlwaysInline.h
deleted file mode 100644
index 156bd34ca..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/AlwaysInline.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/AlwaysInline.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Assertions.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Assertions.h
deleted file mode 100644
index c4cc25cf3..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Assertions.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Assertions.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Deque.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Deque.h
deleted file mode 100644
index f1721ca14..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Deque.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Deque.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/DisallowCType.h b/Source/WebKit/mac/ForwardingHeaders/wtf/DisallowCType.h
deleted file mode 100644
index 445944be9..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/DisallowCType.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/DisallowCType.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/FastMalloc.h b/Source/WebKit/mac/ForwardingHeaders/wtf/FastMalloc.h
deleted file mode 100644
index 8733b5fbf..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/FastMalloc.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/FastMalloc.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Forward.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Forward.h
deleted file mode 100644
index 2d707ecb7..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Forward.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/Forward.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/GetPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/GetPtr.h
deleted file mode 100644
index 61baf6df8..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/GetPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/GetPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/HashCountedSet.h b/Source/WebKit/mac/ForwardingHeaders/wtf/HashCountedSet.h
deleted file mode 100644
index 23120ed16..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/HashCountedSet.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/HashCountedSet.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/HashMap.h b/Source/WebKit/mac/ForwardingHeaders/wtf/HashMap.h
deleted file mode 100644
index 4d7d60f91..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/HashMap.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/HashMap.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/HashSet.h b/Source/WebKit/mac/ForwardingHeaders/wtf/HashSet.h
deleted file mode 100644
index 03b7a7098..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/HashSet.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/HashSet.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h b/Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h
deleted file mode 100644
index fa2ce1c45..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/HashTraits.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/HashTraits.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/ListHashSet.h b/Source/WebKit/mac/ForwardingHeaders/wtf/ListHashSet.h
deleted file mode 100644
index 8ed045dd6..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/ListHashSet.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/ListHashSet.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h
deleted file mode 100644
index 2aa23116d..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/ListRefPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/ListRefPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Locker.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Locker.h
deleted file mode 100644
index 7718305b7..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Locker.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Locker.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/MathExtras.h b/Source/WebKit/mac/ForwardingHeaders/wtf/MathExtras.h
deleted file mode 100644
index 865479e00..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/MathExtras.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/MathExtras.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Noncopyable.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Noncopyable.h
deleted file mode 100644
index 050802453..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Noncopyable.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Noncopyable.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/OwnArrayPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/OwnArrayPtr.h
deleted file mode 100644
index f10532cdd..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/OwnArrayPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/OwnArrayPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtr.h
deleted file mode 100644
index ccf0e22ed..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/OwnPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtrCommon.h b/Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtrCommon.h
deleted file mode 100644
index efffb81b7..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/OwnPtrCommon.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/PassOwnPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/PassOwnPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/PassOwnPtr.h
deleted file mode 100644
index efffb81b7..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/PassOwnPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/PassOwnPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/PassRefPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/PassRefPtr.h
deleted file mode 100644
index f1eb4666f..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/PassRefPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/PassRefPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Platform.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Platform.h
deleted file mode 100644
index 18eaa34b9..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Platform.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Platform.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/RefCounted.h b/Source/WebKit/mac/ForwardingHeaders/wtf/RefCounted.h
deleted file mode 100644
index 02c1236f6..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/RefCounted.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/RefCounted.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/RefCountedLeakCounter.h b/Source/WebKit/mac/ForwardingHeaders/wtf/RefCountedLeakCounter.h
deleted file mode 100644
index 3f229d1aa..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/RefCountedLeakCounter.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <JavaScriptCore/RefCountedLeakCounter.h>
-
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/RefPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/RefPtr.h
deleted file mode 100644
index 33c43be7b..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/RefPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/RefPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/RetainPtr.h b/Source/WebKit/mac/ForwardingHeaders/wtf/RetainPtr.h
deleted file mode 100644
index 8471d5d6d..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/RetainPtr.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/RetainPtr.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/StdLibExtras.h b/Source/WebKit/mac/ForwardingHeaders/wtf/StdLibExtras.h
deleted file mode 100644
index d48b3242c..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/StdLibExtras.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/StdLibExtras.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/TemporaryChange.h b/Source/WebKit/mac/ForwardingHeaders/wtf/TemporaryChange.h
deleted file mode 100644
index 3367eb2d2..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/TemporaryChange.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/TemporaryChange.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Threading.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Threading.h
deleted file mode 100644
index 771edd126..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Threading.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Threading.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/UnusedParam.h b/Source/WebKit/mac/ForwardingHeaders/wtf/UnusedParam.h
deleted file mode 100644
index f1a660060..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/UnusedParam.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/UnusedParam.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/VMTags.h b/Source/WebKit/mac/ForwardingHeaders/wtf/VMTags.h
deleted file mode 100644
index 701e514f7..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/VMTags.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/VMTags.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h b/Source/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h
deleted file mode 100644
index 7a067ff57..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/ValueCheck.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/ValueCheck.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/Vector.h b/Source/WebKit/mac/ForwardingHeaders/wtf/Vector.h
deleted file mode 100644
index 769a55043..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/Vector.h
+++ /dev/null
@@ -1 +0,0 @@
-#import <JavaScriptCore/Vector.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/VectorTraits.h b/Source/WebKit/mac/ForwardingHeaders/wtf/VectorTraits.h
deleted file mode 100644
index 2fc115827..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/VectorTraits.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/VectorTraits.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/unicode/Unicode.h b/Source/WebKit/mac/ForwardingHeaders/wtf/unicode/Unicode.h
deleted file mode 100644
index 623917f76..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/unicode/Unicode.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/Unicode.h>
diff --git a/Source/WebKit/mac/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h b/Source/WebKit/mac/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h
deleted file mode 100644
index 6b64eb509..000000000
--- a/Source/WebKit/mac/ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/UnicodeIcu.h>
diff --git a/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm b/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm
index 2ba333fdd..08f8e6aff 100644
--- a/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm
+++ b/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm
@@ -184,7 +184,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
-(BOOL)_webkit_hasCaseInsensitivePrefix:(NSString *)prefix
{
- return [self rangeOfString:prefix options:(NSCaseInsensitiveSearch | NSAnchoredSearch)].location != NSNotFound;
+ return hasCaseInsensitivePrefix(self, prefix);
}
-(BOOL)_webkit_hasCaseInsensitiveSuffix:(NSString *)suffix
diff --git a/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm b/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm
index 39d489cfd..fa150233d 100644
--- a/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm
+++ b/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm
@@ -31,7 +31,7 @@
#import "WebKitNSStringExtras.h"
#import "WebNSObjectExtras.h"
#import "WebNSURLExtras.h"
-#import <JavaScriptCore/Assertions.h>
+#import <wtf/Assertions.h>
#import <WebKitSystemInterface.h>
#import <sys/stat.h>
#import <wtf/RetainPtr.h>
diff --git a/Source/WebKit/mac/Misc/WebNSURLExtras.mm b/Source/WebKit/mac/Misc/WebNSURLExtras.mm
index c2351dd3d..98fff7aaa 100644
--- a/Source/WebKit/mac/Misc/WebNSURLExtras.mm
+++ b/Source/WebKit/mac/Misc/WebNSURLExtras.mm
@@ -37,366 +37,27 @@
#import <Foundation/NSURLRequest.h>
#import <WebCore/KURL.h>
#import <WebCore/LoaderNSURLExtras.h>
+#import <WebCore/WebCoreNSURLExtras.h>
#import <WebKitSystemInterface.h>
#import <wtf/Assertions.h>
#import <unicode/uchar.h>
-#import <unicode/uidna.h>
#import <unicode/uscript.h>
using namespace WebCore;
using namespace WTF;
-typedef void (* StringRangeApplierFunction)(NSString *string, NSRange range, void *context);
-
-// Needs to be big enough to hold an IDN-encoded name.
-// For host names bigger than this, we won't do IDN encoding, which is almost certainly OK.
-#define HOST_NAME_BUFFER_LENGTH 2048
-
#define URL_BYTES_BUFFER_LENGTH 2048
-static pthread_once_t IDNScriptWhiteListFileRead = PTHREAD_ONCE_INIT;
-static uint32_t IDNScriptWhiteList[(USCRIPT_CODE_LIMIT + 31) / 32];
-
-static inline BOOL isLookalikeCharacter(int charCode)
-{
-// FIXME: Move this code down into WebCore so it can be shared with other platforms.
-
-// This function treats the following as unsafe, lookalike characters:
-// any non-printable character, any character considered as whitespace that isn't already converted to a space by ICU,
-// and any ignorable character.
-
-// We also considered the characters in Mozilla's blacklist (http://kb.mozillazine.org/Network.IDN.blacklist_chars),
-// and included all of these characters that ICU can encode.
-
- if (!u_isprint(charCode) || u_isUWhiteSpace(charCode) || u_hasBinaryProperty(charCode, UCHAR_DEFAULT_IGNORABLE_CODE_POINT))
- return YES;
-
- switch (charCode) {
- case 0x00ED: /* LATIN SMALL LETTER I WITH ACUTE */
- case 0x01C3: /* LATIN LETTER RETROFLEX CLICK */
- case 0x0251: /* LATIN SMALL LETTER ALPHA */
- case 0x0261: /* LATIN SMALL LETTER SCRIPT G */
- case 0x0337: /* COMBINING SHORT SOLIDUS OVERLAY */
- case 0x0338: /* COMBINING LONG SOLIDUS OVERLAY */
- case 0x05B4: /* HEBREW POINT HIRIQ */
- case 0x05BC: /* HEBREW POINT DAGESH OR MAPIQ */
- case 0x05C3: /* HEBREW PUNCTUATION SOF PASUQ */
- case 0x05F4: /* HEBREW PUNCTUATION GERSHAYIM */
- case 0x0660: /* ARABIC INDIC DIGIT ZERO */
- case 0x06D4: /* ARABIC FULL STOP */
- case 0x06F0: /* EXTENDED ARABIC INDIC DIGIT ZERO */
- case 0x2027: /* HYPHENATION POINT */
- case 0x2039: /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
- case 0x203A: /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
- case 0x2044: /* FRACTION SLASH */
- case 0x2215: /* DIVISION SLASH */
- case 0x2216: /* SET MINUS */
- case 0x233F: /* APL FUNCTIONAL SYMBOL SLASH BAR */
- case 0x23AE: /* INTEGRAL EXTENSION */
- case 0x244A: /* OCR DOUBLE BACKSLASH */
- case 0x2571: /* BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT */
- case 0x2572: /* BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT */
- case 0x29F8: /* BIG SOLIDUS */
- case 0x29f6: /* SOLIDUS WITH OVERBAR */
- case 0x2AFB: /* TRIPLE SOLIDUS BINARY RELATION */
- case 0x2AFD: /* DOUBLE SOLIDUS OPERATOR */
- case 0x3008: /* LEFT ANGLE BRACKET */
- case 0x3014: /* LEFT TORTOISE SHELL BRACKET */
- case 0x3015: /* RIGHT TORTOISE SHELL BRACKET */
- case 0x3033: /* VERTICAL KANA REPEAT MARK UPPER HALF */
- case 0x3035: /* VERTICAL KANA REPEAT MARK LOWER HALF */
- case 0x321D: /* PARENTHESIZED KOREAN CHARACTER OJEON */
- case 0x321E: /* PARENTHESIZED KOREAN CHARACTER O HU */
- case 0x33DF: /* SQUARE A OVER M */
- case 0xFE14: /* PRESENTATION FORM FOR VERTICAL SEMICOLON */
- case 0xFE15: /* PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK */
- case 0xFE3F: /* PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET */
- case 0xFE5D: /* SMALL LEFT TORTOISE SHELL BRACKET */
- case 0xFE5E: /* SMALL RIGHT TORTOISE SHELL BRACKET */
- return YES;
- default:
- return NO;
- }
-}
-
-static char hexDigit(int i)
-{
- if (i < 0 || i > 16) {
- LOG_ERROR("illegal hex digit");
- return '0';
- }
- int h = i;
- if (h >= 10) {
- h = h - 10 + 'A';
- }
- else {
- h += '0';
- }
- return h;
-}
-
-static BOOL isHexDigit(char c)
-{
- return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
-}
-
-static int hexDigitValue(char c)
-{
- if (c >= '0' && c <= '9') {
- return c - '0';
- }
- if (c >= 'A' && c <= 'F') {
- return c - 'A' + 10;
- }
- if (c >= 'a' && c <= 'f') {
- return c - 'a' + 10;
- }
- LOG_ERROR("illegal hex digit");
- return 0;
-}
-
-static void applyHostNameFunctionToMailToURLString(NSString *string, StringRangeApplierFunction f, void *context)
-{
- // In a mailto: URL, host names come after a '@' character and end with a '>' or ',' or '?' character.
- // Skip quoted strings so that characters in them don't confuse us.
- // When we find a '?' character, we are past the part of the URL that contains host names.
-
- static NSCharacterSet *hostNameOrStringStartCharacters;
- if (hostNameOrStringStartCharacters == nil) {
- hostNameOrStringStartCharacters = [NSCharacterSet characterSetWithCharactersInString:@"\"@?"];
- CFRetain(hostNameOrStringStartCharacters);
- }
- static NSCharacterSet *hostNameEndCharacters;
- if (hostNameEndCharacters == nil) {
- hostNameEndCharacters = [NSCharacterSet characterSetWithCharactersInString:@">,?"];
- CFRetain(hostNameEndCharacters);
- }
- static NSCharacterSet *quotedStringCharacters;
- if (quotedStringCharacters == nil) {
- quotedStringCharacters = [NSCharacterSet characterSetWithCharactersInString:@"\"\\"];
- CFRetain(quotedStringCharacters);
- }
-
- unsigned stringLength = [string length];
- NSRange remaining = NSMakeRange(0, stringLength);
-
- while (1) {
- // Find start of host name or of quoted string.
- NSRange hostNameOrStringStart = [string rangeOfCharacterFromSet:hostNameOrStringStartCharacters options:0 range:remaining];
- if (hostNameOrStringStart.location == NSNotFound) {
- return;
- }
- unichar c = [string characterAtIndex:hostNameOrStringStart.location];
- remaining.location = NSMaxRange(hostNameOrStringStart);
- remaining.length = stringLength - remaining.location;
-
- if (c == '?') {
- return;
- }
-
- if (c == '@') {
- // Find end of host name.
- unsigned hostNameStart = remaining.location;
- NSRange hostNameEnd = [string rangeOfCharacterFromSet:hostNameEndCharacters options:0 range:remaining];
- BOOL done;
- if (hostNameEnd.location == NSNotFound) {
- hostNameEnd.location = stringLength;
- done = YES;
- } else {
- remaining.location = hostNameEnd.location;
- remaining.length = stringLength - remaining.location;
- done = NO;
- }
-
- // Process host name range.
- f(string, NSMakeRange(hostNameStart, hostNameEnd.location - hostNameStart), context);
-
- if (done) {
- return;
- }
- } else {
- // Skip quoted string.
- ASSERT(c == '"');
- while (1) {
- NSRange escapedCharacterOrStringEnd = [string rangeOfCharacterFromSet:quotedStringCharacters options:0 range:remaining];
- if (escapedCharacterOrStringEnd.location == NSNotFound) {
- return;
- }
- c = [string characterAtIndex:escapedCharacterOrStringEnd.location];
- remaining.location = NSMaxRange(escapedCharacterOrStringEnd);
- remaining.length = stringLength - remaining.location;
-
- // If we are the end of the string, then break from the string loop back to the host name loop.
- if (c == '"') {
- break;
- }
-
- // Skip escaped character.
- ASSERT(c == '\\');
- if (remaining.length == 0) {
- return;
- }
- remaining.location += 1;
- remaining.length -= 1;
- }
- }
- }
-}
-
-static void applyHostNameFunctionToURLString(NSString *string, StringRangeApplierFunction f, void *context)
-{
- // Find hostnames. Too bad we can't use any real URL-parsing code to do this,
- // but we have to do it before doing all the %-escaping, and this is the only
- // code we have that parses mailto URLs anyway.
-
- // Maybe we should implement this using a character buffer instead?
-
- if ([string _webkit_hasCaseInsensitivePrefix:@"mailto:"]) {
- applyHostNameFunctionToMailToURLString(string, f, context);
- return;
- }
-
- // Find the host name in a hierarchical URL.
- // It comes after a "://" sequence, with scheme characters preceding.
- // If ends with the end of the string or a ":", "/", or a "?".
- // If there is a "@" character, the host part is just the part after the "@".
- NSRange separatorRange = [string rangeOfString:@"://"];
- if (separatorRange.location == NSNotFound) {
- return;
- }
-
- // Check that all characters before the :// are valid scheme characters.
- static NSCharacterSet *nonSchemeCharacters;
- if (nonSchemeCharacters == nil) {
- nonSchemeCharacters = [[NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-."] invertedSet];
- CFRetain(nonSchemeCharacters);
- }
- if ([string rangeOfCharacterFromSet:nonSchemeCharacters options:0 range:NSMakeRange(0, separatorRange.location)].location != NSNotFound) {
- return;
- }
-
- unsigned stringLength = [string length];
-
- static NSCharacterSet *hostTerminators;
- if (hostTerminators == nil) {
- hostTerminators = [NSCharacterSet characterSetWithCharactersInString:@":/?#"];
- CFRetain(hostTerminators);
- }
-
- // Start after the separator.
- unsigned authorityStart = NSMaxRange(separatorRange);
-
- // Find terminating character.
- NSRange hostNameTerminator = [string rangeOfCharacterFromSet:hostTerminators options:0 range:NSMakeRange(authorityStart, stringLength - authorityStart)];
- unsigned hostNameEnd = hostNameTerminator.location == NSNotFound ? stringLength : hostNameTerminator.location;
-
- // Find "@" for the start of the host name.
- NSRange userInfoTerminator = [string rangeOfString:@"@" options:0 range:NSMakeRange(authorityStart, hostNameEnd - authorityStart)];
- unsigned hostNameStart = userInfoTerminator.location == NSNotFound ? authorityStart : NSMaxRange(userInfoTerminator);
-
- f(string, NSMakeRange(hostNameStart, hostNameEnd - hostNameStart), context);
-}
-
@implementation NSURL (WebNSURLExtras)
-static void collectRangesThatNeedMapping(NSString *string, NSRange range, void *context, BOOL encode)
-{
- BOOL needsMapping = encode
- ? [string _web_hostNameNeedsEncodingWithRange:range]
- : [string _web_hostNameNeedsDecodingWithRange:range];
- if (!needsMapping) {
- return;
- }
-
- NSMutableArray **array = (NSMutableArray **)context;
- if (*array == nil) {
- *array = [[NSMutableArray alloc] init];
- }
-
- [*array addObject:[NSValue valueWithRange:range]];
-}
-
-static void collectRangesThatNeedEncoding(NSString *string, NSRange range, void *context)
-{
- return collectRangesThatNeedMapping(string, range, context, YES);
-}
-
-static void collectRangesThatNeedDecoding(NSString *string, NSRange range, void *context)
-{
- return collectRangesThatNeedMapping(string, range, context, NO);
-}
-
-static NSString *mapHostNames(NSString *string, BOOL encode)
-{
- // Generally, we want to optimize for the case where there is one host name that does not need mapping.
-
- if (encode && [string canBeConvertedToEncoding:NSASCIIStringEncoding])
- return string;
-
- // Make a list of ranges that actually need mapping.
- NSMutableArray *hostNameRanges = nil;
- StringRangeApplierFunction f = encode
- ? collectRangesThatNeedEncoding
- : collectRangesThatNeedDecoding;
- applyHostNameFunctionToURLString(string, f, &hostNameRanges);
- if (hostNameRanges == nil)
- return string;
-
- // Do the mapping.
- NSMutableString *mutableCopy = [string mutableCopy];
- unsigned i = [hostNameRanges count];
- while (i-- != 0) {
- NSRange hostNameRange = [[hostNameRanges objectAtIndex:i] rangeValue];
- NSString *mappedHostName = encode
- ? [string _web_encodeHostNameWithRange:hostNameRange]
- : [string _web_decodeHostNameWithRange:hostNameRange];
- [mutableCopy replaceCharactersInRange:hostNameRange withString:mappedHostName];
- }
- [hostNameRanges release];
- return [mutableCopy autorelease];
-}
-
+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string relativeToURL:(NSURL *)URL
{
- if (string == nil) {
- return nil;
- }
- string = mapHostNames([string _webkit_stringByTrimmingWhitespace], YES);
-
- NSData *userTypedData = [string dataUsingEncoding:NSUTF8StringEncoding];
- ASSERT(userTypedData);
-
- const UInt8 *inBytes = static_cast<const UInt8 *>([userTypedData bytes]);
- int inLength = [userTypedData length];
- if (inLength == 0) {
- return [NSURL URLWithString:@""];
- }
-
- char *outBytes = static_cast<char *>(malloc(inLength * 3)); // large enough to %-escape every character
- char *p = outBytes;
- int outLength = 0;
- int i;
- for (i = 0; i < inLength; i++) {
- UInt8 c = inBytes[i];
- if (c <= 0x20 || c >= 0x7f) {
- *p++ = '%';
- *p++ = hexDigit(c >> 4);
- *p++ = hexDigit(c & 0xf);
- outLength += 3;
- }
- else {
- *p++ = c;
- outLength++;
- }
- }
-
- NSData *data = [NSData dataWithBytesNoCopy:outBytes length:outLength]; // adopts outBytes
- return [self _web_URLWithData:data relativeToURL:URL];
+ return URLWithUserTypedString(string, URL);
}
+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string
{
- return [self _web_URLWithUserTypedString:string relativeToURL:nil];
+ return URLWithUserTypedString(string, nil);
}
+ (NSURL *)_web_URLWithDataAsString:(NSString *)string
@@ -414,191 +75,45 @@ static NSString *mapHostNames(NSString *string, BOOL encode)
}
string = [string _webkit_stringByTrimmingWhitespace];
NSData *data = [string dataUsingEncoding:NSISOLatin1StringEncoding];
- return [self _web_URLWithData:data relativeToURL:baseURL];
+ return URLWithData(data, baseURL);
}
+ (NSURL *)_web_URLWithData:(NSData *)data
{
- return [NSURL _web_URLWithData:data relativeToURL:nil];
+ return URLWithData(data, nil);
}
+ (NSURL *)_web_URLWithData:(NSData *)data relativeToURL:(NSURL *)baseURL
{
- if (data == nil)
- return nil;
-
- NSURL *result = nil;
- size_t length = [data length];
- if (length > 0) {
- // work around <rdar://4470771>: CFURLCreateAbsoluteURLWithBytes(.., TRUE) doesn't remove non-path components.
- baseURL = [baseURL _webkit_URLByRemovingResourceSpecifier];
-
- const UInt8 *bytes = static_cast<const UInt8*>([data bytes]);
-
- // CFURLCreateAbsoluteURLWithBytes would complain to console if we passed a path to it.
- if (bytes[0] == '/' && !baseURL)
- return nil;
-
- // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components
- // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which
- // could either be a malformed string or bytes in a different encoding, like shift-jis, so we fall back
- // onto using ISO Latin 1 in those cases.
- result = WebCFAutorelease(CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingUTF8, (CFURLRef)baseURL, YES));
- if (!result)
- result = WebCFAutorelease(CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingISOLatin1, (CFURLRef)baseURL, YES));
- } else
- result = [NSURL URLWithString:@""];
-
- return result;
+ return URLWithData(data, baseURL);
}
- (NSData *)_web_originalData
{
- UInt8 *buffer = (UInt8 *)malloc(URL_BYTES_BUFFER_LENGTH);
- CFIndex bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, URL_BYTES_BUFFER_LENGTH);
- if (bytesFilled == -1) {
- CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)self, NULL, 0);
- buffer = (UInt8 *)realloc(buffer, bytesToAllocate);
- bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, bytesToAllocate);
- ASSERT(bytesFilled == bytesToAllocate);
- }
-
- // buffer is adopted by the NSData
- NSData *data = [NSData dataWithBytesNoCopy:buffer length:bytesFilled freeWhenDone:YES];
-
- NSURL *baseURL = (NSURL *)CFURLGetBaseURL((CFURLRef)self);
- if (baseURL)
- return [[NSURL _web_URLWithData:data relativeToURL:baseURL] _web_originalData];
- return data;
+ return originalURLData(self);
}
- (NSString *)_web_originalDataAsString
{
- return [[[NSString alloc] initWithData:[self _web_originalData] encoding:NSISOLatin1StringEncoding] autorelease];
-}
-
-static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
-{
- CFIndex length = CFStringGetLength(string);
- Vector<UChar, 2048> sourceBuffer(length);
- CFStringGetCharacters(string, CFRangeMake(0, length), sourceBuffer.data());
-
- Vector<UChar, 2048> outBuffer;
-
- CFIndex i = 0;
- while (i < length) {
- UChar32 c;
- U16_NEXT(sourceBuffer, i, length, c)
-
- if (isLookalikeCharacter(c)) {
- uint8_t utf8Buffer[4];
- CFIndex offset = 0;
- UBool failure = false;
- U8_APPEND(utf8Buffer, offset, 4, c, failure)
- ASSERT(!failure);
-
- for (CFIndex j = 0; j < offset; ++j) {
- outBuffer.append('%');
- outBuffer.append(hexDigit(utf8Buffer[j] >> 4));
- outBuffer.append(hexDigit(utf8Buffer[j] & 0xf));
- }
- } else {
- UChar utf16Buffer[2];
- CFIndex offset = 0;
- UBool failure = false;
- U16_APPEND(utf16Buffer, offset, 2, c, failure)
- ASSERT(!failure);
- for (CFIndex j = 0; j < offset; ++j)
- outBuffer.append(utf16Buffer[j]);
- }
- }
-
- return CFStringCreateWithCharacters(NULL, outBuffer.data(), outBuffer.size());
+ return [[[NSString alloc] initWithData:originalURLData(self) encoding:NSISOLatin1StringEncoding] autorelease];
}
- (NSString *)_web_userVisibleString
{
- NSData *data = [self _web_originalData];
- const unsigned char *before = static_cast<const unsigned char*>([data bytes]);
- int length = [data length];
-
- bool needsHostNameDecoding = false;
-
- const unsigned char *p = before;
- int bufferLength = (length * 3) + 1;
- char *after = static_cast<char *>(malloc(bufferLength)); // large enough to %-escape every character
- char *q = after;
- int i;
- for (i = 0; i < length; i++) {
- unsigned char c = p[i];
- // unescape escape sequences that indicate bytes greater than 0x7f
- if (c == '%' && (i + 1 < length && isHexDigit(p[i + 1])) && i + 2 < length && isHexDigit(p[i + 2])) {
- unsigned char u = (hexDigitValue(p[i + 1]) << 4) | hexDigitValue(p[i + 2]);
- if (u > 0x7f) {
- // unescape
- *q++ = u;
- } else {
- // do not unescape
- *q++ = p[i];
- *q++ = p[i + 1];
- *q++ = p[i + 2];
- }
- i += 2;
- } else {
- *q++ = c;
-
- // Check for "xn--" in an efficient, non-case-sensitive, way.
- if (c == '-' && i >= 3 && !needsHostNameDecoding && (q[-4] | 0x20) == 'x' && (q[-3] | 0x20) == 'n' && q[-2] == '-')
- needsHostNameDecoding = true;
- }
- }
- *q = '\0';
-
- // Check string to see if it can be converted to display using UTF-8
- NSString *result = [NSString stringWithUTF8String:after];
- if (!result) {
- // Could not convert to UTF-8.
- // Convert characters greater than 0x7f to escape sequences.
- // Shift current string to the end of the buffer
- // then we will copy back bytes to the start of the buffer
- // as we convert.
- int afterlength = q - after;
- char *p = after + bufferLength - afterlength - 1;
- memmove(p, after, afterlength + 1); // copies trailing '\0'
- char *q = after;
- while (*p) {
- unsigned char c = *p;
- if (c > 0x7f) {
- *q++ = '%';
- *q++ = hexDigit(c >> 4);
- *q++ = hexDigit(c & 0xf);
- } else {
- *q++ = *p;
- }
- p++;
- }
- *q = '\0';
- result = [NSString stringWithUTF8String:after];
- }
-
- free(after);
-
- result = mapHostNames(result, !needsHostNameDecoding);
- result = [result precomposedStringWithCanonicalMapping];
- return WebCFAutorelease(createStringWithEscapedUnsafeCharacters((CFStringRef)result));
+ return userVisibleString(self);
}
- (BOOL)_web_isEmpty
{
if (!CFURLGetBaseURL((CFURLRef)self))
return CFURLGetBytes((CFURLRef)self, NULL, 0) == 0;
- return [[self _web_originalData] length] == 0;
+ return [originalURLData(self) length] == 0;
}
- (const char *)_web_URLCString
{
NSMutableData *data = [NSMutableData data];
- [data appendData:[self _web_originalData]];
+ [data appendData:originalURLData(self)];
[data appendBytes:"\0" length:1];
return (const char *)[data bytes];
}
@@ -626,76 +141,22 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
- (NSURL *)_web_URLByTruncatingOneCharacterBeforeComponent:(CFURLComponentType)component
{
- CFRange fragRg = CFURLGetByteRangeForComponent((CFURLRef)self, component, NULL);
- if (fragRg.location == kCFNotFound)
- return self;
-
- UInt8 *urlBytes, buffer[2048];
- CFIndex numBytes = CFURLGetBytes((CFURLRef)self, buffer, 2048);
- if (numBytes == -1) {
- numBytes = CFURLGetBytes((CFURLRef)self, NULL, 0);
- urlBytes = static_cast<UInt8*>(malloc(numBytes));
- CFURLGetBytes((CFURLRef)self, urlBytes, numBytes);
- } else
- urlBytes = buffer;
-
- NSURL *result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, fragRg.location - 1, kCFStringEncodingUTF8, NULL));
- if (!result)
- result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, fragRg.location - 1, kCFStringEncodingISOLatin1, NULL));
-
- if (urlBytes != buffer) free(urlBytes);
- return result ? [result autorelease] : self;
+ return URLByTruncatingOneCharacterBeforeComponent(self, component);
}
- (NSURL *)_webkit_URLByRemovingFragment
{
- return [self _web_URLByTruncatingOneCharacterBeforeComponent:kCFURLComponentFragment];
+ return URLByTruncatingOneCharacterBeforeComponent(self, kCFURLComponentFragment);
}
- (NSURL *)_webkit_URLByRemovingResourceSpecifier
{
- return [self _web_URLByTruncatingOneCharacterBeforeComponent:kCFURLComponentResourceSpecifier];
-}
-
-- (NSURL *)_web_URLByRemovingComponentAndSubsequentCharacter:(CFURLComponentType)component
-{
- CFRange range = CFURLGetByteRangeForComponent((CFURLRef)self, component, 0);
- if (range.location == kCFNotFound)
- return self;
-
- // Remove one subsequent character.
- ++range.length;
-
- UInt8* urlBytes;
- UInt8 buffer[2048];
- CFIndex numBytes = CFURLGetBytes((CFURLRef)self, buffer, 2048);
- if (numBytes == -1) {
- numBytes = CFURLGetBytes((CFURLRef)self, NULL, 0);
- urlBytes = static_cast<UInt8*>(malloc(numBytes));
- CFURLGetBytes((CFURLRef)self, urlBytes, numBytes);
- } else
- urlBytes = buffer;
-
- if (numBytes < range.location)
- return self;
- if (numBytes < range.location + range.length)
- range.length = numBytes - range.location;
-
- memmove(urlBytes + range.location, urlBytes + range.location + range.length, numBytes - range.location + range.length);
-
- NSURL *result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingUTF8, NULL));
- if (!result)
- result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingISOLatin1, NULL));
-
- if (urlBytes != buffer)
- free(urlBytes);
-
- return result ? [result autorelease] : self;
+ return URLByTruncatingOneCharacterBeforeComponent(self, kCFURLComponentResourceSpecifier);
}
- (NSURL *)_web_URLByRemovingUserInfo
{
- return [self _web_URLByRemovingComponentAndSubsequentCharacter:kCFURLComponentUserInfo];
+ return URLByRemovingUserInfo(self);
}
- (BOOL)_webkit_isJavaScriptURL
@@ -764,16 +225,6 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
}
--(BOOL)_web_hasQuestionMarkOnlyQueryString
-{
- CFRange rangeWithSeparators;
- CFURLGetByteRangeForComponent((CFURLRef)self, kCFURLComponentQuery, &rangeWithSeparators);
- if (rangeWithSeparators.location != kCFNotFound && rangeWithSeparators.length == 1) {
- return YES;
- }
- return NO;
-}
-
-(NSData *)_web_schemeSeparatorWithoutColon
{
NSData *result = nil;
@@ -790,77 +241,19 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
return result;
}
-#define completeURL (CFURLComponentType)-1
-
-(NSData *)_web_dataForURLComponentType:(CFURLComponentType)componentType
{
- static int URLComponentTypeBufferLength = 2048;
-
- UInt8 staticAllBytesBuffer[URLComponentTypeBufferLength];
- UInt8 *allBytesBuffer = staticAllBytesBuffer;
-
- CFIndex bytesFilled = CFURLGetBytes((CFURLRef)self, allBytesBuffer, URLComponentTypeBufferLength);
- if (bytesFilled == -1) {
- CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)self, NULL, 0);
- allBytesBuffer = static_cast<UInt8 *>(malloc(bytesToAllocate));
- bytesFilled = CFURLGetBytes((CFURLRef)self, allBytesBuffer, bytesToAllocate);
- }
-
- CFRange range;
- if (componentType != completeURL) {
- range = CFURLGetByteRangeForComponent((CFURLRef)self, componentType, NULL);
- if (range.location == kCFNotFound) {
- return nil;
- }
- }
- else {
- range.location = 0;
- range.length = bytesFilled;
- }
-
- NSData *componentData = [NSData dataWithBytes:allBytesBuffer + range.location length:range.length];
-
- const unsigned char *bytes = static_cast<const unsigned char *>([componentData bytes]);
- NSMutableData *resultData = [NSMutableData data];
- // NOTE: add leading '?' to query strings non-zero length query strings.
- // NOTE: retain question-mark only query strings.
- if (componentType == kCFURLComponentQuery) {
- if (range.length > 0 || [self _web_hasQuestionMarkOnlyQueryString]) {
- [resultData appendBytes:"?" length:1];
- }
- }
- int i;
- for (i = 0; i < range.length; i++) {
- unsigned char c = bytes[i];
- if (c <= 0x20 || c >= 0x7f) {
- char escaped[3];
- escaped[0] = '%';
- escaped[1] = hexDigit(c >> 4);
- escaped[2] = hexDigit(c & 0xf);
- [resultData appendBytes:escaped length:3];
- }
- else {
- char b[1];
- b[0] = c;
- [resultData appendBytes:b length:1];
- }
- }
-
- if (staticAllBytesBuffer != allBytesBuffer) {
- free(allBytesBuffer);
- }
-
- return resultData;
+ return dataForURLComponentType(self, componentType);
}
-(NSData *)_web_schemeData
{
- return [self _web_dataForURLComponentType:kCFURLComponentScheme];
+ return dataForURLComponentType(self, kCFURLComponentScheme);
}
-(NSData *)_web_hostData
{
- NSData *result = [self _web_dataForURLComponentType:kCFURLComponentHost];
+ NSData *result = dataForURLComponentType(self, kCFURLComponentHost);
NSData *scheme = [self _web_schemeData];
// Take off localhost for file
if ([scheme _web_isCaseInsensitiveEqualToCString:"file"]) {
@@ -897,49 +290,9 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
- (BOOL)_web_isUserVisibleURL
{
- BOOL valid = YES;
- // get buffer
-
- char static_buffer[1024];
- const char *p;
- BOOL success = CFStringGetCString((CFStringRef)self, static_buffer, 1023, kCFStringEncodingUTF8);
- if (success) {
- p = static_buffer;
- } else {
- p = [self UTF8String];
- }
-
- int length = strlen(p);
-
- // check for characters <= 0x20 or >=0x7f, %-escape sequences of %7f, and xn--, these
- // are the things that will lead _web_userVisibleString to actually change things.
- int i;
- for (i = 0; i < length; i++) {
- unsigned char c = p[i];
- // escape control characters, space, and delete
- if (c <= 0x20 || c == 0x7f) {
- valid = NO;
- break;
- } else if (c == '%' && (i + 1 < length && isHexDigit(p[i + 1])) && i + 2 < length && isHexDigit(p[i + 2])) {
- unsigned char u = (hexDigitValue(p[i + 1]) << 4) | hexDigitValue(p[i + 2]);
- if (u > 0x7f) {
- valid = NO;
- break;
- }
- i += 2;
- } else {
- // Check for "xn--" in an efficient, non-case-sensitive, way.
- if (c == '-' && i >= 3 && (p[i - 3] | 0x20) == 'x' && (p[i - 2] | 0x20) == 'n' && p[i - 1] == '-') {
- valid = NO;
- break;
- }
- }
- }
-
- return valid;
+ return isUserVisibleURL(self);
}
-
- (BOOL)_webkit_isJavaScriptURL
{
return [self _webkit_hasCaseInsensitivePrefix:@"javascript:"];
@@ -973,204 +326,34 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
return lastChar == '/' && [self _webkit_hasCaseInsensitivePrefix:@"ftp:"];
}
-
-static BOOL readIDNScriptWhiteListFile(NSString *filename)
-{
- if (!filename) {
- return NO;
- }
- FILE *file = fopen([filename fileSystemRepresentation], "r");
- if (file == NULL) {
- return NO;
- }
-
- // Read a word at a time.
- // Allow comments, starting with # character to the end of the line.
- while (1) {
- // Skip a comment if present.
- int result = fscanf(file, " #%*[^\n\r]%*[\n\r]");
- if (result == EOF) {
- break;
- }
-
- // Read a script name if present.
- char word[33];
- result = fscanf(file, " %32[^# \t\n\r]%*[^# \t\n\r] ", word);
- if (result == EOF) {
- break;
- }
- if (result == 1) {
- // Got a word, map to script code and put it into the array.
- int32_t script = u_getPropertyValueEnum(UCHAR_SCRIPT, word);
- if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
- size_t index = script / 32;
- uint32_t mask = 1 << (script % 32);
- IDNScriptWhiteList[index] |= mask;
- }
- }
- }
- fclose(file);
- return YES;
-}
-
-static void readIDNScriptWhiteList(void)
-{
- // Read white list from library.
- NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES);
- int i, numDirs = [dirs count];
- for (i = 0; i < numDirs; i++) {
- NSString *dir = [dirs objectAtIndex:i];
- if (readIDNScriptWhiteListFile([dir stringByAppendingPathComponent:@"IDNScriptWhiteList.txt"])) {
- return;
- }
- }
-
- // Fall back on white list inside bundle.
- NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"];
- readIDNScriptWhiteListFile([bundle pathForResource:@"IDNScriptWhiteList" ofType:@"txt"]);
-}
-
-static BOOL allCharactersInIDNScriptWhiteList(const UChar *buffer, int32_t length)
-{
- pthread_once(&IDNScriptWhiteListFileRead, readIDNScriptWhiteList);
-
- int32_t i = 0;
- while (i < length) {
- UChar32 c;
- U16_NEXT(buffer, i, length, c)
- UErrorCode error = U_ZERO_ERROR;
- UScriptCode script = uscript_getScript(c, &error);
- if (error != U_ZERO_ERROR) {
- LOG_ERROR("got ICU error while trying to look at scripts: %d", error);
- return NO;
- }
- if (script < 0) {
- LOG_ERROR("got negative number for script code from ICU: %d", script);
- return NO;
- }
- if (script >= USCRIPT_CODE_LIMIT) {
- return NO;
- }
- size_t index = script / 32;
- uint32_t mask = 1 << (script % 32);
- if (!(IDNScriptWhiteList[index] & mask)) {
- return NO;
- }
-
- if (isLookalikeCharacter(c))
- return NO;
- }
- return YES;
-}
-
-static BOOL allCharactersAllowedByTLDRules(const UChar* buffer, int32_t length)
-{
- // Skip trailing dot for root domain.
- if (buffer[length - 1] == '.')
- --length;
-
- if (length > 3
- && buffer[length - 3] == '.'
- && buffer[length - 2] == 0x0440 // CYRILLIC SMALL LETTER ER
- && buffer[length - 1] == 0x0444) // CYRILLIC SMALL LETTER EF
- {
- // Rules defined by <http://www.cctld.ru/ru/docs/rulesrf.php>. This code only checks requirements that matter for presentation purposes.
- for (int32_t i = length - 4; i; --i) {
- UChar ch = buffer[i];
-
- // Only modern Russian letters, digits and dashes are allowed.
- if ((ch >= 0x0430 && ch <= 0x044f)
- || ch == 0x0451
- || (ch >= '0' && ch <= '9')
- || ch == '-')
- continue;
-
- // Only check top level domain. Lower level registrars may have different rules.
- if (ch == '.')
- break;
-
- return NO;
- }
- return YES;
- }
-
- // Not a known top level domain with special rules.
- return NO;
-}
-
-// Return value of nil means no mapping is necessary.
-// If makeString is NO, then return value is either nil or self to indicate mapping is necessary.
-// If makeString is YES, then return value is either nil or the mapped string.
-- (NSString *)_web_mapHostNameWithRange:(NSRange)range encode:(BOOL)encode makeString:(BOOL)makeString
-{
- if (range.length > HOST_NAME_BUFFER_LENGTH) {
- return nil;
- }
-
- if ([self length] == 0)
- return nil;
-
- UChar sourceBuffer[HOST_NAME_BUFFER_LENGTH];
- UChar destinationBuffer[HOST_NAME_BUFFER_LENGTH];
-
- NSString *string = self;
- if (encode && [self rangeOfString:@"%" options:NSLiteralSearch range:range].location != NSNotFound) {
- NSString *substring = [self substringWithRange:range];
- substring = WebCFAutorelease(CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)substring, CFSTR("")));
- if (substring != nil) {
- string = substring;
- range = NSMakeRange(0, [string length]);
- }
- }
-
- int length = range.length;
- [string getCharacters:sourceBuffer range:range];
-
- UErrorCode error = U_ZERO_ERROR;
- int32_t numCharactersConverted = (encode ? uidna_IDNToASCII : uidna_IDNToUnicode)
- (sourceBuffer, length, destinationBuffer, HOST_NAME_BUFFER_LENGTH, UIDNA_ALLOW_UNASSIGNED, NULL, &error);
- if (error != U_ZERO_ERROR) {
- return nil;
- }
- if (numCharactersConverted == length && memcmp(sourceBuffer, destinationBuffer, length * sizeof(UChar)) == 0) {
- return nil;
- }
- if (!encode && !allCharactersInIDNScriptWhiteList(destinationBuffer, numCharactersConverted) && !allCharactersAllowedByTLDRules(destinationBuffer, numCharactersConverted)) {
- return nil;
- }
- return makeString ? (NSString *)[NSString stringWithCharacters:destinationBuffer length:numCharactersConverted] : (NSString *)self;
-}
-
- (BOOL)_web_hostNameNeedsDecodingWithRange:(NSRange)range
{
- return [self _web_mapHostNameWithRange:range encode:NO makeString:NO] != nil;
+ return hostNameNeedsDecodingWithRange(self, range);
}
- (BOOL)_web_hostNameNeedsEncodingWithRange:(NSRange)range
{
- return [self _web_mapHostNameWithRange:range encode:YES makeString:NO] != nil;
+ return hostNameNeedsEncodingWithRange(self, range);
}
- (NSString *)_web_decodeHostNameWithRange:(NSRange)range
{
- return [self _web_mapHostNameWithRange:range encode:NO makeString:YES];
+ return decodeHostNameWithRange(self, range);
}
- (NSString *)_web_encodeHostNameWithRange:(NSRange)range
{
- return [self _web_mapHostNameWithRange:range encode:YES makeString:YES];
+ return encodeHostNameWithRange(self, range);
}
- (NSString *)_web_decodeHostName
{
- NSString *name = [self _web_mapHostNameWithRange:NSMakeRange(0, [self length]) encode:NO makeString:YES];
- return name == nil ? self : name;
+ return decodeHostName(self);
}
- (NSString *)_web_encodeHostName
{
- NSString *name = [self _web_mapHostNameWithRange:NSMakeRange(0, [self length]) encode:YES makeString:YES];
- return name == nil ? self : name;
+ return encodeHostName(self);
}
-(NSRange)_webkit_rangeOfURLScheme
diff --git a/Source/WebKit/mac/Panels/WebAuthenticationPanel.m b/Source/WebKit/mac/Panels/WebAuthenticationPanel.m
index e2f483e0f..f843f3208 100644
--- a/Source/WebKit/mac/Panels/WebAuthenticationPanel.m
+++ b/Source/WebKit/mac/Panels/WebAuthenticationPanel.m
@@ -125,7 +125,7 @@
if ([space port] == 0) {
host = [[space host] _web_decodeHostName];
} else {
- host = [NSString stringWithFormat:@"%@:%u", [[space host] _web_decodeHostName], [space port]];
+ host = [NSString stringWithFormat:@"%@:%ld", [[space host] _web_decodeHostName], (long)[space port]];
}
NSString *realm = [space realm];
diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 7248f464b..609ccf0cc 100644
--- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -1085,7 +1085,7 @@ bool NetscapePluginInstanceProxy::setProperty(uint32_t objectID, unsigned proper
JSLock lock(SilenceAssertionsOnly);
JSValue value = demarshalValue(exec, valueData, valueLength);
- object->methodTable()->putByIndex(object, exec, propertyName, value);
+ object->methodTable()->putByIndex(object, exec, propertyName, value, false);
exec->clearException();
return true;
diff --git a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 57df2fe02..5f1f55694 100644
--- a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -1998,7 +1998,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (NPError)getVariable:(NPNVariable)variable value:(void *)value
{
- switch (variable) {
+ switch (static_cast<unsigned>(variable)) {
case NPNVWindowNPObject:
{
Frame* frame = core([self webFrame]);
diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 66fa060b5..46d1201d5 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -184,10 +184,6 @@ public:
virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
-#if ENABLE(CONTEXT_MENUS)
- virtual void showContextMenu() OVERRIDE;
-#endif
-
virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const OVERRIDE { return false; }
diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 3bac87b9c..fc3a1f2b4 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -857,35 +857,6 @@ PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebC
return adoptRef(new SearchPopupMenuMac(client));
}
-#if ENABLE(CONTEXT_MENUS)
-void WebChromeClient::showContextMenu()
-{
- Page* page = [m_webView page];
- if (!page)
- return;
-
- ContextMenuController* controller = page->contextMenuController();
- Node* node = controller->hitTestResult().innerNonSharedNode();
- if (!node)
- return;
- Frame* frame = node->document()->frame();
- if (!frame)
- return;
- FrameView* frameView = frame->view();
- if (!frameView)
- return;
- NSView* view = frameView->documentView();
-
- IntPoint point = frameView->contentsToWindow(controller->hitTestResult().point());
- NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
- // Show the contextual menu for this event.
- NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
- NSMenu* nsMenu = [view menuForEvent:event];
- if (nsMenu)
- [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
-}
-#endif
-
#if USE(ACCELERATED_COMPOSITING)
void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
@@ -983,8 +954,6 @@ void WebChromeClient::fullScreenRendererChanged(RenderBox* renderer)
SEL selector = @selector(webView:fullScreenRendererChanged:);
if ([[m_webView UIDelegate] respondsToSelector:selector])
CallUIDelegate(m_webView, selector, (id)renderer);
- else
- [m_webView _fullScreenRendererChanged:renderer];
}
@implementation WebKitFullScreenListener
diff --git a/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h b/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h
index 21b0d0f25..e536f3c24 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h
@@ -46,6 +46,7 @@ public:
virtual void speak(const WTF::String&) OVERRIDE;
virtual void stopSpeaking() OVERRIDE;
virtual void searchWithSpotlight() OVERRIDE;
+ virtual void showContextMenu() OVERRIDE;
WebView *webView() { return m_webView; }
diff --git a/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm b/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
index 08c0d6087..e31313603 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
@@ -42,9 +42,12 @@
#import "WebViewInternal.h"
#import <WebCore/ContextMenu.h>
#import <WebCore/ContextMenuController.h>
+#import <WebCore/Document.h>
#import <WebCore/KURL.h>
#import <WebCore/LocalizedStrings.h>
#import <WebCore/Page.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
#import <WebCore/RuntimeApplicationChecks.h>
#import <WebKit/DOMPrivate.h>
@@ -346,3 +349,29 @@ void WebContextMenuClient::stopSpeaking()
{
[NSApp stopSpeaking:nil];
}
+
+void WebContextMenuClient::showContextMenu()
+{
+ Page* page = [m_webView page];
+ if (!page)
+ return;
+ ContextMenuController* controller = page->contextMenuController();
+ Node* node = controller->hitTestResult().innerNonSharedNode();
+ if (!node)
+ return;
+ Frame* frame = node->document()->frame();
+ if (!frame)
+ return;
+ FrameView* frameView = frame->view();
+ if (!frameView)
+ return;
+
+ IntPoint point = frameView->contentsToWindow(controller->hitTestResult().roundedPoint());
+ NSView* view = frameView->documentView();
+ NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
+ // Show the contextual menu for this event.
+ NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
+ NSMenu* nsMenu = [view menuForEvent:event];
+ if (nsMenu)
+ [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
+}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
index c75fee09f..06fca8d0e 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -72,7 +72,7 @@ public:
virtual NSString* userVisibleString(NSURL *) OVERRIDE;
virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector< RefPtr<WebCore::ArchiveResource> >&) OVERRIDE;
- virtual void setInsertionPasteboard(NSPasteboard *) OVERRIDE;
+ virtual void setInsertionPasteboard(const String&) OVERRIDE;
virtual NSURL* canonicalizeURL(NSURL*) OVERRIDE;
virtual NSURL* canonicalizeURLString(NSString*) OVERRIDE;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index 478553034..4ffef315d 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -373,9 +373,9 @@ DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttrib
return core(fragment);
}
-void WebEditorClient::setInsertionPasteboard(NSPasteboard *pasteboard)
+void WebEditorClient::setInsertionPasteboard(const String& pasteboardName)
{
- [m_webView _setInsertionPasteboard:pasteboard];
+ [m_webView _setInsertionPasteboard:[NSPasteboard pasteboardWithName:pasteboardName]];
}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 819dd16ce..8ff420c6a 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1714,7 +1714,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
if (implementations->plugInFailedWithErrorFunc) {
KURL pluginPageURL = document->completeURL(stripLeadingAndTrailingHTMLSpaces(parameterValue(paramNames, paramValues, "pluginspage")));
- if (!pluginPageURL.protocolInHTTPFamily())
+ if (!pluginPageURL.protocolIsInHTTPFamily())
pluginPageURL = KURL();
NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
index 2239d5e7f..b145dc4e4 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
@@ -47,6 +47,7 @@ class WebView;
namespace WebCore {
+class Frame;
class Page;
}
@@ -62,6 +63,7 @@ public:
virtual void openInspectorFrontend(WebCore::InspectorController*) OVERRIDE;
virtual void closeInspectorFrontend() OVERRIDE;
virtual void bringFrontendToFront() OVERRIDE;
+ virtual void didResizeMainFrame(WebCore::Frame*) OVERRIDE;
virtual void highlight() OVERRIDE;
virtual void hideHighlight() OVERRIDE;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index 2ae865951..b288f9f97 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -41,10 +41,13 @@
#import "WebViewInternal.h"
#import <WebCore/InspectorController.h>
#import <WebCore/Page.h>
+#import <WebCore/SoftLinking.h>
#import <WebKit/DOMExtensions.h>
#import <WebKitSystemInterface.h>
#import <wtf/PassOwnPtr.h>
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(WebInspector)
+
using namespace WebCore;
@interface WebInspectorWindowController : NSWindowController <NSWindowDelegate> {
@@ -111,6 +114,12 @@ void WebInspectorClient::bringFrontendToFront()
m_frontendClient->bringToFront();
}
+void WebInspectorClient::didResizeMainFrame(Frame*)
+{
+ if (m_frontendClient)
+ m_frontendClient->setDockingUnavailable(!m_frontendClient->canAttachWindow());
+}
+
void WebInspectorClient::highlight()
{
[m_highlighter.get() highlight];
@@ -154,10 +163,20 @@ void WebInspectorFrontendClient::frontendLoaded()
setAttachedWindow(attached);
}
+static bool useWebKitWebInspector()
+{
+ // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
+ WebInspectorLibrary();
+
+ return [[NSUserDefaults standardUserDefaults] boolForKey:@"UseWebKitWebInspector"] ||
+ ![[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"];
+}
+
String WebInspectorFrontendClient::localizedStringsURL()
{
- NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"localizedStrings" ofType:@"js"];
- if (path)
+ NSBundle *bundle = useWebKitWebInspector() ? [NSBundle bundleWithIdentifier:@"com.apple.WebCore"] : [NSBundle bundleWithIdentifier:@"com.apple.WebInspector"];
+ NSString *path = [bundle pathForResource:@"localizedStrings" ofType:@"js"];
+ if ([path length])
return [[NSURL fileURLWithPath:path] absoluteString];
return String();
}
@@ -252,7 +271,14 @@ void WebInspectorFrontendClient::updateWindowTitle() const
[preferences release];
- NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
+ NSString *path;
+ if (useWebKitWebInspector())
+ path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
+ else
+ path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"];
+
+ ASSERT([path length]);
+
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath:path]];
[[_webView mainFrame] loadRequest:request];
[request release];
@@ -289,18 +315,22 @@ void WebInspectorFrontendClient::updateWindowTitle() const
if (window)
return window;
+ bool useTexturedWindow = useWebKitWebInspector();
+
NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask);
- styleMask |= NSTexturedBackgroundWindowMask;
+ if (useTexturedWindow)
+ styleMask |= NSTexturedBackgroundWindowMask;
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(60.0, 200.0, 750.0, 650.0) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO];
[window setDelegate:self];
[window setMinSize:NSMakeSize(400.0, 400.0)];
- [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
- [window setContentBorderThickness:55. forEdge:NSMaxYEdge];
-
- WKNSWindowMakeBottomCornersSquare(window);
+ if (useTexturedWindow) {
+ [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
+ [window setContentBorderThickness:55. forEdge:NSMaxYEdge];
+ WKNSWindowMakeBottomCornersSquare(window);
+ }
[self setWindow:window];
[window release];
diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
index a40ce81e5..d68d92275 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebCore/NotificationPresenter.h>
+#import <WebCore/NotificationClient.h>
#if ENABLE(NOTIFICATIONS)
#import <WebCore/Notification.h>
@@ -41,7 +41,7 @@ class VoidCallback;
@class WebNotification;
@class WebView;
-class WebNotificationClient : public WebCore::NotificationPresenter {
+class WebNotificationClient : public WebCore::NotificationClient {
public:
WebNotificationClient(WebView *);
WebView *webView() { return m_webView; }
@@ -54,7 +54,7 @@ private:
virtual void notificationControllerDestroyed() OVERRIDE;
virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) OVERRIDE;
virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) OVERRIDE { }
- virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::ScriptExecutionContext*) OVERRIDE;
+ virtual WebCore::NotificationClient::Permission checkPermission(WebCore::ScriptExecutionContext*) OVERRIDE;
WebView *m_webView;
#if ENABLE(NOTIFICATIONS)
diff --git a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
index 2f7cd5411..3fdf0bc7f 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
@@ -171,29 +171,29 @@ void WebNotificationClient::requestPermission(ScriptExecutionContext* context, P
#endif
}
-NotificationPresenter::Permission WebNotificationClient::checkPermission(ScriptExecutionContext* context)
+NotificationClient::Permission WebNotificationClient::checkPermission(ScriptExecutionContext* context)
{
#if ENABLE(NOTIFICATIONS)
if (!context || !context->isDocument())
- return NotificationPresenter::PermissionDenied;
+ return NotificationClient::PermissionDenied;
if (![[m_webView preferences] notificationsEnabled])
- return NotificationPresenter::PermissionDenied;
+ return NotificationClient::PermissionDenied;
WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:context->securityOrigin()];
WebNotificationPermission permission = [[m_webView _notificationProvider] policyForOrigin:webOrigin];
[webOrigin release];
switch (permission) {
case WebNotificationPermissionAllowed:
- return NotificationPresenter::PermissionAllowed;
+ return NotificationClient::PermissionAllowed;
case WebNotificationPermissionDenied:
- return NotificationPresenter::PermissionDenied;
+ return NotificationClient::PermissionDenied;
case WebNotificationPermissionNotAllowed:
- return NotificationPresenter::PermissionNotAllowed;
+ return NotificationClient::PermissionNotAllowed;
default:
- return NotificationPresenter::PermissionNotAllowed;
+ return NotificationClient::PermissionNotAllowed;
}
#else
UNUSED_PARAM(context);
- return NotificationPresenter::PermissionDenied;
+ return NotificationClient::PermissionDenied;
#endif
}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index 2a76c98a9..86a44d675 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -43,6 +43,9 @@ void InitWebCoreSystemInterface(void)
return;
INIT(AdvanceDefaultButtonPulseAnimation);
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
+#endif
INIT(CGContextGetShouldSmoothFonts);
INIT(CGPatternCreateWithImageAndTransform);
INIT(CGContextResetClip);
@@ -166,6 +169,8 @@ void InitWebCoreSystemInterface(void)
INIT(CopyCFURLResponseSuggestedFilename);
INIT(SetCFURLResponseMIMEType);
+ INIT(SetMetadataURL);
+
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
INIT(CreateVMPressureDispatchOnMainQueue);
#endif
diff --git a/Source/WebKit/mac/WebView/WebArchiveInternal.h b/Source/WebKit/mac/WebView/WebArchiveInternal.h
index 071d4ab70..4ff5096a6 100644
--- a/Source/WebKit/mac/WebView/WebArchiveInternal.h
+++ b/Source/WebKit/mac/WebView/WebArchiveInternal.h
@@ -27,7 +27,7 @@
*/
#import "WebArchive.h"
-#import <JavaScriptCore/Forward.h>
+#import <wtf/Forward.h>
namespace WebCore {
class LegacyWebArchive;
diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm
index 24bb8f39c..e085bc17f 100644
--- a/Source/WebKit/mac/WebView/WebFrame.mm
+++ b/Source/WebKit/mac/WebView/WebFrame.mm
@@ -60,6 +60,7 @@
#import <WebCore/Chrome.h>
#import <WebCore/ColorMac.h>
#import <WebCore/DOMImplementation.h>
+#import <WebCore/DatabaseContext.h>
#import <WebCore/DocumentFragment.h>
#import <WebCore/DocumentLoader.h>
#import <WebCore/DocumentMarkerController.h>
@@ -797,7 +798,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
- (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction
{
- if (!_private->coreFrame)
+ if (!_private->coreFrame || !style)
return;
// FIXME: We shouldn't have to create a copy here.
_private->coreFrame->editor()->computeAndSetTypingStyle(core(style)->copy().get(), undoAction);
@@ -1120,13 +1121,9 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
if (Document* document = _private->coreFrame->document()) {
#if ENABLE(SQL_DATABASE)
- if (document->hasOpenDatabases())
+ if (DatabaseContext::hasOpenDatabases(document))
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesDatabases];
#endif
-
- if (document->usingGeolocation())
- [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesGeolocation];
-
if (!document->canSuspendActiveDOMObjects())
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameCanSuspendActiveDOMObjects];
}
diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.h b/Source/WebKit/mac/WebView/WebFullScreenController.h
index 0cb25d974..ea03af4ba 100644
--- a/Source/WebKit/mac/WebView/WebFullScreenController.h
+++ b/Source/WebKit/mac/WebView/WebFullScreenController.h
@@ -27,8 +27,10 @@
#import <wtf/OwnPtr.h>
#import <wtf/RefPtr.h>
+#import <wtf/RetainPtr.h>
@class WebWindowFadeAnimation;
+@class WebWindowScaleAnimation;
@class WebView;
namespace WebCore {
class DisplaySleepDisabler;
@@ -40,16 +42,18 @@ namespace WebCore {
@interface WebFullScreenController : NSWindowController {
@private
RefPtr<WebCore::Element> _element;
- WebCore::RenderBox* _renderer; // (set)
WebView *_webView;
- NSView* _placeholderView;
- RefPtr<WebCore::EventListener> _mediaEventListener;
+ RetainPtr<NSView> _webViewPlaceholder;
+ RetainPtr<WebWindowScaleAnimation> _scaleAnimation;
+ RetainPtr<WebWindowFadeAnimation> _fadeAnimation;
+ RetainPtr<NSWindow> _backgroundWindow;
+ NSRect _initialFrame;
+ NSRect _finalFrame;
- BOOL _isAnimating;
- BOOL _isFullscreen;
- BOOL _forceDisableAnimation;
- OwnPtr<WebCore::DisplaySleepDisabler> _displaySleepDisabler;
- CGRect _initialFrame;
+ BOOL _isEnteringFullScreen;
+ BOOL _isExitingFullScreen;
+ BOOL _isFullScreen;
+ BOOL _isPlaying;
}
- (WebView*)webView;
@@ -58,12 +62,9 @@ namespace WebCore {
- (void)setElement:(PassRefPtr<WebCore::Element>)element;
- (WebCore::Element*)element;
-- (void)setRenderer:(WebCore::RenderBox*)renderer;
-- (WebCore::RenderBox*)renderer;
-
-- (void)enterFullscreen:(NSScreen *)screen;
-- (void)exitFullscreen;
-
+- (void)enterFullScreen:(NSScreen *)screen;
+- (void)exitFullScreen;
+- (void)close;
@end
#endif // ENABLE(FULLSCREEN_API)
diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.mm b/Source/WebKit/mac/WebView/WebFullScreenController.mm
index aae92e841..eda499cd9 100644
--- a/Source/WebKit/mac/WebView/WebFullScreenController.mm
+++ b/Source/WebKit/mac/WebView/WebFullScreenController.mm
@@ -30,72 +30,61 @@
#import "WebNSWindowExtras.h"
#import "WebPreferencesPrivate.h"
#import "WebViewInternal.h"
-#import <IOKit/pwr_mgt/IOPMLib.h>
-#import <OSServices/Power.h>
-#import <WebCore/AnimationList.h>
-#import <WebCore/CSSPropertyNames.h>
-#import <WebCore/Color.h>
-#import <WebCore/DOMDocument.h>
-#import <WebCore/DOMDocumentInternal.h>
-#import <WebCore/DOMHTMLElement.h>
-#import <WebCore/DOMWindow.h>
-#import <WebCore/DisplaySleepDisabler.h>
#import <WebCore/Document.h>
-#import <WebCore/EventListener.h>
-#import <WebCore/EventNames.h>
+#import <WebCore/Element.h>
+#import <WebCore/FloatRect.h>
#import <WebCore/HTMLElement.h>
-#import <WebCore/HTMLMediaElement.h>
-#import <WebCore/HTMLNames.h>
#import <WebCore/IntRect.h>
-#import <WebCore/NodeList.h>
-#import <WebCore/RenderBlock.h>
+#import <WebCore/Page.h>
#import <WebCore/RenderLayer.h>
#import <WebCore/RenderLayerBacking.h>
+#import <WebCore/RenderObject.h>
+#import <WebCore/RenderView.h>
#import <WebCore/SoftLinking.h>
-#import <objc/objc-runtime.h>
+#import <WebCore/WebCoreFullScreenWindow.h>
+#import <WebCore/WebWindowAnimation.h>
+#import <WebKitSystemInterface.h>
#import <wtf/RetainPtr.h>
#import <wtf/UnusedParam.h>
-static NSString* const isEnteringFullscreenKey = @"isEnteringFullscreen";
-
using namespace WebCore;
-@interface WebFullscreenWindow : NSWindow
-#ifndef BUILDING_ON_LEOPARD
-<NSAnimationDelegate>
-#endif
+static const CFTimeInterval defaultAnimationDuration = 0.5;
+
+static IntRect screenRectOfContents(Element* element)
{
- NSView* _animationView;
-
- CALayer* _rendererLayer;
- CALayer* _backgroundLayer;
+ ASSERT(element);
+ if (element->renderer() && element->renderer()->hasLayer() && element->renderer()->enclosingLayer()->isComposited()) {
+ FloatQuad contentsBox = static_cast<FloatRect>(element->renderer()->enclosingLayer()->backing()->contentsBox());
+ contentsBox = element->renderer()->localToAbsoluteQuad(contentsBox);
+ return element->renderer()->view()->frameView()->contentsToScreen(contentsBox.enclosingBoundingBox());
+ }
+ return element->screenRect();
}
-- (CALayer*)rendererLayer;
-- (void)setRendererLayer:(CALayer*)rendererLayer;
-- (CALayer*)backgroundLayer;
-- (NSView*)animationView;
-@end
-class MediaEventListener : public EventListener {
-public:
- static PassRefPtr<MediaEventListener> create(WebFullScreenController* delegate);
- virtual bool operator==(const EventListener&);
- virtual void handleEvent(ScriptExecutionContext*, Event*);
-
-private:
- MediaEventListener(WebFullScreenController* delegate);
- WebFullScreenController* delegate;
-};
-
-@interface WebFullScreenController(Private)
-- (void)_requestExitFullscreenWithAnimation:(BOOL)animation;
-- (void)_updateMenuAndDockForFullscreen;
-- (void)_updatePowerAssertions;
-- (WebFullscreenWindow *)_fullscreenWindow;
+@interface WebFullScreenController(Private)<NSAnimationDelegate>
+- (void)_updateMenuAndDockForFullScreen;
+- (void)_swapView:(NSView*)view with:(NSView*)otherView;
- (Document*)_document;
-- (CFTimeInterval)_animationDuration;
-- (BOOL)_isAnyMoviePlaying;
+- (void)_startEnterFullScreenAnimationWithDuration:(NSTimeInterval)duration;
+- (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration;
+@end
+
+#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
+- (NSRect)convertRectToScreen:(NSRect)aRect;
+@end
+
+@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard)
+- (NSRect)convertRectToScreen:(NSRect)rect
+{
+ NSRect frame = [self frame];
+ rect.origin.x += frame.origin.x;
+ rect.origin.y += frame.origin.y;
+ return rect;
+}
@end
+#endif
@interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard)
- (BOOL)isOnActiveSpace;
@@ -108,21 +97,21 @@ private:
- (id)init
{
// Do not defer window creation, to make sure -windowNumber is created (needed by WebWindowScaleAnimation).
- NSWindow *window = [[WebFullscreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ NSWindow *window = [[WebCoreFullScreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
self = [super initWithWindow:window];
[window release];
if (!self)
return nil;
[self windowDidLoad];
- _mediaEventListener = MediaEventListener::create(self);
+
return self;
-
}
- (void)dealloc
{
[self setWebView:nil];
- [_placeholderView release];
+
+ [NSObject cancelPreviousPerformRequestsWithTarget:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
@@ -130,7 +119,8 @@ private:
- (void)windowDidLoad
{
-
+ [super windowDidLoad];
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:NSApp];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangeScreenParameters:) name:NSApplicationDidChangeScreenParametersNotification object:NSApp];
}
@@ -157,157 +147,25 @@ private:
- (void)setElement:(PassRefPtr<Element>)element
{
- // When a new Element is set as the current full screen element, register event
- // listeners on that Element's window, listening for changes in media play states.
- // We will use these events to determine whether to disable the screensaver and
- // display sleep timers when playing video in full screen. Make sure to unregister
- // the events on the old element's window, if necessary, as well.
-
- EventNames& eventNames = WebCore::eventNames();
-
- if (_element) {
- DOMWindow* window = _element->document()->domWindow();
- if (window) {
- window->removeEventListener(eventNames.playEvent, _mediaEventListener.get(), true);
- window->removeEventListener(eventNames.pauseEvent, _mediaEventListener.get(), true);
- window->removeEventListener(eventNames.endedEvent, _mediaEventListener.get(), true);
- }
- }
-
_element = element;
-
- if (_element) {
- DOMWindow* window = _element->document()->domWindow();
- if (window) {
- window->addEventListener(eventNames.playEvent, _mediaEventListener, true);
- window->addEventListener(eventNames.pauseEvent, _mediaEventListener, true);
- window->addEventListener(eventNames.endedEvent, _mediaEventListener, true);
- }
- }
}
-- (RenderBox*)renderer
-{
- return _renderer;
-}
+#pragma mark -
+#pragma mark NSWindowController overrides
-- (void)setRenderer:(RenderBox*)renderer
+- (void)cancelOperation:(id)sender
{
- _renderer = renderer;
+ [self performSelector:@selector(exitFullScreen) withObject:nil afterDelay:0];
}
#pragma mark -
#pragma mark Notifications
-- (void)windowDidExitFullscreen:(BOOL)finished
-{
- if (!_isAnimating)
- return;
-
- if (_isFullscreen)
- return;
-
- NSDisableScreenUpdates();
- ASSERT(_element);
- [self _document]->setFullScreenRendererBackgroundColor(Color::black);
- [self _document]->webkitDidExitFullScreenForElement(_element.get());
- [self setElement:nil];
-
- if (finished) {
- [self _updateMenuAndDockForFullscreen];
- [self _updatePowerAssertions];
-
- [[_webView window] display];
- [[self _fullscreenWindow] setRendererLayer:nil];
- [[self window] close];
- }
-
- NSEnableScreenUpdates();
-
- _isAnimating = NO;
- [self autorelease]; // Associated -retain is in -exitFullscreen.
-}
-
-- (void)windowDidEnterFullscreen:(BOOL)finished
-{
- if (!_isAnimating)
- return;
-
- if (!_isFullscreen)
- return;
-
- NSDisableScreenUpdates();
- [self _document]->webkitDidEnterFullScreenForElement(_element.get());
- [self _document]->setFullScreenRendererBackgroundColor(Color::black);
-
- if (finished) {
- [self _updateMenuAndDockForFullscreen];
- [self _updatePowerAssertions];
- [NSCursor setHiddenUntilMouseMoves:YES];
-
- // Move the webView into our fullscreen Window
- if (!_placeholderView)
- _placeholderView = [[NSView alloc] init];
-
- WebView *webView = [self webView];
- NSWindow *webWindow = [webView window];
- NSResponder *webWindowFirstResponder = [webWindow firstResponder];
-
- // Do not swap the placeholder into place if already is in a window,
- // assuming the placeholder's window will always be the webView's
- // original window.
- if (![_placeholderView window]) {
- [_placeholderView setFrame:[webView frame]];
- [_placeholderView setAutoresizingMask:[webView autoresizingMask]];
- [_placeholderView removeFromSuperview];
- [[webView superview] replaceSubview:webView with:_placeholderView];
-
- [[[self window] contentView] addSubview:webView];
- [[self window] makeResponder:webWindowFirstResponder firstResponderIfDescendantOfView:webView];
- [webView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
- [webView setFrame:[(NSView *)[[self window] contentView] bounds]];
- }
-
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
- // behavior here, making sure to reset the animation behavior afterward.
- NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
- [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
-#endif
- [webWindow orderOut:self];
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- [webWindow setAnimationBehavior:animationBehavior];
-#endif
-
- WebFullscreenWindow* window = [self _fullscreenWindow];
- [window setBackgroundColor:[NSColor blackColor]];
- [window setOpaque:YES];
-
- [CATransaction begin];
- [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
- [[[window animationView] layer] setOpacity:0];
- [CATransaction commit];
- }
- NSEnableScreenUpdates();
-
- _isAnimating = NO;
-}
-
-- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished
-{
- BOOL isEnteringFullscreenAnimation = [[anim valueForKey:isEnteringFullscreenKey] boolValue];
-
- if (!isEnteringFullscreenAnimation)
- [self windowDidExitFullscreen:finished];
- else
- [self windowDidEnterFullscreen:finished];
-}
-
- (void)applicationDidResignActive:(NSNotification*)notification
{
// Check to see if the fullscreenWindow is on the active space; this function is available
// on 10.6 and later, so default to YES if the function is not available:
- NSWindow* fullscreenWindow = [self _fullscreenWindow];
+ NSWindow* fullscreenWindow = [self window];
BOOL isOnActiveSpace = ([fullscreenWindow respondsToSelector:@selector(isOnActiveSpace)] ? [fullscreenWindow isOnActiveSpace] : YES);
// Replicate the QuickTime Player (X) behavior when losing active application status:
@@ -315,7 +173,7 @@ private:
// single screen is available.) Is the fullscreen screen on the current space? IFF so,
// then exit fullscreen mode.
if ([fullscreenWindow screen] == [[NSScreen screens] objectAtIndex:0] && isOnActiveSpace)
- [self _requestExitFullscreenWithAnimation:NO];
+ [self cancelOperation:self];
}
- (void)applicationDidChangeScreenParameters:(NSNotification*)notification
@@ -324,306 +182,230 @@ private:
// the Dock's size or location, or they may have changed the fullscreen screen's dimensions.
// Update our presentation parameters, and ensure that the full screen window occupies the
// entire screen:
- [self _updateMenuAndDockForFullscreen];
+ [self _updateMenuAndDockForFullScreen];
NSWindow* window = [self window];
- [window setFrame:[[window screen] frame] display:YES];
+ NSRect screenFrame = [[window screen] frame];
+ [window setFrame:screenFrame display:YES];
+ [_backgroundWindow.get() setFrame:screenFrame display:YES];
}
#pragma mark -
#pragma mark Exposed Interface
-- (void)enterFullscreen:(NSScreen *)screen
+- (void)enterFullScreen:(NSScreen *)screen
{
- // Disable animation if we are already in full-screen mode.
- BOOL shouldAnimate = !_isFullscreen;
-
- if (_isAnimating) {
- // The CAAnimation delegate functions will only be called the
- // next trip through the run-loop, so manually call the delegate
- // function here, letting it know the animation did not complete:
- [self windowDidExitFullscreen:NO];
- ASSERT(!_isAnimating);
- }
- _isFullscreen = YES;
- _isAnimating = YES;
-
- // setElement: must be called with a non-nil value before calling enterFullscreen:.
- ASSERT(_element);
+ if (_isFullScreen)
+ return;
+ _isFullScreen = YES;
- NSDisableScreenUpdates();
+ [self _updateMenuAndDockForFullScreen];
if (!screen)
screen = [NSScreen mainScreen];
NSRect screenFrame = [screen frame];
- WebView* webView = [self webView];
- NSRect webViewFrame = [webView convertRectToBase:[webView frame]];
- webViewFrame.origin = [[webView window] convertBaseToScreen:webViewFrame.origin];
+ NSRect webViewFrame = [[_webView window] convertRectToScreen:
+ [_webView convertRect:[_webView frame] toView:nil]];
- NSRect elementFrame = _element->screenRect();
+ // Flip coordinate system:
+ webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame);
- // In the case of a multi-monitor setup where the webView straddles two
- // monitors, we must create a window large enough to contain the destination
- // frame and the initial frame.
- NSRect windowFrame = NSUnionRect(screenFrame, elementFrame);
- [[self window] setFrame:windowFrame display:YES];
+ CGWindowID windowID = [[_webView window] windowNumber];
+ RetainPtr<CGImageRef> webViewContents = adoptCF(CGWindowListCreateImage(NSRectToCGRect(webViewFrame), kCGWindowListOptionIncludingWindow, windowID, kCGWindowImageShouldBeOpaque));
- // In a previous incarnation, the NSWindow attached to this controller may have
- // been on a different screen. Temporarily change the collectionBehavior of the window:
- NSWindowCollectionBehavior behavior = [[self window] collectionBehavior];
- [[self window] setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
- [[self window] makeKeyAndOrderFront:self];
- [[self window] setCollectionBehavior:behavior];
-
- NSView* animationView = [[self _fullscreenWindow] animationView];
-
- NSRect backgroundBounds = {[[self window] convertScreenToBase:screenFrame.origin], screenFrame.size};
- backgroundBounds = [animationView convertRectFromBase:backgroundBounds];
- // Flip the background layer's coordinate system.
- backgroundBounds.origin.y = windowFrame.size.height - NSMaxY(backgroundBounds);
-
- // Set our fullscreen element's initial frame, and flip the coordinate systems from
- // screen coordinates (bottom/left) to layer coordinates (top/left):
- _initialFrame = NSRectToCGRect(NSIntersectionRect(elementFrame, webViewFrame));
- _initialFrame.origin.y = screenFrame.size.height - CGRectGetMaxY(_initialFrame);
-
- // Inform the document that we will begin entering full screen. This will change
- // pseudo-classes on the fullscreen element and the document element.
- Document* document = [self _document];
- document->webkitWillEnterFullScreenForElement(_element.get());
-
- // Check to see if the fullscreen renderer is composited. If not, accelerated graphics
- // may be disabled. In this case, do not attempt to animate the contents into place;
- // merely snap to the final position:
- if (!shouldAnimate || !_renderer || !_renderer->layer()->isComposited()) {
- [self windowDidEnterFullscreen:YES];
- NSEnableScreenUpdates();
- return;
- }
+ // Screen updates to be re-enabled in beganEnterFullScreenWithInitialFrame:finalFrame:
+ NSDisableScreenUpdates();
+ [[self window] setAutodisplay:NO];
- // Set up the final style of the FullScreen render block. Set an absolute
- // width and height equal to the size of the screen, and anchor the layer
- // at the top, left at (0,0). The RenderFullScreen style is already set
- // to position:fixed.
- [self _document]->setFullScreenRendererSize(IntSize(screenFrame.size));
- [self _document]->setFullScreenRendererBackgroundColor(Color::transparent);
+ NSResponder *webWindowFirstResponder = [[_webView window] firstResponder];
+ [[self window] setFrame:screenFrame display:NO];
+
+ _initialFrame = screenRectOfContents(_element.get());
+
+ // Swap the webView placeholder into place.
+ if (!_webViewPlaceholder) {
+ _webViewPlaceholder.adoptNS([[NSView alloc] init]);
+ [_webViewPlaceholder.get() setLayer:[CALayer layer]];
+ [_webViewPlaceholder.get() setWantsLayer:YES];
+ }
+ [[_webViewPlaceholder.get() layer] setContents:(id)webViewContents.get()];
+ [self _swapView:_webView with:_webViewPlaceholder.get()];
- // Cause the document to layout, thus calculating a new fullscreen element size:
- [self _document]->updateLayout();
+ // Then insert the WebView into the full screen window
+ NSView* contentView = [[self window] contentView];
+ [contentView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
+ [_webView setFrame:[contentView bounds]];
- // FIXME: try to use the fullscreen element's calculated x, y, width, and height instead of the
- // renderBox functions:
- RenderBox* childRenderer = _renderer->firstChildBox();
- CGRect destinationFrame = CGRectMake(childRenderer->x(), childRenderer->y(), childRenderer->width(), childRenderer->height());
-
- // Some properties haven't propogated from the GraphicsLayer to the CALayer yet. So
- // tell the renderer's layer to sync it's compositing state:
- GraphicsLayer* rendererGraphics = _renderer->layer()->backing()->graphicsLayer();
- rendererGraphics->syncCompositingState(destinationFrame);
-
- CALayer* rendererLayer = rendererGraphics->platformLayer();
- [[self _fullscreenWindow] setRendererLayer:rendererLayer];
-
- CFTimeInterval duration = [self _animationDuration];
-
- // Create a transformation matrix that will transform the renderer layer such that
- // the fullscreen element appears to move from its starting position and size to its
- // final one. Perform the transformation in two steps, using the CALayer's matrix
- // math to calculate the effects of each step:
- // 1. Apply a scale tranform to shrink the apparent size of the layer to the original
- // element screen size.
- // 2. Apply a translation transform to move the shrunk layer into the same screen position
- // as the original element.
- CATransform3D shrinkTransform = CATransform3DMakeScale(_initialFrame.size.width / destinationFrame.size.width, _initialFrame.size.height / destinationFrame.size.height, 1);
- [rendererLayer setTransform:shrinkTransform];
- CGRect shrunkDestinationFrame = [rendererLayer convertRect:destinationFrame toLayer:[animationView layer]];
- CATransform3D moveTransform = CATransform3DMakeTranslation(_initialFrame.origin.x - shrunkDestinationFrame.origin.x, _initialFrame.origin.y - shrunkDestinationFrame.origin.y, 0);
- CATransform3D finalTransform = CATransform3DConcat(shrinkTransform, moveTransform);
- [rendererLayer setTransform:finalTransform];
-
- CALayer* backgroundLayer = [[self _fullscreenWindow] backgroundLayer];
-
- // Start the opacity animation. We can use implicit animations here because we don't care when
- // the animation finishes.
- [CATransaction begin];
- [CATransaction setValue:[NSNumber numberWithDouble:duration] forKey:kCATransactionAnimationDuration];
- [backgroundLayer setOpacity:1];
- [CATransaction commit];
+ [[self window] makeResponder:webWindowFirstResponder firstResponderIfDescendantOfView:_webView];
- // Use a CABasicAnimation here for the zoom effect. We want to be notified that the animation has
- // completed by way of the CAAnimation delegate.
- CABasicAnimation* zoomAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
- [zoomAnimation setFromValue:[NSValue valueWithCATransform3D:finalTransform]];
- [zoomAnimation setToValue:[NSValue valueWithCATransform3D:CATransform3DIdentity]];
- [zoomAnimation setDelegate:self];
- [zoomAnimation setDuration:duration];
- [zoomAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
- [zoomAnimation setFillMode:kCAFillModeForwards];
- [zoomAnimation setValue:(id)kCFBooleanTrue forKey:isEnteringFullscreenKey];
-
- // Disable implicit animations and set the layer's transformation matrix to its final state.
- [CATransaction begin];
- [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
- [rendererLayer setTransform:CATransform3DIdentity];
- [rendererLayer addAnimation:zoomAnimation forKey:@"zoom"];
- [backgroundLayer setFrame:NSRectToCGRect(backgroundBounds)];
- [CATransaction commit];
+ [self _document]->webkitWillEnterFullScreenForElement(_element.get());
+ [self _document]->setAnimatingFullScreen(true);
+ [self _document]->updateLayout();
+
+ _finalFrame = screenRectOfContents(_element.get());
- NSEnableScreenUpdates();
+ [self _updateMenuAndDockForFullScreen];
+
+ [self _startEnterFullScreenAnimationWithDuration:defaultAnimationDuration];
+
+ _isEnteringFullScreen = true;
}
-- (void)exitFullscreen
+- (void)finishedEnterFullScreenAnimation:(bool)completed
{
- if (!_isFullscreen)
- return;
-
- CATransform3D startTransform = CATransform3DIdentity;
- if (_isAnimating) {
- if (_renderer && _renderer->layer()->isComposited()) {
- CALayer* rendererLayer = _renderer->layer()->backing()->graphicsLayer()->platformLayer();
- startTransform = [[rendererLayer presentationLayer] transform];
- }
-
- // The CAAnimation delegate functions will only be called the
- // next trip through the run-loop, so manually call the delegate
- // function here, letting it know the animation did not complete:
- [self windowDidEnterFullscreen:NO];
- ASSERT(!_isAnimating);
- }
- _isFullscreen = NO;
- _isAnimating = YES;
-
- NSDisableScreenUpdates();
-
+ if (!_isEnteringFullScreen)
+ return;
+ _isEnteringFullScreen = NO;
- // The fullscreen animation may have been cancelled before the
- // webView was moved to the fullscreen window. Check to see
- // if the _placeholderView exists and is in a window before
- // attempting to swap the webView back to it's original tree:
- if (_placeholderView && [_placeholderView window]) {
- // Move the webView back to its own native window:
- WebView* webView = [self webView];
- NSResponder *fullScreenWindowFirstResponder = [[self window] firstResponder];
- [webView setFrame:[_placeholderView frame]];
- [webView setAutoresizingMask:[_placeholderView autoresizingMask]];
- [webView removeFromSuperview];
- [[_placeholderView superview] replaceSubview:_placeholderView with:webView];
- [[webView window] makeResponder:fullScreenWindowFirstResponder firstResponderIfDescendantOfView:webView];
+ if (completed) {
+ // Screen updates to be re-enabled at the end of this block
+ NSDisableScreenUpdates();
+ [self _document]->setAnimatingFullScreen(false);
+ [self _document]->webkitDidEnterFullScreenForElement(_element.get());
- NSWindow *webWindow = [[self webView] window];
+ NSRect windowBounds = [[self window] frame];
+ windowBounds.origin = NSZeroPoint;
+ WKWindowSetClipRect([self window], windowBounds);
+
+ NSWindow *webWindow = [_webViewPlaceholder.get() window];
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
// In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
// behavior here, making sure to reset the animation behavior afterward.
NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
[webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
#endif
- // The user may have moved the fullscreen window in Spaces, so temporarily change
- // the collectionBehavior of the fullscreen window:
+ [webWindow orderOut:self];
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ [webWindow setAnimationBehavior:animationBehavior];
+#endif
+
+ [_fadeAnimation.get() stopAnimation];
+ [_fadeAnimation.get() setWindow:nil];
+ _fadeAnimation = nullptr;
+
+ [_backgroundWindow.get() orderOut:self];
+ [_backgroundWindow.get() setFrame:NSZeroRect display:YES];
+ NSEnableScreenUpdates();
+ } else
+ [_scaleAnimation.get() stopAnimation];
+}
+
+- (void)exitFullScreen
+{
+ if (!_isFullScreen)
+ return;
+ _isFullScreen = NO;
+
+ // Screen updates to be re-enabled in beganExitFullScreenWithInitialFrame:finalFrame:
+ NSDisableScreenUpdates();
+ [[self window] setAutodisplay:NO];
+
+ _finalFrame = screenRectOfContents(_element.get());
+
+ [self _document]->webkitWillExitFullScreenForElement(_element.get());
+ [self _document]->setAnimatingFullScreen(true);
+
+ if (_isEnteringFullScreen)
+ [self finishedEnterFullScreenAnimation:NO];
+
+ [self _updateMenuAndDockForFullScreen];
+
+ NSWindow* webWindow = [_webViewPlaceholder.get() window];
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
+ // behavior here, making sure to reset the animation behavior afterward.
+ NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
+ [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
+#endif
+ // If the user has moved the fullScreen window into a new space, temporarily change
+ // the collectionBehavior of the webView's window so that it is pulled into the active space:
+ if (![webWindow isOnActiveSpace]) {
NSWindowCollectionBehavior behavior = [webWindow collectionBehavior];
[webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
[webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
[webWindow setCollectionBehavior:behavior];
+ } else
+ [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- [webWindow setAnimationBehavior:animationBehavior];
+ [webWindow setAnimationBehavior:animationBehavior];
#endif
- // Because the animation view is layer-hosted, make sure to
- // disable animations when changing the layer's opacity. Other-
- // wise, the content will appear to fade into view.
- [CATransaction begin];
- [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
- WebFullscreenWindow* window = [self _fullscreenWindow];
- [[[window animationView] layer] setOpacity:1];
- [window setBackgroundColor:[NSColor clearColor]];
- [window setOpaque:NO];
- [CATransaction commit];
- }
-
- NSView* animationView = [[self _fullscreenWindow] animationView];
- CGRect layerEndFrame = NSRectToCGRect([animationView convertRect:NSRectFromCGRect(_initialFrame) fromView:nil]);
+ [self _startExitFullScreenAnimationWithDuration:defaultAnimationDuration];
+ _isExitingFullScreen = YES;
+}
- // The _renderer might be NULL due to its ancestor being removed:
- CGRect layerStartFrame = CGRectZero;
- if (_renderer) {
- RenderBox* childRenderer = _renderer->firstChildBox();
- layerStartFrame = CGRectMake(childRenderer->x(), childRenderer->y(), childRenderer->width(), childRenderer->height());
- }
+- (void)finishedExitFullScreenAnimation:(bool)completed
+{
+ if (!_isExitingFullScreen)
+ return;
+ _isExitingFullScreen = NO;
- [self _document]->webkitWillExitFullScreenForElement(_element.get());
- [self _document]->updateLayout();
+ [self _updateMenuAndDockForFullScreen];
- // We have to retain ourselves because we want to be alive for the end of the animation.
- // If our owner releases us we could crash if this is not the case.
- // Balanced in windowDidExitFullscreen
- [self retain];
+ // Screen updates to be re-enabled at the end of this function
+ NSDisableScreenUpdates();
- // Check to see if the fullscreen renderer is composited. If not, accelerated graphics
- // may be disabled. In this case, do not attempt to animate the contents into place;
- // merely snap to the final position:
- if (!_renderer || !_renderer->layer()->isComposited()) {
- [self windowDidExitFullscreen:YES];
- NSEnableScreenUpdates();
- return;
- }
-
- GraphicsLayer* rendererGraphics = _renderer->layer()->backing()->graphicsLayer();
+ [self _document]->setAnimatingFullScreen(false);
+ [self _document]->webkitDidExitFullScreenForElement(_element.get());
- [self _document]->setFullScreenRendererBackgroundColor(Color::transparent);
-
- rendererGraphics->syncCompositingState(layerEndFrame);
-
- CALayer* rendererLayer = rendererGraphics->platformLayer();
- [[self _fullscreenWindow] setRendererLayer:rendererLayer];
+ NSResponder *firstResponder = [[self window] firstResponder];
+ [self _swapView:_webViewPlaceholder.get() with:_webView];
+ [[_webView window] makeResponder:firstResponder firstResponderIfDescendantOfView:_webView];
- // Create a transformation matrix that will transform the renderer layer such that
- // the fullscreen element appears to move from the full screen to its original position
- // and size. Perform the transformation in two steps, using the CALayer's matrix
- // math to calculate the effects of each step:
- // 1. Apply a scale tranform to shrink the apparent size of the layer to the original
- // element screen size.
- // 2. Apply a translation transform to move the shrunk layer into the same screen position
- // as the original element.
- CATransform3D shrinkTransform = CATransform3DMakeScale(layerEndFrame.size.width / layerStartFrame.size.width, layerEndFrame.size.height / layerStartFrame.size.height, 1);
- [rendererLayer setTransform:shrinkTransform];
- CGRect shrunkDestinationFrame = [rendererLayer convertRect:layerStartFrame toLayer:[animationView layer]];
- CATransform3D moveTransform = CATransform3DMakeTranslation(layerEndFrame.origin.x - shrunkDestinationFrame.origin.x, layerEndFrame.origin.y - shrunkDestinationFrame.origin.y, 0);
- CATransform3D finalTransform = CATransform3DConcat(shrinkTransform, moveTransform);
- [rendererLayer setTransform:finalTransform];
-
- CFTimeInterval duration = [self _animationDuration];
-
- CALayer* backgroundLayer = [[self _fullscreenWindow] backgroundLayer];
- [CATransaction begin];
- [CATransaction setValue:[NSNumber numberWithDouble:duration] forKey:kCATransactionAnimationDuration];
- [backgroundLayer setOpacity:0];
- [CATransaction commit];
+ NSRect windowBounds = [[self window] frame];
+ windowBounds.origin = NSZeroPoint;
+ WKWindowSetClipRect([self window], windowBounds);
+
+ [[self window] orderOut:self];
+ [[self window] setFrame:NSZeroRect display:YES];
- CABasicAnimation* zoomAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
- [zoomAnimation setFromValue:[NSValue valueWithCATransform3D:startTransform]];
- [zoomAnimation setToValue:[NSValue valueWithCATransform3D:finalTransform]];
- [zoomAnimation setDelegate:self];
- [zoomAnimation setDuration:duration];
- [zoomAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
- [zoomAnimation setFillMode:kCAFillModeBoth];
- [zoomAnimation setRemovedOnCompletion:NO];
- [zoomAnimation setValue:(id)kCFBooleanFalse forKey:isEnteringFullscreenKey];
+ [_fadeAnimation.get() stopAnimation];
+ [_fadeAnimation.get() setWindow:nil];
+ _fadeAnimation = nullptr;
- [rendererLayer addAnimation:zoomAnimation forKey:@"zoom"];
+ [_backgroundWindow.get() orderOut:self];
+ [_backgroundWindow.get() setFrame:NSZeroRect display:YES];
NSEnableScreenUpdates();
}
+- (void)close
+{
+ // We are being asked to close rapidly, most likely because the page
+ // has closed or the web process has crashed. Just walk through our
+ // normal exit full screen sequence, but don't wait to be called back
+ // in response.
+ if (_isFullScreen)
+ [self exitFullScreen];
+
+ if (_isExitingFullScreen)
+ [self finishedExitFullScreenAnimation:YES];
+
+ [super close];
+}
+
+#pragma mark -
+#pragma mark NSAnimation delegate
+
+- (void)animationDidEnd:(NSAnimation*)animation
+{
+ if (_isFullScreen)
+ [self finishedEnterFullScreenAnimation:YES];
+ else
+ [self finishedExitFullScreenAnimation:YES];
+}
+
#pragma mark -
#pragma mark Internal Interface
-- (void)_updateMenuAndDockForFullscreen
+- (void)_updateMenuAndDockForFullScreen
{
// NSApplicationPresentationOptions is available on > 10.6 only:
#ifndef BUILDING_ON_LEOPARD
NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
NSScreen* fullscreenScreen = [[self window] screen];
- if (_isFullscreen) {
+ if (_isFullScreen) {
// Auto-hide the menu bar if the fullscreenScreen contains the menu bar:
// NOTE: if the fullscreenScreen contains the menu bar but not the dock, we must still
// auto-hide the dock, or an exception will be thrown.
@@ -640,212 +422,145 @@ private:
[NSApp setPresentationOptions:options];
else
#endif
- SetSystemUIMode(_isFullscreen ? kUIModeNormal : kUIModeAllHidden, 0);
+ SetSystemUIMode(_isFullScreen ? kUIModeNormal : kUIModeAllHidden, 0);
}
-- (void)_updatePowerAssertions
-{
- BOOL isPlaying = [self _isAnyMoviePlaying];
-
- if (isPlaying && _isFullscreen) {
- if (!_displaySleepDisabler)
- _displaySleepDisabler = DisplaySleepDisabler::create("com.apple.WebKit - Fullscreen video");
- } else
- _displaySleepDisabler = nullptr;
-}
-
-- (void)_requestExit
-{
- [self exitFullscreen];
- _forceDisableAnimation = NO;
-}
+#pragma mark -
+#pragma mark Utility Functions
-- (void)_requestExitFullscreenWithAnimation:(BOOL)animation
+- (Document*)_document
{
- _forceDisableAnimation = !animation;
- [self performSelector:@selector(_requestExit) withObject:nil afterDelay:0];
-
+ return _element->document();
}
-- (BOOL)_isAnyMoviePlaying
+- (void)_swapView:(NSView*)view with:(NSView*)otherView
{
-#if ENABLE(VIDEO)
- if (!_element)
- return NO;
-
- Node* nextNode = _element.get();
- while (nextNode)
- {
- if (nextNode->hasTagName(HTMLNames::videoTag) && static_cast<Element*>(nextNode)->isMediaElement()) {
- HTMLMediaElement* element = static_cast<HTMLMediaElement*>(nextNode);
- if (!element->paused() && !element->ended())
- return YES;
- }
-
- nextNode = nextNode->traverseNextNode(_element.get());
- }
-#endif
-
- return NO;
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ [otherView setFrame:[view frame]];
+ [otherView setAutoresizingMask:[view autoresizingMask]];
+ [otherView removeFromSuperview];
+ [[view superview] replaceSubview:view with:otherView];
+ [CATransaction commit];
}
-#pragma mark -
-#pragma mark Utility Functions
-
-- (WebFullscreenWindow *)_fullscreenWindow
+static RetainPtr<NSWindow> createBackgroundFullscreenWindow(NSRect frame)
{
- return (WebFullscreenWindow *)[self window];
+ NSWindow *window = [[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ [window setOpaque:YES];
+ [window setBackgroundColor:[NSColor blackColor]];
+ [window setReleasedWhenClosed:NO];
+ return adoptNS(window);
}
-- (Document*)_document
+static NSRect windowFrameFromApparentFrames(NSRect screenFrame, NSRect initialFrame, NSRect finalFrame)
{
- return _element->document();
+ NSRect initialWindowFrame;
+ CGFloat xScale = NSWidth(screenFrame) / NSWidth(finalFrame);
+ CGFloat yScale = NSHeight(screenFrame) / NSHeight(finalFrame);
+ CGFloat xTrans = NSMinX(screenFrame) - NSMinX(finalFrame);
+ CGFloat yTrans = NSMinY(screenFrame) - NSMinY(finalFrame);
+ initialWindowFrame.size = NSMakeSize(NSWidth(initialFrame) * xScale, NSHeight(initialFrame) * yScale);
+ initialWindowFrame.origin = NSMakePoint
+ ( NSMinX(initialFrame) + xTrans / (NSWidth(finalFrame) / NSWidth(initialFrame))
+ , NSMinY(initialFrame) + yTrans / (NSHeight(finalFrame) / NSHeight(initialFrame)));
+ return initialWindowFrame;
}
-- (CFTimeInterval)_animationDuration
+- (void)_startEnterFullScreenAnimationWithDuration:(NSTimeInterval)duration
{
- static const CFTimeInterval defaultDuration = 0.5;
- CFTimeInterval duration = defaultDuration;
-#ifndef BUILDING_ON_LEOPARD
- NSUInteger modifierFlags = [NSEvent modifierFlags];
-#else
- NSUInteger modifierFlags = [[NSApp currentEvent] modifierFlags];
-#endif
- if ((modifierFlags & NSControlKeyMask) == NSControlKeyMask)
- duration *= 2;
- if ((modifierFlags & NSShiftKeyMask) == NSShiftKeyMask)
- duration *= 10;
- if (_forceDisableAnimation) {
- // This will disable scale animation
- duration = 0;
+ NSRect screenFrame = [[[self window] screen] frame];
+ NSRect initialWindowFrame = windowFrameFromApparentFrames(screenFrame, _initialFrame, _finalFrame);
+
+ _scaleAnimation = adoptNS([[WebWindowScaleAnimation alloc] initWithHintedDuration:duration window:[self window] initalFrame:initialWindowFrame finalFrame:screenFrame]);
+
+ [_scaleAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
+ [_scaleAnimation.get() setDelegate:self];
+ [_scaleAnimation.get() setCurrentProgress:0];
+ [_scaleAnimation.get() startAnimation];
+
+ // WKWindowSetClipRect takes window coordinates, so convert from screen coordinates here:
+ NSRect finalBounds = _finalFrame;
+ finalBounds.origin = [[self window] convertScreenToBase:finalBounds.origin];
+ WKWindowSetClipRect([self window], finalBounds);
+
+ [[self window] makeKeyAndOrderFront:self];
+
+ if (!_backgroundWindow)
+ _backgroundWindow = createBackgroundFullscreenWindow(screenFrame);
+ else
+ [_backgroundWindow.get() setFrame:screenFrame display:NO];
+
+ CGFloat currentAlpha = 0;
+ if (_fadeAnimation) {
+ currentAlpha = [_fadeAnimation.get() currentAlpha];
+ [_fadeAnimation.get() stopAnimation];
+ [_fadeAnimation.get() setWindow:nil];
}
- return duration;
+
+ _fadeAnimation = adoptNS([[WebWindowFadeAnimation alloc] initWithDuration:duration
+ window:_backgroundWindow.get()
+ initialAlpha:currentAlpha
+ finalAlpha:1]);
+ [_fadeAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
+ [_fadeAnimation.get() setCurrentProgress:0];
+ [_fadeAnimation.get() startAnimation];
+
+ [_backgroundWindow.get() orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
+
+ [[self window] setAutodisplay:YES];
+ [[self window] displayIfNeeded];
+ // Screen updates disabled in enterFullScreen:
+ NSEnableScreenUpdates();
}
-@end
-
-#pragma mark -
-@implementation WebFullscreenWindow
-
-- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
+- (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration
{
- UNUSED_PARAM(aStyle);
- self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
- if (!self)
- return nil;
- [self setOpaque:NO];
- [self setBackgroundColor:[NSColor clearColor]];
- [self setIgnoresMouseEvents:NO];
- [self setAcceptsMouseMovedEvents:YES];
- [self setReleasedWhenClosed:NO];
- [self setHasShadow:YES];
-#ifndef BUILDING_ON_LEOPARD
- [self setMovable:NO];
-#else
- [self setMovableByWindowBackground:NO];
-#endif
+ NSRect screenFrame = [[[self window] screen] frame];
+ NSRect initialWindowFrame = windowFrameFromApparentFrames(screenFrame, _initialFrame, _finalFrame);
- NSView* contentView = [self contentView];
- _animationView = [[NSView alloc] initWithFrame:[contentView bounds]];
+ NSRect currentFrame = _scaleAnimation ? [_scaleAnimation.get() currentFrame] : [[self window] frame];
+ _scaleAnimation = adoptNS([[WebWindowScaleAnimation alloc] initWithHintedDuration:duration window:[self window] initalFrame:currentFrame finalFrame:initialWindowFrame]);
- RetainPtr<CALayer> contentLayer(AdoptNS, [[CALayer alloc] init]);
- [_animationView setLayer:contentLayer.get()];
- [_animationView setWantsLayer:YES];
- [_animationView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
- [contentView addSubview:_animationView];
+ [_scaleAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
+ [_scaleAnimation.get() setDelegate:self];
+ [_scaleAnimation.get() setCurrentProgress:0];
+ [_scaleAnimation.get() startAnimation];
- _backgroundLayer = [[CALayer alloc] init];
- [contentLayer.get() addSublayer:_backgroundLayer];
-#ifndef BUILDING_ON_LEOPARD
- [contentLayer.get() setGeometryFlipped:YES];
-#else
- [contentLayer.get() setSublayerTransform:CATransform3DMakeScale(1, -1, 1)];
-#endif
- [contentLayer.get() setOpacity:0];
+ if (!_backgroundWindow)
+ _backgroundWindow = createBackgroundFullscreenWindow(screenFrame);
+ else
+ [_backgroundWindow.get() setFrame:screenFrame display:NO];
- [_backgroundLayer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
- [_backgroundLayer setOpacity:0];
- return self;
-}
-
-- (void)dealloc
-{
- [_animationView release];
- [_backgroundLayer release];
- [_rendererLayer release];
- [super dealloc];
-}
-
-- (BOOL)canBecomeKeyWindow
-{
- return YES;
-}
-
-- (void)keyDown:(NSEvent *)theEvent
-{
- if ([[theEvent charactersIgnoringModifiers] isEqual:@"\e"]) // Esacpe key-code
- [self cancelOperation:self];
- else [super keyDown:theEvent];
-}
-
-- (void)cancelOperation:(id)sender
-{
- UNUSED_PARAM(sender);
- [[self windowController] _requestExitFullscreenWithAnimation:YES];
-}
-
-- (CALayer*)rendererLayer
-{
- return _rendererLayer;
-}
-
-- (void)setRendererLayer:(CALayer *)rendererLayer
-{
- [CATransaction begin];
- [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
- [rendererLayer retain];
- [_rendererLayer removeFromSuperlayer];
- [_rendererLayer release];
- _rendererLayer = rendererLayer;
-
- if (_rendererLayer)
- [[[self animationView] layer] addSublayer:_rendererLayer];
- [CATransaction commit];
-}
+ CGFloat currentAlpha = 1;
+ if (_fadeAnimation) {
+ currentAlpha = [_fadeAnimation.get() currentAlpha];
+ [_fadeAnimation.get() stopAnimation];
+ [_fadeAnimation.get() setWindow:nil];
+ }
+ _fadeAnimation = adoptNS([[WebWindowFadeAnimation alloc] initWithDuration:duration
+ window:_backgroundWindow.get()
+ initialAlpha:currentAlpha
+ finalAlpha:0]);
+ [_fadeAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
+ [_fadeAnimation.get() setCurrentProgress:0];
+ [_fadeAnimation.get() startAnimation];
+
+ [_backgroundWindow.get() orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
+
+ // WKWindowSetClipRect takes window coordinates, so convert from screen coordinates here:
+ NSRect finalBounds = _finalFrame;
+ finalBounds.origin = [[self window] convertScreenToBase:finalBounds.origin];
+ WKWindowSetClipRect([self window], finalBounds);
+
+ [[self window] setAutodisplay:YES];
+ [[self window] displayIfNeeded];
-- (CALayer*)backgroundLayer
-{
- return _backgroundLayer;
+ // Screen updates disabled in exitFullScreen:
+ NSEnableScreenUpdates();
}
-- (NSView*)animationView
-{
- return _animationView;
-}
@end
-#pragma mark -
-#pragma mark MediaEventListener
-
-MediaEventListener::MediaEventListener(WebFullScreenController* delegate)
- : EventListener(CPPEventListenerType)
- , delegate(delegate)
-{
-}
-
-PassRefPtr<MediaEventListener> MediaEventListener::create(WebFullScreenController* delegate)
-{
- return adoptRef(new MediaEventListener(delegate));
-}
-
-bool MediaEventListener::operator==(const EventListener& listener)
-{
- return this == &listener;
-}
-
-void MediaEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
-{
- [delegate _updatePowerAssertions];
-}
#endif /* ENABLE(FULLSCREEN_API) */
diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm
index 7052fca0b..a9b291e49 100644
--- a/Source/WebKit/mac/WebView/WebHTMLView.mm
+++ b/Source/WebKit/mac/WebView/WebHTMLView.mm
@@ -1372,6 +1372,16 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
return self != [self _topHTMLView];
}
+static BOOL isQuickLookEvent(NSEvent *event)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
+ const int kCGSEventSystemSubtypeHotKeyCombinationReleased = 9;
+ return [event type] == NSSystemDefined && [event subtype] == kCGSEventSystemSubtypeHotKeyCombinationReleased && [event data1] == 'lkup';
+#else
+ return NO;
+#endif
+}
+
- (NSView *)hitTest:(NSPoint)point
{
// WebHTMLView objects handle all events for objects inside them.
@@ -1412,7 +1422,8 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
captureHitsOnSubviews = !([event type] == NSMouseMoved
|| [event type] == NSRightMouseDown
|| ([event type] == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask) != 0)
- || [event type] == NSFlagsChanged);
+ || [event type] == NSFlagsChanged
+ || isQuickLookEvent(event));
}
if (!captureHitsOnSubviews) {
diff --git a/Source/WebKit/mac/WebView/WebNotification.h b/Source/WebKit/mac/WebView/WebNotification.h
index c04b2ad07..8ecc10686 100644
--- a/Source/WebKit/mac/WebView/WebNotification.h
+++ b/Source/WebKit/mac/WebView/WebNotification.h
@@ -36,6 +36,7 @@
- (NSString *)title;
- (NSString *)body;
+- (NSString *)replaceID;
- (WebSecurityOrigin *)origin;
- (uint64_t)notificationID;
diff --git a/Source/WebKit/mac/WebView/WebNotification.mm b/Source/WebKit/mac/WebView/WebNotification.mm
index bbd0248f6..557332cba 100644
--- a/Source/WebKit/mac/WebView/WebNotification.mm
+++ b/Source/WebKit/mac/WebView/WebNotification.mm
@@ -101,6 +101,16 @@ Notification* core(WebNotification *notification)
#endif
}
+- (NSString *)replaceID
+{
+#if ENABLE(NOTIFICATIONS)
+ ASSERT(core(self));
+ return core(self)->replaceId();
+#else
+ return nil;
+#endif
+}
+
- (WebSecurityOrigin *)origin
{
#if ENABLE(NOTIFICATIONS)
diff --git a/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm
index f2c6c833b..3e701cf5c 100644
--- a/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm
+++ b/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm
@@ -26,8 +26,8 @@
#import "WebPDFDocumentExtras.h"
#import "WebTypesInternal.h"
-#import <JavaScriptCore/Vector.h>
-#import <JavaScriptCore/RetainPtr.h>
+#import <wtf/Vector.h>
+#import <wtf/RetainPtr.h>
#import <PDFKit/PDFDocument.h>
#import <objc/objc-runtime.h>
diff --git a/Source/WebKit/mac/WebView/WebPDFRepresentation.mm b/Source/WebKit/mac/WebView/WebPDFRepresentation.mm
index 44a1362f3..a36853349 100644
--- a/Source/WebKit/mac/WebView/WebPDFRepresentation.mm
+++ b/Source/WebKit/mac/WebView/WebPDFRepresentation.mm
@@ -35,7 +35,7 @@
#import "WebPDFDocumentExtras.h"
#import "WebPDFView.h"
#import "WebTypesInternal.h"
-#import <JavaScriptCore/Assertions.h>
+#import <wtf/Assertions.h>
#import <JavaScriptCore/JSContextRef.h>
#import <JavaScriptCore/JSStringRef.h>
#import <JavaScriptCore/JSStringRefCF.h>
diff --git a/Source/WebKit/mac/WebView/WebResource.mm b/Source/WebKit/mac/WebView/WebResource.mm
index 463f76846..3964f6f79 100644
--- a/Source/WebKit/mac/WebView/WebResource.mm
+++ b/Source/WebKit/mac/WebView/WebResource.mm
@@ -35,7 +35,7 @@
#import "WebNSObjectExtras.h"
#import "WebNSURLExtras.h"
#import <JavaScriptCore/InitializeThreading.h>
-#import <JavaScriptCore/PassRefPtr.h>
+#import <wtf/PassRefPtr.h>
#import <WebCore/ArchiveResource.h>
#import <WebCore/LegacyWebArchive.h>
#import <WebCore/RunLoop.h>
diff --git a/Source/WebKit/mac/WebView/WebTextIterator.mm b/Source/WebKit/mac/WebView/WebTextIterator.mm
index e80d4671f..9b1bd8feb 100644
--- a/Source/WebKit/mac/WebView/WebTextIterator.mm
+++ b/Source/WebKit/mac/WebView/WebTextIterator.mm
@@ -28,7 +28,7 @@
#import "DOMNodeInternal.h"
#import "DOMRangeInternal.h"
#import "WebTypesInternal.h"
-#import <JavaScriptCore/Vector.h>
+#import <wtf/Vector.h>
#import <WebCore/RunLoop.h>
#import <WebCore/TextIterator.h>
#import <WebCore/WebCoreObjCExtras.h>
diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm
index 9b722026e..9cfe8b348 100644
--- a/Source/WebKit/mac/WebView/WebView.mm
+++ b/Source/WebKit/mac/WebView/WebView.mm
@@ -6304,21 +6304,14 @@ bool LayerFlushController::flushLayers()
[_private->newFullscreenController setElement:element];
[_private->newFullscreenController setWebView:self];
- [_private->newFullscreenController enterFullscreen:[[self window] screen]];
+ [_private->newFullscreenController enterFullScreen:[[self window] screen]];
}
- (void)_exitFullScreenForElement:(WebCore::Element*)element
{
if (!_private->newFullscreenController)
return;
- [_private->newFullscreenController exitFullscreen];
-}
-
-- (void)_fullScreenRendererChanged:(WebCore::RenderBox*)renderer
-{
- if (!_private->newFullscreenController)
- _private->newFullscreenController = [[WebFullScreenController alloc] init];
- [_private->newFullscreenController setRenderer:renderer];
+ [_private->newFullscreenController exitFullScreen];
}
#endif
diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h
index e0fee81d1..1b61821d1 100644
--- a/Source/WebKit/mac/WebView/WebViewPrivate.h
+++ b/Source/WebKit/mac/WebView/WebViewPrivate.h
@@ -106,7 +106,7 @@ typedef enum {
WebPaginationModeVertical,
} WebPaginationMode;
-// This needs to be in sync with WebCore::NotificationPresenter::Permission
+// This needs to be in sync with WebCore::NotificationClient::Permission
typedef enum {
WebNotificationPermissionAllowed,
WebNotificationPermissionNotAllowed,