diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /WebKit/mac | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'WebKit/mac')
32 files changed, 929 insertions, 32 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 88a2fbf..df5ca46 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,245 @@ +2010-09-09 John Therrell <jtherrell@apple.com> + + Reviewed by Alexey Proskuryakov. + + Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes + https://bugs.webkit.org/show_bug.cgi?id=45134 + + Added ability to enable new JavaScriptCore statistics sampling and reporting for RegisterFile + and ExecutableAllocator classes. Added reporting of JavaScriptCore's stack committed memory + and JIT code committed memory statistics to WebCoreStatistics memoryStatistics. + + * Misc/WebCoreStatistics.mm: + (+[WebCoreStatistics memoryStatistics]): + Added statistics reporting for JSC RegisterFile and ExecutableAllocator. + +2010-09-09 Jer Noble <jer.noble@apple.com> + + Reviewed by Mark Rowe. + + Use of ENABLE macro in WebUIDelegatePrivate.h breaks use from outside WebKit + <rdar://problem/8412657> + + * WebView/WebUIDelegatePrivate.h: Use ENABLE_FULLSCREEN_API instead of ENABLE(FULLSCREEN_API) + +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * WebView/WebFrame.mm: + (-[WebFrame _selectedString]): + (-[WebFrame _firstRectForDOMRange:]): + (-[WebFrame _markDOMRange]): + (-[WebFrame _setTypingStyle:withUndoAction:]): + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation finishedLoadingWithDataSource:]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView _selectionStartFontAttributesAsRTF]): + (-[WebHTMLView toggleBaseWritingDirection:]): + (-[WebHTMLView searchFor:direction:caseSensitive:wrap:startInSelection:]): + (-[WebHTMLView countMatchesForText:caseSensitive:limit:markMatches:]): + (-[WebHTMLView setMarkedTextMatchesAreHighlighted:]): + (-[WebHTMLView markedTextMatchesAreHighlighted]): + * WebView/WebView.mm: + (-[WebView setEditable:]): + Changed call sites to use editor(). + +2010-09-08 MORITA Hajime <morrita@google.com> + + Reviewed by Tony Chang. + + spelling underline gets lost on backspace + https://bugs.webkit.org/show_bug.cgi?id=41423 + + Switched to use a anchorNode of the selection instead of a focused + node for finer control of node selection in spellingNode(): + With the focused node, we cannot select other nodes but the first + child of that node. In some case, we need to inspect these. + + The API is only for LayoutTests, and the change is compatible for + existing test cases. + + * WebView/WebFrame.mm: + (spellingNode): + +2010-09-08 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Rename DocLoader to CachedResourceLoader because that's what it does. + + * WebView/WebFrame.mm: + +2010-09-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + Fix clang++ build. + + * Misc/WebLocalizableStrings.h: + Fix a struct/tag mismatch. + + * WebView/WebDeviceOrientationProviderMock.mm: + (-[WebDeviceOrientationProviderMock init]): + Remove stray semicolon. + + * WebView/WebViewData.h: + Remove unused class forward declaration. + +2010-09-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8381749> -Wcast-align warning emitted when building with clang + + Remove the -Wcast-align-warning since it isn't really useful, and clang is more aggressive about warning than gcc. + + * Configurations/Base.xcconfig: + +2010-09-06 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Rename SecurityOrigin::canLoad to canDisplay + https://bugs.webkit.org/show_bug.cgi?id=45214 + + Propagate name change. + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::loadRequest): + * Plugins/WebNetscapePluginStream.mm: + (WebNetscapePluginStream::WebNetscapePluginStream): + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]): + * Plugins/WebPluginContainerCheck.mm: + (-[WebPluginContainerCheck _isForbiddenFileLoad]): + * WebView/WebFrame.mm: + (-[WebFrame _allowsFollowingLink:]): + +2010-09-03 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + Add Mac's specific implementation of FrameNetworkingContext. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + * WebCoreSupport/WebFrameNetworkingContext.mm: + (WebFrameNetworkingContext::needsSiteSpecificQuirks): + (WebFrameNetworkingContext::localFileContentSniffingEnabled): + (WebFrameNetworkingContext::scheduledRunLoopPairs): + (WebFrameNetworkingContext::blockedError): + +2010-09-03 John Sullivan <sullivan@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=45175 + [WebView unmarkAllTextMatches] will crash if the webview is already closed + + Made this and related methods robust against being called when the WebView is closed. + + * WebView/WebView.mm: + (-[WebView markAllMatchesForText:caseSensitive:highlight:limit:]): + Bail out if the WebView is closed. + (-[WebView countMatchesForText:caseSensitive:highlight:limit:markMatches:]): + Ditto. + (-[WebView unmarkAllTextMatches]): + Ditto. + (-[WebView rectsForTextMatches]): + Ditto. + +2010-09-03 Hironori Bono <hbono@chromium.org> + + Reviewed by Kent Tamura. + + Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests + and implements it for Mac. + https://bugs.webkit.org/show_bug.cgi?id=41832 + + * WebView/WebFrame.mm: Implemented [WebFrame hasSpellingMarker:length:]. + (spellingNode): + (-[WebFrame hasSpellingMarker:length:]): + * WebView/WebFramePrivate.h: Added [WebFrame hasSpellingMarker:length:] so TextInputController can use it. + +2010-09-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorFrontendClient::closeWindow): + (WebInspectorFrontendClient::disconnectFromBackend): + (-[WebInspectorWindowController windowShouldClose:]): + (-[WebInspectorWindowController destroyInspectorView:]): + +2010-09-02 Steve Block <steveblock@google.com> + + Reviewed by Adam Barth. + + Hook up LayoutTestController.setMockDeviceOrientation() on Mac. + https://bugs.webkit.org/show_bug.cgi?id=43181 + + This patch hooks up the mock device orientation client on Mac for use + in DumpRenderTree. + + The patch adds a new WebDeviceOrientationClient for Mac. This client acts + as a proxy to either a real or mock device orientation provider, both of + which implement a new WebDeviceOrientationProvider interface. + + The provider is created by the embedder and passed to the WebView, from + where WebDeviceOrientationClient can access it. + + The mock provider, WebDeviceOrientationProviderMock, is a wrapper around + the existing WebCore mock. + + * WebCoreSupport/WebDeviceOrientationClient.h: Added. + * WebCoreSupport/WebDeviceOrientationClient.mm: Added. + (WebDeviceOrientationClient::WebDeviceOrientationClient): + (WebDeviceOrientationClient::setController): + (WebDeviceOrientationClient::startUpdating): + (WebDeviceOrientationClient::stopUpdating): + (WebDeviceOrientationClient::lastOrientation): + * WebKit.exp: + * WebView/WebDeviceOrientation.h: Added. + * WebView/WebDeviceOrientation.mm: Added. + (-[WebDeviceOrientation initWithCoreDeviceOrientation:WebCore::]): + (core): + (-[WebDeviceOrientation initWithCanProvideAlpha:alpha:canProvideBeta:beta:canProvideGamma:gamma:]): + (-[WebDeviceOrientation dealloc]): + * WebView/WebDeviceOrientationInternal.h: Added. + * WebView/WebDeviceOrientationProvider.h: Added. + * WebView/WebDeviceOrientationProviderMock.h: Added. + * WebView/WebDeviceOrientationProviderMock.mm: Added. + (-[WebDeviceOrientationProviderMockInternal setOrientation:]): + (-[WebDeviceOrientationProviderMockInternal setController:]): + (-[WebDeviceOrientationProviderMockInternal startUpdating]): + (-[WebDeviceOrientationProviderMockInternal stopUpdating]): + (-[WebDeviceOrientationProviderMockInternal lastOrientation]): + (-[WebDeviceOrientationProviderMock init]): + (-[WebDeviceOrientationProviderMock dealloc]): + (-[WebDeviceOrientationProviderMock setOrientation:]): + (-[WebDeviceOrientationProviderMock setController:]): + (-[WebDeviceOrientationProviderMock startUpdating]): + (-[WebDeviceOrientationProviderMock stopUpdating]): + (-[WebDeviceOrientationProviderMock lastOrientation]): + * WebView/WebDeviceOrientationProviderMockInternal.h: Added. + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + (-[WebView _setDeviceOrientationProvider:]): + (-[WebView _deviceOrientationProvider]): + * WebView/WebViewData.h: + * WebView/WebViewPrivate.h: + 2010-09-01 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. diff --git a/WebKit/mac/Configurations/Base.xcconfig b/WebKit/mac/Configurations/Base.xcconfig index b3f8ea6..0e84791 100644 --- a/WebKit/mac/Configurations/Base.xcconfig +++ b/WebKit/mac/Configurations/Base.xcconfig @@ -56,8 +56,8 @@ VALID_ARCHS_macosx = i386 ppc x86_64 ppc64; WARNING_CFLAGS_BASE = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)); WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE); -WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wcast-align; -WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_BASE) -Wcast-align; +WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE); +WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_BASE); REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index 659ac62..9f9441c 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 7; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index a5d5ae1..cc68cef 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -29,6 +29,8 @@ #import "WebCoreStatistics.h" #import "DOMElementInternal.h" +#import <JavaScriptCore/RegisterFile.h> +#import <JavaScriptCore/ExecutableAllocator.h> #import "WebCache.h" #import "WebFrameInternal.h" #import <runtime/JSLock.h> @@ -196,12 +198,16 @@ using namespace WebCore; WTF::FastMallocStatistics fastMallocStatistics = WTF::fastMallocStatistics(); JSLock lock(SilenceAssertionsOnly); Heap::Statistics jsHeapStatistics = JSDOMWindow::commonJSGlobalData()->heap.statistics(); + size_t jscStackBytes = RegisterFile::committedByteCount(); + size_t jscJITBytes = ExecutableAllocator::committedByteCount(); return [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:fastMallocStatistics.reservedVMBytes], @"FastMallocReservedVMBytes", [NSNumber numberWithInt:fastMallocStatistics.committedVMBytes], @"FastMallocCommittedVMBytes", [NSNumber numberWithInt:fastMallocStatistics.freeListBytes], @"FastMallocFreeListBytes", [NSNumber numberWithInt:jsHeapStatistics.size], @"JavaScriptHeapSize", [NSNumber numberWithInt:jsHeapStatistics.free], @"JavaScriptFreeSize", + [NSNumber numberWithUnsignedInt:(unsigned int)jscStackBytes], @"JavaScriptStackSize", + [NSNumber numberWithUnsignedInt:(unsigned int)jscJITBytes], @"JavaScriptJITSize", nil]; } diff --git a/WebKit/mac/Misc/WebLocalizableStrings.h b/WebKit/mac/Misc/WebLocalizableStrings.h index ecad83d..853b601 100644 --- a/WebKit/mac/Misc/WebLocalizableStrings.h +++ b/WebKit/mac/Misc/WebLocalizableStrings.h @@ -28,6 +28,8 @@ #if __OBJC__ @class NSBundle; +#elif __cplusplus +class NSBundle; #else typedef struct NSBundle NSBundle; #endif diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index a8dd09b..88df4cf 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -762,7 +762,7 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch return NPERR_GENERIC_ERROR; } } else { - if (!SecurityOrigin::canLoad(URL, String(), core([m_pluginView webFrame])->document())) + if (!SecurityOrigin::canDisplay(URL, String(), core([m_pluginView webFrame])->document())) return NPERR_GENERIC_ERROR; } diff --git a/WebKit/mac/Plugins/WebNetscapePluginStream.mm b/WebKit/mac/Plugins/WebNetscapePluginStream.mm index 5c1e8ee..35af439 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginStream.mm @@ -161,7 +161,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug WebNetscapePluginView *view = (WebNetscapePluginView *)plugin->ndata; // This check has already been done by the plug-in view. - ASSERT(SecurityOrigin::canLoad([request URL], String(), core([view webFrame])->document())); + ASSERT(SecurityOrigin::canDisplay([request URL], String(), core([view webFrame])->document())); ASSERT([request URL]); ASSERT(plugin); diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index a4481bc..e98c6b7 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -1728,7 +1728,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return NPERR_INVALID_PARAM; } } else { - if (!SecurityOrigin::canLoad(URL, String(), core([self webFrame])->document())) + if (!SecurityOrigin::canDisplay(URL, String(), core([self webFrame])->document())) return NPERR_GENERIC_ERROR; } diff --git a/WebKit/mac/Plugins/WebPluginContainerCheck.mm b/WebKit/mac/Plugins/WebPluginContainerCheck.mm index 5609d80..e273bfc 100644 --- a/WebKit/mac/Plugins/WebPluginContainerCheck.mm +++ b/WebKit/mac/Plugins/WebPluginContainerCheck.mm @@ -99,7 +99,7 @@ using namespace WebCore; { Frame* coreFrame = core([_controller webFrame]); ASSERT(coreFrame); - if (!SecurityOrigin::canLoad([_request URL], String(), coreFrame->document())) { + if (!SecurityOrigin::canDisplay([_request URL], String(), coreFrame->document())) { [self _continueWithPolicy:PolicyIgnore]; return YES; } diff --git a/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.h b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.h new file mode 100644 index 0000000..1cbc8e2 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProvider.h" +#import <WebCore/DeviceOrientationClient.h> + +namespace WebCore { +class DeviceOrientationController; +} + +@class WebView; + +// This class is the Mac implementation of DeviceOrientationClient. It is +// passed to the Page constructor by the WebView. It is a simple proxy to +// either the real or mock client which is passed to the WebView. It is +// required because the WebView must pass a client to the Page constructor, +// but the real or mock client can not be specified until after the Page has +// been constructed. +class WebDeviceOrientationClient : public WebCore::DeviceOrientationClient { +public: + WebDeviceOrientationClient(WebView*); + + // DeviceOrientationClient methods + virtual void setController(WebCore::DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual WebCore::DeviceOrientation* lastOrientation() const; + +private: + id<WebDeviceOrientationProvider> getProvider() const; + + WebView* m_webView; + WebCore::DeviceOrientationController* m_controller; + mutable id<WebDeviceOrientationProvider> m_provider; +}; diff --git a/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm new file mode 100644 index 0000000..278e835 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationClient.h" + +#import "WebDeviceOrientationInternal.h" +#import "WebDeviceOrientationProvider.h" +#import "WebViewInternal.h" +#import <objc/objc-runtime.h> + +using namespace WebCore; + +WebDeviceOrientationClient::WebDeviceOrientationClient(WebView* webView) + : m_webView(webView) + , m_controller(0) +{ +} + +void WebDeviceOrientationClient::setController(DeviceOrientationController* controller) +{ + // This is called by the Page constructor before our WebView has the provider set up. + // Cache the controller for later use. + m_controller = controller; +} + +void WebDeviceOrientationClient::startUpdating() +{ + [getProvider() startUpdating]; +} + +void WebDeviceOrientationClient::stopUpdating() +{ + [getProvider() stopUpdating]; +} + +DeviceOrientation* WebDeviceOrientationClient::lastOrientation() const +{ + return core([getProvider() lastOrientation]); +} + +id<WebDeviceOrientationProvider> WebDeviceOrientationClient::getProvider() const +{ + if (!m_provider) { + m_provider = [m_webView _deviceOrientationProvider]; + if ([m_provider respondsToSelector:@selector(setController:)]) + objc_msgSend(m_provider, @selector(setController:), m_controller); + } + return m_provider; +} diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index d932e66..cbb89ec 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -228,6 +228,8 @@ private: virtual bool canCachePage() const; + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + RetainPtr<WebFrame> m_webFrame; RetainPtr<WebFramePolicyListener> m_policyListener; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 3f7c471..dcbca28 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -47,6 +47,7 @@ #import "WebFormDelegate.h" #import "WebFrameInternal.h" #import "WebFrameLoadDelegate.h" +#import "WebFrameNetworkingContext.h" #import "WebFrameViewInternal.h" #import "WebHTMLRepresentationPrivate.h" #import "WebHTMLViewInternal.h" @@ -1904,6 +1905,11 @@ void WebFrameLoaderClient::didPerformFirstNavigation() const [preferences setCacheModel:WebCacheModelDocumentBrowser]; } +PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext() +{ + return WebFrameNetworkingContext::create(core(m_webFrame.get())); +} + #if ENABLE(JAVA_BRIDGE) jobject WebFrameLoaderClient::javaApplet(NSView* view) { diff --git a/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm index 941cfaa..98b8ce1 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm @@ -17,5 +17,30 @@ Boston, MA 02110-1301, USA. */ -// Checking this file in empty to get the build system work out of the way. -// Will put the code in here later. +#import "WebFrameNetworkingContext.h" + +#import <WebCore/Page.h> +#import <WebCore/ResourceError.h> +#import <WebCore/Settings.h> + +using namespace WebCore; + +bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const +{ + return frame() && frame()->settings() && frame()->settings()->needsSiteSpecificQuirks(); +} + +bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const +{ + return frame() && frame()->settings() && frame()->settings()->localFileContentSniffingEnabled(); +} + +SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const +{ + return frame() && frame()->page() ? frame()->page()->scheduledRunLoopPairs() : 0; +} + +ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const +{ + return frame()->loader()->blockedError(request); +} diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/WebKit/mac/WebCoreSupport/WebInspectorClient.h index d33e3b9..75a3cc6 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.h @@ -84,6 +84,7 @@ public: virtual void bringToFront(); virtual void closeWindow(); + virtual void disconnectFromBackend(); virtual void attachWindow(); virtual void detachWindow(); diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 7cae8fc..d4d0213 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -66,7 +66,7 @@ using namespace WebCore; - (void)setFrontendClient:(WebInspectorFrontendClient*)frontendClient; - (void)setInspectorClient:(WebInspectorClient*)inspectorClient; - (void)setAttachedWindowHeight:(unsigned)height; -- (void)destroyInspectorView; +- (void)destroyInspectorView:(bool)notifyInspectorController; @end #pragma mark - @@ -169,7 +169,12 @@ void WebInspectorFrontendClient::bringToFront() void WebInspectorFrontendClient::closeWindow() { - [m_windowController.get() destroyInspectorView]; + [m_windowController.get() destroyInspectorView:true]; +} + +void WebInspectorFrontendClient::disconnectFromBackend() +{ + [m_windowController.get() destroyInspectorView:false]; } void WebInspectorFrontendClient::attachWindow() @@ -308,7 +313,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const - (BOOL)windowShouldClose:(id)sender { - [self destroyInspectorView]; + [self destroyInspectorView:true]; return YES; } @@ -439,7 +444,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const [frameView setFrame:frameViewRect]; } -- (void)destroyInspectorView +- (void)destroyInspectorView:(bool)notifyInspectorController { if (_destroyingInspectorView) return; @@ -450,10 +455,12 @@ void WebInspectorFrontendClient::updateWindowTitle() const _visible = NO; - if (Page* inspectedPage = [_inspectedWebView page]) - inspectedPage->inspectorController()->disconnectFrontend(); + if (notifyInspectorController) { + if (Page* inspectedPage = [_inspectedWebView page]) + inspectedPage->inspectorController()->disconnectFrontend(); - _inspectorClient->releaseFrontendPage(); + _inspectorClient->releaseFrontendPage(); + } [_webView close]; } diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index a22179f..463ab00 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -7,6 +7,8 @@ .objc_class_name_WebDataSource .objc_class_name_WebDatabaseManager .objc_class_name_WebDefaultPolicyDelegate +.objc_class_name_WebDeviceOrientation +.objc_class_name_WebDeviceOrientationProviderMock .objc_class_name_WebDownload .objc_class_name_WebDynamicScrollBarsView .objc_class_name_WebFormDelegate diff --git a/WebKit/mac/WebView/WebDeviceOrientation.h b/WebKit/mac/WebView/WebDeviceOrientation.h new file mode 100644 index 0000000..ee04199 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientation.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +@class WebDeviceOrientationInternal; + +@interface WebDeviceOrientation : NSObject { + WebDeviceOrientationInternal* m_internal; +} + +- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma; + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientation.mm b/WebKit/mac/WebView/WebDeviceOrientation.mm new file mode 100644 index 0000000..7be5d0c --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientation.mm @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationInternal.h" + +using namespace WebCore; + +@implementation WebDeviceOrientationInternal + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<DeviceOrientation>)coreDeviceOrientation +{ + self = [super init]; + if (!self) + return nil; + m_orientation = coreDeviceOrientation; + return self; +} + +@end + +@implementation WebDeviceOrientation (Internal) + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:coreDeviceOrientation]; + return self; +} + +@end + +@implementation WebDeviceOrientation + +DeviceOrientation* core(WebDeviceOrientation* orientation) +{ + return orientation ? orientation->m_internal->m_orientation.get() : 0; +} + +- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientation::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)]; + return self; +} + +- (void)dealloc +{ + [m_internal release]; + [super dealloc]; +} + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationInternal.h b/WebKit/mac/WebView/WebDeviceOrientationInternal.h new file mode 100644 index 0000000..b7c6aa5 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationInternal.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientation.h" + +#import <WebCore/DeviceOrientation.h> +#import <wtf/RefPtr.h> + +@interface WebDeviceOrientationInternal : NSObject { +@public + RefPtr<WebCore::DeviceOrientation> m_orientation; +} + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation; +@end + +@interface WebDeviceOrientation (Internal) + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation; + +@end + +WebCore::DeviceOrientation* core(WebDeviceOrientation*); diff --git a/WebKit/mac/WebView/WebDeviceOrientationProvider.h b/WebKit/mac/WebView/WebDeviceOrientationProvider.h new file mode 100644 index 0000000..18b688c --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProvider.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +@class WebDeviceOrientation; + +@protocol WebDeviceOrientationProvider <NSObject> +- (void)startUpdating; +- (void)stopUpdating; +- (WebDeviceOrientation*)lastOrientation; +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h new file mode 100644 index 0000000..be5a764 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProvider.h" + +@class WebDeviceOrientationProviderMockInternal; +@class WebDeviceOrientation; + +@interface WebDeviceOrientationProviderMock : NSObject<WebDeviceOrientationProvider> { + WebDeviceOrientationProviderMockInternal* m_internal; +} + +- (id)init; +- (void)setOrientation:(WebDeviceOrientation*)orientation; + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm new file mode 100644 index 0000000..0435264 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProviderMockInternal.h" + +#import "WebDeviceOrientationInternal.h" + +using namespace WebCore; + +@implementation WebDeviceOrientationProviderMockInternal + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + m_core.set(new DeviceOrientationClientMock()); + return self; +} + +- (void)setOrientation:(WebDeviceOrientation*)orientation +{ + m_core->setOrientation(core(orientation)); +} + +- (void)setController:(DeviceOrientationController*)controller +{ + m_core->setController(controller); +} + +- (void)startUpdating +{ + m_core->startUpdating(); +} + +- (void)stopUpdating +{ + m_core->stopUpdating(); +} + +- (WebDeviceOrientation*)lastOrientation +{ + return [[WebDeviceOrientation alloc] initWithCoreDeviceOrientation:m_core->lastOrientation()]; +} + +@end + +@implementation WebDeviceOrientationProviderMock (Internal) + +- (void)setController:(WebCore::DeviceOrientationController*)controller +{ + [m_internal setController:controller]; +} + +@end + +@implementation WebDeviceOrientationProviderMock + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationProviderMockInternal alloc] init]; + return self; +} + +- (void)dealloc +{ + [super dealloc]; + [m_internal release]; +} + +- (void)setOrientation:(WebDeviceOrientation*)orientation +{ + [m_internal setOrientation:orientation]; +} + +- (void)startUpdating +{ + [m_internal startUpdating]; +} + +- (void)stopUpdating +{ + [m_internal stopUpdating]; +} + +- (WebDeviceOrientation*)lastOrientation +{ + return [m_internal lastOrientation]; +} + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h b/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h new file mode 100644 index 0000000..5ac38e5 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProviderMock.h" + +#import <WebCore/DeviceOrientationClientMock.h> +#import <wtf/OwnPtr.h> + +@interface WebDeviceOrientationProviderMockInternal : NSObject { + OwnPtr<WebCore::DeviceOrientationClientMock> m_core; +} + +- (id)init; + +- (void)setOrientation:(WebDeviceOrientation*)orientation; + +- (void)setController:(WebCore::DeviceOrientationController*)controller; + +- (void)startUpdating; +- (void)stopUpdating; +- (WebDeviceOrientation*)lastOrientation; +@end + +@interface WebDeviceOrientationProviderMock (Internal) +- (void)setController:(WebCore::DeviceOrientationController*)controller; +@end diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 1feb97e..8d564a3 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -60,7 +60,7 @@ #import <WebCore/Chrome.h> #import <WebCore/ColorMac.h> #import <WebCore/DOMImplementation.h> -#import <WebCore/DocLoader.h> +#import <WebCore/CachedResourceLoader.h> #import <WebCore/DocumentFragment.h> #import <WebCore/EventHandler.h> #import <WebCore/EventNames.h> @@ -529,7 +529,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSString *)_selectedString { - return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->selectedText()); + return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor()->selectedText()); } - (NSString *)_stringForRange:(DOMRange *)range @@ -662,7 +662,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSRect)_firstRectForDOMRange:(DOMRange *)range { - return _private->coreFrame->firstRectForRange(core(range)); + return _private->coreFrame->editor()->firstRectForRange(core(range)); } - (void)_scrollDOMRangeToVisible:(DOMRange *)range @@ -788,7 +788,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMRange *)_markDOMRange { - return kit(_private->coreFrame->mark().toNormalizedRange().get()); + return kit(_private->coreFrame->editor()->mark().toNormalizedRange().get()); } // Given proposedRange, returns an extended range that includes adjacent whitespace that should @@ -904,7 +904,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return; - _private->coreFrame->computeAndSetTypingStyle(core(style), undoAction); + _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction); } - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation @@ -1282,7 +1282,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return YES; - return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document()); + return SecurityOrigin::canDisplay(URL, String(), _private->coreFrame->document()); } - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world @@ -1366,6 +1366,40 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return coreFrame->layerTreeAsText(); } +static Node* spellingNode(Frame* coreFrame) +{ + Node* focusedNode = coreFrame->selection()->start().node(); + if (!focusedNode || !focusedNode->renderer()) + return 0; + + for (const RenderObject* renderer = focusedNode->renderer(); renderer; renderer = renderer->childAt(0)) { + if (renderer->isText()) + return renderer->node(); + } + return 0; +} + +- (BOOL)hasSpellingMarker:(int)from length:(int)length +{ + Frame* coreFrame = _private->coreFrame; + if (!coreFrame) + return NO; + + Node* node = spellingNode(coreFrame); + if (!node) + return NO; + + unsigned int startOffset = static_cast<unsigned int>(from); + unsigned int endOffset = static_cast<unsigned int>(from + length); + Vector<DocumentMarker> markers = coreFrame->document()->markers()->markersForNode(node); + for (size_t i = 0; i < markers.size(); ++i) { + DocumentMarker marker = markers[i]; + if (marker.startOffset <= startOffset && endOffset <= marker.endOffset && marker.type == DocumentMarker::Spelling) + return YES; + } + return NO; +} + @end @implementation WebFrame diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h index a1031f3..9cb6232 100644 --- a/WebKit/mac/WebView/WebFramePrivate.h +++ b/WebKit/mac/WebView/WebFramePrivate.h @@ -143,4 +143,7 @@ typedef enum { - (NSString*)_layerTreeAsText; +// Returns whether there is a spelling marker in the specified range of the focused node. +- (BOOL)hasSpellingMarker:(int)location length:(int)length; + @end diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm index 7843c9a..188747d 100644 --- a/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -212,7 +212,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) WebView *webView = [frame webView]; if ([webView isEditable]) - core(frame)->applyEditingStyleToBodyElement(); + core(frame)->editor()->applyEditingStyleToBodyElement(); } } diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 34745a1..bd71eff 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -4204,7 +4204,7 @@ static BOOL isInPasswordField(Frame* coreFrame) { Frame* coreFrame = core([self _frame]); NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"x" - attributes:coreFrame ? coreFrame->fontAttributesForSelectionStart() : nil]; + attributes:coreFrame ? coreFrame->editor()->fontAttributesForSelectionStart() : nil]; NSData *data = [string RTFFromRange:NSMakeRange(0, [string length]) documentAttributes:nil]; [string release]; return data; @@ -4831,7 +4831,7 @@ NSStrokeColorAttributeName /* NSColor, default nil: same as foreground co return; WritingDirection direction = RightToLeftWritingDirection; - switch (coreFrame->baseWritingDirectionForSelectionStart()) { + switch (coreFrame->editor()->baseWritingDirectionForSelectionStart()) { case NSWritingDirectionLeftToRight: break; case NSWritingDirectionRightToLeft: @@ -6167,7 +6167,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde if (![string length]) return NO; Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->findString(string, forward, caseFlag, wrapFlag, startInSelection); + return coreFrame && coreFrame->editor()->findString(string, forward, caseFlag, wrapFlag, startInSelection); } @end @@ -6197,7 +6197,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (!coreFrame) return 0; - return coreFrame->countMatchesForText(string, caseFlag, limit, markMatches); + return coreFrame->editor()->countMatchesForText(string, caseFlag, limit, markMatches); } - (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue @@ -6205,13 +6205,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (!coreFrame) return; - coreFrame->setMarkedTextMatchesAreHighlighted(newValue); + coreFrame->editor()->setMarkedTextMatchesAreHighlighted(newValue); } - (BOOL)markedTextMatchesAreHighlighted { Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->markedTextMatchesAreHighlighted(); + return coreFrame && coreFrame->editor()->markedTextMatchesAreHighlighted(); } - (void)unmarkAllTextMatches diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index 22752ae..4565a4e 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -32,6 +32,10 @@ #define ENABLE_DASHBOARD_SUPPORT 1 #endif +#if !defined(ENABLE_FULLSCREEN_API) +#define ENABLE_FULLSCREEN_API 1 +#endif + // Mail on Tiger expects the old value for WebMenuItemTagSearchInGoogle #define WebMenuItemTagSearchInGoogle OldWebMenuItemTagSearchWeb @@ -95,7 +99,7 @@ enum { - (void)deny; @end -#if ENABLE(FULLSCREEN_API) +#if ENABLE_FULLSCREEN_API @protocol WebKitFullScreenListener<NSObject> - (void)webkitWillEnterFullScreen; - (void)webkitDidEnterFullScreen; @@ -173,7 +177,7 @@ enum { */ - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; -#if ENABLE(FULLSCREEN_API) +#if ENABLE_FULLSCREEN_API - (BOOL)webView:(WebView *)sender supportsFullScreenForElement:(DOMElement *)element; - (void)webView:(WebView *)sender enterFullScreenForElement:(DOMElement *)element; - (void)webView:(WebView *)sender exitFullScreenForElement:(DOMElement *)element; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index f2e76c1..0125e1c 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -47,6 +47,8 @@ #import "WebDefaultPolicyDelegate.h" #import "WebDefaultUIDelegate.h" #import "WebDelegateImplementationCaching.h" +#import "WebDeviceOrientationClient.h" +#import "WebDeviceOrientationProvider.h" #import "WebDocument.h" #import "WebDocumentInternal.h" #import "WebDownload.h" @@ -683,6 +685,9 @@ static bool shouldEnableLoadDeferring() #if ENABLE(CLIENT_BASED_GEOLOCATION) pageClients.geolocationControllerClient = new WebGeolocationControllerClient(self); #endif +#if ENABLE(DEVICE_ORIENTATION) + pageClients.deviceOrientationClient = new WebDeviceOrientationClient(self); +#endif _private->page = new Page(pageClients); _private->page->setCanStartMedia([self window]); @@ -4375,11 +4380,17 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit { + if (_private->closed) + return 0; + return [self countMatchesForText:string caseSensitive:caseFlag highlight:highlight limit:limit markMatches:YES]; } - (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches { + if (_private->closed) + return 0; + WebFrame *frame = [self mainFrame]; unsigned matchCount = 0; do { @@ -4404,6 +4415,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (void)unmarkAllTextMatches { + if (_private->closed) + return; + WebFrame *frame = [self mainFrame]; do { id <WebDocumentView> view = [[frame frameView] documentView]; @@ -4416,6 +4430,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSArray *)rectsForTextMatches { + if (_private->closed) + return [NSArray array]; + NSMutableArray *result = [NSMutableArray array]; WebFrame *frame = [self mainFrame]; do { @@ -4749,7 +4766,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu Frame* mainFrame = [self _mainCoreFrame]; if (mainFrame) { if (flag) { - mainFrame->applyEditingStyleToBodyElement(); + mainFrame->editor()->applyEditingStyleToBodyElement(); // If the WebView is made editable and the selection is empty, set it to something. if (![self selectedDOMRange]) mainFrame->setSelectionFromNone(); @@ -5883,6 +5900,23 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity @end +@implementation WebView (WebViewDeviceOrientation) + +- (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider +{ + if (_private) + _private->m_deviceOrientationProvider = deviceOrientationProvider; +} + +- (id<WebDeviceOrientationProvider>)_deviceOrientationProvider +{ + if (_private) + return _private->m_deviceOrientationProvider; + return nil; +} + +@end + @implementation WebView (WebViewGeolocation) - (void)_setGeolocationProvider:(id<WebGeolocationProvider>)geolocationProvider diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 3b80a89..558770e 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -44,6 +44,7 @@ namespace WebCore { @class WebPreferences; @class WebTextCompletionController; @protocol WebFormDelegate; +@protocol WebDeviceOrientationProvider; @protocol WebGeolocationProvider; #if ENABLE(VIDEO) @class WebVideoFullscreenController; @@ -174,5 +175,6 @@ extern int pluginDatabaseClientCount; CFRunLoopObserverRef glibRunLoopObserver; #endif id<WebGeolocationProvider> _geolocationProvider; + id<WebDeviceOrientationProvider> m_deviceOrientationProvider; } @end diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index 28348cc..aeb36c7 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -44,12 +44,14 @@ @class NSError; @class WebFrame; +@class WebDeviceOrientation; @class WebGeolocationPosition; @class WebInspector; @class WebPreferences; @class WebScriptWorld; @class WebTextIterator; +@protocol WebDeviceOrientationProvider; @protocol WebFormDelegate; extern NSString *_WebCanGoBackKey; @@ -605,6 +607,11 @@ Could be worth adding to the API. - (BOOL)_selectionIsAll; @end +@interface WebView (WebViewDeviceOrientation) +- (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider; +- (id<WebDeviceOrientationProvider>)_deviceOrientationProvider; +@end + @protocol WebGeolocationProvider <NSObject> - (void)registerWebView:(WebView *)webView; - (void)unregisterWebView:(WebView *)webView; |