diff options
Diffstat (limited to 'WebKit')
87 files changed, 2477 insertions, 447 deletions
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 6efc8e5..07e6edb 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,365 @@ +2010-05-21 Tony Chang <tony@chromium.org> + + Reviewed by Ojan Vafai. + + [chromium] if keydown is prevented, don't update the IME and clear the IME state + https://bugs.webkit.org/show_bug.cgi?id=39475 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleCompositionEvent): + +2010-05-23 Roman Gershman <romange@google.com> + + Reviewed by Darin Fisher. + + [Chromium] Suggestion popup is not closed when the view is scrolled. + https://bugs.webkit.org/show_bug.cgi?id=38640 + + This bug appears on both Windows and Linux platforms. + Mac OS, however handles window messages differently and + closes popup menu in RenderWidgetHostViewMac::Destroy(). + + No tests were added because test_shell does not support suggestion + popup. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::invalidateContentsForSlowScroll): + (WebKit::ChromeClientImpl::scroll): + +2010-05-23 Marcus Bulach <bulach@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] Adds Geolocation support to DumpRenderTree. + https://bugs.webkit.org/show_bug.cgi?id=39440 + + Existing LayoutTests/fast/dom/Geolocation/* should pass. + + * public/WebGeolocationServiceMock.h: + * src/WebGeolocationServiceMock.cpp: + (WebKit::WebGeolocationServiceMock::setMockGeolocationPermission): + (WebKit::WebGeolocationServiceMock::requestPermissionForFrame): + (WebKit::WebGeolocationServiceMock::attachBridge): + (WebKit::WebGeolocationServiceMock::detachBridge): + +2010-05-22 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Link resources and load Ahem font for Windows + https://bugs.webkit.org/show_bug.cgi?id=39473 + + * WebKit.gyp: + Add net and webkit resources for Windows. + Copy AHEM____.TTF to DumpRenderTree.exe directory. + +2010-05-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add DeviceOrientation and DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=39479 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + +2010-05-20 Viet-Trung Luu <viettrungluu@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Don't rely on focused node to route mouse events to plugins. + https://bugs.webkit.org/show_bug.cgi?id=39375 + http://crbug.com/43935 + + On mouse down, do a hit test and check if a plugin was hit. If so, then + save the node for future mouse events (until mouse up or capture lost). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::mouseDown): + (WebKit::WebViewImpl::handleInputEvent): + (WebKit::WebViewImpl::mouseCaptureLost): + * src/WebViewImpl.h: Remove m_haveMouseCapture; add m_mouseCaptureNode. + +2010-05-20 Dominic Mazzoni <dmazzoni@chromium.org> + + Reviewed by Darin Fisher. + + Add headingLevel and setFocused methods. + + https://bugs.webkit.org/show_bug.cgi?id=39238 + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::headingLevel): + (WebKit::WebAccessibilityObject::setFocused): + +2010-05-20 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Map RGBA4/RGB5_A1 to RGBA and RGB565 to RGB in RenderbufferStorage + https://bugs.webkit.org/show_bug.cgi?id=39077 + + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::renderbufferStorage): Mapping the enums. + +2010-05-20 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Added method to WebSecurityOrigin for invoking + SecurityOrigin::canAccessPasswordManager. + https://bugs.webkit.org/show_bug.cgi?id=38916 + + * public/WebSecurityOrigin.h: + * src/WebSecurityOrigin.cpp: + (WebKit::WebSecurityOrigin::canAccessPasswordManager): + +2010-05-20 Darin Fisher <darin@chromium.org> + + Reviewed by Nate Chapin. + + [chromium] Provide a way to catch exceptions thrown while interacting + with a NPObject via WebBindings methods. + https://bugs.webkit.org/show_bug.cgi?id=39378 + + * public/WebBindings.h: + * src/WebBindings.cpp: + (WebKit::WebBindings::pushExceptionHandler): + (WebKit::WebBindings::popExceptionHandler): + +2010-05-20 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Rename GenericWorkerTask.h to CrossThreadTask.h and move it to dom directory. + https://bugs.webkit.org/show_bug.cgi?id=39135 + + * src/WebSharedWorkerImpl.cpp: + * src/WebWorkerBase.cpp: + * src/WebWorkerClientImpl.cpp: + * src/WebWorkerImpl.cpp: + +2010-05-20 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Ojan Vafai. + + Expose the editing behavior setting in DRT to test all editing code paths + https://bugs.webkit.org/show_bug.cgi?id=38603 + + * public/WebSettings.h: + (WebKit::WebSettings::): Added an enum for EditingBehavior types. + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setEditingBehavior): Added. + * src/WebSettingsImpl.h: + +2010-05-19 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + Modifying WebViewImpl to support new hardware compositing for + LayerChromium layers. + https://bugs.webkit.org/show_bug.cgi?id=38783 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::updateRootLayerContents): + (WebKit::WebViewImpl::setRootLayerNeedsDisplay): + +2010-05-19 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] disable spelling suggestions if spellcheck=false + https://bugs.webkit.org/show_bug.cgi?id=39402 + + This is the Chromium fix for bug 25639 that was fixed in the + other ports in r59585. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2010-05-19 Darin Fisher <darin@chromium.org> + + Revert r59790 due to failing Chromium npruntime tests. + + * public/WebBindings.h: + * src/WebBindings.cpp: + +2010-05-19 Darin Fisher <darin@chromium.org> + + Reviewed by Nate Chapin. + + [chromium] Provide a way to catch exceptions thrown while interacting + with a NPObject via WebBindings methods. + https://bugs.webkit.org/show_bug.cgi?id=39378 + + * public/WebBindings.h: + * src/WebBindings.cpp: + (WebKit::WebBindings::pushExceptionHandler): + (WebKit::WebBindings::popExceptionHandler): + +2010-05-19 Dirk Pranke <dpranke@chromium.org> + + Try again to roll out r58765. + + * public/WebNotification.h: + * src/WebNotification.cpp: + +2010-05-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r59782. + http://trac.webkit.org/changeset/59782 + https://bugs.webkit.org/show_bug.cgi?id=39379 + + broke DRT build (Requested by dpranke on #webkit). + + * public/WebNotification.h: + * src/WebNotification.cpp: + (WebKit::WebNotification::dir): + (WebKit::WebNotification::replaceId): + +2010-05-18 Dirk Pranke <dpranke@chromium.org> + + Reviewed by Dimitri Glazkov. + + Attempt to revert r58765 to see if it was causing a performance + regression. + + https://bugs.webkit.org/show_bug.cgi?id=39328 + + * public/WebNotification.h: + * src/WebNotification.cpp: + +2010-05-19 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + Remove obsolete ChromiumBridge code that routes FileSystem calls to WebKitClient. + https://bugs.webkit.org/show_bug.cgi?id=39332 + + * public/WebKitClient.h: + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::fileExists): + (WebCore::ChromiumBridge::deleteFile): + (WebCore::ChromiumBridge::deleteEmptyDirectory): + (WebCore::ChromiumBridge::getFileSize): + (WebCore::ChromiumBridge::getFileModificationTime): + (WebCore::ChromiumBridge::directoryName): + (WebCore::ChromiumBridge::pathByAppendingComponent): + (WebCore::ChromiumBridge::makeAllDirectories): + (WebCore::ChromiumBridge::getAbsolutePath): + (WebCore::ChromiumBridge::isDirectory): + (WebCore::ChromiumBridge::filePathToURL): + +2010-05-19 Marcus Bulach <bulach@chromium.org> + + Reviewed by Steve Block. + + [chromium] Adds supports for layout tests using GeolocationServiceMock. + https://bugs.webkit.org/show_bug.cgi?id=39081 + + Allows injection of GeolocationServiceMock factory. + Tests: existing fast/dom/Geolocation/* + + * WebKit.gyp: + * public/WebGeolocationServiceMock.h: Added. + * src/WebGeolocationServiceMock.cpp: Added. + (WebCore::GeolocationServiceChromiumMock::create): + (WebCore::GeolocationServiceChromiumMock::GeolocationServiceChromiumMock): + (WebCore::GeolocationServiceChromiumMock::startUpdating): + (WebCore::GeolocationServiceChromiumMock::stopUpdating): + (WebCore::GeolocationServiceChromiumMock::lastPosition): + (WebCore::GeolocationServiceChromiumMock::lastError): + (WebCore::GeolocationServiceChromiumMock::geolocationServicePositionChanged): + (WebCore::GeolocationServiceChromiumMock::geolocationServiceErrorOccurred): + (WebKit::WebGeolocationServiceMock::setMockGeolocationPosition): + (WebKit::WebGeolocationServiceMock::setMockGeolocationError): + +2010-05-17 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Hook Chromium's WebIndexedDatabaseImpl up to IndexedDatabaseImpl + https://bugs.webkit.org/show_bug.cgi?id=39216 + + Web____Impl is for re-entering the WebKit layer from the browser layer. + Thus the previous IDBCallbacksProxy was mis-named (and should have been + WebIDBCallbacksImpl). This patch renames it and then implements the + proper proxy (which is for going from WebCore to WebKit). + + Also change using security origin strings to using WebSecurityOrigin + objects. + + This patch also implements the glue between WebIndexedDatabaseImpl and + IndexedDatabaseImpl. + + * WebKit.gyp: + * src/IDBCallbacksProxy.cpp: + (WebCore::IDBCallbacksProxy::create): + (WebCore::IDBCallbacksProxy::IDBCallbacksProxy): + (WebCore::IDBCallbacksProxy::onError): + (WebCore::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + * src/IndexedDatabaseProxy.cpp: + (WebCore::IndexedDatabaseProxy::open): + * src/IndexedDatabaseProxy.h: + * src/WebIDBCallbacksImpl.cpp: Added. + (WebCore::WebIDBCallbacksImpl::WebIDBCallbacksImpl): + (WebCore::WebIDBCallbacksImpl::~WebIDBCallbacksImpl): + (WebCore::WebIDBCallbacksImpl::onError): + (WebCore::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: Added. + * src/WebIDBDatabaseImpl.cpp: Added. + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::~WebIDBDatabaseImpl): + * src/WebIDBDatabaseImpl.h: Added. + * src/WebIndexedDatabaseImpl.cpp: + (WebKit::WebIndexedDatabaseImpl::WebIndexedDatabaseImpl): + (WebKit::WebIndexedDatabaseImpl::open): + * src/WebIndexedDatabaseImpl.h: + +2010-05-18 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Fix a repaint issue and textarea tests + https://bugs.webkit.org/show_bug.cgi?id=39054 + + * DEPS: Update to Chromium r47248 to use a fix for CommandLine assertion + and textAreaResizeCorner.png + * WebKit.gyp: Add textAreaResizeCorner.png as a Mac resource + +2010-05-18 Tony Chang <tony@chromium.org> + + Reviewed by Ojan Vafai. + + [chromium] ignore IME events if the keydown event was prevented + https://bugs.webkit.org/show_bug.cgi?id=37692 + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleCompositionEvent): + +2010-05-18 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + [Chromium] Windows: Determinate progress bar should have glossy overlay + https://bugs.webkit.org/show_bug.cgi?id=39269 + + Changed WebThemeEngine::drawProgressBar() signature to delegate + theme implementation detail to the engine. + Chromium side will come to http://crbug.com/44430. + + No new tests, animation effect can be confirmed only manually. + + * public/WebThemeEngine.h: + (WebKit::WebThemeEngine::paintProgressBar): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::paintProgressBar): + 2010-05-16 Mike Belshe <mbelshe@chromium.org> Reviewed by Dimitri Glazkov. diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index 9e34fe4..c633a79 100644 --- a/WebKit/chromium/DEPS +++ b/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '46899', + 'chromium_rev': '47248', 'pthreads-win32_rev': '26716', } diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index 8ac5a90..94d7a46 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -47,6 +47,7 @@ 'chromium_src_dir': '../../../..', }], ], + 'ahem_path': '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF', }, 'targets': [ { @@ -126,6 +127,7 @@ 'public/WebFormElement.h', 'public/WebGeolocationService.h', 'public/WebGeolocationServiceBridge.h', + 'public/WebGeolocationServiceMock.h', 'public/WebGlyphCache.h', 'public/WebGLES2Context.h', 'public/WebGraphicsContext3D.h', @@ -337,13 +339,18 @@ 'src/WebFrameImpl.h', 'src/WebGeolocationServiceBridgeImpl.cpp', 'src/WebGeolocationServiceBridgeImpl.h', + 'src/WebGeolocationServiceMock.cpp', 'src/WebGlyphCache.cpp', 'src/WebGraphicsContext3D.cpp', 'src/WebGraphicsContext3DDefaultImpl.cpp', 'src/WebGraphicsContext3DDefaultImpl.h', 'src/WebHistoryItem.cpp', 'src/WebHTTPBody.cpp', + 'src/WebIDBCallbacksImpl.cpp', + 'src/WebIDBCallbacksImpl.h', 'src/WebIDBDatabaseError.cpp', + 'src/WebIDBDatabaseImpl.cpp', + 'src/WebIDBDatabaseImpl.h', 'src/WebImageCG.cpp', 'src/WebImageDecoder.cpp', 'src/WebImageSkia.cpp', @@ -573,11 +580,24 @@ '<@(drt_files)', ], 'conditions': [ + ['OS=="win"', { + 'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'], + 'sources': [ + '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc', + ], + 'copies': [{ + 'destination': '<(PRODUCT_DIR)', + 'files': ['<(ahem_path)'], + }], + }], ['OS=="mac"', { 'dependencies': ['LayoutTestHelper'], 'mac_bundle_resources': [ - '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF', + '<(ahem_path)', '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', @@ -587,6 +607,7 @@ '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', + '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', ], 'actions': [ { diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h index f46c0d8..191d40f 100644 --- a/WebKit/chromium/public/WebAccessibilityObject.h +++ b/WebKit/chromium/public/WebAccessibilityObject.h @@ -94,10 +94,12 @@ public: WebRect boundingBoxRect() const; WebString helpText() const; + int headingLevel() const; WebAccessibilityObject hitTest(const WebPoint&) const; WebString keyboardShortcut() const; bool performDefaultAction() const; WebAccessibilityRole roleValue() const; + void setFocused(bool) const; WebString stringValue() const; WebString title() const; diff --git a/WebKit/chromium/public/WebBindings.h b/WebKit/chromium/public/WebBindings.h index 4e66a8f..0fa3bfd 100644 --- a/WebKit/chromium/public/WebBindings.h +++ b/WebKit/chromium/public/WebBindings.h @@ -117,7 +117,7 @@ public: // NPN_UTF8FromIdentifier WEBKIT_API static NPUTF8* utf8FromIdentifier(NPIdentifier); - // Miscellaneous utility functions ------------------------------------ + // Miscellaneous utility functions ---------------------------------------- // Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data // structure. If isString is true upon return, string will be set but number's value is @@ -138,6 +138,15 @@ public: // Return true (success) if the given npobj is a range object. // If so, return that range as a WebRange object. WEBKIT_API static bool getRange(NPObject* range, WebRange*); + + // Exceptions ------------------------------------------------------------- + + typedef void (ExceptionHandler)(void* data, const NPUTF8* message); + + // The exception handler will be notified of any exceptions thrown while + // operating on a NPObject. + WEBKIT_API static void pushExceptionHandler(ExceptionHandler, void* data); + WEBKIT_API static void popExceptionHandler(); }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebGeolocationServiceMock.h b/WebKit/chromium/public/WebGeolocationServiceMock.h new file mode 100644 index 0000000..285f70c --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationServiceMock.h @@ -0,0 +1,60 @@ +/* + * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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. + */ + +#ifndef WebGeolocationServiceMock_h +#define WebGeolocationServiceMock_h + +#include "WebGeolocationService.h" +#include <wtf/HashMap.h> + +namespace WebKit { + +class WebString; + +class WebGeolocationServiceMock : public WebGeolocationService { +public: + static void setMockGeolocationPermission(bool allowed); + static void setMockGeolocationPosition(double latitude, double longitude, double accuracy); + static void setMockGeolocationError(int errorCode, const WebString& message); + + virtual void requestPermissionForFrame(int bridgeId, const WebURL& url); + virtual int attachBridge(WebGeolocationServiceBridge*); + virtual void detachBridge(int bridgeId); + +private: + typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap; + IdToBridgeMap m_idToBridgeMap; + + static bool s_mockGeolocationPermission; +}; + +} // namespace WebKit + +#endif // WebGeolocationServiceMock_h diff --git a/WebKit/chromium/public/WebIndexedDatabase.h b/WebKit/chromium/public/WebIndexedDatabase.h index 8861456..61b77a0 100644 --- a/WebKit/chromium/public/WebIndexedDatabase.h +++ b/WebKit/chromium/public/WebIndexedDatabase.h @@ -31,12 +31,15 @@ #include "WebCommon.h" #include "WebIDBCallbacks.h" +#include "WebSecurityOrigin.h" +#include "WebString.h" namespace WebKit { class WebFrame; class WebIDBDatabase; class WebString; +class WebSecurityOrigin; // The entry point into the IndexedDatabase API. These classes match their _____Request and // _____Sync counterparts in the spec, but operate only in an async manner. @@ -48,7 +51,17 @@ public: virtual ~WebIndexedDatabase() { } // The WebKit implementation of open ignores the WebFrame* parameter. - virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebString& origin, WebFrame*, int& exceptionCode) = 0; + virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, + WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode) + { + open(name, description, modifyDatabase, callbacks, origin.toString(), webFrame, exceptionCode); + } + // FIXME: Delete soon. Compatability hack. + virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, + WebIDBCallbacks* callbacks, const WebString& origin, WebFrame* webFrame, int& exceptionCode) + { + open(name, description, modifyDatabase, callbacks, WebSecurityOrigin::createFromString(origin), webFrame, exceptionCode); + } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h index 584679d..d1da883 100644 --- a/WebKit/chromium/public/WebKitClient.h +++ b/WebKit/chromium/public/WebKitClient.h @@ -95,23 +95,6 @@ public: const WebURL& url, bool isLocalStorage) { } - // File ---------------------------------------------------------------- - - // Various file/directory related functions. These map 1:1 with - // functions in WebCore's FileSystem.h. - virtual bool fileExists(const WebString& path) { return false; } - virtual bool deleteFile(const WebString& path) { return false; } - virtual bool deleteEmptyDirectory(const WebString& path) { return false; } - virtual bool getFileSize(const WebString& path, long long& result) { return false; } - virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } - virtual WebString directoryName(const WebString& path) { return WebString(); } - virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } - virtual bool makeAllDirectories(const WebString& path) { return false; } - virtual WebString getAbsolutePath(const WebString& path) { return WebString(); } - virtual bool isDirectory(const WebString& path) { return false; } - virtual WebURL filePathToURL(const WebString& path) { return WebURL(); } - - // History ------------------------------------------------------------- // Returns the hash for the given canonicalized URL for use in visited diff --git a/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h index ab747e3..9d64e2a 100644 --- a/WebKit/chromium/public/WebNotification.h +++ b/WebKit/chromium/public/WebNotification.h @@ -75,9 +75,6 @@ public: WEBKIT_API WebString title() const; WEBKIT_API WebString body() const; - WEBKIT_API WebString dir() const; - WEBKIT_API WebString replaceId() const; - // Called to indicate the notification has been displayed. WEBKIT_API void dispatchDisplayEvent(); diff --git a/WebKit/chromium/public/WebSecurityOrigin.h b/WebKit/chromium/public/WebSecurityOrigin.h index 76012a1..efcb2e9 100644 --- a/WebKit/chromium/public/WebSecurityOrigin.h +++ b/WebKit/chromium/public/WebSecurityOrigin.h @@ -90,7 +90,11 @@ public: // Returns a string representation of this WebSecurityOrigin that can // be used as a file. Should be used in storage APIs only. - WEBKIT_API WebString databaseIdentifier(); + WEBKIT_API WebString databaseIdentifier() const; + + // Returns true if this WebSecurityOrigin can access usernames and + // passwords stored in password manager. + WEBKIT_API bool canAccessPasswordManager() const; #if WEBKIT_IMPLEMENTATION WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h index 356d9fa..dd31ea0 100644 --- a/WebKit/chromium/public/WebSettings.h +++ b/WebKit/chromium/public/WebSettings.h @@ -43,6 +43,11 @@ class WebURL; // these functions have a 1:1 mapping with the methods in WebCore/page/settings.h. class WebSettings { public: + enum EditingBehavior { + EditingBehaviorMac, + EditingBehaviorWin + }; + virtual void setStandardFontFamily(const WebString&) = 0; virtual void setFixedFontFamily(const WebString&) = 0; virtual void setSerifFontFamily(const WebString&) = 0; @@ -84,6 +89,7 @@ public: virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; virtual void setExperimentalWebGLEnabled(bool) = 0; virtual void setShowDebugBorders(bool) = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; protected: ~WebSettings() { } diff --git a/WebKit/chromium/public/WebThemeEngine.h b/WebKit/chromium/public/WebThemeEngine.h index 606de09..9638c2f 100644 --- a/WebKit/chromium/public/WebThemeEngine.h +++ b/WebKit/chromium/public/WebThemeEngine.h @@ -77,8 +77,8 @@ public: const WebRect&) = 0; virtual void paintProgressBar( - WebCanvas*, const WebRect& barRect, - int valuePart, const WebRect& valueRect) {} + WebCanvas*, const WebRect& barRect, const WebRect& valueRect, + bool determinate, double animatedSeconds) {} #endif }; diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp index e7aeb49..fa7d73a 100644 --- a/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -41,6 +41,7 @@ #include "NotificationPresenter.h" #include "PasteboardPrivate.h" #include "PlatformCursor.h" +#include "Settings.h" #include "StringImpl.h" #include "TextAffinity.h" #include "WebAccessibilityObject.h" @@ -52,6 +53,7 @@ #include "WebMediaPlayer.h" #include "WebNotificationPresenter.h" #include "WebScrollbar.h" +#include "WebSettings.h" #include "WebTextAffinity.h" #include "WebTextCaseSensitivity.h" #include <wtf/Assertions.h> @@ -300,6 +302,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPage, ScrollByPage); COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByDocument, ScrollByDocument); COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPixel, ScrollByPixel); +COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorMac, EditingMacBehavior); +COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorWin, EditingWindowsBehavior); + COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM); COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM); diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 1a366bc..d54f328 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -500,6 +500,7 @@ void ChromeClientImpl::invalidateContentsAndWindow(const IntRect& updateRect, bo void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) { + m_webView->hidePopups(); invalidateContentsAndWindow(updateRect, immediate); } @@ -507,6 +508,7 @@ void ChromeClientImpl::scroll( const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) { + m_webView->hidePopups(); if (m_webView->client()) { int dx = scrollDelta.width(); int dy = scrollDelta.height(); diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index d188016..01e91a6 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -278,86 +278,61 @@ void ChromiumBridge::prefetchDNS(const String& hostname) bool ChromiumBridge::fileExists(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->fileExists(path); - return webKitClient()->fileExists(path); + return webKitClient()->fileSystem()->fileExists(path); } bool ChromiumBridge::deleteFile(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->deleteFile(path); - return webKitClient()->deleteFile(path); + return webKitClient()->fileSystem()->deleteFile(path); } bool ChromiumBridge::deleteEmptyDirectory(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->deleteEmptyDirectory(path); - return webKitClient()->deleteEmptyDirectory(path); + return webKitClient()->fileSystem()->deleteEmptyDirectory(path); } bool ChromiumBridge::getFileSize(const String& path, long long& result) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->getFileSize(path, result); - return webKitClient()->getFileSize(path, result); + return webKitClient()->fileSystem()->getFileSize(path, result); } bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) { double modificationTime; - if (webKitClient()->fileSystem()) { - if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime)) - return false; - } else { - if (!webKitClient()->getFileModificationTime(path, modificationTime)) - return false; - } + if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime)) + return false; result = static_cast<time_t>(modificationTime); return true; } String ChromiumBridge::directoryName(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->directoryName(path); - return webKitClient()->directoryName(path); + return webKitClient()->fileSystem()->directoryName(path); } String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->pathByAppendingComponent(path, component); - return webKitClient()->pathByAppendingComponent(path, component); + return webKitClient()->fileSystem()->pathByAppendingComponent(path, component); } bool ChromiumBridge::makeAllDirectories(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->makeAllDirectories(path); - return webKitClient()->makeAllDirectories(path); + return webKitClient()->fileSystem()->makeAllDirectories(path); } String ChromiumBridge::getAbsolutePath(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->getAbsolutePath(path); - return webKitClient()->getAbsolutePath(path); + return webKitClient()->fileSystem()->getAbsolutePath(path); } bool ChromiumBridge::isDirectory(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->isDirectory(path); - return webKitClient()->isDirectory(path); + return webKitClient()->fileSystem()->isDirectory(path); } KURL ChromiumBridge::filePathToURL(const String& path) { - if (webKitClient()->fileSystem()) - return webKitClient()->fileSystem()->filePathToURL(path); - return webKitClient()->filePathToURL(path); + return webKitClient()->fileSystem()->filePathToURL(path); } PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode) @@ -680,10 +655,10 @@ void ChromiumBridge::paintTrackbar( } void ChromiumBridge::paintProgressBar( - GraphicsContext* gc, const IntRect& barRect, int valuePart, const IntRect& valueRect) + GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds) { webKitClient()->themeEngine()->paintProgressBar( - gc->platformContext()->canvas(), barRect, valuePart, valueRect); + gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds); } #endif diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index b6005f9..8dd3393 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -203,7 +203,9 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( data.isEditable = true; if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { data.isSpellCheckingEnabled = true; - data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); + // Spellchecking might be enabled for the field, but could be disabled on the node. + if (m_webView->focusedWebCoreFrame()->editor()->spellCheckingEnabledInFocusedNode()) + data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } } diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp index 0346b58..2bdf140 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -29,11 +29,10 @@ #include "config.h" #include "IDBCallbacksProxy.h" -#include "IDBCallbacks.h" #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" #include "WebIDBCallbacks.h" -#include "WebIDBDatabase.h" +#include "WebIDBDatabaseImpl.h" #include "WebIDBDatabaseError.h" #include "WebSerializedScriptValue.h" @@ -41,7 +40,12 @@ namespace WebCore { -IDBCallbacksProxy::IDBCallbacksProxy(PassRefPtr<IDBCallbacks> callbacks) +PassRefPtr<IDBCallbacksProxy> IDBCallbacksProxy::create(PassOwnPtr<WebKit::WebIDBCallbacks> callbacks) +{ + return new IDBCallbacksProxy(callbacks); +} + +IDBCallbacksProxy::IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks> callbacks) : m_callbacks(callbacks) { } @@ -50,21 +54,21 @@ IDBCallbacksProxy::~IDBCallbacksProxy() { } -void IDBCallbacksProxy::onError(const WebKit::WebIDBDatabaseError& error) +void IDBCallbacksProxy::onError(PassRefPtr<IDBDatabaseError> idbDatabaseError) { - m_callbacks->onError(error); + m_callbacks->onError(WebKit::WebIDBDatabaseError(idbDatabaseError)); m_callbacks.clear(); } -void IDBCallbacksProxy::onSuccess(WebKit::WebIDBDatabase* webKitInstance) +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabase> idbDatabase) { - m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance)); + m_callbacks->onSuccess(new WebKit::WebIDBDatabaseImpl(idbDatabase)); m_callbacks.clear(); } -void IDBCallbacksProxy::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) +void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { - m_callbacks->onSuccess(serializedScriptValue); + m_callbacks->onSuccess(WebKit::WebSerializedScriptValue(serializedScriptValue)); m_callbacks.clear(); } diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h index 692b0a3..5d4bc0b 100644 --- a/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/WebKit/chromium/src/IDBCallbacksProxy.h @@ -29,33 +29,35 @@ #ifndef IDBCallbacksProxy_h #define IDBCallbacksProxy_h -#include "WebIDBCallbacks.h" +#include "IDBCallbacks.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #if ENABLE(INDEXED_DATABASE) namespace WebKit { -class WebIDBDatabase; -class WebIDBDatabaseError; -class WebSerializedScriptValue; +class WebIDBCallbacks; } namespace WebCore { -class IDBCallbacks; +class IDBDatabaseError; +class IDBDatabase; +class SerializedScriptValue; -class IDBCallbacksProxy : public WebKit::WebIDBCallbacks { +class IDBCallbacksProxy : public IDBCallbacks { public: - IDBCallbacksProxy(PassRefPtr<IDBCallbacks> callbacks); + static PassRefPtr<IDBCallbacksProxy> create(PassOwnPtr<WebKit::WebIDBCallbacks>); virtual ~IDBCallbacksProxy(); - virtual void onError(const WebKit::WebIDBDatabaseError& error); - virtual void onSuccess(WebKit::WebIDBDatabase* webKitInstance); - virtual void onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue); + virtual void onError(PassRefPtr<IDBDatabaseError>); + virtual void onSuccess(PassRefPtr<IDBDatabase>); + virtual void onSuccess(PassRefPtr<SerializedScriptValue>); private: - RefPtr<IDBCallbacks> m_callbacks; + IDBCallbacksProxy(PassOwnPtr<WebKit::WebIDBCallbacks>); + + OwnPtr<WebKit::WebIDBCallbacks> m_callbacks; }; diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.cpp b/WebKit/chromium/src/IndexedDatabaseProxy.cpp index a4bd0b1..aed7c13 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.cpp +++ b/WebKit/chromium/src/IndexedDatabaseProxy.cpp @@ -29,13 +29,10 @@ #include "config.h" #include "IndexedDatabaseProxy.h" -#include "Document.h" -#include "Frame.h" -#include "IDBCallbacksProxy.h" #include "IDBDatabaseError.h" #include "IDBDatabaseProxy.h" -#include "SecurityOrigin.h" #include "WebFrameImpl.h" +#include "WebIDBCallbacksImpl.h" #include "WebIDBDatabase.h" #include "WebIDBDatabaseError.h" #include "WebIndexedDatabase.h" @@ -60,12 +57,12 @@ IndexedDatabaseProxy::~IndexedDatabaseProxy() { } -void IndexedDatabaseProxy::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, Frame* frame, ExceptionCode& ec) +void IndexedDatabaseProxy::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame, ExceptionCode& ec) { if (!frame || !frame->document()) return; WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); - m_webIndexedDatabase->open(name, description, modifyDatabase, new IDBCallbacksProxy(callbacks), frame->document()->securityOrigin()->toString(), webFrame, ec); + m_webIndexedDatabase->open(name, description, modifyDatabase, new WebIDBCallbacksImpl(callbacks), origin, webFrame, ec); } } // namespace WebCore diff --git a/WebKit/chromium/src/IndexedDatabaseProxy.h b/WebKit/chromium/src/IndexedDatabaseProxy.h index 0c8674a..e372e9a 100644 --- a/WebKit/chromium/src/IndexedDatabaseProxy.h +++ b/WebKit/chromium/src/IndexedDatabaseProxy.h @@ -42,7 +42,7 @@ public: static PassRefPtr<IndexedDatabase> create(); virtual ~IndexedDatabaseProxy(); - virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, Frame*, ExceptionCode&); + virtual void open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, ExceptionCode&); private: IndexedDatabaseProxy(); diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp index c386d44..e59a1a2 100644 --- a/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -303,6 +303,15 @@ WebString WebAccessibilityObject::helpText() const return m_private->helpText(); } +int WebAccessibilityObject::headingLevel() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->headingLevel(); +} + WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) const { if (!m_private) @@ -368,6 +377,12 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const return static_cast<WebAccessibilityRole>(m_private->roleValue()); } +void WebAccessibilityObject::setFocused(bool on) const +{ + if (m_private) + m_private->setFocused(on); +} + WebString WebAccessibilityObject::stringValue() const { if (!m_private) diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp index 99e82a7..2b20c0a 100644 --- a/WebKit/chromium/src/WebBindings.cpp +++ b/WebKit/chromium/src/WebBindings.cpp @@ -45,6 +45,7 @@ #include "V8DOMWrapper.h" #include "V8Event.h" #include "V8Helpers.h" +#include "V8NPUtils.h" #include "V8Proxy.h" #include "V8Range.h" #elif USE(JSC) @@ -322,4 +323,14 @@ bool WebBindings::getRange(NPObject* range, WebRange* webrange) #endif } +void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data) +{ + WebCore::pushExceptionHandler(handler, data); +} + +void WebBindings::popExceptionHandler() +{ + WebCore::popExceptionHandler(); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebGeolocationServiceMock.cpp b/WebKit/chromium/src/WebGeolocationServiceMock.cpp new file mode 100644 index 0000000..2eed352 --- /dev/null +++ b/WebKit/chromium/src/WebGeolocationServiceMock.cpp @@ -0,0 +1,170 @@ +/* + * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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. + */ + +#include "config.h" +#include "WebGeolocationServiceMock.h" + +#include "GeolocationService.h" +#include "GeolocationServiceChromium.h" +#include "GeolocationServiceMock.h" +#include "WebString.h" +#include <wtf/CurrentTime.h> + +#if ENABLE(GEOLOCATION) + +using WebCore::Coordinates; +using WebCore::Frame; +using WebCore::Geolocation; +using WebCore::GeolocationServiceBridge; +using WebCore::GeolocationServiceChromium; +using WebCore::GeolocationServiceClient; +using WebCore::GeolocationServiceMock; +using WebCore::Geoposition; +using WebCore::PositionError; +using WebCore::PositionOptions; +using WebCore::String; + +namespace WebCore { +class GeolocationServiceChromiumMock : public GeolocationServiceChromium, public GeolocationServiceClient { +public: + static GeolocationService* create(GeolocationServiceClient*); + virtual bool startUpdating(PositionOptions*); + virtual void stopUpdating(); + virtual Geoposition* lastPosition() const; + virtual PositionError* lastError() const; + + virtual void geolocationServicePositionChanged(GeolocationService*); + virtual void geolocationServiceErrorOccurred(GeolocationService*); + +private: + explicit GeolocationServiceChromiumMock(GeolocationServiceClient*); + + GeolocationServiceClient* m_geolocationServiceClient; + OwnPtr<GeolocationService> m_geolocationServiceMock; +}; + +GeolocationService* GeolocationServiceChromiumMock::create(GeolocationServiceClient* geolocationServiceClient) +{ + return new GeolocationServiceChromiumMock(geolocationServiceClient); +} + +GeolocationServiceChromiumMock::GeolocationServiceChromiumMock(GeolocationServiceClient* geolocationServiceClient) + : GeolocationServiceChromium(geolocationServiceClient), + m_geolocationServiceClient(geolocationServiceClient) +{ + m_geolocationServiceMock.set(GeolocationServiceMock::create(this)); +} + +bool GeolocationServiceChromiumMock::startUpdating(PositionOptions* positionOptions) +{ + GeolocationServiceChromium::startUpdating(positionOptions); + return m_geolocationServiceMock->startUpdating(positionOptions); +} + +void GeolocationServiceChromiumMock::stopUpdating() +{ + GeolocationServiceChromium::stopUpdating(); + m_geolocationServiceMock->stopUpdating(); +} + +Geoposition* GeolocationServiceChromiumMock::lastPosition() const +{ + return m_geolocationServiceMock->lastPosition(); +} + +PositionError* GeolocationServiceChromiumMock::lastError() const +{ + return m_geolocationServiceMock->lastError(); +} + +void GeolocationServiceChromiumMock::geolocationServicePositionChanged(GeolocationService* geolocationService) +{ + ASSERT_UNUSED(geolocationService, geolocationService == m_geolocationServiceMock); + m_geolocationServiceClient->geolocationServicePositionChanged(this); + +} + +void GeolocationServiceChromiumMock::geolocationServiceErrorOccurred(GeolocationService* geolocationService) +{ + ASSERT_UNUSED(geolocationService, geolocationService == m_geolocationServiceMock); + m_geolocationServiceClient->geolocationServiceErrorOccurred(this); +} + +} // namespace WebCore + +namespace WebKit { + +bool WebGeolocationServiceMock::s_mockGeolocationPermission = false; + +void WebGeolocationServiceMock::setMockGeolocationPermission(bool allowed) +{ + s_mockGeolocationPermission = allowed; +} + +void WebGeolocationServiceMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy) +{ + WebCore::GeolocationService::setCustomMockFactory(&WebCore::GeolocationServiceChromiumMock::create); + RefPtr<Geoposition> geoposition = Geoposition::create(Coordinates::create(latitude, longitude, false, 0, accuracy, true, 0, false, 0, false, 0), currentTime() * 1000.0); + GeolocationServiceMock::setPosition(geoposition); +} + +void WebGeolocationServiceMock::setMockGeolocationError(int errorCode, const WebString& message) +{ + WebCore::GeolocationService::setCustomMockFactory(&WebCore::GeolocationServiceChromiumMock::create); + RefPtr<PositionError> positionError = PositionError::create(static_cast<PositionError::ErrorCode>(errorCode), message); + GeolocationServiceMock::setError(positionError); +} + +void WebGeolocationServiceMock::requestPermissionForFrame(int bridgeId, const WebURL& url) +{ + IdToBridgeMap::iterator iter = m_idToBridgeMap.find(bridgeId); + if (iter == m_idToBridgeMap.end()) + return; + iter->second->setIsAllowed(s_mockGeolocationPermission); +} + +int WebGeolocationServiceMock::attachBridge(WebGeolocationServiceBridge* bridge) +{ + static int nextAvailableWatchId = 1; + // In case of overflow, make sure the ID remains positive, but reuse the ID values. + if (nextAvailableWatchId < 1) + nextAvailableWatchId = 1; + m_idToBridgeMap.set(nextAvailableWatchId, bridge); + return nextAvailableWatchId++; +} + +void WebGeolocationServiceMock::detachBridge(int bridgeId) +{ + m_idToBridgeMap.remove(bridgeId); +} + +} // namespace WebKit + +#endif // ENABLE(GEOLOCATION) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 52bc645..e7e0c32 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -1215,10 +1215,21 @@ void WebGraphicsContext3DDefaultImpl::renderbufferStorage(unsigned long target, unsigned long height) { makeContextCurrent(); - if (internalformat == GL_DEPTH_STENCIL) + switch (internalformat) { + case GL_DEPTH_STENCIL: internalformat = GL_DEPTH24_STENCIL8_EXT; - else if (internalformat == GL_DEPTH_COMPONENT16) + break; + case GL_DEPTH_COMPONENT16: internalformat = GL_DEPTH_COMPONENT; + break; + case GL_RGBA4: + case GL_RGB5_A1: + internalformat = GL_RGBA; + break; + case 0x8D62: // GL_RGB565 + internalformat = GL_RGB; + break; + } glRenderbufferStorageEXT(target, internalformat, width, height); } diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp new file mode 100644 index 0000000..8f88cb6 --- /dev/null +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -0,0 +1,74 @@ +/* + * 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS 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. + */ + +#include "config.h" +#include "WebIDBCallbacksImpl.h" + +#include "IDBCallbacks.h" +#include "IDBDatabaseError.h" +#include "IDBDatabaseProxy.h" +#include "WebIDBCallbacks.h" +#include "WebIDBDatabase.h" +#include "WebIDBDatabaseError.h" +#include "WebSerializedScriptValue.h" + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks) + : m_callbacks(callbacks) +{ +} + +WebIDBCallbacksImpl::~WebIDBCallbacksImpl() +{ +} + +void WebIDBCallbacksImpl::onError(const WebKit::WebIDBDatabaseError& error) +{ + m_callbacks->onError(error); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance) +{ + m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance)); + m_callbacks.clear(); +} + +void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) +{ + m_callbacks->onSuccess(serializedScriptValue); + m_callbacks.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) + diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h new file mode 100644 index 0000000..9b53117 --- /dev/null +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -0,0 +1,65 @@ +/* + * 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS 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. + */ + +#ifndef WebIDBCallbacksImpl_h +#define WebIDBCallbacksImpl_h + +#include "WebIDBCallbacks.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebKit { +class WebIDBDatabase; +class WebIDBDatabaseError; +class WebSerializedScriptValue; +} + +namespace WebCore { + +class IDBCallbacks; + +class WebIDBCallbacksImpl : public WebKit::WebIDBCallbacks { +public: + WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks); + virtual ~WebIDBCallbacksImpl(); + + virtual void onError(const WebKit::WebIDBDatabaseError& error); + virtual void onSuccess(WebKit::WebIDBDatabase* webKitInstance); + virtual void onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue); + +private: + RefPtr<IDBCallbacks> m_callbacks; +}; + +} // namespace WebCore + +#endif + +#endif // WebIDBCallbacksImpl_h diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp new file mode 100644 index 0000000..e33edc2 --- /dev/null +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -0,0 +1,50 @@ +/* + * 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS 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. + */ + +#include "config.h" +#include "WebIDBDatabaseImpl.h" + +#include "IDBDatabase.h" + +#if ENABLE(INDEXED_DATABASE) + +using namespace WebCore; + +namespace WebKit { + +WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabase> idbDatabase) +{ +} + +WebIDBDatabaseImpl::~WebIDBDatabaseImpl() +{ +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h new file mode 100644 index 0000000..758f84a --- /dev/null +++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -0,0 +1,55 @@ +/* + * 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS 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. + */ + +#ifndef WebIDBDatabaseImpl_h +#define WebIDBDatabaseImpl_h + +#include "WebCommon.h" +#include "WebIDBDatabase.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { class IDBDatabase; } + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBDatabaseImpl : public WebIDBDatabase { +public: + WebIDBDatabaseImpl(WTF::PassRefPtr<WebCore::IDBDatabase> idbDatabase); + virtual ~WebIDBDatabaseImpl(); + + // FIXME: Implement. + +private: + WTF::RefPtr<WebCore::IDBDatabase> m_idbDatabase; +}; + +} // namespace WebKit + +#endif // WebIDBDatabaseImpl_h diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp index 4820cfb..99aad39 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.cpp @@ -31,11 +31,16 @@ #include "config.h" #include "WebIndexedDatabaseImpl.h" +#include "IDBCallbacksProxy.h" +#include "IndexedDatabaseImpl.h" +#include "SecurityOrigin.h" #include "WebIDBDatabaseError.h" #include <wtf/OwnPtr.h> #if ENABLE(INDEXED_DATABASE) +using namespace WebCore; + namespace WebKit { WebIndexedDatabase* WebIndexedDatabase::create() @@ -43,15 +48,18 @@ WebIndexedDatabase* WebIndexedDatabase::create() return new WebIndexedDatabaseImpl(); } +WebIndexedDatabaseImpl::WebIndexedDatabaseImpl() + : m_indexedDatabase(WebCore::IndexedDatabaseImpl::create()) +{ +} + WebIndexedDatabaseImpl::~WebIndexedDatabaseImpl() { } -void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks* callbacksPtr, const WebString& origin, WebFrame*, int& exceptionCode) +void WebIndexedDatabaseImpl::open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, int& exceptionCode) { - OwnPtr<WebIDBCallbacks> callbacks(callbacksPtr); - callbacks->onError(WebIDBDatabaseError(0, "Not implemented")); - // FIXME: Implement for realz. + m_indexedDatabase->open(name, description, modifyDatabase, IDBCallbacksProxy::create(callbacks), origin, 0, exceptionCode); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebIndexedDatabaseImpl.h b/WebKit/chromium/src/WebIndexedDatabaseImpl.h index 0402ede..57d20a6 100644 --- a/WebKit/chromium/src/WebIndexedDatabaseImpl.h +++ b/WebKit/chromium/src/WebIndexedDatabaseImpl.h @@ -30,14 +30,21 @@ #define WebIndexedDatabaseImpl_h #include "WebIndexedDatabase.h" +#include <wtf/RefPtr.h> + +namespace WebCore { class IndexedDatabase; } namespace WebKit { class WebIndexedDatabaseImpl : public WebIndexedDatabase { public: + WebIndexedDatabaseImpl(); virtual ~WebIndexedDatabaseImpl(); - virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebString& origin, WebFrame*, int& exceptionCode); + virtual void open(const WebString& name, const WebString& description, bool modifyDatabase, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, int& exceptionCode); + +private: + WTF::RefPtr<WebCore::IndexedDatabase> m_indexedDatabase; }; } // namespace WebKit diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp index 5ae1557..5200d17 100644 --- a/WebKit/chromium/src/WebNotification.cpp +++ b/WebKit/chromium/src/WebNotification.cpp @@ -94,16 +94,6 @@ WebString WebNotification::body() const return m_private->contents().body(); } -WebString WebNotification::dir() const -{ - return m_private->dir(); -} - -WebString WebNotification::replaceId() const -{ - return m_private->replaceId(); -} - void WebNotification::dispatchDisplayEvent() { RefPtr<Event> event = Event::create("display", false, true); diff --git a/WebKit/chromium/src/WebSecurityOrigin.cpp b/WebKit/chromium/src/WebSecurityOrigin.cpp index bc36be7..8685738 100644 --- a/WebKit/chromium/src/WebSecurityOrigin.cpp +++ b/WebKit/chromium/src/WebSecurityOrigin.cpp @@ -115,12 +115,18 @@ WebString WebSecurityOrigin::toString() const return m_private->toString(); } -WebString WebSecurityOrigin::databaseIdentifier() +WebString WebSecurityOrigin::databaseIdentifier() const { ASSERT(m_private); return m_private->databaseIdentifier(); } +bool WebSecurityOrigin::canAccessPasswordManager() const +{ + ASSERT(m_private); + return m_private->canAccessPasswordManager(); +} + WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) : m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())) { diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 3adf3ac..5f32346 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -269,4 +269,9 @@ void WebSettingsImpl::setShowDebugBorders(bool show) m_settings->setShowDebugBorders(show); } +void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior) +{ + m_settings->setEditingBehavior(static_cast<WebCore::EditingBehavior>(behavior)); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index fdc03f0..0a90091 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -85,6 +85,7 @@ public: virtual void setOfflineWebApplicationCacheEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); virtual void setShowDebugBorders(bool); + virtual void setEditingBehavior(EditingBehavior); private: WebCore::Settings* m_settings; diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/WebKit/chromium/src/WebSharedWorkerImpl.cpp index 91636d9..51bbf1b 100644 --- a/WebKit/chromium/src/WebSharedWorkerImpl.cpp +++ b/WebKit/chromium/src/WebSharedWorkerImpl.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebSharedWorkerImpl.h" -#include "GenericWorkerTask.h" +#include "CrossThreadTask.h" #include "KURL.h" #include "MessageEvent.h" #include "MessagePortChannel.h" diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 94cf36c..4e8b7c8 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -239,7 +239,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_suggestionsPopup(0) , m_isTransparent(false) , m_tabsToLinks(false) - , m_haveMouseCapture(false) #if USE(ACCELERATED_COMPOSITING) , m_layerRenderer(0) , m_isAcceleratedCompositingActive(false) @@ -255,13 +254,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) m_lastMousePosition = WebPoint(-1, -1); // the page will take ownership of the various clients - m_page.set(new Page(&m_chromeClientImpl, - &m_contextMenuClientImpl, - &m_editorClientImpl, - &m_dragClientImpl, - &m_inspectorClientImpl, - 0, - 0)); + m_page.set(new Page(&m_chromeClientImpl, &m_contextMenuClientImpl, &m_editorClientImpl, &m_dragClientImpl, &m_inspectorClientImpl, 0, 0, 0)); m_page->backForwardList()->setClient(&m_backForwardListClientImpl); m_page->setGroupName(pageGroupName); @@ -337,19 +330,23 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) } m_lastMouseDownPoint = WebPoint(event.x, event.y); - m_haveMouseCapture = true; - // If a text field that has focus is clicked again, we should display the - // suggestions popup. RefPtr<Node> clickedNode; if (event.button == WebMouseEvent::ButtonLeft) { + IntPoint point(event.x, event.y); + point = m_page->mainFrame()->view()->windowToContents(point); + HitTestResult result(m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false)); + Node* hitNode = result.innerNonSharedNode(); + + // Take capture on a mouse down on a plugin so we can send it mouse events. + if (hitNode && hitNode->renderer() && hitNode->renderer()->isEmbeddedObject()) + m_mouseCaptureNode = hitNode; + + // If a text field that has focus is clicked again, we should display the + // suggestions popup. RefPtr<Node> focusedNode = focusedWebCoreNode(); if (focusedNode.get() && toHTMLInputElement(focusedNode.get())) { - IntPoint point(event.x, event.y); - point = m_page->mainFrame()->view()->windowToContents(point); - HitTestResult result(point); - result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false); - if (result.innerNonSharedNode() == focusedNode) { + if (hitNode == focusedNode) { // Already focused text field was clicked, let's remember this. If // focus has not changed after the mouse event is processed, we'll // trigger the autocomplete. @@ -970,12 +967,19 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) // Draw the contents of the root layer. updateRootLayerContents(rect); - // Composite everything into the canvas that's passed to us. -#if PLATFORM(SKIA) - m_layerRenderer->drawLayersInCanvas(static_cast<skia::PlatformCanvas*>(canvas), IntRect(rect)); -#elif PLATFORM(CG) -#error "Need to implement CG version" -#endif + WebFrameImpl* webframe = mainFrameImpl(); + if (!webframe) + return; + FrameView* view = webframe->frameView(); + if (!view) + return; + + // The visibleRect includes scrollbars whereas the contentRect doesn't. + IntRect visibleRect = view->visibleContentRect(true); + IntRect contentRect = view->visibleContentRect(false); + + // Ask the layer compositor to redraw all the layers. + m_layerRenderer->drawLayers(rect, visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY())); } #endif } @@ -994,36 +998,36 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) if (m_ignoreInputEvents) return true; - if (m_haveMouseCapture && WebInputEvent::isMouseEventType(inputEvent.type)) { + if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.type)) { + // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. + RefPtr<Node> node = m_mouseCaptureNode; + // Not all platforms call mouseCaptureLost() directly. if (inputEvent.type == WebInputEvent::MouseUp) mouseCaptureLost(); - Node* node = focusedWebCoreNode(); - if (node && node->renderer() && node->renderer()->isEmbeddedObject()) { - AtomicString eventType; - switch (inputEvent.type) { - case WebInputEvent::MouseMove: - eventType = eventNames().mousemoveEvent; - break; - case WebInputEvent::MouseLeave: - eventType = eventNames().mouseoutEvent; - break; - case WebInputEvent::MouseDown: - eventType = eventNames().mousedownEvent; - break; - case WebInputEvent::MouseUp: - eventType = eventNames().mouseupEvent; - break; - default: - ASSERT_NOT_REACHED(); - } - - node->dispatchMouseEvent( - PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)), - eventType); - return true; + AtomicString eventType; + switch (inputEvent.type) { + case WebInputEvent::MouseMove: + eventType = eventNames().mousemoveEvent; + break; + case WebInputEvent::MouseLeave: + eventType = eventNames().mouseoutEvent; + break; + case WebInputEvent::MouseDown: + eventType = eventNames().mousedownEvent; + break; + case WebInputEvent::MouseUp: + eventType = eventNames().mouseupEvent; + break; + default: + ASSERT_NOT_REACHED(); } + + node->dispatchMouseEvent( + PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_cast<const WebMouseEvent*>(&inputEvent)), + eventType); + return true; } // FIXME: Remove m_currentInputEvent. @@ -1090,7 +1094,7 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) void WebViewImpl::mouseCaptureLost() { - m_haveMouseCapture = false; + m_mouseCaptureNode = 0; } void WebViewImpl::setFocus(bool enable) @@ -1178,7 +1182,11 @@ bool WebViewImpl::handleCompositionEvent(WebCompositionCommand command, return false; } - if (command == WebCompositionCommandDiscard) { + // If we're not going to fire a keypress event, then the keydown event was + // canceled. In that case, cancel any existing composition. + // FIXME: Ideally, we would only cancel a single keypress, rather than the + // whole composition. + if ((command == WebCompositionCommandDiscard) || m_suppressNextKeypressEvent) { // A browser process sent an IPC message which does not contain a valid // string, which means an ongoing composition has been canceled. // If the ongoing composition has been canceled, replace the ongoing @@ -2072,9 +2080,13 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) return; if (active) { - m_layerRenderer = LayerRendererChromium::create(); - if (m_layerRenderer) + m_layerRenderer = LayerRendererChromium::create(page()); + if (m_layerRenderer->hardwareCompositing()) m_isAcceleratedCompositingActive = true; + else { + m_layerRenderer.clear(); + m_isAcceleratedCompositingActive = false; + } } else { m_layerRenderer = 0; m_isAcceleratedCompositingActive = false; @@ -2086,6 +2098,12 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) if (!isAcceleratedCompositingActive()) return; + // FIXME: The accelerated compositing path invalidates a 1x1 rect at (0, 0) + // in order to get the renderer to ask the compositor to redraw. This is only + // temporary until we get the compositor to render directly from its own thread. + if (!rect.x && !rect.y && rect.width == 1 && rect.height == 1) + return; + WebFrameImpl* webframe = mainFrameImpl(); if (!webframe) return; @@ -2093,24 +2111,28 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) if (!view) return; - WebRect viewRect = view->frameRect(); - SkIRect scrollFrame; - scrollFrame.set(view->scrollX(), view->scrollY(), view->layoutWidth() + view->scrollX(), view->layoutHeight() + view->scrollY()); - m_layerRenderer->setScrollFrame(scrollFrame); LayerChromium* rootLayer = m_layerRenderer->rootLayer(); if (rootLayer) { IntRect visibleRect = view->visibleContentRect(true); - // Set the backing store size used by the root layer to be the size of the visible - // area. Note that the root layer bounds could be larger than the backing store size, - // but there's no reason to waste memory by allocating backing store larger than the - // visible portion. - rootLayer->setBackingStoreRect(IntSize(visibleRect.width(), visibleRect.height())); + // Update the root layer's backing store to be the size of the dirty rect. + // Unlike other layers the root layer doesn't have persistent storage for its + // contents in system memory. + rootLayer->setBackingStoreSize(IntSize(rect.width, rect.height)); GraphicsContext* rootLayerContext = rootLayer->graphicsContext(); + skia::PlatformCanvas* platformCanvas = rootLayer->platformCanvas(); + + platformCanvas->save(); + + // Bring the canvas into the coordinate system of the paint rect. + platformCanvas->translate(static_cast<SkScalar>(-rect.x), static_cast<SkScalar>(-rect.y)); + rootLayerContext->save(); webframe->paintWithContext(*(rootLayer->graphicsContext()), rect); rootLayerContext->restore(); + + platformCanvas->restore(); } } @@ -2119,8 +2141,10 @@ void WebViewImpl::setRootLayerNeedsDisplay() // FIXME: For now we're posting a repaint event for the entire page which is an overkill. if (WebFrameImpl* webframe = mainFrameImpl()) { if (FrameView* view = webframe->frameView()) { + // FIXME: Temporary hack to invalidate part of the page so that we get called to render + // again. IntRect visibleRect = view->visibleContentRect(true); - m_client->didInvalidateRect(visibleRect); + m_client->didInvalidateRect(IntRect(0, 0, 1, 1)); } } diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index b561e49..d545a42 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -490,7 +490,8 @@ private: NotificationPresenterImpl m_notificationPresenter; #endif - bool m_haveMouseCapture; + // If set, the (plugin) node which has mouse capture. + RefPtr<WebCore::Node> m_mouseCaptureNode; #if USE(ACCELERATED_COMPOSITING) OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer; diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index 1fedeb2..244cceb 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "WebWorkerBase.h" +#include "CrossThreadTask.h" #include "DatabaseTask.h" -#include "GenericWorkerTask.h" #include "MessagePortChannel.h" #include "PlatformMessagePortChannel.h" diff --git a/WebKit/chromium/src/WebWorkerClientImpl.cpp b/WebKit/chromium/src/WebWorkerClientImpl.cpp index d0dda8e..13b7fe6 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -33,11 +33,11 @@ #if ENABLE(WORKERS) +#include "CrossThreadTask.h" #include "DedicatedWorkerThread.h" #include "ErrorEvent.h" #include "Frame.h" #include "FrameLoaderClient.h" -#include "GenericWorkerTask.h" #include "MessageEvent.h" #include "MessagePort.h" #include "MessagePortChannel.h" diff --git a/WebKit/chromium/src/WebWorkerImpl.cpp b/WebKit/chromium/src/WebWorkerImpl.cpp index 5b5e053..857c50f 100644 --- a/WebKit/chromium/src/WebWorkerImpl.cpp +++ b/WebKit/chromium/src/WebWorkerImpl.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "WebWorkerImpl.h" +#include "CrossThreadTask.h" #include "DedicatedWorkerContext.h" #include "DedicatedWorkerThread.h" -#include "GenericWorkerTask.h" #include "KURL.h" #include "MessageEvent.h" #include "MessagePort.h" diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index e166b52..9db2729 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,104 @@ +2010-05-22 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt + https://bugs.webkit.org/show_bug.cgi?id=39465 + + Properly call EventHandler::dragSourceEndedAt so that dragEnd events are processed in the DOM. + dragSourceEndedAt is responsible for calling the dragEnd DOM event as well as cleaning up assets + (such as the Clipboard) associated with the drag source. + + * webkit/webkitwebview.cpp: + (webkit_web_view_drag_end): Remember to call dragSourceEndedAt here. + +2010-05-22 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] WebKit/gtk/WebCoreSupport/DragClientGtk::startDrag should use the Clipboard::sourceOperation + https://bugs.webkit.org/show_bug.cgi?id=39459 + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): + Use Clipboard::sourceOperation instead of trying to figure out the GdkDragAction + manually. The DOM may have changed the appropriate list of actions anyhow. + +2010-05-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add DeviceOrientation and DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=39479 + + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + +2010-05-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r59240. + http://trac.webkit.org/changeset/59240 + https://bugs.webkit.org/show_bug.cgi?id=39377 + + "Might cause crashes in GTK+ bots" (Requested by xan_ on + #webkit). + + * WebCoreSupport/ContextMenuClientGtk.cpp: + (WebKit::inputMethodsMenuItem): + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::EditorClient::setInputMethodState): + (WebKit::EditorClient::respondToChangedSelection): + (WebKit::EditorClient::handleInputMethodKeydown): + (WebKit::EditorClient::EditorClient): + (WebKit::EditorClient::~EditorClient): + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::postCommitFrameViewSetup): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (destroy_menu_cb): + (webkit_web_view_forward_context_menu_event): + (webkit_web_view_key_release_event): + (webkit_web_view_button_release_event): + (webkit_web_view_focus_in_event): + (webkit_web_view_focus_out_event): + (webkit_web_view_realize): + (webkit_web_view_set_scroll_adjustments): + (webkit_web_view_dispose): + (webkit_web_view_finalize): + (webViewGetDPI): + (webkit_web_view_screen_changed): + (webkit_web_view_query_tooltip): + (webkit_web_view_get_im_context): + (webkit_web_view_update_settings): + (webkit_web_view_init): + (webkit_web_view_set_settings): + (webkit_web_view_get_settings): + (webkit_web_view_get_inspector): + (webkit_web_view_set_window_features): + (webkit_web_view_get_window_features): + (webkit_web_view_get_back_forward_list): + (webkit_web_view_zoom_in): + (webkit_web_view_zoom_out): + (webkit_web_view_get_encoding): + (webkit_web_view_get_custom_encoding): + (webkit_web_view_add_resource): + (webkit_web_view_get_resource): + (webkit_web_view_get_main_resource): + (webkit_web_view_clear_resources): + (webkit_web_view_get_subresources): + (webkit_web_view_set_tooltip_text): + (webkit_web_view_get_icon_uri): + +2010-05-18 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] DragClientGtk::startDrag leaks GdkEvents + https://bugs.webkit.org/show_bug.cgi?id=39322 + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): Properly clean up allocated GdkEvent. + 2010-05-12 Martin Robinson <mrobinson@igalia.com> Reviewed by Xan Lopez. diff --git a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp index 069fb19..5c1bc0b 100644 --- a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp @@ -62,7 +62,7 @@ static GtkWidget* inputMethodsMenuItem (WebKitWebView* webView) WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); GtkWidget* imContextMenu = gtk_menu_new(); - gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(priv->imContext.get()), GTK_MENU_SHELL(imContextMenu)); + gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(priv->imContext), GTK_MENU_SHELL(imContextMenu)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), imContextMenu); diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index 900fb61..c1e8e74 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -20,8 +20,10 @@ #include "DragClientGtk.h" #include "ClipboardGtk.h" +#include "ClipboardUtilitiesGtk.h" #include "DataObjectGtk.h" #include "Document.h" +#include "DragController.h" #include "Element.h" #include "Frame.h" #include "GRefPtrGtk.h" @@ -71,25 +73,24 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, { ClipboardGtk* clipboardGtk = reinterpret_cast<ClipboardGtk*>(clipboard); - GdkDragAction dragAction = GDK_ACTION_COPY; - if (linkDrag) - dragAction = (GdkDragAction) (dragAction | GDK_ACTION_LINK); - WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject(); GRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get())); GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); - reinterpret_cast<GdkEventButton*>(event)->window = gtk_widget_get_window(GTK_WIDGET(m_webView)); - reinterpret_cast<GdkEventButton*>(event)->time = GDK_CURRENT_TIME; + // This will be decremented by gdk_event_free() below. + event->button.window = static_cast<GdkWindow*>(g_object_ref(gtk_widget_get_window(GTK_WIDGET(m_webView)))); + event->button.time = GDK_CURRENT_TIME; - GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragAction, 1, event); + GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, event); webView->priv->draggingDataObjects.set(context, dataObject); if (image) gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y()); else gtk_drag_set_icon_default(context); + + gdk_event_free(event); } DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*) diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp index d3f8fa1..a5c36e8 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp @@ -220,15 +220,15 @@ void EditorClient::setInputMethodState(bool active) WebKitWebViewPrivate* priv = m_webView->priv; if (active) - gtk_im_context_focus_in(priv->imContext.get()); + gtk_im_context_focus_in(priv->imContext); else - gtk_im_context_focus_out(priv->imContext.get()); + gtk_im_context_focus_out(priv->imContext); #ifdef MAEMO_CHANGES if (active) - hildon_gtk_im_context_show(priv->imContext.get()); + hildon_gtk_im_context_show(priv->imContext); else - hildon_gtk_im_context_hide(priv->imContext.get()); + hildon_gtk_im_context_hide(priv->imContext); #endif } @@ -367,7 +367,7 @@ void EditorClient::respondToChangedSelection() unsigned end; if (!targetFrame->editor()->getCompositionSelection(start, end)) { // gtk_im_context_reset() clears the composition for us. - gtk_im_context_reset(priv->imContext.get()); + gtk_im_context_reset(priv->imContext); targetFrame->editor()->confirmCompositionWithoutDisturbingSelection(); } } @@ -700,7 +700,7 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event) m_treatContextCommitAsKeyEvent = (!targetFrame->editor()->hasComposition()) && event->keyEvent()->gdkEventKey()->keyval; clearPendingComposition(); - if ((gtk_im_context_filter_keypress(priv->imContext.get(), event->keyEvent()->gdkEventKey()) && !m_pendingComposition) + if ((gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()) && !m_pendingComposition) || (!m_treatContextCommitAsKeyEvent && !targetFrame->editor()->hasComposition())) event->preventDefault(); @@ -714,8 +714,8 @@ EditorClient::EditorClient(WebKitWebView* webView) , m_nativeWidget(gtk_text_view_new()) { WebKitWebViewPrivate* priv = m_webView->priv; - g_signal_connect(priv->imContext.get(), "commit", G_CALLBACK(imContextCommitted), this); - g_signal_connect(priv->imContext.get(), "preedit-changed", G_CALLBACK(imContextPreeditChanged), this); + g_signal_connect(priv->imContext, "commit", G_CALLBACK(imContextCommitted), this); + g_signal_connect(priv->imContext, "preedit-changed", G_CALLBACK(imContextPreeditChanged), this); g_signal_connect(m_nativeWidget.get(), "backspace", G_CALLBACK(backspaceCallback), this); g_signal_connect(m_nativeWidget.get(), "cut-clipboard", G_CALLBACK(cutClipboardCallback), this); @@ -729,8 +729,8 @@ EditorClient::EditorClient(WebKitWebView* webView) EditorClient::~EditorClient() { WebKitWebViewPrivate* priv = m_webView->priv; - g_signal_handlers_disconnect_by_func(priv->imContext.get(), (gpointer)imContextCommitted, this); - g_signal_handlers_disconnect_by_func(priv->imContext.get(), (gpointer)imContextPreeditChanged, this); + g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextCommitted, this); + g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextPreeditChanged, this); } void EditorClient::textFieldDidBeginEditing(Element*) diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 1fe6b0f..fd2d7ed 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -1135,11 +1135,14 @@ static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, boo { WebKitWebView* containingWindow = getViewFromFrame(frame); WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow); - view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues); + view->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment, resetValues); if (priv->currentMenu) { - gtk_menu_popdown(priv->currentMenu.get()); - priv->currentMenu.clear(); + GtkMenu* menu = priv->currentMenu; + priv->currentMenu = 0; + + gtk_menu_popdown(menu); + g_object_unref(menu); } } diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index abca3c8..057b0e5 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -115,42 +115,42 @@ extern "C" { typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; struct _WebKitWebViewPrivate { WebCore::Page* corePage; - GRefPtr<WebKitWebSettings> webSettings; - GRefPtr<WebKitWebInspector> webInspector; - GRefPtr<WebKitWebWindowFeatures> webWindowFeatures; + WebKitWebSettings* webSettings; + WebKitWebInspector* webInspector; + WebKitWebWindowFeatures* webWindowFeatures; WebKitWebFrame* mainFrame; - GRefPtr<WebKitWebBackForwardList> backForwardList; + WebKitWebBackForwardList* backForwardList; - GRefPtr<GtkMenu> currentMenu; + GtkMenu* currentMenu; gint lastPopupXPosition; gint lastPopupYPosition; HashSet<GtkWidget*> children; bool editable; - GRefPtr<GtkIMContext> imContext; + GtkIMContext* imContext; gboolean transparent; - GRefPtr<GtkAdjustment> horizontalAdjustment; - GRefPtr<GtkAdjustment> verticalAdjustment; + GtkAdjustment* horizontalAdjustment; + GtkAdjustment* verticalAdjustment; gboolean zoomFullContent; WebKitLoadStatus loadStatus; - GOwnPtr<char> encoding; - GOwnPtr<char> customEncoding; + char* encoding; + char* customEncoding; - GOwnPtr<char> iconURI; + char* iconURI; gboolean disposing; gboolean usePrimaryForPaste; // These are hosted here because the DataSource object is // created too late in the frame loading process. - GRefPtr<WebKitWebResource> mainResource; - GOwnPtr<char> mainResourceIdentifier; - GRefPtr<GHashTable> subResources; - GOwnPtr<char> tooltipText; + WebKitWebResource* mainResource; + char* mainResourceIdentifier; + GHashTable* subResources; + char* tooltipText; HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> > draggingDataObjects; }; diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index ca72665..f3bb5e6 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -44,6 +44,7 @@ #include "BackForwardList.h" #include "Cache.h" #include "ChromeClientGtk.h" +#include "ClipboardUtilitiesGtk.h" #include "ContextMenuClientGtk.h" #include "ContextMenuController.h" #include "ContextMenu.h" @@ -204,7 +205,9 @@ static void destroy_menu_cb(GtkObject* object, gpointer data) { WebKitWebView* webView = WEBKIT_WEB_VIEW(data); WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); - priv->currentMenu = 0; + + g_object_unref(priv->currentMenu); + priv->currentMenu = NULL; } static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData) @@ -294,7 +297,7 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie return FALSE; WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); - priv->currentMenu = menu; + priv->currentMenu = GTK_MENU(g_object_ref(menu)); priv->lastPopupXPosition = event.globalX(); priv->lastPopupYPosition = event.globalY(); @@ -568,7 +571,7 @@ static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey // the event if we don't have a pending composition, because that means we // are using a context like 'simple' which marks every keystroke as filtered. WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient()); - if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition()) + if (gtk_im_context_filter_keypress(webView->priv->imContext, event) && !client->hasPendingComposition()) return TRUE; Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); @@ -625,7 +628,7 @@ static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEvent if (focusedFrame && focusedFrame->editor()->canEdit()) { #ifdef MAEMO_CHANGES WebKitWebViewPrivate* priv = webView->priv; - hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event); + hildon_gtk_im_context_filter_event(priv->imContext, (GdkEvent*)event); #endif } @@ -728,7 +731,7 @@ static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* else focusController->setFocusedFrame(core(webView)->mainFrame()); - gtk_im_context_focus_in(webView->priv->imContext.get()); + gtk_im_context_focus_in(webView->priv->imContext); } return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event); } @@ -746,7 +749,7 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus } if (webView->priv->imContext) - gtk_im_context_focus_out(webView->priv->imContext.get()); + gtk_im_context_focus_out(webView->priv->imContext); return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event); } @@ -785,7 +788,7 @@ static void webkit_web_view_realize(GtkWidget* widget) WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; - gtk_im_context_set_client_window(priv->imContext.get(), widget->window); + gtk_im_context_set_client_window(priv->imContext, widget->window); } static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj) @@ -794,7 +797,19 @@ static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAd return; FrameView* view = core(webkit_web_view_get_main_frame(webView))->view(); + + if (hadj) + g_object_ref(hadj); + if (vadj) + g_object_ref(vadj); + WebKitWebViewPrivate* priv = webView->priv; + + if (priv->horizontalAdjustment) + g_object_unref(priv->horizontalAdjustment); + if (priv->verticalAdjustment) + g_object_unref(priv->verticalAdjustment); + priv->horizontalAdjustment = hadj; priv->verticalAdjustment = vadj; @@ -1062,6 +1077,21 @@ static void webkit_web_view_dispose(GObject* object) priv->disposing = TRUE; + if (priv->horizontalAdjustment) { + g_object_unref(priv->horizontalAdjustment); + priv->horizontalAdjustment = NULL; + } + + if (priv->verticalAdjustment) { + g_object_unref(priv->verticalAdjustment); + priv->verticalAdjustment = NULL; + } + + if (priv->backForwardList) { + g_object_unref(priv->backForwardList); + priv->backForwardList = NULL; + } + if (priv->corePage) { webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object)); @@ -1071,18 +1101,30 @@ static void webkit_web_view_dispose(GObject* object) } if (priv->webSettings) { - g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); - priv->webSettings.clear(); + g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView); + g_object_unref(priv->webSettings); + priv->webSettings = NULL; + + g_object_unref(priv->webInspector); + priv->webInspector = NULL; + + g_object_unref(priv->webWindowFeatures); + priv->webWindowFeatures = NULL; + + g_object_unref(priv->imContext); + priv->imContext = NULL; + } + + if (priv->mainResource) { + g_object_unref(priv->mainResource); + priv->mainResource = NULL; + } + + if (priv->subResources) { + g_hash_table_unref(priv->subResources); + priv->subResources = NULL; } - priv->horizontalAdjustment.clear(); - priv->verticalAdjustment.clear(); - priv->backForwardList.clear(); - priv->webInspector.clear(); - priv->webWindowFeatures.clear(); - priv->imContext.clear(); - priv->mainResource.clear(); - priv->subResources.clear(); priv->draggingDataObjects.clear(); G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); @@ -1093,11 +1135,11 @@ static void webkit_web_view_finalize(GObject* object) WebKitWebView* webView = WEBKIT_WEB_VIEW(object); WebKitWebViewPrivate* priv = webView->priv; - priv->tooltipText.clear(); - priv->mainResourceIdentifier.clear(); - priv->encoding.clear(); - priv->customEncoding.clear(); - priv->iconURI.clear(); + g_free(priv->tooltipText); + g_free(priv->mainResourceIdentifier); + g_free(priv->encoding); + g_free(priv->customEncoding); + g_free(priv->iconURI); G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); } @@ -1148,7 +1190,7 @@ static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) static gdouble webViewGetDPI(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; - WebKitWebSettings* webSettings = priv->webSettings.get(); + WebKitWebSettings* webSettings = priv->webSettings; gboolean enforce96DPI; g_object_get(webSettings, "enforce-96-dpi", &enforce96DPI, NULL); if (enforce96DPI) @@ -1174,7 +1216,7 @@ static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previou if (priv->disposing) return; - WebKitWebSettings* webSettings = priv->webSettings.get(); + WebKitWebSettings* webSettings = priv->webSettings; Settings* settings = core(webView)->settings(); gdouble DPI = webViewGetDPI(webView); @@ -1195,14 +1237,37 @@ static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previou static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context) { - WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(WEBKIT_WEB_VIEW(widget)); + WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); + WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); // This might happen if a drag is still in progress after a WebKitWebView - // is diposed and before it is finalized. + // is disposed and before it is finalized. if (!priv->draggingDataObjects.contains(context)) return; priv->draggingDataObjects.remove(context); + + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + if (!frame) + return; + + GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE); + int x, y, xRoot, yRoot; + GdkModifierType modifiers; + GdkDisplay* display = gdk_display_get_default(); + gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers); + + event->button.window = static_cast<GdkWindow*>(g_object_ref(gdk_display_get_window_at_pointer(display, &x, &y))); + event->button.x = x; + event->button.y = y; + event->button.x_root = xRoot; + event->button.y_root = yRoot; + event->button.state = modifiers; + + PlatformMouseEvent platformEvent(&event->button); + frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(context->action)); + + gdk_event_free(event); } static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint) @@ -1223,7 +1288,7 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(widget); if (priv->tooltipText) { - gtk_tooltip_set_text(tooltip, priv->tooltipText.get()); + gtk_tooltip_set_text(tooltip, priv->tooltipText); return TRUE; } @@ -1234,7 +1299,7 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - return GTK_IM_CONTEXT(webView->priv->imContext.get()); + return GTK_IM_CONTEXT(webView->priv->imContext); } static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) @@ -2550,7 +2615,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) static void webkit_web_view_update_settings(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; - WebKitWebSettings* webSettings = priv->webSettings.get(); + WebKitWebSettings* webSettings = priv->webSettings; Settings* settings = core(webView)->settings(); gchar* defaultEncoding, *cursiveFontFamily, *defaultFontFamily, *fantasyFontFamily, *monospaceFontFamily, *sansSerifFontFamily, *serifFontFamily, *userStylesheetUri; @@ -2754,36 +2819,40 @@ static void webkit_web_view_init(WebKitWebView* webView) WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); webView->priv = priv; - priv->imContext = adoptGRef(gtk_im_multicontext_new()); + priv->imContext = gtk_im_multicontext_new(); WebKit::InspectorClient* inspectorClient = new WebKit::InspectorClient(webView); - priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0, 0); + priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0, 0, 0); // We also add a simple wrapper class to provide the public // interface for the Web Inspector. - priv->webInspector = adoptGRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL))); - webkit_web_inspector_set_inspector_client(priv->webInspector.get(), priv->corePage); + priv->webInspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL)); + webkit_web_inspector_set_inspector_client(priv->webInspector, priv->corePage); - // These are create with floating references, so they should not be wrapped in adoptGref. priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); + g_object_ref_sink(priv->horizontalAdjustment); + g_object_ref_sink(priv->verticalAdjustment); + GTK_WIDGET_SET_FLAGS(webView, GTK_CAN_FOCUS); priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView)); priv->lastPopupXPosition = priv->lastPopupYPosition = -1; priv->editable = false; - priv->backForwardList = adoptGRef(webkit_web_back_forward_list_new_with_web_view(webView)); + priv->backForwardList = webkit_web_back_forward_list_new_with_web_view(webView); priv->zoomFullContent = FALSE; - priv->webSettings = adoptGRef(webkit_web_settings_new()); + priv->webSettings = webkit_web_settings_new(); webkit_web_view_update_settings(webView); - g_signal_connect(priv->webSettings.get(), "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); + g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); - priv->webWindowFeatures = adoptGRef(webkit_web_window_features_new()); + priv->webWindowFeatures = webkit_web_window_features_new(); - priv->subResources = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref)); + priv->subResources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); + + priv->tooltipText = 0; } GtkWidget* webkit_web_view_new(void) @@ -2839,7 +2908,9 @@ void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* web g_return_if_fail(WEBKIT_IS_WEB_SETTINGS(webSettings)); WebKitWebViewPrivate* priv = webView->priv; - g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); + g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView); + g_object_unref(priv->webSettings); + g_object_ref(webSettings); priv->webSettings = webSettings; webkit_web_view_update_settings(webView); g_signal_connect(webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); @@ -2851,7 +2922,7 @@ WebKitWebSettings* webkit_web_view_get_settings(WebKitWebView* webView) g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); WebKitWebViewPrivate* priv = webView->priv; - return priv->webSettings.get(); + return priv->webSettings; } /** @@ -2875,7 +2946,7 @@ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView) g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); WebKitWebViewPrivate* priv = webView->priv; - return priv->webInspector.get(); + return priv->webInspector; } // internal @@ -2886,9 +2957,11 @@ static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWe if (!webWindowFeatures) return; - if (webkit_web_window_features_equal(priv->webWindowFeatures.get(), webWindowFeatures)) + if (webkit_web_window_features_equal(priv->webWindowFeatures, webWindowFeatures)) return; + g_object_unref(priv->webWindowFeatures); + g_object_ref(webWindowFeatures); priv->webWindowFeatures = webWindowFeatures; } @@ -2908,7 +2981,7 @@ WebKitWebWindowFeatures* webkit_web_view_get_window_features(WebKitWebView* webV g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); WebKitWebViewPrivate* priv = webView->priv; - return priv->webWindowFeatures.get(); + return priv->webWindowFeatures; } /** @@ -2978,7 +3051,7 @@ WebKitWebBackForwardList* webkit_web_view_get_back_forward_list(WebKitWebView* w if (!core(webView) || !core(webView)->backForwardList()->enabled()) return NULL; - return priv->backForwardList.get(); + return priv->backForwardList; } /** @@ -3738,7 +3811,7 @@ void webkit_web_view_zoom_in(WebKitWebView* webView) WebKitWebViewPrivate* priv = webView->priv; gfloat zoomMultiplierRatio; - g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL); + g_object_get(priv->webSettings, "zoom-step", &zoomMultiplierRatio, NULL); webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) + zoomMultiplierRatio); } @@ -3759,7 +3832,7 @@ void webkit_web_view_zoom_out(WebKitWebView* webView) WebKitWebViewPrivate* priv = webView->priv; gfloat zoomMultiplierRatio; - g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL); + g_object_get(priv->webSettings, "zoom-step", &zoomMultiplierRatio, NULL); webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) - zoomMultiplierRatio); } @@ -3874,8 +3947,9 @@ const gchar* webkit_web_view_get_encoding(WebKitWebView* webView) if (!encoding.isEmpty()) { WebKitWebViewPrivate* priv = webView->priv; - priv->encoding.set(g_strdup(encoding.utf8().data())); - return priv->encoding.get(); + g_free(priv->encoding); + priv->encoding = g_strdup(encoding.utf8().data()); + return priv->encoding; } else return NULL; } @@ -3916,8 +3990,9 @@ const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView) if (!overrideEncoding.isEmpty()) { WebKitWebViewPrivate* priv = webView->priv; - priv->customEncoding.set(g_strdup(overrideEncoding.utf8().data())); - return priv->customEncoding.get(); + g_free (priv->customEncoding); + priv->customEncoding = g_strdup(overrideEncoding.utf8().data()); + return priv->customEncoding; } else return NULL; } @@ -4072,11 +4147,11 @@ void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebK if (!priv->mainResource) { priv->mainResource = webResource; - priv->mainResourceIdentifier.set(g_strdup(identifier)); + priv->mainResourceIdentifier = g_strdup(identifier); return; } - g_hash_table_insert(priv->subResources.get(), identifier, webResource); + g_hash_table_insert(priv->subResources, identifier, webResource); } WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* identifier) @@ -4084,13 +4159,13 @@ WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* id WebKitWebViewPrivate* priv = webView->priv; gpointer webResource = NULL; - gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources.get(), identifier, NULL, &webResource); + gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources, identifier, NULL, &webResource); // The only resource we do not store in this hash table is the // main! If we did not find a request, it probably means the load // has been interrupted while while a resource was still being // loaded. - if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier.get())) + if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier)) return NULL; if (!webResource) @@ -4101,24 +4176,30 @@ WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* id WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView) { - return webView->priv->mainResource.get(); + return webView->priv->mainResource; } void webkit_web_view_clear_resources(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; - priv->mainResourceIdentifier.clear(); - priv->mainResource.clear(); + + g_free(priv->mainResourceIdentifier); + priv->mainResourceIdentifier = NULL; + + if (priv->mainResource) { + g_object_unref(priv->mainResource); + priv->mainResource = NULL; + } if (priv->subResources) - g_hash_table_remove_all(priv->subResources.get()); + g_hash_table_remove_all(priv->subResources); } GList* webkit_web_view_get_subresources(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; - GList* subResources = g_hash_table_get_values(priv->subResources.get()); - return g_list_remove(subResources, priv->mainResource.get()); + GList* subResources = g_hash_table_get_values(priv->subResources); + return g_list_remove(subResources, priv->mainResource); } /* From EventHandler.cpp */ @@ -4134,11 +4215,12 @@ void webkit_web_view_set_tooltip_text(WebKitWebView* webView, const char* toolti { #if GTK_CHECK_VERSION(2, 12, 0) WebKitWebViewPrivate* priv = webView->priv; + g_free(priv->tooltipText); if (tooltip && *tooltip != '\0') { - priv->tooltipText.set(g_strdup(tooltip)); + priv->tooltipText = g_strdup(tooltip); gtk_widget_set_has_tooltip(GTK_WIDGET(webView), TRUE); } else { - priv->tooltipText.clear(); + priv->tooltipText = 0; gtk_widget_set_has_tooltip(GTK_WIDGET(webView), FALSE); } @@ -4196,8 +4278,9 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView) String iconURL = iconDatabase()->iconURLForPageURL(corePage->mainFrame()->loader()->url().prettyURL()); WebKitWebViewPrivate* priv = webView->priv; - priv->iconURI.set(g_strdup(iconURL.utf8().data())); - return priv->iconURI.get(); + g_free(priv->iconURI); + priv->iconURI = g_strdup(iconURL.utf8().data()); + return priv->iconURI; } /** diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index f43aa5a..510ccfd 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,198 @@ +2010-05-21 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=39420 + + Make sure everyone who needs to is using visitedDependentColor rather than accessing styles + directly. + + * Misc/WebNSAttributedStringExtras.mm: + (+[NSAttributedString _web_attributedStringFromRange:]): + * WebView/WebFrame.mm: + (-[WebFrame _bodyBackgroundColor]): + +2010-05-21 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoffrey Garen. + + All callable objects should have a global object reference + https://bugs.webkit.org/show_bug.cgi?id=39495 + + Update the plugin proxy to handle the need for global object. + + * Plugins/Hosted/ProxyInstance.mm: + (WebKit::ProxyInstance::newRuntimeObject): + (WebKit::ProxyRuntimeMethod::ProxyRuntimeMethod): + (WebKit::ProxyInstance::getMethod): + * Plugins/Hosted/ProxyRuntimeObject.h: + * Plugins/Hosted/ProxyRuntimeObject.mm: + (WebKit::ProxyRuntimeObject::ProxyRuntimeObject): + +2010-05-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add DeviceOrientation and DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=39479 + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +2010-05-20 Mike Thole <mthole@apple.com> + + Reviewed by Dave Hyatt. + + When using a scale factor > 1, scrollbars sometimes appear when not necessary + https://bugs.webkit.org/show_bug.cgi?id=39458 + + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView updateScrollers]): Round up non-integral sizes from AppKit + so that they can be compared against the integral document size. + +2010-05-20 Kevin Decker <kdecker@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=39441 + <rdar://problem/7985715> Flash context menu is both horizontally and vertically offset from point of click + <rdar://problem/7986109> Youtube video controller UI entirely missing + <rdar://problem/7986154> Flash content paints at horizontally and vertically shifted locations (within the plug-in region) + + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (-[WebHostedNetscapePluginView updateAndSetWindow]): The base coordinates of a window and + it's contentView happen to be the equal at a userSpaceScaleFactor of 1. For non-1.0 scale + factors this assumption is false. Accordingly we now convert to the window contentView + coordinate system when computing bounds in "window" and the visible rect. + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): Ditto. + +2010-05-20 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Provide bindings for DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39210 + + Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled. + + * Configurations/FeatureDefines.xcconfig: + +2010-05-20 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Ojan Vafai. + + Expose the editing behavior setting in DRT to test all editing code paths + https://bugs.webkit.org/show_bug.cgi?id=38603 + + * WebView/WebFrame.mm: + (core): + * WebView/WebFrameInternal.h: Added a conversion method from the API enum to the WebCore enum. + * WebView/WebPreferenceKeysPrivate.h: Added a preference key for the new setting. + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Initialize the EditingBehavior to Mac style. + (-[WebPreferences editingBehavior]): Added. + (-[WebPreferences setEditingBehavior:]): Added. + * WebView/WebPreferencesPrivate.h: Added the new API points to the private API. + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): Set the editing behavior via the WebPreferences setting. + +2010-05-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Kevin Decker and Simon Fraser. + + <rdar://problem/8004528> + REGRESSION: Coordinate system for Core Animation NPAPI plug-ins is flipped with accelerated compositing turned on + + When needed, create a new CALayer and set it's geometry to be flipped. Add the plug-in layer as a sublayer and then return + the newly created layer. + + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (-[WebHostedNetscapePluginView createPlugin]): + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView createPlugin]): + +2010-05-18 Tony Chang <tony@chromium.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=24943 + Command-B and Command-I do not generate keydown events in contentEditable regions. + + Manual test because performKeyEquivalent is not called by DRT. + + Test: manual-tests/style-keypress-events.html + + * WebView/WebHTMLView.mm: + (-[WebHTMLView performKeyEquivalent:]): Move style key handling until after webcore gets a chance to handle the event + +2010-05-18 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Darin Adler, Jian Li. + + DragData::asURL() shouldn't do file validity checks + https://bugs.webkit.org/show_bug.cgi?id=38711 + + Change [NSPasteboard _web_bestURL] to still return a file URL for paths + that don't exist. Callers who care about the existence of the file or + whether or not it is a directory should check themselves when they + want to use the file. The directory check has been left in for now, + since the Mac implementation of ResourceHandle, which uses this function + indirectly via DragController::performDrag) handles directories somewhat + non-intuitively: it opens the parent directory in the Finder, rather + than opening the directory itself. + + * Misc/WebNSPasteboardExtras.mm: + (-[NSPasteboard _web_bestURL]): + +2010-05-18 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth (and Maciej Stachowiak). + + Make it possible to enable the new HTML5Tokenizer for testing + https://bugs.webkit.org/show_bug.cgi?id=39275 + + Expose the WebCore::Settings::html5ParserEnabled as a private WebKit setting. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (-[WebPreferences html5ParserEnabled]): + (-[WebPreferences setHTML5ParserEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-05-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r59652. + http://trac.webkit.org/changeset/59652 + https://bugs.webkit.org/show_bug.cgi?id=39268 + + file-input-files-access test is broken on Mac (Requested by + dcheng on #webkit). + + * Misc/WebNSPasteboardExtras.mm: + (-[NSPasteboard _web_bestURL]): + +2010-05-17 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Darin Adler. + + DragData::asURL() shouldn't do file validity checks + https://bugs.webkit.org/show_bug.cgi?id=38711 + + Change [NSPasteboard _web_bestURL] to still return a file URL for paths + that don't exist. Callers who care about the existence of the file or + whether or not it is a directory should check themselves when they + want to use the file. The directory check has been left in for now, + since the Mac implementation of ResourceHandle, which uses this function + indirectly via DragController::performDrag) handles directories somewhat + non-intuitively: it opens the parent directory in the Finder, rather + than opening the directory itself. + + * Misc/WebNSPasteboardExtras.mm: + (-[NSPasteboard _web_bestURL]): + 2010-05-14 Stephanie Lewis <slewis@apple.com> Rubber-stamped by Mark Rowe. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 947f371..c64d94c 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ; ENABLE_DATALIST = ENABLE_DATALIST; +ENABLE_DEVICE_ORIENTATION = ; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ENABLE_FILTERS; @@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index daa79a9..6f999af 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 = 0; +MINOR_VERSION = 1; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/Misc/WebNSAttributedStringExtras.mm b/WebKit/mac/Misc/WebNSAttributedStringExtras.mm index eb422f1..35b2524 100644 --- a/WebKit/mac/Misc/WebNSAttributedStringExtras.mm +++ b/WebKit/mac/Misc/WebNSAttributedStringExtras.mm @@ -154,12 +154,12 @@ static NSFileWrapper *fileWrapperForElement(Element* e) RenderStyle* style = renderer->style(); NSFont *font = style->font().primaryFont()->getNSFont(); [attrs.get() setObject:font forKey:NSFontAttributeName]; - if (style->color().isValid()) - [attrs.get() setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName]; + if (style->visitedDependentColor(CSSPropertyColor).isValid()) + [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; else [attrs.get() removeObjectForKey:NSForegroundColorAttributeName]; - if (style->backgroundColor().isValid()) - [attrs.get() setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName]; + if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) + [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; else [attrs.get() removeObjectForKey:NSBackgroundColorAttributeName]; diff --git a/WebKit/mac/Misc/WebNSPasteboardExtras.mm b/WebKit/mac/Misc/WebNSPasteboardExtras.mm index 8cebeb6..ab3baf7 100644 --- a/WebKit/mac/Misc/WebNSPasteboardExtras.mm +++ b/WebKit/mac/Misc/WebNSPasteboardExtras.mm @@ -141,12 +141,17 @@ static NSArray *_writableTypesForImageWithArchive (void) if ([types containsObject:NSFilenamesPboardType]) { NSArray *files = [self propertyListForType:NSFilenamesPboardType]; + // FIXME: Maybe it makes more sense to allow multiple files and only use the first one? if ([files count] == 1) { NSString *file = [files objectAtIndex:0]; + // FIXME: We are filtering out directories because that's what the original code used to + // do. Without this check, if the URL points to a local directory, Safari will open the + // parent directory of the directory in Finder. This check should go away as soon as + // possible. BOOL isDirectory; - if([[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDirectory] && !isDirectory){ - return [[NSURL fileURLWithPath:file] _webkit_canonicalize]; - } + if ([[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDirectory] && isDirectory) + return nil; + return [[NSURL fileURLWithPath:file] _webkit_canonicalize]; } } diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm index 9a976f9..b569a4f 100644 --- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm +++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm @@ -133,7 +133,7 @@ ProxyInstance::~ProxyInstance() RuntimeObject* ProxyInstance::newRuntimeObject(ExecState* exec) { - return new (exec) ProxyRuntimeObject(exec, this); + return new (exec) ProxyRuntimeObject(exec, exec->lexicalGlobalObject(), this); } JSC::Bindings::Class* ProxyInstance::getClass() const @@ -178,8 +178,8 @@ JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t id class ProxyRuntimeMethod : public RuntimeMethod { public: - ProxyRuntimeMethod(ExecState* exec, const Identifier& name, Bindings::MethodList& list) - : RuntimeMethod(exec, name, list) + ProxyRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list) + : RuntimeMethod(exec, globalObject, name, list) { } @@ -193,7 +193,7 @@ const ClassInfo ProxyRuntimeMethod::s_info = { "ProxyRuntimeMethod", &RuntimeMet JSValue ProxyInstance::getMethod(JSC::ExecState* exec, const JSC::Identifier& propertyName) { MethodList methodList = getClass()->methodsNamed(propertyName, this); - return new (exec) ProxyRuntimeMethod(exec, propertyName, methodList); + return new (exec) ProxyRuntimeMethod(exec, exec->lexicalGlobalObject(), propertyName, methodList); } JSValue ProxyInstance::invokeMethod(ExecState* exec, JSC::RuntimeMethod* runtimeMethod, const ArgList& args) diff --git a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h index af3c5db..81d9b42 100644 --- a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h +++ b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h @@ -36,7 +36,7 @@ class ProxyInstance; class ProxyRuntimeObject : public JSC::Bindings::RuntimeObject { public: - ProxyRuntimeObject(JSC::ExecState*, PassRefPtr<ProxyInstance>); + ProxyRuntimeObject(JSC::ExecState*, JSC::JSGlobalObject*, PassRefPtr<ProxyInstance>); virtual ~ProxyRuntimeObject(); ProxyInstance* getInternalProxyInstance() const; diff --git a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm index 5ba6e15..96855b3 100644 --- a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm +++ b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm @@ -35,8 +35,8 @@ namespace WebKit { const ClassInfo ProxyRuntimeObject::s_info = { "ProxyRuntimeObject", &RuntimeObject::s_info, 0, 0 }; -ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, PassRefPtr<ProxyInstance> instance) - : RuntimeObject(exec, instance) +ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<ProxyInstance> instance) + : RuntimeObject(exec, globalObject, instance) { } diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 519e274..6917e5f 100644 --- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -122,6 +122,20 @@ extern "C" { _pluginLayer = WKMakeRenderLayer(_proxy->renderContextID()); if (accleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) { + // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. +#ifndef BUILDING_ON_LEOPARD + // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry + // in order to get the coordinate system right. + RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.releaseRef()); + + _pluginLayer.adoptNS([[CALayer alloc] init]); + _pluginLayer.get().bounds = realPluginLayer.get().bounds; + _pluginLayer.get().geometryFlipped = YES; + + realPluginLayer.get().autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; + [_pluginLayer.get() addSublayer:realPluginLayer.get()]; +#endif + // Eagerly enter compositing mode, since we know we'll need it. This avoids firing setNeedsStyleRecalc() // for iframes that contain composited plugins at bad times. https://bugs.webkit.org/show_bug.cgi?id=39033 core([self webFrame])->view()->enterCompositingMode(); @@ -166,8 +180,11 @@ extern "C" { if (!_proxy) return; - // Use AppKit to convert view coordinates to NSWindow coordinates. - NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil]; + // The base coordinates of a window and it's contentView happen to be the equal at a userSpaceScaleFactor + // of 1. For non-1.0 scale factors this assumption is false. + NSView *windowContentView = [[self window] contentView]; + NSRect boundsInWindow = [self convertRect:[self bounds] toView:windowContentView]; + NSRect visibleRectInWindow; // Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when @@ -176,7 +193,7 @@ extern "C" { // compatible with this behavior. BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin]; if (!shouldClipOutPlugin) - visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil]; + visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView]; else visibleRectInWindow = NSZeroRect; diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index 9f5a6c2..8b4d998 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -274,12 +274,14 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) - (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate { ASSERT([self currentWindow] != nil); - - // Use AppKit to convert view coordinates to NSWindow coordinates. - NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil]; - NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil]; - // Flip Y to convert NSWindow coordinates to top-left-based window coordinates. + // The base coordinates of a window and it's contentView happen to be the equal at a userSpaceScaleFactor + // of 1. For non-1.0 scale factors this assumption is false. + NSView *windowContentView = [[self window] contentView]; + NSRect boundsInWindow = [self convertRect:[self bounds] toView:windowContentView]; + NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView]; + + // Flip Y to convert -[NSWindow contentView] coordinates to top-left-based window coordinates. float borderViewHeight = [[self currentWindow] frame].size.height; boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow); visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow); @@ -1091,6 +1093,19 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) accleratedCompositingEnabled = [[[self webView] preferences] acceleratedCompositingEnabled]; #endif if (accleratedCompositingEnabled) { + // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. +#ifndef BUILDING_ON_LEOPARD + // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry + // in order to get the coordinate system right. + RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.releaseRef()); + + _pluginLayer.adoptNS([[CALayer alloc] init]); + _pluginLayer.get().bounds = realPluginLayer.get().bounds; + _pluginLayer.get().geometryFlipped = YES; + + realPluginLayer.get().autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; + [_pluginLayer.get() addSublayer:realPluginLayer.get()]; +#endif // Eagerly enter compositing mode, since we know we'll need it. This avoids firing setNeedsStyleRecalc() // for iframes that contain composited plugins at bad times. https://bugs.webkit.org/show_bug.cgi?id=39033 core([self webFrame])->view()->enterCompositingMode(); diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 3aaea46..2041ac0 100644 --- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -262,6 +262,15 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; NSSize documentSize = [documentView frame].size; NSSize visibleSize = [self documentVisibleRect].size; NSSize frameSize = [self frame].size; + + // When in HiDPI with a scale factor > 1, the visibleSize and frameSize may be non-integral values, + // while the documentSize (set by WebCore) will be integral. Round up the non-integral sizes so that + // the mismatch won't cause unwanted scrollbars to appear. This can result in slightly cut off content, + // but it will always be less than one pixel, which should not be noticeable. + visibleSize.width = ceilf(visibleSize.width); + visibleSize.height = ceilf(visibleSize.height); + frameSize.width = ceilf(frameSize.width); + frameSize.height = ceilf(frameSize.height); if (_private->hScroll == ScrollbarAuto) { newHasHorizontalScroller = documentSize.width > visibleSize.width; diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 7545bd8..999f177 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -196,6 +196,18 @@ EditableLinkBehavior core(WebKitEditableLinkBehavior editableLinkBehavior) return EditableLinkDefaultBehavior; } +WebCore::EditingBehavior core(WebKitEditingBehavior behavior) +{ + switch (behavior) { + case WebKitEditingMacBehavior: + return WebCore::EditingMacBehavior; + case WebKitEditingWinBehavior: + return WebCore::EditingWindowsBehavior; + } + ASSERT_NOT_REACHED(); + return WebCore::EditingMacBehavior; +} + TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior behavior) { switch (behavior) { @@ -1025,7 +1037,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) RenderObject* bodyRenderer = body->renderer(); if (!bodyRenderer) return nil; - Color color = bodyRenderer->style()->backgroundColor(); + Color color = bodyRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor); if (!color.isValid()) return nil; return nsColor(color); diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h index 4c1ee40..9b2248a 100644 --- a/WebKit/mac/WebView/WebFrameInternal.h +++ b/WebKit/mac/WebView/WebFrameInternal.h @@ -71,6 +71,7 @@ WebView *kit(WebCore::Page*); WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior); WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior); +WebCore::EditingBehavior core(WebKitEditingBehavior); WebView *getWebView(WebFrame *webFrame); diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 83d2e7b..5f9134f 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -4344,9 +4344,6 @@ static BOOL isInPasswordField(Frame* coreFrame) // the current event prevents that from causing a problem inside WebKit or AppKit code. [[event retain] autorelease]; - if ([self _handleStyleKeyEquivalent:event]) - return YES; - BOOL eventWasSentToWebCore = (_private->keyDownEvent == event); BOOL ret = NO; @@ -4364,7 +4361,7 @@ static BOOL isInPasswordField(Frame* coreFrame) ret = frame->eventHandler()->keyEvent(event); if (!ret) - ret = [super performKeyEquivalent:event]; + ret = [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event]; [self release]; diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index f4ae333..ba4df8f 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -93,6 +93,7 @@ #define WebKitUsesProxiedOpenPanelPreferenceKey @"WebKitUsesProxiedOpenPanel" #define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime" #define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled" +#define WebKitHTML5ParserEnabledPreferenceKey @"WebKitHTML5ParserEnabled" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. @@ -104,6 +105,7 @@ #define WebKitEditableLinkBehaviorPreferenceKey @"WebKitEditableLinkBehavior" #define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey" #define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey" +#define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior" // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set // to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 9de8495..ac98282 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -334,6 +334,7 @@ static WebCacheModel cacheModelForMainBundle(void) @"0", WebKitPDFScaleFactorPreferenceKey, @"0", WebKitUseSiteSpecificSpoofingPreferenceKey, [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey, + [NSNumber numberWithInt:WebKitEditingMacBehavior], WebKitEditingBehaviorPreferenceKey, #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded], #else @@ -1237,6 +1238,26 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:flag forKey:WebKitFrameFlatteningEnabledPreferenceKey]; } +- (BOOL)html5ParserEnabled +{ + return [self _boolValueForKey:WebKitHTML5ParserEnabledPreferenceKey]; +} + +- (void)setHTML5ParserEnabled:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitHTML5ParserEnabledPreferenceKey]; +} + +- (WebKitEditingBehavior)editingBehavior +{ + return static_cast<WebKitEditingBehavior>([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]); +} + +- (void)setEditingBehavior:(WebKitEditingBehavior)behavior +{ + [self _setIntegerValue:behavior forKey:WebKitEditingBehaviorPreferenceKey]; +} + - (void)didRemoveFromWebView { ASSERT(_private->numWebViews); diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index ee785e9..0031860 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -43,6 +43,11 @@ typedef enum { WebTextDirectionSubmenuAlwaysIncluded } WebTextDirectionSubmenuInclusionBehavior; +typedef enum { + WebKitEditingMacBehavior, + WebKitEditingWinBehavior +} WebKitEditingBehavior; + extern NSString *WebPreferencesChangedNotification; extern NSString *WebPreferencesRemovedNotification; @@ -129,6 +134,9 @@ extern NSString *WebPreferencesRemovedNotification; - (WebKitEditableLinkBehavior)editableLinkBehavior; - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior; +- (WebKitEditingBehavior)editingBehavior; +- (void)setEditingBehavior:(WebKitEditingBehavior)behavior; + - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior; - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior; @@ -167,6 +175,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)webGLEnabled; - (void)setWebGLEnabled:(BOOL)enabled; +- (BOOL)html5ParserEnabled; +- (void)setHTML5ParserEnabled:(BOOL)flag; + - (BOOL)usesProxiedOpenPanel; - (void)setUsesProxiedOpenPanel:(BOOL)enabled; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 36313b4..0df62ea 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -662,7 +662,8 @@ static bool shouldEnableLoadDeferring() #else WebGeolocationControllerClient* geolocationControllerClient = 0; #endif - _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient); + DeviceOrientationClient* deviceOrientationClient = 0; + _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient, deviceOrientationClient); _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); @@ -1368,6 +1369,7 @@ static bool fastDocumentTeardownEnabled() settings->setTextAreasAreResizable([preferences textAreasAreResizable]); settings->setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]); settings->setEditableLinkBehavior(core([preferences editableLinkBehavior])); + settings->setEditingBehavior(core([preferences editingBehavior])); settings->setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior])); settings->setDOMPasteAllowed([preferences isDOMPasteAllowed]); settings->setUsesPageCache([self usesPageCache]); @@ -1405,6 +1407,7 @@ static bool fastDocumentTeardownEnabled() settings->setWebGLEnabled([preferences webGLEnabled]); settings->setLoadDeferringEnabled(shouldEnableLoadDeferring()); settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]); + settings->setHTML5ParserEnabled([preferences html5ParserEnabled]); } static inline IMP getMethod(id o, SEL s) diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 904201e..178f5c2 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -60,8 +60,6 @@ public: void syncLayers(); void updateResizesToContentsForPage(); - virtual QRectF graphicsItemVisibleRect() const; - void detachCurrentPage(); @@ -157,25 +155,6 @@ void QGraphicsWebViewPrivate::_q_scaleChanged() #endif } -QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const -{ - if (!q->scene()) - return QRectF(); - QList<QGraphicsView*> views = q->scene()->views(); - if (views.size() > 1) { -#ifndef QT_NO_DEBUG_STREAM - qDebug() << "QGraphicsWebView is in more than one graphics views, unable to compute the visible rect"; -#endif - return QRectF(); - } - if (views.size() < 1) - return QRectF(); - - int xPosition = views[0]->horizontalScrollBar()->value(); - int yPosition = views[0]->verticalScrollBar()->value(); - return q->mapRectFromScene(QRectF(QPoint(xPosition, yPosition), views[0]->viewport()->size())); -} - /*! \class QGraphicsWebView \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp index d852012..06e6cfa 100644 --- a/WebKit/qt/Api/qwebhistory.cpp +++ b/WebKit/qt/Api/qwebhistory.cpp @@ -540,6 +540,8 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history) d->lst->addItem(item); } d->lst->removeItem(nullItem); + // Update the HistoryController. + history.d->lst->page()->mainFrame()->loader()->history()->setCurrentItem(history.d->lst->entries()[currentIndex].get()); history.goToItem(history.itemAt(currentIndex)); } } diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 3810155..1ae8e35 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -272,7 +272,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) contextMenuClient = new ContextMenuClientQt(); editorClient = new EditorClientQt(q); page = new Page(chromeClient, contextMenuClient, editorClient, - new DragClientQt(q), new InspectorClientQt(q), 0, 0); + new DragClientQt(q), new InspectorClientQt(q), 0, 0, 0); settings = new QWebSettings(page->settings()); @@ -1369,7 +1369,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const RefPtr<Range> range = editor->compositionRange(); return QVariant(renderTextControl->selectionEnd() - TextIterator::rangeLength(range.get())); } - return QVariant(renderTextControl->selectionEnd()); + return QVariant(frame->selection()->extent().offsetInContainerNode()); } return QVariant(); } @@ -1401,7 +1401,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const RefPtr<Range> range = editor->compositionRange(); return QVariant(renderTextControl->selectionStart() - TextIterator::rangeLength(range.get())); } - return QVariant(renderTextControl->selectionStart()); + return QVariant(frame->selection()->base().offsetInContainerNode()); } return QVariant(); } @@ -3180,12 +3180,37 @@ QString QWebPage::userAgentForUrl(const QUrl&) const #elif defined Q_WS_X11 "X11" #elif defined Q_OS_SYMBIAN - "SymbianOS" + "Symbian" #else "Unknown" #endif ); +#if defined Q_OS_SYMBIAN + QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); + switch (symbianVersion) { + case QSysInfo::SV_9_2: + firstPartTemp += QString::fromLatin1("OS/9.2"); + break; + case QSysInfo::SV_9_3: + firstPartTemp += QString::fromLatin1("OS/9.3"); + break; + case QSysInfo::SV_9_4: + firstPartTemp += QString::fromLatin1("OS/9.4"); + break; + case QSysInfo::SV_SF_2: + firstPartTemp += QString::fromLatin1("/2"); + break; + case QSysInfo::SV_SF_3: + firstPartTemp += QString::fromLatin1("/3"); + break; + case QSysInfo::SV_SF_4: + firstPartTemp += QString::fromLatin1("/4"); + default: + break; + } +#endif + firstPartTemp += QString::fromLatin1("; "); // SSL support @@ -3309,51 +3334,22 @@ QString QWebPage::userAgentForUrl(const QUrl&) const firstPartTemp += QString::fromLatin1("Sun Solaris"); #elif defined Q_OS_ULTRIX firstPartTemp += QString::fromLatin1("DEC Ultrix"); -#elif defined Q_OS_SYMBIAN - firstPartTemp += QString::fromLatin1("SymbianOS"); - QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); - switch (symbianVersion) { - case QSysInfo::SV_9_2: - firstPartTemp += QString::fromLatin1("/9.2"); - break; - case QSysInfo::SV_9_3: - firstPartTemp += QString::fromLatin1("/9.3"); - break; - case QSysInfo::SV_9_4: - firstPartTemp += QString::fromLatin1("/9.4"); - break; - case QSysInfo::SV_SF_2: - firstPartTemp += QString::fromLatin1("^2"); - break; - case QSysInfo::SV_SF_3: - firstPartTemp += QString::fromLatin1("^3"); - break; - case QSysInfo::SV_SF_4: - firstPartTemp += QString::fromLatin1("^4"); - break; - default: - firstPartTemp += QString::fromLatin1("/Unknown"); - } - -#if defined Q_WS_S60 +#elif defined Q_WS_S60 firstPartTemp += QLatin1Char(' '); - firstPartTemp += QString::fromLatin1("Series60"); QSysInfo::S60Version s60Version = QSysInfo::s60Version(); switch (s60Version) { case QSysInfo::SV_S60_3_1: - firstPartTemp += QString::fromLatin1("/3.1"); + firstPartTemp += QString::fromLatin1("Series60/3.1"); break; case QSysInfo::SV_S60_3_2: - firstPartTemp += QString::fromLatin1("/3.2"); + firstPartTemp += QString::fromLatin1("Series60/3.2"); break; case QSysInfo::SV_S60_5_0: - firstPartTemp += QString::fromLatin1("/5.0"); + firstPartTemp += QString::fromLatin1("Series60/5.0"); break; default: - firstPartTemp += QString::fromLatin1("/Unknown"); + break; } -#endif - #elif defined Q_OS_UNIX firstPartTemp += QString::fromLatin1("UNIX BSD/SYSV system"); #elif defined Q_OS_UNIXWARE @@ -3383,8 +3379,8 @@ QString QWebPage::userAgentForUrl(const QUrl&) const QString thirdPartTemp; thirdPartTemp.reserve(150); -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - thirdPartTemp + QLatin1String(" Mobile Safari/"); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + thirdPartTemp += QLatin1String(" Mobile Safari/"); #else thirdPartTemp += QLatin1String(" Safari/"); #endif @@ -3402,7 +3398,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const languageName = d->client->ownerWidget()->locale().name(); else languageName = QLocale().name(); - languageName[2] = QLatin1Char('-'); + languageName.replace(QLatin1Char('_'), QLatin1Char('-')); // Application name/version QString appName = QCoreApplication::applicationName(); diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index e5fabd8..bc1f45d 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,203 @@ +2010-05-23 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] GraphicsLayer: The rocket animation doesn't scroll together with the page + https://bugs.webkit.org/show_bug.cgi?id=39517 + + A previous fix to this issue was overridden by the PageClientQt refactor. Reapplying. + + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQGraphicsWidget::update): + +2010-05-23 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Update the Symbian version for the user agent + https://bugs.webkit.org/show_bug.cgi?id=38389 + + Fixes a regression introduced by r58648. Ensure that the "Symbian" string + is only listed one time in the User Agent string. + + In addition make an effort to align the User Agent string to already + released WebKit based products for Symbian. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2010-05-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add DeviceOrientation and DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=39479 + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2010-05-21 Simon Hausmann <simon.hausmann@nokia.com> + + Symbian build fix. + + [Qt] Updated the wins def file with one new export. + + The DRT symbols are still missing, but I can't build DRT ;( + + * symbian/bwins/QtWebKitu.def: + +2010-05-20 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] WINSCW compile fix for qwebframe test + https://bugs.webkit.org/show_bug.cgi?id=38722 + + WINSCW cannot determine template type up the hierarchy + to common base class. + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-05-20 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Remove unused "old style" private APIs + + These symbols were introduced after QtWebKit v4.6 + so no-one should be using them + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + +2010-05-20 Rajiv Ramanasankaran <rajiv.ramanasankaran@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] QWebPage::inputMethodQuery() returns wrong values for Qt::ImCursorPosition, Qt::ImAnchorPosition + https://bugs.webkit.org/show_bug.cgi?id=38779 + + The earlier implementation was written with the assumption that in this scenario the + anchor position always corresponds to the START index and that the current cursor position + always corresponds to the END index in WebKit. + + Updated the implementation of QWebPage::inputMethodQuery(Qt::ImCursorPosition) and + QWebPage::inputMethodQuery(Qt::ImAnchorPosition) for the case where the Editor is not in + composition mode. In the non-composition mode, the Anchor and the Current cursor positions + correspond to the Base and Extent position offsets in WebKit. + + Also added the auto-tests for the RIGHT to LEFT and LEFT to RIGHT selections. + + * Api/qwebpage.cpp: + (QWebPage::inputMethodQuery): Now returning correct values for Qt::ImCursorPosition and + Qt::ImAnchorPosition when the Editor is not in composition mode. + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): Added auto-tests for RIGHT to LEFT and LEFT to RIGHT selections + +2010-05-20 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Skipping popup focus test for maemo + https://bugs.webkit.org/show_bug.cgi?id=39314 + + Skipping popup focus test for maemo in qwebframe auto test. + + The test method tst_QWebFrame::popupFocus() was testing popup focus AND input + field focus. The input field focus has been removed from the method popupFocus() + and a new test method named inputFieldFocus() has been added. Finally the test + method popupFocus() has been skipped for maemo. + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-05-19 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Crash fix in the HistoryController. + + The problem was casued by a documented feature of the QWebFrame::setHtml(). + The method doesn't affect a browsing history (doesn't create a HistoryItem instance), so + m_currentItem and m_previousItem are not set. + + A null check was added. + + [Qt] The QWebPage crashes on history.pushState(). + https://bugs.webkit.org/show_bug.cgi?id=38840 + + * tests/qwebhistory/tst_qwebhistory.cpp: + (tst_QWebHistory::popPushState_data): + (tst_QWebHistory::popPushState): + +2010-05-19 Antti Koivisto <koivisto@iki.fi> + + Rubber-stamped by Kenneth Rohde Christiansen. + + [Qt] TiledBackingStore updates broken when not using resizesToContents mode + https://bugs.webkit.org/show_bug.cgi?id=39359 + + Put the back logic that was lost in refactoring. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::visibleRectForTiledBackingStore): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect): + * WebCoreSupport/PageClientQt.h: + (WebCore::PageClientQWidget::viewResizesToContentsEnabled): + (WebCore::PageClientQGraphicsWidget::viewResizesToContentsEnabled): + +2010-05-19 Simon Hausmann <simon.hausmann@nokia.com> + + Symbian build fix. + + [Qt] Updated the def file with exports needed for DumpRenderTree. + + * symbian/eabi/QtWebKitu.def: + +2010-05-19 Denis Dzyubenko <denis.dzyubenko@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + When creating the UA, do not sassmue the language code is a + two-letter iso639-1 code. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2010-05-18 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Move visible rect calculation from QGraphicsWebViewPrivate to PageClientQGraphicsWidget + https://bugs.webkit.org/show_bug.cgi?id=39294 + + * Api/qgraphicswebview.cpp: + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect): + * WebCoreSupport/PageClientQt.h: + +2010-05-18 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Symbian build fix. + + [Qt] Updated the def file with new exports after r59335. + + * symbian/eabi/QtWebKitu.def: + +2010-05-18 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + Fix QWebHistory serialization. + + Regression was caused by bug 33224. The streaming function + should generate a documentSequenceNumber for all loaded values. + + [Qt] tst_QWebHistory::serialize_2() fails + https://bugs.webkit.org/show_bug.cgi?id=37322 + + * Api/qwebhistory.cpp: + (operator>>): + 2010-05-17 Tasuku Suzuki <tasuku.suzuki@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 1c475b3..bcb07ee 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -571,8 +571,12 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const #if ENABLE(TILED_BACKING_STORE) IntRect ChromeClientQt::visibleRectForTiledBackingStore() const { - if (!platformPageClient()) + if (!platformPageClient() || !m_webPage) return IntRect(); + + if (!platformPageClient()->viewResizesToContentsEnabled()) + return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size()); + return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect())); } #endif diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 6e59a20..9d335b8 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -604,27 +604,6 @@ void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b) DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b); } -void QWEBKIT_EXPORT qt_dump_resource_load_callbacks_path(const QString& path) -{ - DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(path); -} - -void QWEBKIT_EXPORT qt_set_will_send_request_returns_null_on_redirect(bool b) -{ - DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(b); - -} - -void QWEBKIT_EXPORT qt_set_will_send_request_returns_null(bool b) -{ - DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(b); -} - -void QWEBKIT_EXPORT qt_set_will_send_request_clear_headers(const QStringList& headers) -{ - DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(headers); -} - void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b) { DumpRenderTreeSupportQt::dumpEditingCallbacks(b); @@ -635,7 +614,3 @@ void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b) DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b); } -void QWEBKIT_EXPORT qt_dump_notification(bool b) -{ - DumpRenderTreeSupportQt::dumpNotification(b); -} diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp index e19f44f..4ccf34a 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -132,6 +132,8 @@ void PageClientQGraphicsWidget::update(const QRect& dirtyRect) overlay->update(QRectF(dirtyRect)); #if USE(ACCELERATED_COMPOSITING) syncLayers(); + // This might be a slow-scroll. We ensure that the compositing layers are in the right position. + updateCompositingScrollPosition(); #endif } @@ -288,6 +290,23 @@ QRect PageClientQGraphicsWidget::geometryRelativeToOwnerWidget() const return graphicsView->mapFromScene(view->boundingRect()).boundingRect(); } +#if ENABLE(TILED_BACKING_STORE) +QRectF PageClientQGraphicsWidget::graphicsItemVisibleRect() const +{ + if (!view->scene()) + return QRectF(); + + QList<QGraphicsView*> views = view->scene()->views(); + if (views.isEmpty()) + return QRectF(); + + QGraphicsView* graphicsView = views.at(0); + int xOffset = graphicsView->horizontalScrollBar()->value(); + int yOffset = graphicsView->verticalScrollBar()->value(); + return view->mapRectFromScene(QRectF(QPointF(xOffset, yOffset), graphicsView->viewport()->size())); +} +#endif + QObject* PageClientQGraphicsWidget::pluginParent() const { return view; diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h index 9341b19..6dab4e1 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -76,6 +76,8 @@ public: virtual QObject* pluginParent() const; virtual QStyle* style() const; + + virtual bool viewResizesToContentsEnabled() const { return false; } QWidget* view; }; @@ -161,10 +163,13 @@ public: virtual QStyle* style() const; + virtual bool viewResizesToContentsEnabled() const { return viewResizesToContents; } + void createOrDeleteOverlay(); #if ENABLE(TILED_BACKING_STORE) void updateTiledBackingStoreScale(); + virtual QRectF graphicsItemVisibleRect() const; #endif #if USE(ACCELERATED_COMPOSITING) diff --git a/WebKit/qt/symbian/bwins/QtWebKitu.def b/WebKit/qt/symbian/bwins/QtWebKitu.def index 729b97c..0f4e4b2 100644 --- a/WebKit/qt/symbian/bwins/QtWebKitu.def +++ b/WebKit/qt/symbian/bwins/QtWebKitu.def @@ -649,4 +649,5 @@ EXPORTS ?setInspectorUrl@QWebSettings@@QAEXABVQUrl@@@Z @ 648 NONAME ABSENT ; void QWebSettings::setInspectorUrl(class QUrl const &) ?setResizesToContents@QGraphicsWebView@@QAEX_N@Z @ 649 NONAME ; void QGraphicsWebView::setResizesToContents(bool) ?setTiledBackingStoreFrozen@QGraphicsWebView@@QAEX_N@Z @ 650 NONAME ; void QGraphicsWebView::setTiledBackingStoreFrozen(bool) + ?qtwebkit_webframe_scrollOverflow@@YA_NPAVQWebFrame@@HHABVQPoint@@@Z @ 651 NONAME ; bool qtwebkit_webframe_scrollOverflow(QWebFrame *, int, int, const QPoint&) diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index a9c2825..203261a 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -723,3 +723,50 @@ EXPORTS _ZN23DumpRenderTreeSupportQt19webPageSetGroupNameEP8QWebPageRK7QString @ 722 NONAME _ZN23DumpRenderTreeSupportQt16webPageGroupNameEP8QWebPage @ 723 NONAME _ZN23DumpRenderTreeSupportQt23garbageCollectorCollectEv @ 724 NONAME + _Z32qtwebkit_webframe_scrollOverflowP9QWebFrameiiRK6QPoint @ 725 NONAME + _ZN23DumpRenderTreeSupportQt12setMediaTypeEP9QWebFrameRK7QString @ 726 NONAME + _ZN23DumpRenderTreeSupportQt13numberOfPagesEP9QWebFrameff @ 727 NONAME + _ZN23DumpRenderTreeSupportQt13selectedRangeEP8QWebPage @ 728 NONAME + _ZN23DumpRenderTreeSupportQt14clearFrameNameEP9QWebFrame @ 729 NONAME + _ZN23DumpRenderTreeSupportQt14pauseAnimationEP9QWebFrameRK7QStringdS4_ @ 730 NONAME + _ZN23DumpRenderTreeSupportQt15dumpFrameLoaderEb @ 731 NONAME + _ZN23DumpRenderTreeSupportQt16dumpNotificationEb @ 732 NONAME + _ZN23DumpRenderTreeSupportQt16isCommandEnabledEP8QWebPageRK7QString @ 733 NONAME + _ZN23DumpRenderTreeSupportQt16webInspectorShowEP8QWebPage @ 734 NONAME + _ZN23DumpRenderTreeSupportQt17pauseSVGAnimationEP9QWebFrameRK7QStringdS4_ @ 735 NONAME + _ZN23DumpRenderTreeSupportQt17webInspectorCloseEP8QWebPage @ 736 NONAME + _ZN23DumpRenderTreeSupportQt17workerThreadCountEv @ 737 NONAME + _ZN23DumpRenderTreeSupportQt18hasDocumentElementEP9QWebFrame @ 738 NONAME + _ZN23DumpRenderTreeSupportQt20dumpEditingCallbacksEb @ 739 NONAME + _ZN23DumpRenderTreeSupportQt21markerTextForListItemERK11QWebElement @ 740 NONAME + _ZN23DumpRenderTreeSupportQt22javaScriptObjectsCountEv @ 741 NONAME + _ZN23DumpRenderTreeSupportQt23setCaretBrowsingEnabledEP8QWebPageb @ 742 NONAME + _ZN23DumpRenderTreeSupportQt24executeCoreCommandByNameEP8QWebPageRK7QStringS4_ @ 743 NONAME + _ZN23DumpRenderTreeSupportQt21dumpSetAcceptsEditingEb @744 NONAME + _ZN23DumpRenderTreeSupportQt22resumeActiveDOMObjectsEP9QWebFrame @745 NONAME + _ZN23DumpRenderTreeSupportQt23suspendActiveDOMObjectsEP9QWebFrame @746 NONAME + _ZN23DumpRenderTreeSupportQt24numberOfActiveAnimationsEP9QWebFrame @747 NONAME + _ZN23DumpRenderTreeSupportQt24pageNumberForElementByIdEP9QWebFrameRK7QStringff @748 NONAME + _ZN23DumpRenderTreeSupportQt25dumpResourceLoadCallbacksEb @749 NONAME + _ZN23DumpRenderTreeSupportQt25pauseTransitionOfPropertyEP9QWebFrameRK7QStringdS4_ @750 NONAME + _ZN23DumpRenderTreeSupportQt25setFrameFlatteningEnabledEP8QWebPageb @751 NONAME + _ZN23DumpRenderTreeSupportQt25webInspectorExecuteScriptEP8QWebPagelRK7QString @752 NONAME + _ZN23DumpRenderTreeSupportQt25whiteListAccessFromOriginERK7QStringS2_S2_b @753 NONAME + _ZN23DumpRenderTreeSupportQt26counterValueForElementByIdEP9QWebFrameRK7QString @754 NONAME + _ZN23DumpRenderTreeSupportQt26firstRectForCharacterRangeEP8QWebPageii @755 NONAME + _ZN23DumpRenderTreeSupportQt26overwritePluginDirectoriesEv @756 NONAME + _ZN23DumpRenderTreeSupportQt27resetOriginAccessWhiteListsEv @757 NONAME + _ZN23DumpRenderTreeSupportQt27setSmartInsertDeleteEnabledEP8QWebPageb @758 NONAME + _ZN23DumpRenderTreeSupportQt27setTimelineProfilingEnabledEP8QWebPageb @759 NONAME + _ZN23DumpRenderTreeSupportQt28setDumpRenderTreeModeEnabledEb @760 NONAME + _ZN23DumpRenderTreeSupportQt29dumpResourceLoadCallbacksPathERK7QString @761 NONAME + _ZN23DumpRenderTreeSupportQt29evaluateScriptInIsolatedWorldEP9QWebFrameiRK7QString @762 NONAME + _ZN23DumpRenderTreeSupportQt29setJavaScriptProfilingEnabledEP9QWebFrameb @763 NONAME + _ZN23DumpRenderTreeSupportQt29setWillSendRequestReturnsNullEb @764 NONAME + _ZN23DumpRenderTreeSupportQt30setWillSendRequestClearHeadersERK11QStringList @765 NONAME + _ZN23DumpRenderTreeSupportQt33computedStyleIncludingVisitedInfoERK11QWebElement @766 NONAME + _ZN23DumpRenderTreeSupportQt34setSelectTrailingWhitespaceEnabledEP8QWebPageb @767 NONAME + _ZN23DumpRenderTreeSupportQt39elementDoesAutoCompleteForElementWithIdEP9QWebFrameRK7QString @768 NONAME + _ZN23DumpRenderTreeSupportQt39setWillSendRequestReturnsNullOnRedirectEb @769 NONAME + _ZN23DumpRenderTreeSupportQt40garbageCollectorCollectOnAlternateThreadEb @770 NONAME + _ZN23DumpRenderTreeSupportQt40setDomainRelaxationForbiddenForURLSchemeEbRK7QString @771 NONAME diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index bea7a67..76fdba3 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -600,7 +600,12 @@ private slots: void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); +#if !defined(Q_WS_MAEMO_5) + // as maemo 5 does not use QComboBoxes to implement the popups + // this test does not make sense for it. void popupFocus(); +#endif + void inputFieldFocus(); void hitTestContent(); void jsByteArray(); void ownership(); @@ -686,13 +691,13 @@ private: QWebView* m_view; QWebPage* m_page; MyQObject* m_myObject; - QWebView* m_popupTestView; - int m_popupTestPaintCount; + QWebView* m_inputFieldsTestView; + int m_inputFieldTestPaintCount; }; tst_QWebFrame::tst_QWebFrame() : sTrue("true"), sFalse("false"), sUndefined("undefined"), sArray("array"), sFunction("function"), sError("error"), - sString("string"), sObject("object"), sNumber("number"), m_popupTestView(0), m_popupTestPaintCount(0) + sString("string"), sObject("object"), sNumber("number"), m_inputFieldsTestView(0), m_inputFieldTestPaintCount(0) { } @@ -702,10 +707,10 @@ tst_QWebFrame::~tst_QWebFrame() bool tst_QWebFrame::eventFilter(QObject* watched, QEvent* event) { - // used on the popupFocus test - if (watched == m_popupTestView) { + // used on the inputFieldFocus test + if (watched == m_inputFieldsTestView) { if (event->type() == QEvent::Paint) - m_popupTestPaintCount++; + m_inputFieldTestPaintCount++; } return QObject::eventFilter(watched, event); } @@ -780,7 +785,7 @@ void tst_QWebFrame::getSetStaticProperty() QCOMPARE(vm.size(), 3); QCOMPARE(vm.value("a").toInt(), 123); QCOMPARE(vm.value("b").toString(), QLatin1String("foo")); - QCOMPARE(vm.value("c").value<QObject*>(), m_myObject); + QCOMPARE(vm.value("c").value<QObject*>(), static_cast<QObject*>(m_myObject)); } QCOMPARE(evalJS("myObject.variantMapProperty.a === 123"), sTrue); QCOMPARE(evalJS("myObject.variantMapProperty.b === 'foo'"), sTrue); @@ -2549,6 +2554,7 @@ void tst_QWebFrame::metaData() QCOMPARE(metaData.value("nonexistant"), QString()); } +#if !defined(Q_WS_MAEMO_5) void tst_QWebFrame::popupFocus() { QWebView view; @@ -2580,16 +2586,27 @@ void tst_QWebFrame::popupFocus() // hide the popup and check if focus is on the page combo->hidePopup(); QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView +} +#endif + +void tst_QWebFrame::inputFieldFocus() +{ + QWebView view; + view.setHtml("<html><body><input type=\"text\"></input></body></html>"); + view.resize(400, 100); + view.show(); + view.setFocus(); + QTRY_VERIFY(view.hasFocus()); // double the flashing time, should at least blink once already int delay = qApp->cursorFlashTime() * 2; // focus the lineedit and check if it blinks - QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(200, 25)); - m_popupTestView = &view; + QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); + m_inputFieldsTestView = &view; view.installEventFilter( this ); QTest::qWait(delay); - QVERIFY2(m_popupTestPaintCount >= 3, + QVERIFY2(m_inputFieldTestPaintCount >= 3, "The input field should have a blinking caret"); } diff --git a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index e967dcc..49a606b 100644 --- a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -59,6 +59,8 @@ private slots: void saveAndRestore_crash_1(); void saveAndRestore_crash_2(); void saveAndRestore_crash_3(); + void popPushState_data(); + void popPushState(); void clear(); @@ -349,6 +351,25 @@ void tst_QWebHistory::saveAndRestore_crash_3() delete page2; } +void tst_QWebHistory::popPushState_data() +{ + QTest::addColumn<QString>("script"); + QTest::newRow("pushState") << "history.pushState(123, \"foo\");"; + QTest::newRow("replaceState") << "history.replaceState(\"a\", \"b\");"; + QTest::newRow("back") << "history.back();"; + QTest::newRow("forward") << "history.forward();"; + QTest::newRow("clearState") << "history.clearState();"; +} + +/** Crash test, WebKit bug 38840 (https://bugs.webkit.org/show_bug.cgi?id=38840) */ +void tst_QWebHistory::popPushState() +{ + QFETCH(QString, script); + QWebPage page; + page.mainFrame()->setHtml("<html><body>long live Qt!</body></html>"); + page.mainFrame()->evaluateJavaScript(script); +} + /** ::clear */ void tst_QWebHistory::clear() { diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index bbbfe09..ceb8aff 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1494,6 +1494,98 @@ void tst_QWebPage::inputMethods() QCOMPARE(value, QString("QtWebKit")); #endif + // Cancel current composition first + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant()); + QInputMethodEvent eventSelection4("", inputAttributes); + page->event(&eventSelection4); + + // START - Tests for Selection when the Editor is NOT in Composition mode + + // LEFT to RIGHT selection + // Deselect the selection by sending MouseButtonPress events + // This moves the current cursor to the end of the text + page->event(&evpres); + page->event(&evrel); + + //Move to the start of the line + page->triggerAction(QWebPage::MoveToStartOfLine); + + QKeyEvent keyRightEventPress(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier); + QKeyEvent keyRightEventRelease(QEvent::KeyRelease, Qt::Key_Right, Qt::NoModifier); + + //Move 2 characters RIGHT + for (int j = 0; j < 2; ++j) { + page->event(&keyRightEventPress); + page->event(&keyRightEventRelease); + } + + //Select to the end of the line + page->triggerAction(QWebPage::SelectEndOfLine); + + //ImAnchorPosition QtWebKit + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 2); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 8); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("WebKit")); + + //RIGHT to LEFT selection + //Deselect the selection (this moves the current cursor to the end of the text) + page->event(&evpres); + page->event(&evrel); + + //ImAnchorPosition + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 8); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 8); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("")); + + QKeyEvent keyLeftEventPress(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier); + QKeyEvent keyLeftEventRelease(QEvent::KeyRelease, Qt::Key_Left, Qt::NoModifier); + + //Move 2 characters LEFT + for (int i = 0; i < 2; ++i) { + page->event(&keyLeftEventPress); + page->event(&keyLeftEventRelease); + } + + //Select to the start of the line + page->triggerAction(QWebPage::SelectStartOfLine); + + //ImAnchorPosition + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 6); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 0); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("QtWebK")); + + //END - Tests for Selection when the Editor is not in Composition mode + //ImhHiddenText QMouseEvent evpresPassword(QEvent::MouseButtonPress, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); page->event(&evpresPassword); diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index a67e10f..69d7ea9 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,139 @@ +2010-05-21 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add DeviceOrientation and DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=39479 + + * WebView.cpp: + (WebView::initWithFrame): + +2010-05-20 Simon Fraser <simon.fraser@apple.com> + + Build fix, no review. + + Fix the non-accelerated-compositing Windows build with some + #if USE(ACCELERATED_COMPOSITING) loving. + + * WebView.cpp: + * WebView.h: + +2010-05-20 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + Avoid flushing CA layers when a layout is pending + https://bugs.webkit.org/show_bug.cgi?id=39463 + + <rdar://problem/7999463> + + Avoid rendering the compositing layers to the screen if there's a layout pending, + since the layer tree not in a state that should be presented to the user. + + This fixes flashes in some types of content that dynamically add and remove layers. + + Have the WebView implement WKCACFLayerRendererClient so that the + WKCACFLayerRenderer can ask whether it's a good time to render. If the FrameView + has a layout pending, say no. + + * WebView.h: + * WebView.cpp: + (WebView::setAcceleratedCompositing): + (WebView::shouldRender): + +2010-05-18 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Adam Roben. + + [WinCairo] Correct scaling for print preview + https://bugs.webkit.org/show_bug.cgi?id=39329 + + Cairo does not properly deal with Windows HDCs that have been + scaled using MM_ANISOTROPIC mapping mode, and a WindowExt and + ViewportExt setting. + (see http://bugs.freedesktop.org/show_bug.cgi?id=28161) + + Instead, reset the HDC's WorldTransform to be unscaled, then + scale the cairo context to the desired scaling, and perform + the drawing operation. + + * WebFrame.cpp: + (WebFrame::drawHeader): Use pre-positioned context to simplify + this method. + (WebFrame::drawFooter): Use pre-positioned context to simplify + this method. + (WebFrame::spoolPage): Revise scaling logic to turn off HDC + scaling, and scale using only Cairo. Revert scaling at end + so that user-defined GDI-based routines (e.g., header/footer) + will draw in the right position. + (WebFrame::spoolPages): Identify print preview case, and + retrieve scaling factors from preview context. Set the + Cairo context to use these factors during the spoolPage + operation. + +2010-05-20 Martin Robinson <mrobinson@igalia.com> + + Unreviewed. + + Touch WebKit.idl to ensure that interfaces rebuild. + + * Interfaces/WebKit.idl: Touched. + +2010-05-20 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Adam Roben. + + Fix the Windows build and move new IDL declarations to the bottom of the file. + + * Interfaces/IWebPreferences.idl: Move new API to the bottom of the IDL file to prevent vtable mismatch. + * WebPreferences.cpp: + (WebPreferences::setEditingBehavior): Change the type of the parameter to setEditingBehavior to the proper type. + +2010-05-20 Martin Robinson <mrobinson@igalia.com> + + Unreviewed. + + Fix the Windows build. + + * WebView.cpp: + (WebView::notifyPreferencesChanged): Change behavior to 'editingBehavior'. + +2010-05-20 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Ojan Vafai. + + Expose the editing behavior setting in DRT to test all editing code paths + https://bugs.webkit.org/show_bug.cgi?id=38603 + + Expose the EditingBehavior setting in the Windows API. + + * Interfaces/IWebPreferences.idl: Add the API point for setting the editing behavior. + * WebPreferenceKeysPrivate.h: Add a key for the editing behavior setting. + * WebPreferences.cpp: + (WebPreferences::editingBehavior): Added. + (WebPreferences::setEditingBehavior): Added. + * WebPreferences.h: Add method declarations. + * WebView.cpp: + (WebView::notifyPreferencesChanged): Update the WebCore setting based on the WebPreferences setting. + +2010-05-20 Chris Jerdonek <cjerdonek@webkit.org> + + Reviewed by Eric Seidel. + + Modified FrameLoader::urlSelected() to accept a KURL instead of a + ResourceRequest. + + https://bugs.webkit.org/show_bug.cgi?id=39320 + + Since ResourceRequest has non-explicit single-parameter constructors for + String and KURL, urlSelected() previously accepted any of String, KURL, + and ResourceRequest. This revision changes urlSelected() to accept only + a KURL to make the API tighter and easier to refactor. + + * WebCoreSupport/WebContextMenuClient.cpp: + (WebContextMenuClient::searchWithGoogle): + - Updated the call to urlSelected(). + 2010-05-13 Brian Weinstein <bweinstein@apple.com> Reviewed by Tim Hatcher. diff --git a/WebKit/win/Interfaces/IWebPreferences.idl b/WebKit/win/Interfaces/IWebPreferences.idl index 1c43135..4fb3de8 100644 --- a/WebKit/win/Interfaces/IWebPreferences.idl +++ b/WebKit/win/Interfaces/IWebPreferences.idl @@ -47,6 +47,12 @@ typedef enum WebKitEditableLinkBehavior { WebKitEditableLinkNeverLive } WebKitEditableLinkBehavior; +typedef enum WebKitEditingBehavior { + WebKitEditingMacBehavior = 0, + WebKitEditingWinBehavior +} WebKitEditingBehavior; + + typedef enum WebKitCookieStorageAcceptPolicy { WebKitCookieStorageAcceptPolicyAlways = 0, WebKitCookieStorageAcceptPolicyNever, @@ -189,4 +195,7 @@ interface IWebPreferences : IUnknown HRESULT setAcceleratedCompositingEnabled(BOOL acceleratedCompositingEnabled); HRESULT acceleratedCompositingEnabled(BOOL *acceleratedCompositingEnabled); + + HRESULT editingBehavior([out, retval] WebKitEditingBehavior* editingBehavior); + HRESULT setEditingBehavior([in] WebKitEditingBehavior behavior); } diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp index 241c35d..078b725 100644 --- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp +++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp @@ -140,9 +140,8 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame) url.append(encoded); url.append("&ie=UTF-8&oe=UTF-8"); - ResourceRequest request = ResourceRequest(url); if (Page* page = frame->page()) - page->mainFrame()->loader()->urlSelected(request, String(), 0, false, false, true, SendReferrer); + page->mainFrame()->loader()->urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, true, SendReferrer); } void WebContextMenuClient::lookUpInDictionary(Frame*) diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 0e8ee80..319fbbc 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -2150,12 +2150,10 @@ static HDC hdcFromContext(PlatformGraphicsContext* pctx) void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, float headerHeight) { HDC hdc = hdcFromContext(pctx); - const IntRect& marginRect = printerMarginRect(hdc); - const float scale = scaleFactor(hdc, marginRect, pageRect); - int x = static_cast<int>(scale * pageRect.x()); + int x = pageRect.x(); int y = 0; - RECT headerRect = {x, y, x + static_cast<int>(scale * pageRect.width()), y + static_cast<int>(scale * headerHeight)}; + RECT headerRect = {x, y, x + pageRect.width(), y + static_cast<int>(headerHeight)}; ui->drawHeaderInRect(d->webView, &headerRect, static_cast<OLE_HANDLE>(reinterpret_cast<LONG64>(hdc))); } @@ -2163,16 +2161,29 @@ void WebFrame::drawHeader(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, con void WebFrame::drawFooter(PlatformGraphicsContext* pctx, IWebUIDelegate* ui, const IntRect& pageRect, UINT page, UINT pageCount, float headerHeight, float footerHeight) { HDC hdc = hdcFromContext(pctx); - const IntRect& marginRect = printerMarginRect(hdc); - - const float scale = scaleFactor(hdc, marginRect, pageRect); - int x = static_cast<int>(scale * pageRect.x()); - int y = static_cast<int>(scale * max(static_cast<int>(headerHeight) + pageRect.height(), m_pageHeight-static_cast<int>(footerHeight))); - RECT footerRect = {x, y, x + static_cast<int>(scale * pageRect.width()), y + static_cast<int>(scale * footerHeight)}; + + int x = pageRect.x(); + int y = max(static_cast<int>(headerHeight) + pageRect.height(), m_pageHeight -static_cast<int>(footerHeight)); + RECT footerRect = {x, y, x + pageRect.width(), y + static_cast<int>(footerHeight)}; ui->drawFooterInRect(d->webView, &footerRect, static_cast<OLE_HANDLE>(reinterpret_cast<LONG64>(hdc)), page+1, pageCount); } +static XFORM buildXFORMFromCairo(HDC targetDC, cairo_t* previewContext) +{ + XFORM scaled; + GetWorldTransform(targetDC, &scaled); + + cairo_matrix_t ctm; + cairo_get_matrix(previewContext, &ctm); + + // Scale to the preview screen bounds + scaled.eM11 = ctm.xx; + scaled.eM22 = ctm.yy; + + return scaled; +} + void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCtx, HDC printDC, IWebUIDelegate* ui, float headerHeight, float footerHeight, UINT page, UINT pageCount) { Frame* coreFrame = core(this); @@ -2180,48 +2191,83 @@ void WebFrame::spoolPage(PlatformGraphicsContext* pctx, GraphicsContext* spoolCt const IntRect& pageRect = m_pageRects[page]; const IntRect& marginRect = printerMarginRect(printDC); - cairo_save(pctx); + // In preview, the printDC is a placeholder, so just always use the HDC backing the graphics context. + HDC hdc = hdcFromContext(pctx); + spoolCtx->save(); - float scale = scaleFactor(printDC, marginRect, pageRect); - cairo_scale(pctx, scale, scale); + + XFORM original, scaled; + GetWorldTransform(hdc, &original); + + bool preview = (hdc != printDC); + if (preview) { + // If this is a preview, the Windows HDC was set to a non-scaled state so that Cairo will + // draw correctly. We need to retain the correct preview scale here for use when the Cairo + // drawing completes so that we can scale our GDI-based header/footer calls. This is a + // workaround for a bug in Cairo (see https://bugs.freedesktop.org/show_bug.cgi?id=28161) + scaled = buildXFORMFromCairo(hdc, pctx); + } - IntRect cairoMarginRect (marginRect); - cairoMarginRect.scale (1 / scale); + float scale = scaleFactor(printDC, marginRect, pageRect); + + IntRect cairoMarginRect(marginRect); + cairoMarginRect.scale(1 / scale); - // Modify Cairo and GDI World Transform to account for margin in the - // subsequent WebKit-controlled 'paintContents' drawing operations: - spoolCtx->translate(cairoMarginRect.x(), cairoMarginRect.y() + headerHeight); + // We cannot scale the display HDC because the print surface also scales fonts, + // resulting in invalid printing (and print preview) + cairo_scale(pctx, scale, scale); + cairo_translate(pctx, cairoMarginRect.x(), cairoMarginRect.y() + headerHeight); // Modify Cairo (only) to account for page position. cairo_translate(pctx, -pageRect.x(), -pageRect.y()); coreFrame->view()->paintContents(spoolCtx, pageRect); - cairo_translate(pctx, pageRect.x(), pageRect.y()); - - XFORM originalWorld; - ::GetWorldTransform(printDC, &originalWorld); - - // Position GDI world transform to account for margin in GDI-only - // header/footer calls - XFORM newWorld = originalWorld; - newWorld.eDx = marginRect.x(); - newWorld.eDy = marginRect.y(); - - ::SetWorldTransform(printDC, &newWorld); - + + if (preview) { + // If this is a preview, the Windows HDC was set to a non-scaled state so that Cairo would + // draw correctly. We need to rescale the HDC to the correct preview scale so our GDI-based + // header/footer calls will draw properly. This is a workaround for a bug in Cairo. + // (see https://bugs.freedesktop.org/show_bug.cgi?id=28161) + SetWorldTransform(hdc, &scaled); + } + + XFORM xform = TransformationMatrix().translate(marginRect.x(), marginRect.y()).scale(scale); + ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY); + if (headerHeight) drawHeader(pctx, ui, pageRect, headerHeight); if (footerHeight) drawFooter(pctx, ui, pageRect, page, pageCount, headerHeight, footerHeight); - ::SetWorldTransform(printDC, &originalWorld); + SetWorldTransform(hdc, &original); cairo_show_page(pctx); ASSERT(!cairo_status(pctx)); spoolCtx->restore(); - cairo_restore(pctx); } + +static void setCairoTransformToPreviewHDC(cairo_t* previewCtx, HDC previewDC) +{ + XFORM passedCTM; + GetWorldTransform(previewDC, &passedCTM); + + // Reset HDC WorldTransform to unscaled state. Scaling must be + // done in Cairo to avoid drawing errors. + XFORM unscaledCTM = passedCTM; + unscaledCTM.eM11 = 1.0; + unscaledCTM.eM22 = 1.0; + + SetWorldTransform(previewDC, &unscaledCTM); + + // Make the Cairo transform match the information passed to WebKit + // in the HDC's WorldTransform. + cairo_matrix_t ctm = { passedCTM.eM11, passedCTM.eM12, passedCTM.eM21, + passedCTM.eM22, passedCTM.eDx, passedCTM.eDy }; + + cairo_set_matrix(previewCtx, &ctm); +} + #endif HRESULT STDMETHODCALLTYPE WebFrame::spoolPages( @@ -2240,13 +2286,28 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages( ASSERT_NOT_REACHED(); return E_POINTER; } + + HDC targetDC = (ctx) ? (HDC)ctx : printDC; - cairo_surface_t* printSurface = cairo_win32_printing_surface_create(printDC); - ctx = cairo_create(printSurface); - if (!ctx) { + cairo_surface_t* printSurface = 0; + if (ctx) + printSurface = cairo_win32_surface_create(targetDC); // in-memory + else + printSurface = cairo_win32_printing_surface_create(targetDC); // metafile + + PlatformGraphicsContext* pctx = (PlatformGraphicsContext*)cairo_create(printSurface); + if (!pctx) { cairo_surface_destroy(printSurface); return E_FAIL; } + + if (ctx) { + // If this is a preview, the Windows HDC was sent with scaling information. + // Retrieve it and reset it so that it draws properly. This is a workaround + // for a bug in Cairo (see https://bugs.freedesktop.org/show_bug.cgi?id=28161) + setCairoTransformToPreviewHDC(pctx, targetDC); + } + cairo_surface_set_fallback_resolution(printSurface, 72.0, 72.0); #endif @@ -2260,7 +2321,9 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages( return E_FAIL; UINT pageCount = (UINT) m_pageRects.size(); +#if PLATFORM(CG) PlatformGraphicsContext* pctx = (PlatformGraphicsContext*)ctx; +#endif if (!pageCount || startPage > pageCount) { ASSERT_NOT_REACHED(); diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h index c49a96d..da63754 100644 --- a/WebKit/win/WebPreferenceKeysPrivate.h +++ b/WebKit/win/WebPreferenceKeysPrivate.h @@ -74,6 +74,7 @@ #define WebKitPDFDisplayModePreferenceKey "WebKitPDFDisplayMode" #define WebKitPDFScaleFactorPreferenceKey "WebKitPDFScaleFactor" #define WebKitEditableLinkBehaviorPreferenceKey "WebKitEditableLinkBehavior" +#define WebKitEditingBehaviorPreferenceKey "WebKitEditingBehavior" // Window display is throttled to 60 frames per second if WebKitThrottleWindowDisplayPreferenceKey // is set to YES. The window display throttle is OFF by default for compatibility with Mac OS X diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp index 33e904d..e49bd20 100644 --- a/WebKit/win/WebPreferences.cpp +++ b/WebKit/win/WebPreferences.cpp @@ -1130,6 +1130,21 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setEditableLinkBehavior( return S_OK; } +HRESULT STDMETHODCALLTYPE WebPreferences::editingBehavior( + /* [out, retval] */ WebKitEditingBehavior* editingBehavior) +{ + *editingBehavior = (WebKitEditingBehavior) integerValueForKey(CFSTR(WebKitEditingBehaviorPreferenceKey)); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::setEditingBehavior( + /* [in] */ WebKitEditingBehavior behavior) +{ + setIntegerValue(CFSTR(WebKitEditingBehaviorPreferenceKey), behavior); + return S_OK; +} + + HRESULT STDMETHODCALLTYPE WebPreferences::cookieStorageAcceptPolicy( /* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy ) { diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h index cfdefa8..1ea69c7 100644 --- a/WebKit/win/WebPreferences.h +++ b/WebKit/win/WebPreferences.h @@ -238,6 +238,12 @@ public: virtual HRESULT STDMETHODCALLTYPE setEditableLinkBehavior( /* [in] */ WebKitEditableLinkBehavior behavior); + virtual HRESULT STDMETHODCALLTYPE editingBehavior( + /* [retval][out] */ WebKitEditingBehavior* behavior); + + virtual HRESULT STDMETHODCALLTYPE setEditingBehavior( + /* [in] */ WebKitEditingBehavior behavior); + virtual HRESULT STDMETHODCALLTYPE cookieStorageAcceptPolicy( /* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy); diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index 1fbd8d3..20f0f06 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -2561,12 +2561,13 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( #else WebGeolocationControllerClient* geolocationControllerClient = 0; #endif + DeviceOrientationClient* deviceOrientationClient = 0; BOOL useHighResolutionTimer; if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer))) Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer); - m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient); + m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient, deviceOrientationClient); BSTR localStoragePath; if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) { @@ -4593,6 +4594,12 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) return hr; settings->setEditableLinkBehavior((EditableLinkBehavior)behavior); + WebKitEditingBehavior editingBehavior; + hr = preferences->editingBehavior(&editingBehavior); + if (FAILED(hr)) + return hr; + settings->setEditingBehavior((EditingBehavior)editingBehavior); + hr = preferences->usesPageCache(&enabled); if (FAILED(hr)) return hr; @@ -6155,7 +6162,7 @@ void WebView::setAcceleratedCompositing(bool accelerated) return; if (accelerated) { - m_layerRenderer = WKCACFLayerRenderer::create(); + m_layerRenderer = WKCACFLayerRenderer::create(this); if (m_layerRenderer) { m_isAcceleratedCompositing = true; @@ -6371,6 +6378,20 @@ HRESULT WebView::nextDisplayIsSynchronous() return S_OK; } +#if USE(ACCELERATED_COMPOSITING) +bool WebView::shouldRender() const +{ + Frame* coreFrame = core(m_mainFrame); + if (!coreFrame) + return true; + FrameView* frameView = coreFrame->view(); + if (!frameView) + return true; + + return !frameView->layoutPending(); +} +#endif + class EnumTextMatches : public IEnumTextMatches { long m_ref; diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h index 29f8705..752c16d 100644 --- a/WebKit/win/WebView.h +++ b/WebKit/win/WebView.h @@ -66,6 +66,9 @@ class WebView , public IWebNotificationObserver , public IDropTarget , WebCore::WindowMessageListener +#if USE(ACCELERATED_COMPOSITING) + , WebCore::WKCACFLayerRendererClient +#endif { public: static WebView* createInstance(); @@ -921,6 +924,11 @@ private: // (see https://bugs.webkit.org/show_bug.cgi?id=29264) DWORD m_lastDropEffect; +#if USE(ACCELERATED_COMPOSITING) + // WKCACFLayerRendererClient + virtual bool shouldRender() const; +#endif + protected: static bool registerWebViewWindowClass(); static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); |