diff options
Diffstat (limited to 'WebKit/chromium/src')
28 files changed, 631 insertions, 151 deletions
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" |