diff options
Diffstat (limited to 'Source/WebKit/chromium/src')
84 files changed, 1727 insertions, 913 deletions
diff --git a/Source/WebKit/chromium/src/ApplicationCacheHostInternal.h b/Source/WebKit/chromium/src/ApplicationCacheHostInternal.h index b9dee63a4..54b5f1c7d 100644 --- a/Source/WebKit/chromium/src/ApplicationCacheHostInternal.h +++ b/Source/WebKit/chromium/src/ApplicationCacheHostInternal.h @@ -35,9 +35,7 @@ #include "WebApplicationCacheHostClient.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebURL.h" +#include <public/WebURL.h> namespace WebCore { diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 5f250351a..8f2dc5e86 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -49,11 +49,13 @@ #include "GeolocationError.h" #include "GeolocationPosition.h" #include "HTMLInputElement.h" +#include "IDBCursor.h" #include "IDBDatabaseException.h" #include "IDBFactoryBackendInterface.h" #include "IDBKey.h" #include "IDBKeyPath.h" #include "IDBMetadata.h" +#include "IDBTransactionBackendInterface.h" #include "IceOptions.h" #include "IconURL.h" #include "MediaPlayer.h" @@ -84,11 +86,13 @@ #include "WebFontDescription.h" #include "WebGeolocationError.h" #include "WebGeolocationPosition.h" +#include "WebIDBCursor.h" #include "WebIDBDatabaseException.h" #include "WebIDBFactory.h" #include "WebIDBKey.h" #include "WebIDBKeyPath.h" #include "WebIDBMetadata.h" +#include "WebIDBTransaction.h" #include "WebIconURL.h" #include "WebInputElement.h" #include "WebMediaPlayer.h" @@ -433,6 +437,23 @@ 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(WebScrollbar::RegularScrollbar, RegularScrollbar); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::SmallScrollbar, SmallScrollbar); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::NoPart, NoPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::BackButtonStartPart, BackButtonStartPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ForwardButtonStartPart, ForwardButtonStartPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::BackTrackPart, BackTrackPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ThumbPart, ThumbPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ForwardTrackPart, ForwardTrackPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::BackButtonEndPart, BackButtonEndPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ForwardButtonEndPart, ForwardButtonEndPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollbarBGPart, ScrollbarBGPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::TrackBGPart, TrackBGPart); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::AllParts, AllParts); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollbarOverlayStyleDefault, ScrollbarOverlayStyleDefault); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollbarOverlayStyleDark, ScrollbarOverlayStyleDark); +COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollbarOverlayStyleLight, ScrollbarOverlayStyleLight); + COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorMac, EditingMacBehavior); COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorWin, EditingWindowsBehavior); COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorUnix, EditingUnixBehavior); @@ -465,6 +486,14 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::StringType, IDBKeyPath::StringType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::ArrayType, IDBKeyPath::ArrayType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBMetadata::NoIntVersion, IDBDatabaseMetadata::NoIntVersion); + +COMPILE_ASSERT_MATCHING_ENUM(WebIDBCursor::Next, IDBCursor::NEXT); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBCursor::NextNoDuplicate, IDBCursor::NEXT_NO_DUPLICATE); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBCursor::Prev, IDBCursor::PREV); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBCursor::PrevNoDuplicate, IDBCursor::PREV_NO_DUPLICATE); + +COMPILE_ASSERT_MATCHING_ENUM(WebIDBTransaction::PreemptiveTask, IDBTransactionBackendInterface::PreemptiveTask); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBTransaction::NormalTask, IDBTransactionBackendInterface::NormalTask); #endif #if ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp index 086e79e7d..b2ceab78b 100644 --- a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp +++ b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp @@ -40,16 +40,14 @@ #include "WebApplicationCacheHost.h" #include "WebDataSource.h" #include "WebFrameImpl.h" -#include "WebKit.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" #include "XMLHttpRequest.h" -#include "platform/WebHTTPHeaderVisitor.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebString.h" -#include "platform/WebURLError.h" -#include "platform/WebURLLoaderClient.h" -#include "platform/WebURLRequest.h" +#include <public/WebHTTPHeaderVisitor.h> +#include <public/WebString.h> +#include <public/WebURLError.h> +#include <public/WebURLLoaderClient.h> +#include <public/WebURLRequest.h> #include <wtf/HashSet.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index 5f608a3d9..a6b9b64f9 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -41,9 +41,6 @@ #include "WebFileInfo.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" -#include "WebKit.h" -#include "platform/WebFileSystem.h" -#include "platform/WebKitPlatformSupport.h" #include <public/Platform.h> #include <public/WebFileSystem.h> #include <wtf/text/CString.h> @@ -102,7 +99,7 @@ PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create() } AsyncFileSystemChromium::AsyncFileSystemChromium() - : m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) + : m_webFileSystem(WebKit::Platform::current()->fileSystem()) { ASSERT(m_webFileSystem); } diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp index cadb2e3a9..646e9ef0d 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp @@ -52,13 +52,14 @@ const size_t fifoSize = 8192; const unsigned numberOfChannels = 2; // Factory method: Chromium-implementation -PassOwnPtr<AudioDestination> AudioDestination::create(AudioSourceProvider& provider, float sampleRate) +PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, float sampleRate) { - return adoptPtr(new AudioDestinationChromium(provider, sampleRate)); + return adoptPtr(new AudioDestinationChromium(callback, sampleRate)); } -AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider, float sampleRate) - : m_renderBus(numberOfChannels, renderBufferSize, false) +AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, float sampleRate) + : m_callback(callback) + , m_renderBus(numberOfChannels, renderBufferSize, false) , m_sampleRate(sampleRate) , m_isPlaying(false) { @@ -78,7 +79,7 @@ AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider // contains enough data, the data will be provided directly. // Otherwise, the FIFO will call the provider enough times to // satisfy the request for data. - m_fifo = adoptPtr(new AudioPullFIFO(provider, numberOfChannels, fifoSize, renderBufferSize)); + m_fifo = adoptPtr(new AudioPullFIFO(*this, numberOfChannels, fifoSize, renderBufferSize)); } AudioDestinationChromium::~AudioDestinationChromium() @@ -127,6 +128,12 @@ void AudioDestinationChromium::render(const WebVector<float*>& audioData, size_t m_fifo->consume(&m_renderBus, numberOfFrames); } +void AudioDestinationChromium::provideInput(AudioBus* bus, size_t framesToProcess) +{ + // FIXME: Add support for local/live audio input. + m_callback.render(0, bus, framesToProcess); +} + } // namespace WebCore #endif // ENABLE(WEB_AUDIO) diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.h b/Source/WebKit/chromium/src/AudioDestinationChromium.h index be4cc4b84..fd676d102 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.h +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.h @@ -31,6 +31,7 @@ #include "AudioBus.h" #include "AudioDestination.h" +#include "AudioIOCallback.h" #include "AudioSourceProvider.h" #include "platform/WebAudioDevice.h" #include "platform/WebVector.h" @@ -43,9 +44,9 @@ class AudioPullFIFO; // An AudioDestination using Chromium's audio system -class AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback { +class AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback, public AudioSourceProvider { public: - AudioDestinationChromium(AudioSourceProvider&, float sampleRate); + AudioDestinationChromium(AudioIOCallback&, float sampleRate); virtual ~AudioDestinationChromium(); virtual void start(); @@ -57,7 +58,11 @@ public: // WebKit::WebAudioDevice::RenderCallback virtual void render(const WebKit::WebVector<float*>& audioData, size_t numberOfFrames); + // WebCore::AudioSourceProvider + virtual void provideInput(AudioBus*, size_t framesToProcess); + private: + AudioIOCallback& m_callback; AudioBus m_renderBus; float m_sampleRate; bool m_isPlaying; diff --git a/Source/WebKit/chromium/src/BlobRegistryProxy.cpp b/Source/WebKit/chromium/src/BlobRegistryProxy.cpp index 05fbb3638..a78bde36e 100644 --- a/Source/WebKit/chromium/src/BlobRegistryProxy.cpp +++ b/Source/WebKit/chromium/src/BlobRegistryProxy.cpp @@ -37,11 +37,10 @@ #include "BlobData.h" #include "KURL.h" #include "ResourceHandle.h" -#include "WebKit.h" -#include "platform/WebURL.h" #include <public/Platform.h> #include <public/WebBlobData.h> #include <public/WebBlobRegistry.h> +#include <public/WebURL.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> diff --git a/Source/WebKit/chromium/src/CCThreadImpl.cpp b/Source/WebKit/chromium/src/CCThreadImpl.cpp deleted file mode 100644 index ef7bb5cb3..000000000 --- a/Source/WebKit/chromium/src/CCThreadImpl.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2011 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "CCThreadImpl.h" - -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebThread.h" -#include "cc/CCCompletionEvent.h" -#include <stdint.h> - -using namespace WebCore; - -namespace WebKit { - -// Task that, when runs, places the current thread ID into the provided -// pointer and signals a completion event. -// -// Does not provide a PassOwnPtr<GetThreadIDTask>::create method because -// the resulting object is always handed into a WebThread, which does not understand -// PassOwnPtrs. -class GetThreadIDTask : public WebThread::Task { -public: - GetThreadIDTask(ThreadIdentifier* result, CCCompletionEvent* completion) - : m_completion(completion) - , m_result(result) { } - - virtual ~GetThreadIDTask() { } - - virtual void run() - { - *m_result = currentThread(); - m_completion->signal(); - } - -private: - CCCompletionEvent* m_completion; - ThreadIdentifier* m_result; -}; - -// General adapter from a CCThread::Task to a WebThread::Task. -class CCThreadTaskAdapter : public WebThread::Task { -public: - CCThreadTaskAdapter(PassOwnPtr<CCThread::Task> task) : m_task(task) { } - - virtual ~CCThreadTaskAdapter() { } - - virtual void run() - { - m_task->performTask(); - } - -private: - OwnPtr<CCThread::Task> m_task; -}; - -PassOwnPtr<CCThread> CCThreadImpl::create(WebThread* thread) -{ - return adoptPtr(new CCThreadImpl(thread)); -} - -CCThreadImpl::~CCThreadImpl() -{ -} - -void CCThreadImpl::postTask(PassOwnPtr<CCThread::Task> task) -{ - m_thread->postTask(new CCThreadTaskAdapter(task)); -} - -void CCThreadImpl::postDelayedTask(PassOwnPtr<CCThread::Task> task, long long delayMs) -{ - m_thread->postDelayedTask(new CCThreadTaskAdapter(task), delayMs); -} - -ThreadIdentifier CCThreadImpl::threadID() const -{ - return m_threadID; -} - -CCThreadImpl::CCThreadImpl(WebThread* thread) - : m_thread(thread) -{ - if (thread == WebKit::Platform::current()->currentThread()) { - m_threadID = currentThread(); - return; - } - - // Get the threadId for the newly-created thread by running a task - // on that thread, blocking on the result. - m_threadID = currentThread(); - CCCompletionEvent completion; - m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion)); - completion.wait(); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index f7cb94bbc..ad1000e63 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -37,7 +37,7 @@ #if ENABLE(INPUT_TYPE_COLOR) #include "ColorChooser.h" #include "ColorChooserClient.h" -#include "ColorChooserProxy.h" +#include "ColorChooserUIController.h" #endif #include "Console.h" #include "Cursor.h" @@ -77,7 +77,6 @@ #include "WebAccessibilityObject.h" #if ENABLE(INPUT_TYPE_COLOR) #include "WebColorChooser.h" -#include "WebColorChooserClientImpl.h" #endif #include "WebConsoleMessage.h" #include "WebCursorInfo.h" @@ -694,17 +693,16 @@ void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64 } #if ENABLE(INPUT_TYPE_COLOR) -PassOwnPtr<ColorChooser> ChromeClientImpl::createColorChooser(ColorChooserClient* chooserClient, const Color& initialColor) +PassOwnPtr<ColorChooser> ChromeClientImpl::createColorChooser(ColorChooserClient* chooserClient, const Color&) +{ + return adoptPtr(new ColorChooserUIController(this, chooserClient)); +} +PassOwnPtr<WebColorChooser> ChromeClientImpl::createWebColorChooser(WebColorChooserClient* chooserClient, const WebColor& initialColor) { WebViewClient* client = m_webView->client(); if (!client) return nullptr; - WebColorChooserClientImpl* chooserClientProxy = new WebColorChooserClientImpl(chooserClient); - WebColor webColor = static_cast<WebColor>(initialColor.rgb()); - WebColorChooser* chooser = client->createColorChooser(chooserClientProxy, webColor); - if (!chooser) - return nullptr; - return adoptPtr(new ColorChooserProxy(adoptPtr(chooser))); + return adoptPtr(client->createColorChooser(chooserClient, initialColor)); } #endif @@ -1114,6 +1112,15 @@ bool ChromeClientImpl::isPointerLocked() } #endif +#if ENABLE(WIDGET_REGION) +void ChromeClientImpl::dashboardRegionsChanged() +{ + WebViewClient* client = m_webView->client(); + if (client) + client->draggableRegionsChanged(); +} +#endif + #if ENABLE(REGISTER_PROTOCOL_HANDLER) PassOwnPtr<RegisterProtocolHandlerClientImpl> RegisterProtocolHandlerClientImpl::create(WebViewImpl* webView) { diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 30315d394..a786dc5eb 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -37,14 +37,13 @@ #include "RegisterProtocolHandlerClient.h" #include "SearchPopupMenu.h" #include "WebNavigationPolicy.h" +#include <public/WebColor.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class AccessibilityObject; -#if ENABLE(INPUT_TYPE_COLOR) class ColorChooser; class ColorChooserClient; -#endif class Element; class FileChooser; class PopupContainer; @@ -55,6 +54,8 @@ struct WindowFeatures; } namespace WebKit { +class WebColorChooser; +class WebColorChooserClient; class WebViewImpl; struct WebCursorInfo; struct WebPopupMenuInfo; @@ -135,9 +136,13 @@ public: WebCore::Frame*, const WTF::String& databaseName); virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded); +#if ENABLE(WIDGET_REGION) + virtual void dashboardRegionsChanged(); +#endif virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&); #if ENABLE(INPUT_TYPE_COLOR) virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE; + PassOwnPtr<WebColorChooser> createWebColorChooser(WebColorChooserClient*, const WebColor&); #endif virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*); diff --git a/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp b/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp index 25090fdd0..c1ab19609 100644 --- a/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp +++ b/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp @@ -29,10 +29,9 @@ */ #include "config.h" -#include <wtf/CurrentTime.h> -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" +#include <public/Platform.h> +#include <wtf/CurrentTime.h> namespace WTF { diff --git a/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp b/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp index 9a31f4ae4..00691b49e 100644 --- a/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp +++ b/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp @@ -31,8 +31,6 @@ #include "config.h" #include <wtf/OSRandomSource.h> -#include "WebKit.h" - #include <public/Platform.h> namespace WTF { diff --git a/Source/WebKit/chromium/src/ChromiumThreading.cpp b/Source/WebKit/chromium/src/ChromiumThreading.cpp index bc677f3c9..d6520e2b3 100644 --- a/Source/WebKit/chromium/src/ChromiumThreading.cpp +++ b/Source/WebKit/chromium/src/ChromiumThreading.cpp @@ -29,12 +29,9 @@ */ #include "config.h" -#include <wtf/chromium/ChromiumThreading.h> - -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include <wtf/MainThread.h> +#include <public/Platform.h> +#include <wtf/chromium/ChromiumThreading.h> namespace WTF { diff --git a/Source/WebKit/chromium/src/ColorChooserProxy.cpp b/Source/WebKit/chromium/src/ColorChooserProxy.cpp deleted file mode 100644 index 6cf72d524..000000000 --- a/Source/WebKit/chromium/src/ColorChooserProxy.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011 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. - * - * 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 "ColorChooserProxy.h" - -#include "Color.h" -#include "WebColorChooser.h" -#include "platform/WebColor.h" - -#if ENABLE(INPUT_TYPE_COLOR) - -namespace WebKit { - -ColorChooserProxy::ColorChooserProxy(PassOwnPtr<WebColorChooser> chooser) : m_chooser(chooser) -{ -} - -ColorChooserProxy::~ColorChooserProxy() -{ -} - -void ColorChooserProxy::setSelectedColor(const WebCore::Color& color) -{ - if (!m_chooser) - return; - WebColor webColor = static_cast<WebColor>(color.rgb()); - m_chooser->setSelectedColor(webColor); -} - -void ColorChooserProxy::endChooser() -{ - if (!m_chooser) - return; - m_chooser->endChooser(); -} - -} - -#endif // ENABLE(INPUT_TYPE_COLOR) diff --git a/Source/WebKit/chromium/src/ColorChooserProxy.h b/Source/WebKit/chromium/src/ColorChooserProxy.h deleted file mode 100644 index 987f67b3c..000000000 --- a/Source/WebKit/chromium/src/ColorChooserProxy.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2011 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. - * - * 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 ColorChooserProxy_h -#define ColorChooserProxy_h - -#include "ColorChooser.h" -#include "WebColorChooser.h" -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> - -#if ENABLE(INPUT_TYPE_COLOR) - -namespace WebKit { - -class ColorChooserProxy : public WebCore::ColorChooser { -public: - ColorChooserProxy(PassOwnPtr<WebColorChooser>); - virtual ~ColorChooserProxy(); - - virtual void setSelectedColor(const WebCore::Color&); - virtual void endChooser(); - -private: - OwnPtr<WebColorChooser> m_chooser; -}; - -} // namespace WebKit - -#endif // ENABLE(INPUT_TYPE_COLOR) - -#endif // ColorChooserProxy_h diff --git a/Source/WebKit/chromium/src/ColorChooserUIController.cpp b/Source/WebKit/chromium/src/ColorChooserUIController.cpp new file mode 100644 index 000000000..28cdc3840 --- /dev/null +++ b/Source/WebKit/chromium/src/ColorChooserUIController.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2012 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. + * + * 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 "ColorChooserUIController.h" + +#if ENABLE(INPUT_TYPE_COLOR) + +#include "ChromeClientImpl.h" +#include "Color.h" +#include "ColorChooserClient.h" +#include "ColorSuggestionPicker.h" +#include "IntRect.h" +#include "LocalizedStrings.h" +#include "WebColorChooser.h" +#include "platform/WebColor.h" +#include "platform/WebKitPlatformSupport.h" +#include <public/WebLocalizedString.h> + +namespace WebKit { + +// Keep in sync with Actions in colorSuggestionPicker.js. +enum ColorPickerPopupAction { + ColorPickerPopupActionChooseOtherColor = -2, + ColorPickerPopupActionCancel = -1, + ColorPickerPopupActionSetValue = 0 +}; + +ColorChooserUIController::ColorChooserUIController(ChromeClientImpl* chromeClient, WebCore::ColorChooserClient* client) + : m_chromeClient(chromeClient) + , m_client(client) + , m_popup(0) +{ + if (m_client->shouldShowSuggestions()) + openPopup(); + else + openColorChooser(); +} + +ColorChooserUIController::~ColorChooserUIController() +{ +} + +void ColorChooserUIController::setSelectedColor(const WebCore::Color& color) +{ + ASSERT(m_chooser); + m_chooser->setSelectedColor(static_cast<WebColor>(color.rgb())); +} + +void ColorChooserUIController::endChooser() +{ + if (m_chooser) + m_chooser->endChooser(); + if (m_popup) + closePopup(); +} + +void ColorChooserUIController::didChooseColor(const WebColor& color) +{ + ASSERT(m_client); + m_client->didChooseColor(WebCore::Color(static_cast<WebCore::RGBA32>(color))); +} + +void ColorChooserUIController::didEndChooser() +{ + ASSERT(m_client); + m_chooser = nullptr; + m_client->didEndChooser(); +} + +WebCore::IntSize ColorChooserUIController::contentSize() +{ + return WebCore::IntSize(0, 0); +} + +void ColorChooserUIController::writeDocument(WebCore::DocumentWriter& writer) +{ + Vector<WebCore::Color> suggestions = m_client->suggestions(); + Vector<String> suggestionValues; + for (unsigned i = 0; i < suggestions.size(); i++) + suggestionValues.append(suggestions[i].serialized()); + + WebCore::PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); + writer.addData(WebCore::colorSuggestionPickerCss, sizeof(WebCore::colorSuggestionPickerCss)); + WebCore::PagePopupClient::addString("</style></head><body><div id=main>Loading...</div><script>\n" + "window.dialogArguments = {\n", writer); + WebCore::PagePopupClient::addProperty("values", suggestionValues, writer); + WebCore::PagePopupClient::addProperty("otherColorLabel", Platform::current()->queryLocalizedString(WebLocalizedString::OtherColorLabel), writer); + WebCore::PagePopupClient::addString("};\n", writer); + writer.addData(WebCore::colorSuggestionPickerJs, sizeof(WebCore::colorSuggestionPickerJs)); + WebCore::PagePopupClient::addString("</script></body>\n", writer); +} + +void ColorChooserUIController::setValueAndClosePopup(int numValue, const String& stringValue) +{ + ASSERT(m_popup); + ASSERT(m_client); + if (numValue == ColorPickerPopupActionSetValue) + m_client->didChooseColor(WebCore::Color(stringValue)); + if (numValue == ColorPickerPopupActionChooseOtherColor) + openColorChooser(); + closePopup(); +} + +void ColorChooserUIController::didClosePopup() +{ + m_popup = 0; + + if (!m_chooser) + didEndChooser(); +} + +void ColorChooserUIController::openPopup() +{ + ASSERT(!m_popup); + m_popup = m_chromeClient->openPagePopup(this, m_client->elementRectRelativeToRootView()); +} + +void ColorChooserUIController::closePopup() +{ + if (!m_popup) + return; + m_chromeClient->closePagePopup(m_popup); +} + +void ColorChooserUIController::openColorChooser() +{ + ASSERT(!m_chooser); + m_chooser = m_chromeClient->createWebColorChooser(this, static_cast<WebColor>(m_client->currentColor().rgb())); +} + +} // namespace WebKit + +#endif // ENABLE(INPUT_TYPE_COLOR) diff --git a/Source/WebKit/chromium/src/WebColorChooserClientImpl.h b/Source/WebKit/chromium/src/ColorChooserUIController.h index d5a085da8..98adb6714 100644 --- a/Source/WebKit/chromium/src/WebColorChooserClientImpl.h +++ b/Source/WebKit/chromium/src/ColorChooserUIController.h @@ -23,33 +23,59 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebColorChooserClientImpl_h -#define WebColorChooserClientImpl_h - -#include "WebColorChooserClient.h" +#ifndef ColorChooserUIController_h +#define ColorChooserUIController_h #if ENABLE(INPUT_TYPE_COLOR) +#include "ColorChooser.h" +#include "PagePopupClient.h" +#include "WebColorChooserClient.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + namespace WebCore { class ColorChooserClient; +class PagePopup; } namespace WebKit { -class WebColorChooserClientImpl : public WebColorChooserClient { +class ChromeClientImpl; +class WebColorChooser; + +class ColorChooserUIController : public WebColorChooserClient, public WebCore::ColorChooser, public WebCore::PagePopupClient { public: - WebColorChooserClientImpl(WebCore::ColorChooserClient*); - virtual ~WebColorChooserClientImpl(); + ColorChooserUIController(ChromeClientImpl*, WebCore::ColorChooserClient*); + virtual ~ColorChooserUIController(); + + // ColorChooser functions: + virtual void setSelectedColor(const WebCore::Color&) OVERRIDE; + virtual void endChooser() OVERRIDE; + // WebColorChooserClient functions: virtual void didChooseColor(const WebColor&) OVERRIDE; virtual void didEndChooser() OVERRIDE; + // PagePopupClient functions: + virtual WebCore::IntSize contentSize() OVERRIDE; + virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE; + virtual void setValueAndClosePopup(int, const String&) OVERRIDE; + virtual void didClosePopup() OVERRIDE; + private: + void openPopup(); + void closePopup(); + void openColorChooser(); + + ChromeClientImpl* m_chromeClient; WebCore::ColorChooserClient* m_client; + OwnPtr<WebColorChooser> m_chooser; + WebCore::PagePopup* m_popup; }; } #endif // ENABLE(INPUT_TYPE_COLOR) -#endif // WebColorChooserClientImpl_h +#endif // ColorChooserUIController_h diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index b2d060f0e..b5eaf595f 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -49,9 +49,9 @@ #include "WebElement.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" -#include "WebKit.h" #include "WebInputElement.h" #include "WebInputEventConversion.h" +#include "WebKit.h" #include "WebNode.h" #include "WebPermissionClient.h" #include "WebRange.h" diff --git a/Source/WebKit/chromium/src/ExternalPopupMenu.h b/Source/WebKit/chromium/src/ExternalPopupMenu.h index aefd35e12..382bf4cbf 100644 --- a/Source/WebKit/chromium/src/ExternalPopupMenu.h +++ b/Source/WebKit/chromium/src/ExternalPopupMenu.h @@ -33,6 +33,8 @@ #include "PopupMenu.h" #include "WebExternalPopupMenuClient.h" +#include <public/WebCanvas.h> +#include <public/WebScrollbar.h> namespace WebCore { class FrameView; @@ -45,6 +47,7 @@ namespace WebKit { class WebExternalPopupMenu; class WebViewClient; struct WebPopupMenuInfo; +class WebInputEvent; // The ExternalPopupMenu connects the actual implementation of the popup menu // to the WebCore popup menu. @@ -76,7 +79,7 @@ private: // The actual implementor of the show menu. WebExternalPopupMenu* m_webExternalPopupMenu; -}; +}; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index b67798e74..1e315660a 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -52,7 +52,6 @@ #include "MessageEvent.h" #include "MouseEvent.h" #include "Page.h" -#include "PlatformString.h" #include "PluginData.h" #include "PluginDataChromium.h" #include "ProgressTracker.h" @@ -69,7 +68,6 @@ #include "WebFrameImpl.h" #include "WebIntentRequest.h" #include "WebIntentServiceInfo.h" -#include "WebKit.h" #include "WebNode.h" #include "WebPermissionClient.h" #include "WebPlugin.h" @@ -83,14 +81,15 @@ #include "WindowFeatures.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" -#include "platform/WebKitPlatformSupport.h" #include "platform/WebURL.h" #include "platform/WebURLError.h" #include "platform/WebVector.h" +#include <public/Platform.h> #include <public/WebMimeRegistry.h> #include <wtf/StringExtras.h> #include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> #if USE(V8) #include <v8.h> @@ -1606,7 +1605,7 @@ bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( if (event && event->source() && event->source()->document()) source = WebFrameImpl::fromFrame(event->source()->document()->frame()); return m_webFrame->client()->willCheckAndDispatchMessageEvent( - source, WebSecurityOrigin(target), WebDOMMessageEvent(event)); + source, m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event)); } #if ENABLE(WEB_INTENTS_TAG) diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index e2c9bb9e2..c1bec1077 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -43,9 +43,7 @@ #include "WebIDBDatabaseError.h" #include "WebIDBFactory.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebPermissionClient.h" -#include "platform/WebVector.h" #include "WebViewImpl.h" #include "WebWorkerBase.h" #include "WebWorkerClientImpl.h" @@ -53,6 +51,8 @@ #include "WorkerLoaderProxy.h" #include "WorkerScriptController.h" #include "WorkerThread.h" +#include "platform/WebKitPlatformSupport.h" +#include <public/WebVector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index e3f7f1318..0338d3f2d 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -143,6 +143,11 @@ void InspectorFrontendClientImpl::append(const String& url, const String& conten m_client->append(url, content); } +bool InspectorFrontendClientImpl::canInspectWorkers() +{ + return true; +} + void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) { m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url); diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h index 4f66e1bcd..55e57e696 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -72,6 +72,7 @@ public: virtual bool canSave(); virtual void save(const WTF::String& urk, const WTF::String& content, bool forceSaveAs); virtual void append(const WTF::String& urk, const WTF::String& content); + virtual bool canInspectWorkers(); virtual void inspectedURLChanged(const WTF::String&); diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 081a67b8a..2a4432d8a 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -34,11 +34,9 @@ #include "IntSize.h" #include "NotImplemented.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebString.h" - +#include <public/Platform.h> #include <public/WebLocalizedString.h> +#include <public/WebString.h> #include <wtf/text/StringBuilder.h> #include <wtf/text/WTFString.h> @@ -215,6 +213,12 @@ String crashedPluginText() return String("Plug-in Failure"); } +String blockedPluginByContentSecurityPolicyText() +{ + notImplemented(); + return String(); +} + String insecurePluginVersionText() { notImplemented(); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 899315d29..fb9c12de6 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -30,10 +30,9 @@ #include "FloatPoint.h" #include "FloatRect.h" #include "GraphicsLayer.h" -#include "LayerChromium.h" #include "PlatformContextSkia.h" #include "WebViewImpl.h" -#include "cc/CCLayerTreeHost.h" +#include <public/WebContentLayer.h> #include <public/WebFloatPoint.h> namespace WebKit { @@ -49,10 +48,11 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView) m_graphicsLayer->setName("non-composited content"); #endif m_graphicsLayer->setDrawsContent(true); - m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true); - m_graphicsLayer->platformLayer()->setOpaque(true); + WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>(); + layer.setUseLCDText(true); + layer.setOpaque(true); #if !OS(ANDROID) - m_graphicsLayer->platformLayer()->setDrawCheckerboardForMissingTiles(true); + layer.setDrawCheckerboardForMissingTiles(true); #endif } @@ -77,11 +77,10 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) if (!layer) { m_graphicsLayer->removeFromParent(); - m_graphicsLayer->platformLayer()->setLayerTreeHost(0); return; } - if (WebScrollableLayer(layer->platformLayer()) == scrollLayer()) + if (*layer->platformLayer() == scrollLayer()) return; layer->addChildAtIndex(m_graphicsLayer.get(), 0); @@ -152,7 +151,7 @@ WebScrollableLayer NonCompositedContentHost::scrollLayer() { if (!m_graphicsLayer->parent()) return WebScrollableLayer(); - return WebScrollableLayer(m_graphicsLayer->parent()->platformLayer()); + return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>(); } void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) @@ -169,9 +168,7 @@ void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLay void NonCompositedContentHost::notifySyncRequired(const WebCore::GraphicsLayer*) { - WebCore::CCLayerTreeHost* layerTreeHost = m_graphicsLayer->platformLayer()->layerTreeHost(); - if (layerTreeHost) - layerTreeHost->setNeedsCommit(); + m_webView->scheduleCompositingLayerSync(); } void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) diff --git a/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp b/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp index cd903c221..deb9031cc 100644 --- a/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp +++ b/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp @@ -35,8 +35,6 @@ #include "ScriptExecutionContext.h" #include "SerializedScriptValue.h" -#include "WebKit.h" - #include <public/Platform.h> #include <public/WebMessagePortChannel.h> #include <public/WebString.h> diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp index 0888e3033..aa9b189a7 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp @@ -85,23 +85,13 @@ void SpeechRecognitionClientProxy::didStartSound(const WebSpeechRecognitionHandl { RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); recognition->didStartSound(); -} - -void SpeechRecognitionClientProxy::didStartSpeech(const WebSpeechRecognitionHandle& handle) -{ - RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); recognition->didStartSpeech(); } -void SpeechRecognitionClientProxy::didEndSpeech(const WebSpeechRecognitionHandle& handle) -{ - RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); - recognition->didEndSpeech(); -} - void SpeechRecognitionClientProxy::didEndSound(const WebSpeechRecognitionHandle& handle) { RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); + recognition->didEndSpeech(); recognition->didEndSound(); } diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h index 8063e71ed..750cbae5c 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h @@ -53,8 +53,6 @@ public: // WebSpeechRecognizerClient: virtual void didStartAudio(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didStartSound(const WebSpeechRecognitionHandle&) OVERRIDE; - virtual void didStartSpeech(const WebSpeechRecognitionHandle&) OVERRIDE; - virtual void didEndSpeech(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didEndSound(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didEndAudio(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE; diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 576105c4d..722e80f53 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -120,6 +120,11 @@ bool StorageAreaProxy::canAccessStorage(Frame* frame) const return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); } +size_t StorageAreaProxy::memoryBytesUsedByCache() const +{ + return m_storageArea->memoryBytesUsedByCache(); +} + void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h index 83f2eae17..cae359358 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.h +++ b/Source/WebKit/chromium/src/StorageAreaProxy.h @@ -58,6 +58,8 @@ public: virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; } + virtual size_t memoryBytesUsedByCache() const; + static void dispatchLocalStorageEvent( PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); diff --git a/Source/WebKit/chromium/src/WebAnimation.cpp b/Source/WebKit/chromium/src/WebAnimation.cpp index 7dddfc241..610201512 100644 --- a/Source/WebKit/chromium/src/WebAnimation.cpp +++ b/Source/WebKit/chromium/src/WebAnimation.cpp @@ -38,6 +38,11 @@ using WebCore::CCActiveAnimation; namespace WebKit { +WebAnimation::TargetProperty WebAnimation::targetProperty() const +{ + return static_cast<WebAnimation::TargetProperty>(m_private->targetProperty()); +} + int WebAnimation::iterations() const { return m_private->iterations(); @@ -87,10 +92,12 @@ WebAnimation::operator PassOwnPtr<WebCore::CCActiveAnimation>() const void WebAnimation::initialize(const WebAnimationCurve& curve, TargetProperty targetProperty) { - m_private.reset(CCActiveAnimation::create(curve, - AnimationIdVendor::getNextAnimationId(), - AnimationIdVendor::getNextGroupId(), - static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)).leakPtr()); + initialize(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty); +} + +void WebAnimation::initialize(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty) +{ + m_private.reset(CCActiveAnimation::create(curve, animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)).leakPtr()); } void WebAnimation::destroy() diff --git a/Source/WebKit/chromium/src/WebBindings.cpp b/Source/WebKit/chromium/src/WebBindings.cpp index 926db3b11..786a4175b 100644 --- a/Source/WebKit/chromium/src/WebBindings.cpp +++ b/Source/WebKit/chromium/src/WebBindings.cpp @@ -35,18 +35,20 @@ #include "npruntime_priv.h" #if USE(V8) -#include <wtf/ArrayBufferView.h> +#include "BindingState.h" #include "DOMWindow.h" +#include "Frame.h" #include "NPV8Object.h" // for PrivateIdentifier #include "Range.h" #include "V8ArrayBuffer.h" #include "V8ArrayBufferView.h" -#include "V8BindingState.h" #include "V8DOMWrapper.h" #include "V8Element.h" #include "V8NPUtils.h" #include "V8Proxy.h" #include "V8Range.h" +#include <wtf/ArrayBufferView.h> +// FIXME: Remove the USE(JSC) ifdefs because we don't support USE(JSC) anymore. #elif USE(JSC) #include "bridge/c/c_utility.h" #endif @@ -288,7 +290,7 @@ static NPObject* makeIntArrayImpl(const WebVector<int>& data) for (size_t i = 0; i < data.size(); ++i) result->Set(i, v8::Number::New(data[i])); - DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext()); + DOMWindow* window = V8Proxy::retrieveWindow(v8::Context::GetCurrent()); return npCreateV8ScriptObject(0, result, window); } @@ -299,7 +301,7 @@ static NPObject* makeStringArrayImpl(const WebVector<WebString>& data) for (size_t i = 0; i < data.size(); ++i) result->Set(i, data[i].data() ? v8::String::New(reinterpret_cast<const uint16_t*>((data[i].data())), data[i].length()) : v8::String::New("")); - DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext()); + DOMWindow* window = V8Proxy::retrieveWindow(v8::Context::GetCurrent()); return npCreateV8ScriptObject(0, result, window); } diff --git a/Source/WebKit/chromium/src/WebCompositorImpl.cpp b/Source/WebKit/chromium/src/WebCompositorImpl.cpp deleted file mode 100644 index 369ae555a..000000000 --- a/Source/WebKit/chromium/src/WebCompositorImpl.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2011 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. - * - * 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 "WebCompositorImpl.h" - -#include "CCThreadImpl.h" -#include "GraphicsContext3D.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "WebCompositorClient.h" -#include "WebInputEvent.h" -#include "cc/CCLayerTreeHost.h" -#include "cc/CCProxy.h" -#include "cc/CCSettings.h" -#include <wtf/ThreadingPrimitives.h> - -using namespace WebCore; - -namespace WebKit { - -bool WebCompositorImpl::s_initialized = false; -CCThread* WebCompositorImpl::s_mainThread = 0; -CCThread* WebCompositorImpl::s_implThread = 0; - -void WebCompositor::initialize(WebThread* implThread) -{ - WebCompositorImpl::initialize(implThread); -} -void WebCompositor::shutdown() -{ - WebCompositorImpl::shutdown(); - CCSettings::reset(); -} - -void WebCompositor::setPerTilePaintingEnabled(bool enabled) -{ - ASSERT(!WebCompositorImpl::initialized()); - CCSettings::setPerTilePaintingEnabled(enabled); -} - -void WebCompositor::setPartialSwapEnabled(bool enabled) -{ - ASSERT(!WebCompositorImpl::initialized()); - CCSettings::setPartialSwapEnabled(enabled); -} - -void WebCompositor::setAcceleratedAnimationEnabled(bool enabled) -{ - ASSERT(!WebCompositorImpl::initialized()); - CCSettings::setAcceleratedAnimationEnabled(enabled); -} - -void WebCompositorImpl::initialize(WebThread* implThread) -{ - ASSERT(!s_initialized); - s_initialized = true; - - s_mainThread = CCThreadImpl::create(WebKit::Platform::current()->currentThread()).leakPtr(); - CCProxy::setMainThread(s_mainThread); - if (implThread) { - s_implThread = CCThreadImpl::create(implThread).leakPtr(); - CCProxy::setImplThread(s_implThread); - } else - CCProxy::setImplThread(0); -} - -bool WebCompositorImpl::initialized() -{ - return s_initialized; -} - -void WebCompositorImpl::shutdown() -{ - ASSERT(s_initialized); - ASSERT(!CCLayerTreeHost::anyLayerTreeHostInstanceExists()); - - if (s_implThread) { - delete s_implThread; - s_implThread = 0; - } - delete s_mainThread; - s_mainThread = 0; - CCProxy::setImplThread(0); - CCProxy::setMainThread(0); - s_initialized = false; -} - -} diff --git a/Source/WebKit/chromium/src/WebCompositorImpl.h b/Source/WebKit/chromium/src/WebCompositorImpl.h deleted file mode 100644 index 34c6bd0fd..000000000 --- a/Source/WebKit/chromium/src/WebCompositorImpl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2011 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. - * - * 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 WebCompositorImpl_h -#define WebCompositorImpl_h - -#include "WebCompositor.h" - -#include <wtf/HashSet.h> -#include <wtf/Noncopyable.h> -#include <wtf/OwnPtr.h> - -namespace WebCore { -class CCThread; -} - -namespace WebKit { - -class WebThread; - -class WebCompositorImpl : public WebCompositor { - WTF_MAKE_NONCOPYABLE(WebCompositorImpl); -public: - static bool initialized(); - -private: - - friend class WebCompositor; - static void initialize(WebThread* implThread); - static void shutdown(); - - static bool s_initialized; - static WebCore::CCThread* s_mainThread; - static WebCore::CCThread* s_implThread; -}; - -} - -#endif // WebCompositorImpl_h diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp index 63bf270fe..25b31d5e9 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp @@ -33,10 +33,8 @@ #include "WebCompositorImpl.h" #include "WebCompositorInputHandlerClient.h" #include "WebInputEvent.h" -#include "WebKit.h" #include "cc/CCActiveGestureAnimation.h" #include "cc/CCProxy.h" -#include "platform/WebKitPlatformSupport.h" #include <wtf/ThreadingPrimitives.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h index 64647105b..6bb09ab5c 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h @@ -27,11 +27,11 @@ #define WebCompositorInputHandlerImpl_h #include "WebActiveWheelFlingParameters.h" -#include "WebCompositor.h" #include "WebCompositorInputHandler.h" #include "WebInputEvent.h" #include "cc/CCGestureCurve.h" #include "cc/CCInputHandler.h" +#include <public/WebCompositor.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> diff --git a/Source/WebKit/chromium/src/WebContentLayer.cpp b/Source/WebKit/chromium/src/WebContentLayer.cpp index 14ce98039..efa7465b1 100644 --- a/Source/WebKit/chromium/src/WebContentLayer.cpp +++ b/Source/WebKit/chromium/src/WebContentLayer.cpp @@ -53,6 +53,16 @@ void WebContentLayer::setContentsScale(float scale) m_private->setContentsScale(scale); } +void WebContentLayer::setUseLCDText(bool enable) +{ + m_private->setUseLCDText(enable); +} + +void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable) +{ + m_private->setDrawCheckerboardForMissingTiles(enable); +} + WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node) : WebScrollableLayer(node) { diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index ecf099a4a..69da1ea3f 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -26,12 +26,9 @@ #include "config.h" #include "WebContentLayerImpl.h" -#include "platform/WebContentLayerClient.h" -#include "platform/WebFloatRect.h" -#include "platform/WebRect.h" -#include "GraphicsContext.h" -#include "platform/WebCanvas.h" -#include "PlatformContextSkia.h" +#include <public/WebContentLayerClient.h> +#include <public/WebFloatRect.h> +#include <public/WebRect.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 7a4617ddc..d4366f99a 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -423,8 +423,8 @@ void WebDevToolsAgentImpl::didCreateScriptContext(WebFrameImpl* webframe, int wo // Skip non main world contexts. if (worldId) return; - if (WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame())) - proxy->setContextDebugId(m_hostId); + if (WebCore::Frame* frame = webframe->frame()) + frame->script()->proxy()->setContextDebugId(m_hostId); } void WebDevToolsAgentImpl::mainFrameViewCreated(WebFrameImpl* webFrame) diff --git a/Source/WebKit/chromium/src/WebDocument.cpp b/Source/WebKit/chromium/src/WebDocument.cpp index 063f71892..691701715 100644 --- a/Source/WebKit/chromium/src/WebDocument.cpp +++ b/Source/WebKit/chromium/src/WebDocument.cpp @@ -44,6 +44,7 @@ #include "HTMLFormElement.h" #include "HTMLHeadElement.h" #include "NodeList.h" +#include "RenderObject.h" #include "SecurityOrigin.h" #include "StyleSheetContents.h" #include "WebAccessibilityObject.h" @@ -228,6 +229,15 @@ WebReferrerPolicy WebDocument::referrerPolicy() const return static_cast<WebReferrerPolicy>(constUnwrap<Document>()->referrerPolicy()); } +WebElement WebDocument::createElement(const WebString& tagName) +{ + ExceptionCode ec = 0; + WebElement element(unwrap<Document>()->createElement(tagName, ec)); + if (ec) + return WebElement(); + return element; +} + WebAccessibilityObject WebDocument::accessibilityObject() const { const Document* document = constUnwrap<Document>(); @@ -242,6 +252,25 @@ WebAccessibilityObject WebDocument::accessibilityObjectFromID(int axID) const document->axObjectCache()->objectFromAXID(axID)); } +WebVector<WebDraggableRegion> WebDocument::draggableRegions() const +{ + WebVector<WebDraggableRegion> draggableRegions; +#if ENABLE(WIDGET_REGION) + const Document* document = constUnwrap<Document>(); + if (document->hasDashboardRegions()) { + const Vector<DashboardRegionValue>& regions = document->dashboardRegions(); + draggableRegions = WebVector<WebDraggableRegion>(regions.size()); + for (size_t i = 0; i < regions.size(); i++) { + const DashboardRegionValue& value = regions[i]; + draggableRegions[i].label = value.label; + draggableRegions[i].bounds = WebCore::IntRect(value.bounds); + draggableRegions[i].clip = WebCore::IntRect(value.clip); + } + } +#endif + return draggableRegions; +} + WebDocument::WebDocument(const PassRefPtr<Document>& elem) : WebNode(elem) { diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp index d9cea3bb1..bbd1f8ddb 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp @@ -27,7 +27,7 @@ #include <public/WebExternalTextureLayer.h> #include "TextureLayerChromium.h" -#include "cc/CCTextureUpdater.h" +#include "cc/CCTextureUpdateQueue.h" #include <public/WebExternalTextureLayerClient.h> #include <public/WebFloatRect.h> #include <public/WebSize.h> @@ -38,18 +38,19 @@ namespace WebKit { class WebTextureUpdaterImpl : public WebTextureUpdater { public: - explicit WebTextureUpdaterImpl(CCTextureUpdater& updater) - : m_updater(updater) + explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) + : m_queue(queue) { } virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE { - m_updater.appendCopy(sourceTexture, destinationTexture, size); + TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size }; + m_queue.appendCopy(copy); } private: - CCTextureUpdater& m_updater; + CCTextureUpdateQueue& m_queue; }; class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium { @@ -60,9 +61,9 @@ public: { } - virtual unsigned prepareTexture(CCTextureUpdater& updater) OVERRIDE + virtual unsigned prepareTexture(CCTextureUpdateQueue& queue) OVERRIDE { - WebTextureUpdaterImpl updaterImpl(updater); + WebTextureUpdaterImpl updaterImpl(queue); return m_client->prepareTexture(updaterImpl); } diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index f821562f6..fb2a29540 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -169,6 +169,8 @@ #include "XPathResult.h" #include "markup.h" #include "painting/GraphicsContextBuilder.h" +#include "platform/WebFloatPoint.h" +#include "platform/WebFloatRect.h" #include "platform/WebPoint.h" #include "platform/WebRect.h" #include "platform/WebSerializedScriptValue.h" @@ -588,6 +590,16 @@ WebString WebFrameImpl::name() const return m_frame->tree()->uniqueName(); } +WebString WebFrameImpl::uniqueName() const +{ + return m_frame->tree()->uniqueName(); +} + +WebString WebFrameImpl::assignedName() const +{ + return m_frame->tree()->name(); +} + void WebFrameImpl::setName(const WebString& name) { m_frame->tree()->setName(name); @@ -1446,11 +1458,22 @@ bool WebFrameImpl::selectWordAroundCaret() void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end) { - VisibleSelection selection(visiblePositionForWindowPoint(start), - visiblePositionForWindowPoint(end)); + VisiblePosition startPosition = visiblePositionForWindowPoint(start); + VisiblePosition endPosition = visiblePositionForWindowPoint(end); + + // To correctly handle editable boundaries, we adjust the selection by setting its extent + // while keeping its base fixed. For a touch-based UI, this means that moving the selection + // handles behaves like a drag-select with the mouse, which is what we want here. If both + // endpoints changed, we need to set the extent twice. + // FIXME: the WebFrame::SelectRange API should explicitly state which endpoint is moving. + VisibleSelection newSelection = frame()->selection()->selection(); + if (startPosition != newSelection.visibleStart()) + newSelection = VisibleSelection(newSelection.visibleEnd(), startPosition); + if (endPosition != newSelection.visibleEnd()) + newSelection = VisibleSelection(newSelection.visibleStart(), endPosition); - if (frame()->selection()->shouldChangeSelection(selection)) - frame()->selection()->setSelection(selection, CharacterGranularity); + if (frame()->selection()->shouldChangeSelection(newSelection)) + frame()->selection()->setSelection(newSelection, CharacterGranularity); } void WebFrameImpl::selectRange(const WebRange& webRange) @@ -1472,13 +1495,9 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin frame()->document()->renderView()->layer()->hitTest(request, result); - // Matching the logic in MouseEventWithHitTestResults::targetNode() - Node* node = result.innerNode(); + Node* node = EventHandler::targetNode(result); if (!node) return VisiblePosition(); - Element* element = node->parentElement(); - if (!node->inDocument() && element && element->inDocument()) - node = element; return node->renderer()->positionForPoint(result.localPoint()); } @@ -1938,6 +1957,29 @@ void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); } +int WebFrameImpl::findMatchMarkersVersion() const +{ + // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. + return 0; +} + +WebFloatRect WebFrameImpl::activeFindMatchRect() +{ + // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. + return WebFloatRect(); +} + +void WebFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects) +{ + // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. +} + +int WebFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRect* selectionRect) +{ + // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. + return 0; +} + void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelArray* ports, WebDeliveredIntentClient* intentClient) { #if ENABLE(WEB_INTENTS) @@ -2001,21 +2043,6 @@ WebString WebFrameImpl::markerTextForListItem(const WebElement& webElement) cons return WebCore::markerTextForListItem(const_cast<Element*>(webElement.constUnwrap<Element>())); } -int WebFrameImpl::pageNumberForElementById(const WebString& id, - float pageWidthInPixels, - float pageHeightInPixels) const -{ - if (!m_frame) - return -1; - - Element* element = m_frame->document()->getElementById(id); - if (!element) - return -1; - - FloatSize pageSize(pageWidthInPixels, pageHeightInPixels); - return PrintContext::pageNumberForElement(element, pageSize); -} - void WebFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSize& pageSizeInPixels) { ASSERT(m_printContext.get()); @@ -2142,6 +2169,9 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame( if (!childFrame->tree()->parent()) return 0; + if (m_client) + m_client->didCreateFrame(this, webframe.get()); + return childFrame.release(); } diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 9dbf68336..0aba56f4c 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -72,6 +72,8 @@ class WebFrameImpl : public WebFrame, public RefCounted<WebFrameImpl> { public: // WebFrame methods: virtual WebString name() const; + virtual WebString uniqueName() const; + virtual WebString assignedName() const; virtual void setName(const WebString&); virtual long long identifier() const; virtual WebVector<WebIconURL> iconURLs(int iconTypes) const; @@ -210,6 +212,10 @@ public: virtual void cancelPendingScopingEffort(); virtual void increaseMatchCount(int count, int identifier); virtual void resetMatchCount(); + virtual int findMatchMarkersVersion() const; + virtual WebFloatRect activeFindMatchRect(); + virtual void findMatchRects(WebVector<WebFloatRect>&); + virtual int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); virtual void sendOrientationChangeEvent(int orientation); @@ -228,9 +234,6 @@ public: virtual WebString contentAsMarkup() const; virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const; virtual WebString markerTextForListItem(const WebElement&) const; - virtual int pageNumberForElementById(const WebString& id, - float pageWidthInPixels, - float pageHeightInPixels) const; virtual WebRect selectionBoundsRect() const; virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 22a066807..c327eba84 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -106,8 +106,9 @@ void WebIDBObjectStoreImpl::deleteIndex(const WebString& name, const WebIDBTrans m_objectStore->deleteIndex(name, transaction.getIDBTransactionBackendInterface(), ec); } -void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) +void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, WebIDBCursor::Direction direction, WebIDBCallbacks* callbacks, WebIDBTransaction::TaskType, const WebIDBTransaction& transaction, WebExceptionCode& ec) { + // FIXME: Pass along TaskType when the API becomes available. m_objectStore->openCursor(keyRange, direction, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 934cffa99..482b22380 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -54,7 +54,11 @@ public: WebIDBIndex* index(const WebString& name, WebExceptionCode&); void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); - void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); + void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) + { + openCursor(range, static_cast<WebIDBCursor::Direction>(direction), callbacks, WebIDBTransaction::NormalTask, transaction, ec); + } + void openCursor(const WebIDBKeyRange&, WebIDBCursor::Direction, WebIDBCallbacks*, WebIDBTransaction::TaskType, const WebIDBTransaction&, WebExceptionCode&); void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); private: diff --git a/Source/WebKit/chromium/src/WebImageCG.cpp b/Source/WebKit/chromium/src/WebImageCG.cpp deleted file mode 100644 index 242a68304..000000000 --- a/Source/WebKit/chromium/src/WebImageCG.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2009 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 "Image.h" -#include "ImageSource.h" -#include "SharedBuffer.h" - -#include "platform/WebData.h" -#include "platform/WebSize.h" - -#include <CoreGraphics/CGImage.h> - -#include <public/WebImage.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RetainPtr.h> - -using namespace WebCore; - -namespace WebKit { - -WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize) -{ - ImageSource source; - source.setData(PassRefPtr<SharedBuffer>(data).get(), true); - if (!source.isSizeAvailable()) - return WebImage(); - - // Frames are arranged by decreasing size, then decreasing bit depth. - // Pick the frame closest to |desiredSize|'s area without being smaller, - // which has the highest bit depth. - const size_t frameCount = source.frameCount(); - size_t index = 0; // Default to first frame if none are large enough. - int frameAreaAtIndex = 0; - for (size_t i = 0; i < frameCount; ++i) { - const IntSize frameSize = source.frameSizeAtIndex(i); - if (WebSize(frameSize) == desiredSize) { - index = i; - break; // Perfect match. - } - const int frameArea = frameSize.width() * frameSize.height(); - if (frameArea < (desiredSize.width * desiredSize.height)) - break; // No more frames that are large enough. - - if (!i || (frameArea < frameAreaAtIndex)) { - index = i; // Closer to desired area than previous best match. - frameAreaAtIndex = frameArea; - } - } - - RetainPtr<CGImageRef> frame(AdoptCF, source.createFrameAtIndex(index)); - if (!frame) - return WebImage(); - - return WebImage(frame.get()); -} - -void WebImage::reset() -{ - CGImageRelease(m_imageRef); - m_imageRef = 0; -} - -void WebImage::assign(const WebImage& image) -{ - assign(image.m_imageRef); -} - -bool WebImage::isNull() const -{ - return !m_imageRef; -} - -WebSize WebImage::size() const -{ - return WebSize(CGImageGetWidth(m_imageRef), CGImageGetHeight(m_imageRef)); -} - -WebImage::WebImage(const PassRefPtr<Image>& image) - : m_imageRef(0) -{ - NativeImagePtr p; - if (image && (p = image->nativeImageForCurrentFrame())) - assign(p); -} - -WebImage& WebImage::operator=(const PassRefPtr<Image>& image) -{ - NativeImagePtr p; - if (image && (p = image->nativeImageForCurrentFrame())) - assign(p); - else - reset(); - return *this; -} - -void WebImage::assign(CGImageRef imageRef) -{ - // Make sure to retain the imageRef first incase m_imageRef == imageRef. - CGImageRetain(imageRef); - CGImageRelease(m_imageRef); - m_imageRef = imageRef; -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebImageSkia.cpp b/Source/WebKit/chromium/src/WebImageSkia.cpp index 36dabac3e..e1a926050 100644 --- a/Source/WebKit/chromium/src/WebImageSkia.cpp +++ b/Source/WebKit/chromium/src/WebImageSkia.cpp @@ -38,10 +38,12 @@ #include "platform/WebData.h" #include "platform/WebSize.h" +#include <algorithm> #include <public/WebImage.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> using namespace WebCore; @@ -84,6 +86,36 @@ WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize) return WebImage(frame->bitmap()); } +WebVector<WebImage> WebImage::framesFromData(const WebData& data) +{ + // This is to protect from malicious images. It should be big enough that it's never hit in pracice. + const size_t maxFrameCount = 8; + + ImageSource source; + source.setData(PassRefPtr<SharedBuffer>(data).get(), true); + if (!source.isSizeAvailable()) + return WebVector<WebImage>(); + + // Frames are arranged by decreasing size, then decreasing bit depth. + // Keep the first frame at every size, has the highest bit depth. + const size_t frameCount = source.frameCount(); + IntSize lastSize; + + Vector<WebImage> frames; + for (size_t i = 0; i < std::min(frameCount, maxFrameCount); ++i) { + const IntSize frameSize = source.frameSizeAtIndex(i); + if (frameSize == lastSize) + continue; + lastSize = frameSize; + + OwnPtr<NativeImageSkia> frame = adoptPtr(source.createFrameAtIndex(i)); + if (frame) + frames.append(WebImage(frame->bitmap())); + } + + return frames; +} + void WebImage::reset() { m_bitmap.reset(); diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 207d81ca3..0391c285b 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -32,6 +32,7 @@ #include "WebInputEventConversion.h" #include "EventNames.h" +#include "GestureEvent.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "MouseEvent.h" @@ -151,7 +152,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureTap: m_type = PlatformEvent::GestureTap; - m_area = IntSize(e.deltaX * 2, e.deltaY * 2); + m_area = IntSize(e.boundingBox.width, e.boundingBox.height); break; case WebInputEvent::GestureTapDown: m_type = PlatformEvent::GestureTapDown; @@ -164,6 +165,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureLongPress: m_type = PlatformEvent::GestureLongPress; + m_area = IntSize(e.boundingBox.width, e.boundingBox.height); break; case WebInputEvent::GesturePinchBegin: m_type = PlatformEvent::GesturePinchBegin; @@ -462,6 +464,7 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) text[i] = event.keyEvent()->text()[i]; unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; } + memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentifier().length()); } #if ENABLE(TOUCH_EVENTS) @@ -512,4 +515,31 @@ WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const TouchEven #endif // ENABLE(TOUCH_EVENTS) +#if ENABLE(GESTURE_EVENTS) +WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const GestureEvent& event) +{ + if (event.type() == eventNames().gesturetapEvent) + type = GestureTap; + else if (event.type() == eventNames().gesturetapdownEvent) + type = GestureTapDown; + else if (event.type() == eventNames().gesturescrollstartEvent) + type = GestureScrollBegin; + else if (event.type() == eventNames().gesturescrollendEvent) + type = GestureScrollEnd; + else if (event.type() == eventNames().gesturescrollupdateEvent) + type = GestureScrollUpdate; + + timeStampSeconds = event.timeStamp() / millisPerSecond; + modifiers = getWebInputModifiers(event); + + globalX = event.screenX(); + globalY = event.screenY(); + x = event.absoluteLocation().x() - widget->location().x(); + y = event.absoluteLocation().y() - widget->location().y(); + + deltaX = event.deltaX(); + deltaY = event.deltaY(); +} +#endif // ENABLE(GESTURE_EVENTS) + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.h b/Source/WebKit/chromium/src/WebInputEventConversion.h index d47bda814..48975a404 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.h +++ b/Source/WebKit/chromium/src/WebInputEventConversion.h @@ -39,6 +39,7 @@ #include "WebInputEvent.h" namespace WebCore { +class GestureEvent; class KeyboardEvent; class MouseEvent; class ScrollView; @@ -131,6 +132,15 @@ public: }; #endif // ENABLE(TOUCH_EVENTS) +#if ENABLE(GESTURE_EVENTS) +// Converts WebCore::GestureEvent to a corresponding WebGestureEvent. +// NOTE: If event mapping fails, the type will be set to Undefined. +class WebGestureEventBuilder : public WebGestureEvent { +public: + WebGestureEventBuilder(const WebCore::Widget*, const WebCore::GestureEvent&); +}; +#endif // ENABLE(GESTURE_EVENTS) + } // namespace WebKit #endif diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp index a3f0f8391..9331d053a 100644 --- a/Source/WebKit/chromium/src/WebKit.cpp +++ b/Source/WebKit/chromium/src/WebKit.cpp @@ -105,7 +105,7 @@ void initialize(WebKitPlatformSupport* webKitPlatformSupport) v8::V8::SetEntropySource(&generateEntropy); v8::V8::Initialize(); - WebCore::V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); + WebCore::V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); #if ENABLE(MUTATION_OBSERVERS) // currentThread will always be non-null in production, but can be null in Chromium unit tests. diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index 5b8d55cf4..d77c25eb9 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -24,12 +24,10 @@ */ #include "config.h" -#include "platform/WebLayer.h" +#include <public/WebLayer.h> -#include "Color.h" #include "LayerChromium.h" #include "SkMatrix44.h" -#include "TransformationMatrix.h" #include "WebLayerImpl.h" #include <public/WebFilterOperations.h> #include <public/WebFloatPoint.h> @@ -144,6 +142,14 @@ void WebLayer::replaceChild(const WebLayer& reference, const WebLayer& newLayer) m_private->replaceChild(ref.unwrap<LayerChromium>(), newLayer); } +void WebLayer::setChildren(const WebVector<WebLayer>& webChildren) +{ + Vector<RefPtr<LayerChromium> > children(webChildren.size()); + for (size_t i = 0; i < webChildren.size(); ++i) + children[i] = webChildren[i].unwrap<LayerChromium>(); + m_private->setChildren(children); +} + void WebLayer::removeFromParent() { m_private->removeFromParent(); @@ -205,6 +211,12 @@ WebLayer WebLayer::maskLayer() const return WebLayer(m_private->maskLayer()); } +void WebLayer::setReplicaLayer(const WebLayer& replicaLayer) +{ + WebLayer ref = replicaLayer; + m_private->setReplicaLayer(ref.unwrap<LayerChromium>()); +} + void WebLayer::setOpacity(float opacity) { m_private->setOpacity(opacity); @@ -310,6 +322,53 @@ void WebLayer::setDebugBorderWidth(float width) m_private->setDebugBorderWidth(width); } +void WebLayer::setDebugName(WebString name) +{ + m_private->setDebugName(name); +} + +void WebLayer::setAnimationDelegate(WebAnimationDelegate* delegate) +{ + m_private->setLayerAnimationDelegate(delegate); +} + +bool WebLayer::addAnimation(const WebAnimation& animation) +{ + return m_private->addAnimation(animation); +} + +void WebLayer::removeAnimation(int animationId) +{ + m_private->removeAnimation(animationId); +} + +void WebLayer::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty) +{ + m_private->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty)); +} + +void WebLayer::pauseAnimation(int animationId, double timeOffset) +{ + m_private->pauseAnimation(animationId, timeOffset); +} + +void WebLayer::suspendAnimations(double monotonicTime) +{ + m_private->suspendAnimations(monotonicTime); +} + +void WebLayer::resumeAnimations(double monotonicTime) +{ + m_private->resumeAnimations(monotonicTime); +} + +void WebLayer::transferAnimationsTo(WebLayer* other) +{ + ASSERT(other); + if (other) + other->m_private->setLayerAnimationController(m_private->releaseLayerAnimationController()); +} + void WebLayer::setAlwaysReserveTextures(bool reserve) { m_private->setAlwaysReserveTextures(reserve); @@ -320,6 +379,11 @@ void WebLayer::setForceRenderSurface(bool forceRenderSurface) m_private->setForceRenderSurface(forceRenderSurface); } +void WebLayer::clearRenderSurface() +{ + m_private->clearRenderSurface(); +} + WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node) : m_private(node) { diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index b87df0f1b..edd43df20 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -24,19 +24,19 @@ */ #include "config.h" -#include "platform/WebLayerTreeView.h" +#include <public/WebLayerTreeView.h> -#include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" #include "WebLayerTreeViewImpl.h" +#include "cc/CCFontAtlas.h" #include "cc/CCGraphicsContext.h" #include "cc/CCLayerTreeHost.h" #include "cc/CCRenderingStats.h" -#include "platform/WebLayer.h" -#include "platform/WebPoint.h" -#include "platform/WebRect.h" -#include "platform/WebSize.h" +#include <public/WebLayer.h> +#include <public/WebPoint.h> +#include <public/WebRect.h> #include <public/WebRenderingStats.h> +#include <public/WebSize.h> using namespace WebCore; @@ -45,10 +45,10 @@ namespace WebKit { WebLayerTreeView::Settings::operator CCLayerTreeSettings() const { CCLayerTreeSettings settings; - settings.forceSoftwareCompositing = forceSoftwareCompositing; settings.showFPSCounter = showFPSCounter; settings.showPlatformLayerTree = showPlatformLayerTree; settings.showPaintRects = showPaintRects; + settings.renderVSyncEnabled = renderVSyncEnabled; settings.refreshRate = refreshRate; settings.defaultTileSize = defaultTileSize; settings.maxUntiledLayerSize = maxUntiledLayerSize; @@ -93,14 +93,22 @@ int WebLayerTreeView::compositorIdentifier() return m_private->layerTreeHost()->compositorIdentifier(); } -void WebLayerTreeView::setViewportSize(const WebSize& viewportSize) +void WebLayerTreeView::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize) { - m_private->layerTreeHost()->setViewportSize(viewportSize); + if (!deviceViewportSize.isEmpty()) + m_private->layerTreeHost()->setViewportSize(layoutViewportSize, deviceViewportSize); + else + m_private->layerTreeHost()->setViewportSize(layoutViewportSize, layoutViewportSize); +} + +WebSize WebLayerTreeView::layoutViewportSize() const +{ + return WebSize(m_private->layerTreeHost()->layoutViewportSize()); } -WebSize WebLayerTreeView::viewportSize() const +WebSize WebLayerTreeView::deviceViewportSize() const { - return WebSize(m_private->layerTreeHost()->viewportSize()); + return WebSize(m_private->layerTreeHost()->deviceViewportSize()); } void WebLayerTreeView::setDeviceScaleFactor(const float deviceScaleFactor) @@ -188,6 +196,15 @@ void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; } +void WebLayerTreeView::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight) +{ + IntRect asciiToRectTable[128]; + for (int i = 0; i < 128; ++i) + asciiToRectTable[i] = asciiToWebRectTable[i]; + OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable, fontHeight); + m_private->layerTreeHost()->setFontAtlas(fontAtlas.release()); +} + void WebLayerTreeView::loseCompositorContext(int numTimes) { m_private->layerTreeHost()->loseContext(numTimes); diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 825fc01ef..a7bf64d36 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -26,26 +26,71 @@ #include "config.h" #include "WebLayerTreeViewImpl.h" -#include "CCThreadImpl.h" -#include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" #include "cc/CCLayerTreeHost.h" #include "cc/CCThreadProxy.h" -#include "platform/WebGraphicsContext3D.h" -#include "platform/WebLayer.h" -#include "platform/WebLayerTreeView.h" -#include "platform/WebLayerTreeViewClient.h" -#include "platform/WebSize.h" -#include "platform/WebThread.h" +#include <public/WebGraphicsContext3D.h> +#include <public/WebLayer.h> +#include <public/WebLayerTreeView.h> +#include <public/WebLayerTreeViewClient.h> +#include <public/WebSize.h> +#include <public/WebThread.h> using namespace WebCore; +namespace { + +// Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until +// downstream code can be updated to produce output surfaces directly. +class WebGraphicsContextToOutputSurfaceAdapter : public WebKit::WebCompositorOutputSurface { +public: + explicit WebGraphicsContextToOutputSurfaceAdapter(PassOwnPtr<WebKit::WebGraphicsContext3D> context) + : m_context3D(context) + , m_client(0) + { + } + + virtual bool bindToClient(WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE + { + ASSERT(client); + if (!m_context3D->makeContextCurrent()) + return false; + m_client = client; + return true; + } + + virtual const Capabilities& capabilities() const OVERRIDE + { + return m_capabilities; + } + + virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE + { + return m_context3D.get(); + } + + virtual void sendFrameToParentCompositor(const WebKit::WebCompositorFrame&) OVERRIDE + { + } + +private: + OwnPtr<WebKit::WebGraphicsContext3D> m_context3D; + Capabilities m_capabilities; + WebKit::WebCompositorOutputSurfaceClient* m_client; +}; + +} + namespace WebKit { // Converts messages from CCLayerTreeHostClient to WebLayerTreeViewClient. class WebLayerTreeViewClientAdapter : public WebCore::CCLayerTreeHostClient { public: - WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) : m_client(client) { } + WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) + : m_client(client) + , m_usingRealOutputSurface(false) + { + } virtual ~WebLayerTreeViewClientAdapter() { } // CCLayerTreeHostClient implementation @@ -54,11 +99,33 @@ public: virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); } virtual void layout() OVERRIDE { m_client->layout(); } virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); } - virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE + virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE + { + WebCompositorOutputSurface* outputSurface = m_client->createOutputSurface(); + if (outputSurface) { + m_usingRealOutputSurface = true; + return adoptPtr(outputSurface); + } + + // Temporarily, if the output surface can't be created, create a WebGraphicsContext3D + // directly. This allows bootstrapping the output surface system while downstream + // users of the API still use the old approach. + WebGraphicsContext3D* context = m_client->createContext3D(); + if (!context) + return nullptr; + + m_usingRealOutputSurface = false; + return adoptPtr(new WebGraphicsContextToOutputSurfaceAdapter(adoptPtr(context))); + } + + virtual void didRecreateOutputSurface(bool success) OVERRIDE { - return adoptPtr(m_client->createContext3D()); + if (m_usingRealOutputSurface) { + m_client->didRecreateOutputSurface(success); + return; + } + m_client->didRebindGraphicsContext(success); } - virtual void didRecreateContext(bool success) OVERRIDE { m_client->didRebindGraphicsContext(success); } virtual void willCommit() OVERRIDE { m_client->willCommit(); } virtual void didCommit() OVERRIDE { m_client->didCommit(); } virtual void didCommitAndDrawFrame() OVERRIDE { m_client->didCommitAndDrawFrame(); } @@ -67,6 +134,7 @@ public: private: WebLayerTreeViewClient* m_client; + bool m_usingRealOutputSurface; }; PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h index 1184342e8..3bc43410d 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h @@ -26,7 +26,7 @@ #ifndef WebLayerTreeViewImpl_h #define WebLayerTreeViewImpl_h -#include "platform/WebLayerTreeView.h" +#include <public/WebLayerTreeView.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 3ca9f5d0f..c48aa8967 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -23,18 +23,16 @@ #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebHelperPluginImpl.h" -#include "WebKit.h" #include "WebMediaPlayer.h" #include "WebViewImpl.h" -#include "cc/CCProxy.h" -#include "platform/WebCString.h" -#include "platform/WebCanvas.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebRect.h" -#include "platform/WebSize.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/Platform.h> +#include <public/WebCString.h> +#include <public/WebCanvas.h> #include <public/WebMimeRegistry.h> +#include <public/WebRect.h> +#include <public/WebSize.h> +#include <public/WebString.h> +#include <public/WebURL.h> #if USE(ACCELERATED_COMPOSITING) #include "RenderLayerCompositor.h" @@ -342,10 +340,10 @@ void WebMediaPlayerClientImpl::cancelLoad() } #if USE(ACCELERATED_COMPOSITING) -LayerChromium* WebMediaPlayerClientImpl::platformLayer() const +WebLayer* WebMediaPlayerClientImpl::platformLayer() const { ASSERT(m_supportsAcceleratedCompositing); - return m_videoLayer.unwrap<LayerChromium>(); + return const_cast<WebVideoLayer*>(&m_videoLayer); } #endif @@ -841,14 +839,12 @@ void WebMediaPlayerClientImpl::startDelayedLoad() void WebMediaPlayerClientImpl::didReceiveFrame() { // No lock since this gets called on the client's thread. - ASSERT(CCProxy::isImplThread()); m_videoFrameProviderClient->didReceiveFrame(); } void WebMediaPlayerClientImpl::didUpdateMatrix(const float* matrix) { // No lock since this gets called on the client's thread. - ASSERT(CCProxy::isImplThread()); m_videoFrameProviderClient->didUpdateMatrix(matrix); } diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index b3c94fe58..2df54cd20 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -98,7 +98,7 @@ public: virtual void load(const WTF::String& url); virtual void cancelLoad(); #if USE(ACCELERATED_COMPOSITING) - virtual WebCore::PlatformLayer* platformLayer() const; + virtual WebKit::WebLayer* platformLayer() const; #endif virtual WebCore::PlatformMedia platformMedia() const; virtual void play(); diff --git a/Source/WebKit/chromium/src/WebNode.cpp b/Source/WebKit/chromium/src/WebNode.cpp index 14da1d570..c5e836d4a 100644 --- a/Source/WebKit/chromium/src/WebNode.cpp +++ b/Source/WebKit/chromium/src/WebNode.cpp @@ -136,6 +136,13 @@ WebNodeList WebNode::childNodes() return WebNodeList(m_private->childNodes()); } +bool WebNode::appendChild(const WebNode& child) +{ + ExceptionCode exceptionCode = 0; + m_private->appendChild(child, exceptionCode); + return !exceptionCode; +} + WebString WebNode::createMarkup() const { return WebCore::createMarkup(m_private.get()); diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index fd5d2f2ad..18f5de20a 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -78,11 +78,7 @@ private: virtual void setWindowRect(const FloatRect& rect) OVERRIDE { - IntRect intRect(rect); - const WebRect currentRect = m_popup->m_windowRectInScreen; - if (intRect.x() == currentRect.x && intRect.y() == currentRect.y && m_popup->m_isPutAboveOrigin) - intRect.setY(currentRect.y + currentRect.height - intRect.height()); - m_popup->m_windowRectInScreen = intRect; + m_popup->m_windowRectInScreen = IntRect(rect); m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen); } @@ -123,6 +119,11 @@ private: return m_popup->m_webView; } + virtual FloatSize minimumWindowSize() const OVERRIDE + { + return FloatSize(0, 0); + } + WebPagePopupImpl* m_popup; }; @@ -141,7 +142,6 @@ bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client) : m_widgetClient(client) - , m_isPutAboveOrigin(false) { ASSERT(client); } @@ -157,24 +157,13 @@ bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient, ASSERT(popupClient); m_webView = webView; m_popupClient = popupClient; + m_originBoundsInRootView = originBoundsInRootView; - WebSize rootViewSize = webView->size(); - IntSize popupSize = popupClient->contentSize(); - IntRect popupBoundsInRootView(IntPoint(max(0, originBoundsInRootView.x()), max(0, originBoundsInRootView.maxY())), popupSize); - if (popupBoundsInRootView.maxY() > rootViewSize.height) { - popupBoundsInRootView.setY(max(0, originBoundsInRootView.y() - popupSize.height())); - m_isPutAboveOrigin = true; - } - if (popupBoundsInRootView.maxX() > rootViewSize.width) - popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width())); - IntRect boundsInScreen = webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView); + reposition(m_popupClient->contentSize()); - m_widgetClient->setWindowRect(boundsInScreen); - m_windowRectInScreen = boundsInScreen; if (!initPage()) return false; m_widgetClient->show(WebNavigationPolicy()); - setFocus(true); return true; @@ -242,8 +231,23 @@ void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect) PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect, PageWidgetDelegate::Opaque); } +void WebPagePopupImpl::reposition(const WebSize& popupSize) +{ + WebSize rootViewSize = m_webView->size(); + IntRect popupBoundsInRootView(IntPoint(max(0, m_originBoundsInRootView.x()), max(0, m_originBoundsInRootView.maxY())), popupSize); + if (popupBoundsInRootView.maxY() > rootViewSize.height) + popupBoundsInRootView.setY(max(0, m_originBoundsInRootView.y() - popupSize.height)); + if (popupBoundsInRootView.maxX() > rootViewSize.width) + popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width)); + IntRect boundsInScreen = m_webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView); + m_widgetClient->setWindowRect(boundsInScreen); + m_windowRectInScreen = boundsInScreen; +} + void WebPagePopupImpl::resize(const WebSize& newSize) { + reposition(newSize); + if (m_page) m_page->mainFrame()->view()->resize(newSize); m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.height)); diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.h b/Source/WebKit/chromium/src/WebPagePopupImpl.h index 2552bacf1..76936a4cd 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.h +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.h @@ -87,14 +87,15 @@ private: explicit WebPagePopupImpl(WebWidgetClient*); bool initPage(); + void reposition(const WebSize&); WebWidgetClient* m_widgetClient; WebRect m_windowRectInScreen; + WebCore::IntRect m_originBoundsInRootView; WebViewImpl* m_webView; OwnPtr<WebCore::Page> m_page; OwnPtr<PagePopupChromeClient> m_chromeClient; WebCore::PagePopupClient* m_popupClient; - bool m_isPutAboveOrigin; friend class WebPagePopup; friend class PagePopupChromeClient; diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 29489e25a..71361780b 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -39,14 +39,7 @@ #include "WebElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" -#include "WebKit.h" #include "WebPlugin.h" -#include "platform/WebRect.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "platform/WebURLError.h" -#include "platform/WebURLRequest.h" -#include "platform/WebVector.h" #include "WebViewImpl.h" #include "WrappedResourceResponse.h" @@ -56,6 +49,7 @@ #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameView.h" +#include "GestureEvent.h" #include "GraphicsContext.h" #include "HitTestResult.h" #include "HostWindow.h" @@ -77,6 +71,12 @@ #include "WheelEvent.h" #include <public/Platform.h> #include <public/WebClipboard.h> +#include <public/WebRect.h> +#include <public/WebString.h> +#include <public/WebURL.h> +#include <public/WebURLError.h> +#include <public/WebURLRequest.h> +#include <public/WebVector.h> #if ENABLE(GESTURE_EVENTS) #include "PlatformGestureEvent.h" @@ -188,6 +188,8 @@ void WebPluginContainerImpl::handleEvent(Event* event) handleKeyboardEvent(static_cast<KeyboardEvent*>(event)); else if (eventNames().isTouchEventType(event->type())) handleTouchEvent(static_cast<TouchEvent*>(event)); + else if (eventNames().isGestureEventType(event->type())) + handleGestureEvent(static_cast<GestureEvent*>(event)); // FIXME: it would be cleaner if Widget::handleEvent returned true/false and // HTMLPluginElement called setDefaultHandled or defaultEventHandler. @@ -557,6 +559,11 @@ bool WebPluginContainerImpl::getFormValue(String& value) return false; } +bool WebPluginContainerImpl::supportsKeyboardFocus() const +{ + return m_webPlugin->supportsKeyboardFocus(); +} + void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver* observer) { size_t pos = m_pluginLoadObservers.find(observer); @@ -566,12 +573,12 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver } #if USE(ACCELERATED_COMPOSITING) -WebCore::LayerChromium* WebPluginContainerImpl::platformLayer() const +WebLayer* WebPluginContainerImpl::platformLayer() const { if (m_textureId) - return m_textureLayer.unwrap<LayerChromium>(); + return const_cast<WebExternalTextureLayer*>(&m_textureLayer); if (m_ioSurfaceId) - return m_ioSurfaceLayer.unwrap<LayerChromium>(); + return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer); return 0; } #endif @@ -736,6 +743,17 @@ void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) // FIXME: Can a plugin change the cursor from a touch-event callback? } +void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) +{ + WebGestureEventBuilder webEvent(this, *event); + if (webEvent.type == WebInputEvent::Undefined) + return; + WebCursorInfo cursorInfo; + if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) + event->setDefaultHandled(); + // FIXME: Can a plugin change the cursor from a touch-event callback? +} + void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, IntRect& windowRect, IntRect& clipRect, diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 4c2aaeb4a..074a0ccdc 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -45,10 +45,10 @@ struct NPObject; namespace WebCore { +class GestureEvent; class HTMLPlugInElement; class IntRect; class KeyboardEvent; -class LayerChromium; class MouseEvent; class ResourceError; class ResourceResponse; @@ -77,6 +77,7 @@ public: // PluginViewBase methods virtual bool getFormValue(String&); + virtual bool supportsKeyboardFocus() const; // Widget methods virtual void setFrameRect(const WebCore::IntRect&); @@ -149,7 +150,7 @@ public: void willDestroyPluginLoadObserver(WebPluginLoadObserver*); #if USE(ACCELERATED_COMPOSITING) - virtual WebCore::LayerChromium* platformLayer() const; + virtual WebLayer* platformLayer() const; #endif ScrollbarGroup* scrollbarGroup(); @@ -167,6 +168,7 @@ private: void handleWheelEvent(WebCore::WheelEvent*); void handleKeyboardEvent(WebCore::KeyboardEvent*); void handleTouchEvent(WebCore::TouchEvent*); + void handleGestureEvent(WebCore::GestureEvent*); void calculateGeometry(const WebCore::IntRect& frameRect, WebCore::IntRect& windowRect, diff --git a/Source/WebKit/chromium/src/WebPluginScrollbarImpl.cpp b/Source/WebKit/chromium/src/WebPluginScrollbarImpl.cpp index b0f63a7e4..f34dbfdc7 100644 --- a/Source/WebKit/chromium/src/WebPluginScrollbarImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginScrollbarImpl.cpp @@ -69,8 +69,8 @@ WebPluginScrollbarImpl::WebPluginScrollbarImpl(Orientation orientation, { m_scrollbar = Scrollbar::createNativeScrollbar( static_cast<ScrollableArea*>(m_group), - static_cast<ScrollbarOrientation>(orientation), - RegularScrollbar); + static_cast<WebCore::ScrollbarOrientation>(orientation), + WebCore::RegularScrollbar); m_group->scrollbarCreated(this); } @@ -123,6 +123,78 @@ int WebPluginScrollbarImpl::value() const return m_scrollOffset; } +WebPoint WebPluginScrollbarImpl::location() const +{ + return m_scrollbar->frameRect().location(); +} + +WebSize WebPluginScrollbarImpl::size() const +{ + return m_scrollbar->frameRect().size(); +} + +bool WebPluginScrollbarImpl::enabled() const +{ + return m_scrollbar->enabled(); +} + +int WebPluginScrollbarImpl::maximum() const +{ + return m_scrollbar->maximum(); +} + +int WebPluginScrollbarImpl::totalSize() const +{ + return m_scrollbar->totalSize(); +} + +bool WebPluginScrollbarImpl::isScrollViewScrollbar() const +{ + return m_scrollbar->isScrollViewScrollbar(); +} + +bool WebPluginScrollbarImpl::isScrollableAreaActive() const +{ + return m_scrollbar->isScrollableAreaActive(); +} + +void WebPluginScrollbarImpl::getTickmarks(WebVector<WebRect>& tickmarks) const +{ + m_client->getTickmarks(const_cast<WebPluginScrollbarImpl*>(this), &tickmarks); +} + +WebScrollbar::ScrollbarControlSize WebPluginScrollbarImpl::controlSize() const +{ + return static_cast<WebScrollbar::ScrollbarControlSize>(m_scrollbar->controlSize()); +} + +WebScrollbar::ScrollbarPart WebPluginScrollbarImpl::pressedPart() const +{ + return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->pressedPart()); +} + +WebScrollbar::ScrollbarPart WebPluginScrollbarImpl::hoveredPart() const +{ + return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart()); +} + +WebScrollbar::ScrollbarOverlayStyle WebPluginScrollbarImpl::scrollbarOverlayStyle() const +{ + return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle()); +} + +WebScrollbar::Orientation WebPluginScrollbarImpl::orientation() const +{ + if (m_scrollbar->orientation() == WebCore::HorizontalScrollbar) + return WebScrollbar::Horizontal; + return WebScrollbar::Vertical; +} + +bool WebPluginScrollbarImpl::isCustomScrollbar() const +{ + return m_scrollbar->isCustomScrollbar(); +} + void WebPluginScrollbarImpl::setLocation(const WebRect& rect) { IntRect oldRect = m_scrollbar->frameRect(); @@ -211,7 +283,7 @@ bool WebPluginScrollbarImpl::onMouseDown(const WebInputEvent& event) bool WebPluginScrollbarImpl::onMouseUp(const WebInputEvent& event) { WebMouseEvent mouseup = *static_cast<const WebMouseEvent*>(&event); - if (m_scrollbar->pressedPart() == NoPart) + if (m_scrollbar->pressedPart() == WebCore::NoPart) return false; return m_scrollbar->mouseUp(PlatformMouseEventBuilder(m_scrollbar.get(), mouseup)); @@ -221,20 +293,20 @@ bool WebPluginScrollbarImpl::onMouseMove(const WebInputEvent& event) { WebMouseEvent mousemove = *static_cast<const WebMouseEvent*>(&event); if (m_scrollbar->frameRect().contains(mousemove.x, mousemove.y) - || m_scrollbar->pressedPart() != NoPart) { + || m_scrollbar->pressedPart() != WebCore::NoPart) { mousemove.x -= m_scrollbar->x(); mousemove.y -= m_scrollbar->y(); return m_scrollbar->mouseMoved(PlatformMouseEventBuilder(m_scrollbar.get(), mousemove)); } - if (m_scrollbar->hoveredPart() != NoPart && !m_scrollbar->isOverlayScrollbar()) + if (m_scrollbar->hoveredPart() != WebCore::NoPart && !m_scrollbar->isOverlayScrollbar()) m_scrollbar->mouseExited(); return false; } bool WebPluginScrollbarImpl::onMouseLeave(const WebInputEvent& event) { - if (m_scrollbar->hoveredPart() != NoPart) + if (m_scrollbar->hoveredPart() != WebCore::NoPart) m_scrollbar->mouseExited(); return false; diff --git a/Source/WebKit/chromium/src/WebPluginScrollbarImpl.h b/Source/WebKit/chromium/src/WebPluginScrollbarImpl.h index b42cb82fd..43e3fd7b2 100644 --- a/Source/WebKit/chromium/src/WebPluginScrollbarImpl.h +++ b/Source/WebKit/chromium/src/WebPluginScrollbarImpl.h @@ -49,6 +49,7 @@ public: void setScrollOffset(int); void invalidateScrollbarRect(const WebCore::IntRect&); + // FIXME: Combine this with the other getTickmarks method void getTickmarks(Vector<WebCore::IntRect>&) const; WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::IntPoint& parentPoint) const; void scrollbarStyleChanged(); @@ -57,16 +58,30 @@ public: WebCore::Scrollbar* scrollbar() { return m_scrollbar.get(); } // WebKit::WebScrollbar methods - virtual bool isOverlay() const; - virtual int value() const; + virtual bool isOverlay() const OVERRIDE; + virtual int value() const OVERRIDE; + virtual WebPoint location() const OVERRIDE; + virtual WebSize size() const OVERRIDE; + virtual bool enabled() const OVERRIDE; + virtual int maximum() const OVERRIDE; + virtual int totalSize() const OVERRIDE; + virtual bool isScrollViewScrollbar() const OVERRIDE; + virtual bool isScrollableAreaActive() const OVERRIDE; + virtual void getTickmarks(WebVector<WebRect>& tickmarks) const OVERRIDE; + virtual WebScrollbar::ScrollbarControlSize controlSize() const OVERRIDE; + virtual WebScrollbar::ScrollbarPart pressedPart() const OVERRIDE; + virtual WebScrollbar::ScrollbarPart hoveredPart() const OVERRIDE; + virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; + virtual WebScrollbar::Orientation orientation() const OVERRIDE; + virtual bool isCustomScrollbar() const OVERRIDE; // WebKit::WebPluginScrollbar methods - virtual void setLocation(const WebRect&); - virtual void setValue(int position); - virtual void setDocumentSize(int); - virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier); - virtual void paint(WebCanvas*, const WebRect&); - virtual bool handleInputEvent(const WebInputEvent&); + virtual void setLocation(const WebRect&) OVERRIDE; + virtual void setValue(int position) OVERRIDE; + virtual void setDocumentSize(int) OVERRIDE; + virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) OVERRIDE; + virtual void paint(WebCanvas*, const WebRect&) OVERRIDE; + virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE; private: bool onMouseDown(const WebInputEvent&); diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index ec08f0a0e..8bc880c75 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -639,5 +639,14 @@ bool WebRuntimeFeatures::isDialogElementEnabled() #endif } +void WebRuntimeFeatures::enableCSSExclusions(bool enable) +{ + RuntimeEnabledFeatures::setCSSExclusionsEnabled(enable); +} + +bool WebRuntimeFeatures::isCSSExclusionsEnabled() +{ + return RuntimeEnabledFeatures::cssExclusionsEnabled(); +} } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScriptController.cpp b/Source/WebKit/chromium/src/WebScriptController.cpp index 5d36bbe0d..804e27821 100644 --- a/Source/WebKit/chromium/src/WebScriptController.cpp +++ b/Source/WebKit/chromium/src/WebScriptController.cpp @@ -43,7 +43,7 @@ namespace WebKit { void WebScriptController::registerExtension(v8::Extension* extension) { - V8Proxy::registerExtension(extension); + V8Proxy::registerExtensionIfNeeded(extension); } void WebScriptController::enableV8SingleThreadMode() diff --git a/Source/WebKit/chromium/src/WebScrollableLayer.cpp b/Source/WebKit/chromium/src/WebScrollableLayer.cpp index 19e410aa5..a20e81d81 100644 --- a/Source/WebKit/chromium/src/WebScrollableLayer.cpp +++ b/Source/WebKit/chromium/src/WebScrollableLayer.cpp @@ -27,7 +27,7 @@ #include <public/WebScrollableLayer.h> #include "LayerChromium.h" - +#include "Region.h" namespace WebKit { @@ -51,4 +51,25 @@ void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThre m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread); } +void WebScrollableLayer::setNonFastScrollableRegion(const WebVector<WebRect>& rects) +{ + WebCore::Region region; + for (size_t i = 0; i < rects.size(); ++i) { + WebCore::IntRect rect = rects[i]; + region.unite(rect); + } + m_private->setNonFastScrollableRegion(region); + +} + +void WebScrollableLayer::setIsContainerForFixedPositionLayers(bool enable) +{ + m_private->setIsContainerForFixedPositionLayers(enable); +} + +void WebScrollableLayer::setFixedToContainerLayer(bool enable) +{ + m_private->setFixedToContainerLayer(enable); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarImpl.cpp new file mode 100644 index 000000000..73b92697e --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollbarImpl.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2012 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "WebScrollbarImpl.h" + +#include "IntRect.h" +#include "Scrollbar.h" + +namespace WebKit { + +PassOwnPtr<WebScrollbar> WebScrollbar::create(WebCore::Scrollbar* scrollbar) +{ + return adoptPtr(new WebScrollbarImpl(scrollbar)); +} + +WebScrollbarImpl::WebScrollbarImpl(WebCore::Scrollbar* scrollbar) + : m_scrollbar(scrollbar) +{ +} + +bool WebScrollbarImpl::isOverlay() const +{ + return m_scrollbar->isOverlayScrollbar(); +} + +int WebScrollbarImpl::value() const +{ + return m_scrollbar->value(); +} + +WebPoint WebScrollbarImpl::location() const +{ + return m_scrollbar->location(); +} + +WebSize WebScrollbarImpl::size() const +{ + return m_scrollbar->size(); +} + +bool WebScrollbarImpl::enabled() const +{ + return m_scrollbar->enabled(); +} + +int WebScrollbarImpl::maximum() const +{ + return m_scrollbar->maximum(); +} + +int WebScrollbarImpl::totalSize() const +{ + return m_scrollbar->totalSize(); +} + +bool WebScrollbarImpl::isScrollViewScrollbar() const +{ + return m_scrollbar->isScrollViewScrollbar(); +} + +bool WebScrollbarImpl::isScrollableAreaActive() const +{ + return m_scrollbar->isScrollableAreaActive(); +} + +void WebScrollbarImpl::getTickmarks(WebVector<WebRect>& webTickmarks) const +{ + Vector<WebCore::IntRect> tickmarks; + m_scrollbar->getTickmarks(tickmarks); + + WebVector<WebRect> result(tickmarks.size()); + for (size_t i = 0; i < tickmarks.size(); ++i) + result[i] = tickmarks[i]; + + webTickmarks.swap(result); +} + +WebScrollbar::ScrollbarControlSize WebScrollbarImpl::controlSize() const +{ + return static_cast<WebScrollbar::ScrollbarControlSize>(m_scrollbar->controlSize()); +} + +WebScrollbar::ScrollbarPart WebScrollbarImpl::pressedPart() const +{ + return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->pressedPart()); +} + +WebScrollbar::ScrollbarPart WebScrollbarImpl::hoveredPart() const +{ + return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart()); +} + +WebScrollbar::ScrollbarOverlayStyle WebScrollbarImpl::scrollbarOverlayStyle() const +{ + return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle()); +} + +WebScrollbar::Orientation WebScrollbarImpl::orientation() const +{ + return static_cast<WebScrollbar::Orientation>(m_scrollbar->orientation()); +} + +bool WebScrollbarImpl::isCustomScrollbar() const +{ + return m_scrollbar->isCustomScrollbar(); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/CCThreadImpl.h b/Source/WebKit/chromium/src/WebScrollbarImpl.h index 9b9900602..5c9231aaa 100644 --- a/Source/WebKit/chromium/src/CCThreadImpl.h +++ b/Source/WebKit/chromium/src/WebScrollbarImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -22,32 +22,41 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "cc/CCThread.h" -#include <wtf/OwnPtr.h> -#include <wtf/Threading.h> +#ifndef WebScrollbarImpl_h +#define WebScrollbarImpl_h +#include <public/WebScrollbar.h> -#ifndef CCThreadImpl_h -#define CCThreadImpl_h +namespace WebCore { +class Scrollbar; +} namespace WebKit { -class WebThread; - -// Implements CCThread in terms of WebThread. -class CCThreadImpl : public WebCore::CCThread { +class WebScrollbarImpl : public WebScrollbar { public: - static PassOwnPtr<WebCore::CCThread> create(WebThread*); - virtual ~CCThreadImpl(); - virtual void postTask(PassOwnPtr<WebCore::CCThread::Task>); - virtual void postDelayedTask(PassOwnPtr<WebCore::CCThread::Task>, long long delayMs); - WTF::ThreadIdentifier threadID() const; + WebScrollbarImpl(WebCore::Scrollbar*); -private: - explicit CCThreadImpl(WebThread*); + // Implement WebKit::WebScrollbar methods + virtual bool isOverlay() const OVERRIDE; + virtual int value() const OVERRIDE; + virtual WebPoint location() const OVERRIDE; + virtual WebSize size() const OVERRIDE; + virtual bool enabled() const OVERRIDE; + virtual int maximum() const OVERRIDE; + virtual int totalSize() const OVERRIDE; + virtual bool isScrollViewScrollbar() const OVERRIDE; + virtual bool isScrollableAreaActive() const OVERRIDE; + virtual void getTickmarks(WebVector<WebRect>& tickmarks) const OVERRIDE; + virtual ScrollbarControlSize controlSize() const OVERRIDE; + virtual ScrollbarPart pressedPart() const OVERRIDE; + virtual ScrollbarPart hoveredPart() const OVERRIDE; + virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; + virtual Orientation orientation() const OVERRIDE; + virtual bool isCustomScrollbar() const OVERRIDE; - WebThread* m_thread; - WTF::ThreadIdentifier m_threadID; +private: + RefPtr<WebCore::Scrollbar> m_scrollbar; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarLayer.cpp index c7ec47149..2bd1b20fb 100644 --- a/Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebScrollbarLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,37 +24,39 @@ */ #include "config.h" -#include "WebColorChooserClientImpl.h" +#include <public/WebScrollbarLayer.h> -#include "Color.h" -#include "ColorChooserClient.h" +#include "ScrollbarLayerChromium.h" -#if ENABLE(INPUT_TYPE_COLOR) +using namespace WebCore; namespace WebKit { -WebColorChooserClientImpl::WebColorChooserClientImpl(WebCore::ColorChooserClient* client) : m_client(client) +void WebScrollbarLayer::setScrollLayer(const WebLayer layer) { + int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id(); + unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id); } -WebColorChooserClientImpl::~WebColorChooserClientImpl() +WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) { + return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); } -void WebColorChooserClientImpl::didChooseColor(const WebColor& color) +WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer) + : WebLayer(layer) { - if (!m_client) - return; - m_client->didChooseColor(WebCore::Color(static_cast<WebCore::RGBA32>(color))); } -void WebColorChooserClientImpl::didEndChooser() +WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer) { - if (!m_client) - return; - m_client->didEndChooser(); + m_private = layer; + return *this; } +WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const +{ + return unwrap<ScrollbarLayerChromium>(); } -#endif // ENABLE(INPUT_TYPE_COLOR) +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarThemeClientImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarThemeClientImpl.cpp new file mode 100644 index 000000000..68c9458d0 --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollbarThemeClientImpl.cpp @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2012 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. + * + * 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 "WebScrollbarThemeClientImpl.h" + +using namespace WebCore; + +namespace WebKit { + +WebScrollbarThemeClientImpl::WebScrollbarThemeClientImpl(WebScrollbar* scrollbar) + : m_scrollbar(scrollbar) +{ +} + +int WebScrollbarThemeClientImpl::x() const +{ + return location().x(); +} + +int WebScrollbarThemeClientImpl::y() const +{ + return location().y(); +} + +int WebScrollbarThemeClientImpl::width() const +{ + return size().width(); +} + +int WebScrollbarThemeClientImpl::height() const +{ + return size().height(); +} + +IntSize WebScrollbarThemeClientImpl::size() const +{ + return m_scrollbar->size(); +} + +IntPoint WebScrollbarThemeClientImpl::location() const +{ + return m_scrollbar->location(); +} + +ScrollView* WebScrollbarThemeClientImpl::parent() const +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); + return 0; +} + +ScrollView* WebScrollbarThemeClientImpl::root() const +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); + return 0; +} + +void WebScrollbarThemeClientImpl::setFrameRect(const IntRect&) +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); +} + +IntRect WebScrollbarThemeClientImpl::frameRect() const +{ + return IntRect(location(), size()); +} + +void WebScrollbarThemeClientImpl::invalidate() +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); +} + +void WebScrollbarThemeClientImpl::invalidateRect(const IntRect&) +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); +} + +WebCore::ScrollbarOverlayStyle WebScrollbarThemeClientImpl::scrollbarOverlayStyle() const +{ + return static_cast<WebCore::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle()); +} + +void WebScrollbarThemeClientImpl::getTickmarks(Vector<IntRect>& tickmarks) const +{ + WebVector<WebRect> webTickmarks; + m_scrollbar->getTickmarks(webTickmarks); + tickmarks.resize(webTickmarks.size()); + for (size_t i = 0; i < webTickmarks.size(); ++i) + tickmarks[i] = webTickmarks[i]; +} + +bool WebScrollbarThemeClientImpl::isScrollableAreaActive() const +{ + return m_scrollbar->isScrollableAreaActive(); +} + +bool WebScrollbarThemeClientImpl::isScrollViewScrollbar() const +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); + return false; +} + +IntPoint WebScrollbarThemeClientImpl::convertFromContainingWindow(const IntPoint& windowPoint) +{ + // Unused by Chromium scrollbar themes. + ASSERT_NOT_REACHED(); + return windowPoint; +} + +bool WebScrollbarThemeClientImpl::isCustomScrollbar() const +{ + return m_scrollbar->isCustomScrollbar(); +} + +WebCore::ScrollbarOrientation WebScrollbarThemeClientImpl::orientation() const +{ + return static_cast<WebCore::ScrollbarOrientation>(m_scrollbar->orientation()); +} + +int WebScrollbarThemeClientImpl::value() const +{ + return m_scrollbar->value(); +} + +float WebScrollbarThemeClientImpl::currentPos() const +{ + return value(); +} + +int WebScrollbarThemeClientImpl::visibleSize() const +{ + return totalSize() - maximum(); +} + +int WebScrollbarThemeClientImpl::totalSize() const +{ + return m_scrollbar->totalSize(); +} + +int WebScrollbarThemeClientImpl::maximum() const +{ + return m_scrollbar->maximum(); +} + +WebCore::ScrollbarControlSize WebScrollbarThemeClientImpl::controlSize() const +{ + return static_cast<WebCore::ScrollbarControlSize>(m_scrollbar->controlSize()); +} + +int WebScrollbarThemeClientImpl::lineStep() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +int WebScrollbarThemeClientImpl::pageStep() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +WebCore::ScrollbarPart WebScrollbarThemeClientImpl::pressedPart() const +{ + return static_cast<WebCore::ScrollbarPart>(m_scrollbar->pressedPart()); +} + +WebCore::ScrollbarPart WebScrollbarThemeClientImpl::hoveredPart() const +{ + return static_cast<WebCore::ScrollbarPart>(m_scrollbar->hoveredPart()); +} + +void WebScrollbarThemeClientImpl::styleChanged() +{ + ASSERT_NOT_REACHED(); +} + +bool WebScrollbarThemeClientImpl::enabled() const +{ + return m_scrollbar->enabled(); +} + +void WebScrollbarThemeClientImpl::setEnabled(bool) +{ + ASSERT_NOT_REACHED(); +} + +bool WebScrollbarThemeClientImpl::isOverlayScrollbar() const +{ + return m_scrollbar->isOverlay(); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarThemeClientImpl.h b/Source/WebKit/chromium/src/WebScrollbarThemeClientImpl.h new file mode 100644 index 000000000..b3a6ac956 --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollbarThemeClientImpl.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2012 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. + * + * 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 WebScrollbarThemeClientImpl_h +#define WebScrollbarThemeClientImpl_h + +#include "ScrollbarThemeClient.h" +#include <public/WebScrollbar.h> +#include <wtf/Noncopyable.h> + +namespace WebCore { +class ScrollView; +} + +namespace WebKit { + +// Adapts a WebScrollbar to the ScrollbarThemeClient interface +class WebScrollbarThemeClientImpl : public WebCore::ScrollbarThemeClient { + WTF_MAKE_NONCOPYABLE(WebScrollbarThemeClientImpl); +public: + // Caller must retain ownership of this pointer and ensure that its lifetime + // exceeds this instance. + WebScrollbarThemeClientImpl(WebScrollbar*); + + // Implement WebCore::ScrollbarThemeClient interface + virtual int x() const OVERRIDE; + virtual int y() const OVERRIDE; + virtual int width() const OVERRIDE; + virtual int height() const OVERRIDE; + virtual WebCore::IntSize size() const OVERRIDE; + virtual WebCore::IntPoint location() const OVERRIDE; + virtual WebCore::ScrollView* parent() const OVERRIDE; + virtual WebCore::ScrollView* root() const OVERRIDE; + virtual void setFrameRect(const WebCore::IntRect&) OVERRIDE; + virtual WebCore::IntRect frameRect() const OVERRIDE; + virtual void invalidate() OVERRIDE; + virtual void invalidateRect(const WebCore::IntRect&) OVERRIDE; + virtual WebCore::ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; + virtual void getTickmarks(Vector<WebCore::IntRect>&) const OVERRIDE; + virtual bool isScrollableAreaActive() const OVERRIDE; + virtual bool isScrollViewScrollbar() const OVERRIDE; + virtual WebCore::IntPoint convertFromContainingWindow(const WebCore::IntPoint&) OVERRIDE; + virtual bool isCustomScrollbar() const OVERRIDE; + virtual WebCore::ScrollbarOrientation orientation() const OVERRIDE; + virtual int value() const OVERRIDE; + virtual float currentPos() const OVERRIDE; + virtual int visibleSize() const OVERRIDE; + virtual int totalSize() const OVERRIDE; + virtual int maximum() const OVERRIDE; + virtual WebCore::ScrollbarControlSize controlSize() const OVERRIDE; + virtual int lineStep() const OVERRIDE; + virtual int pageStep() const OVERRIDE; + virtual WebCore::ScrollbarPart pressedPart() const OVERRIDE; + virtual WebCore::ScrollbarPart hoveredPart() const OVERRIDE; + virtual void styleChanged() OVERRIDE; + virtual bool enabled() const OVERRIDE; + virtual void setEnabled(bool) OVERRIDE; + virtual bool isOverlayScrollbar() const OVERRIDE; + +private: + WebKit::WebScrollbar* m_scrollbar; +}; + +} + +#endif // WebScrollbarThemeClientImpl_h diff --git a/Source/WebKit/chromium/src/WebScrollbarThemePainter.cpp b/Source/WebKit/chromium/src/WebScrollbarThemePainter.cpp new file mode 100644 index 000000000..a96fdca45 --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollbarThemePainter.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2012 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. + * + * 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 <public/WebScrollbarThemePainter.h> + +#include "PlatformContextSkia.h" +#include "Scrollbar.h" +#include "ScrollbarThemeComposite.h" +#include <public/WebRect.h> + +using namespace WebCore; + +namespace WebKit { + +void WebScrollbarThemePainter::assign(const WebScrollbarThemePainter& painter) +{ + // This is a pointer to a static object, so no ownership transferral. + m_theme = painter.m_theme; + m_scrollbar = painter.m_scrollbar; +} + +void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const WebRect& rect) +{ + SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height); + canvas->clipRect(clip); + + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintScrollbarBackground(&context, m_scrollbar); +} + +void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintTrackBackground(&context, m_scrollbar, IntRect(rect)); +} + +void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::BackTrackPart); +} + +void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), WebCore::ForwardTrackPart); +} + +void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButtonStartPart); +} + +void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::BackButtonEndPart); +} + +void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardButtonStartPart); +} + +void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintButton(&context, m_scrollbar, IntRect(rect), WebCore::ForwardButtonEndPart); +} + +void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintTickmarks(&context, m_scrollbar, IntRect(rect)); +} + +void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect) +{ + PlatformContextSkia platformContext(canvas); + platformContext.setDrawingToImageBuffer(true); + GraphicsContext context(&platformContext); + m_theme->paintThumb(&context, m_scrollbar, IntRect(rect)); +} + +WebScrollbarThemePainter::WebScrollbarThemePainter(WebCore::ScrollbarThemeComposite* theme, WebCore::Scrollbar* scrollbar) + : m_theme(theme) + , m_scrollbar(scrollbar) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 5c57cf8ca..eb4b7bb76 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -47,10 +47,10 @@ namespace WebKit { WebSettingsImpl::WebSettingsImpl(Settings* settings) : m_settings(settings) - , m_forceSoftwareCompositing(false) , m_showFPSCounter(false) , m_showPlatformLayerTree(false) , m_showPaintRects(false) + , m_renderVSyncEnabled(true) , m_viewportEnabled(false) , m_applyDefaultDeviceScaleFactorInCompositor(false) , m_defaultTileSize(WebSize(256, 256)) @@ -148,6 +148,15 @@ void WebSettingsImpl::setTextAutosizingEnabled(bool enabled) #endif } +void WebSettingsImpl::setTextAutosizingFontScaleFactor(float fontScaleFactor) +{ +#if ENABLE(TEXT_AUTOSIZING) + m_settings->setTextAutosizingFontScaleFactor(fontScaleFactor); +#else + UNUSED_PARAM(fontScaleFactor); +#endif +} + void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding) { m_settings->setDefaultTextEncodingName((String)encoding); @@ -357,6 +366,11 @@ void WebSettingsImpl::setPrivilegedWebGLExtensionsEnabled(bool enabled) m_settings->setPrivilegedWebGLExtensionsEnabled(enabled); } +void WebSettingsImpl::setRenderVSyncEnabled(bool enabled) +{ + m_renderVSyncEnabled = enabled; +} + void WebSettingsImpl::setWebGLErrorsToConsoleEnabled(bool enabled) { m_settings->setWebGLErrorsToConsoleEnabled(enabled); @@ -398,11 +412,6 @@ void WebSettingsImpl::setForceCompositingMode(bool enabled) m_settings->setForceCompositingMode(enabled); } -void WebSettingsImpl::setForceSoftwareCompositing(bool enabled) -{ - m_forceSoftwareCompositing = enabled; -} - void WebSettingsImpl::setMockScrollbarsEnabled(bool enabled) { m_settings->setMockScrollbarsEnabled(enabled); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 76e30b52f..7bc8a649a 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -45,7 +45,6 @@ public: virtual ~WebSettingsImpl() { } virtual bool deviceSupportsTouch(); - virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } virtual bool scrollAnimatorEnabled() const; virtual bool viewportEnabled() const { return m_viewportEnabled; } virtual void setAccelerated2dCanvasEnabled(bool); @@ -94,7 +93,6 @@ public: virtual void setFixedPositionCreatesStackingContext(bool); virtual void setFontRenderingModeNormal(); virtual void setForceCompositingMode(bool); - virtual void setForceSoftwareCompositing(bool); virtual void setFrameFlatteningEnabled(bool); virtual void setFullScreenEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); @@ -124,6 +122,7 @@ public: virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setPluginsEnabled(bool); virtual void setPrivilegedWebGLExtensionsEnabled(bool); + virtual void setRenderVSyncEnabled(bool); virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setShouldDisplayCaptions(bool); @@ -139,6 +138,7 @@ public: virtual void setSyncXHRInDocumentsEnabled(bool); virtual void setTextAreasAreResizable(bool); virtual void setTextAutosizingEnabled(bool); + virtual void setTextAutosizingFontScaleFactor(float); virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); virtual void setUnifiedTextCheckerEnabled(bool); virtual void setUserStyleSheetLocation(const WebURL&); @@ -155,16 +155,17 @@ public: bool showFPSCounter() const { return m_showFPSCounter; } bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } bool showPaintRects() const { return m_showPaintRects; } + bool renderVSyncEnabled() const { return m_renderVSyncEnabled; } bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } private: WebCore::Settings* m_settings; - bool m_forceSoftwareCompositing; bool m_showFPSCounter; bool m_showPlatformLayerTree; bool m_showPaintRects; + bool m_renderVSyncEnabled; bool m_viewportEnabled; bool m_applyDefaultDeviceScaleFactorInCompositor; WebSize m_defaultTileSize; diff --git a/Source/WebKit/chromium/src/WebSocketImpl.cpp b/Source/WebKit/chromium/src/WebSocketImpl.cpp index 179303ad9..7548c6315 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.cpp +++ b/Source/WebKit/chromium/src/WebSocketImpl.cpp @@ -126,7 +126,7 @@ bool WebSocketImpl::sendText(const WebString& message) bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) { #if ENABLE(WEB_SOCKETS) - return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer)) == ThreadableWebSocketChannel::SendSuccess; + return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer), 0, webArrayBuffer.byteLength()) == ThreadableWebSocketChannel::SendSuccess; #else ASSERT_NOT_REACHED(); #endif diff --git a/Source/WebKit/chromium/src/WebSolidColorLayer.cpp b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp index 11d7c1417..83914b263 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayer.cpp +++ b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp @@ -24,10 +24,10 @@ */ #include "config.h" -#include "platform/WebSolidColorLayer.h" +#include <public/WebSolidColorLayer.h> #include "WebSolidColorLayerImpl.h" -#include "platform/WebFloatRect.h" +#include <public/WebFloatRect.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp index 9764af138..a0f7a4b0b 100644 --- a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp @@ -59,7 +59,8 @@ void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintCl FloatSize layerSize = layer.size(); IntRect clip(0, 0, layerSize.width(), layerSize.height()); - paintLayer(paintClient, layer, clip); + if (layer.drawsContent()) + paintLayer(paintClient, layer, clip); const Vector<GraphicsLayer*>& children = layer.children(); Vector<GraphicsLayer*>::const_iterator it; diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 7c6da60d9..0bd3ea116 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -42,6 +42,7 @@ #include "Color.h" #include "ColorSpace.h" #include "CompositionUnderlineVectorBuilder.h" +#include "CompositorHUDFontAtlas.h" #include "ContextFeaturesClientImpl.h" #include "ContextMenu.h" #include "ContextMenuController.h" @@ -81,7 +82,6 @@ #include "InspectorInstrumentation.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" -#include "LayerChromium.h" #include "LayerPainterChromium.h" #include "MIMETypeRegistry.h" #include "NodeRenderStyle.h" @@ -97,7 +97,6 @@ #include "PlatformMouseEvent.h" #include "PlatformThemeChromiumLinux.h" #include "PlatformWheelEvent.h" -#include "PointerLock.h" #include "PointerLockController.h" #include "PopupContainer.h" #include "PopupMenuClient.h" @@ -133,7 +132,6 @@ #include "WebInputElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" -#include "WebKit.h" #include "WebMediaPlayerAction.h" #include "WebNode.h" #include "WebPagePopupImpl.h" @@ -145,15 +143,13 @@ #include "WebRuntimeFeatures.h" #include "WebSettingsImpl.h" #include "WebTextInputInfo.h" +#include "WebTouchCandidatesInfo.h" #include "WebViewClient.h" #include "WheelEvent.h" -#include "cc/CCProxy.h" -#include "cc/CCSettings.h" #include "painting/GraphicsContextBuilder.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" #include <public/Platform.h> +#include <public/WebCompositor.h> +#include <public/WebCompositorOutputSurface.h> #include <public/WebDragData.h> #include <public/WebFloatPoint.h> #include <public/WebGraphicsContext3D.h> @@ -162,6 +158,8 @@ #include <public/WebLayerTreeView.h> #include <public/WebPoint.h> #include <public/WebRect.h> +#include <public/WebString.h> +#include <public/WebVector.h> #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> #include <wtf/RefPtr.h> @@ -195,7 +193,7 @@ static const int touchPointPadding = 32; static const float minScaleDifference = 0.01f; static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; -static const double doubleTabZoomAnimationDurationInSeconds = 0.25; +static const double doubleTapZoomAnimationDurationInSeconds = 0.25; // Constants for zooming in on a focused text field. static const double scrollAndScaleAnimationDurationInSeconds = 0.2; @@ -763,15 +761,25 @@ void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar void WebViewImpl::renderingStats(WebRenderingStats& stats) const { - ASSERT(isAcceleratedCompositingActive()); if (!m_layerTreeView.isNull()) m_layerTreeView.renderingStats(stats); } -void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationInSeconds) +void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds) { - if (!m_layerTreeView.isNull()) - m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationInSeconds); + if (m_layerTreeView.isNull()) + return; + + IntPoint clampedPoint = targetPosition; + if (!useAnchor) + clampedPoint = clampOffsetAtScale(targetPosition, newScale); + + if (!durationInSeconds && !useAnchor) { + setPageScaleFactor(newScale, clampedPoint); + return; + } + + m_layerTreeView.startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds); } #endif @@ -780,6 +788,17 @@ WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport() return &m_benchmarkSupport; } +WebVector<WebFloatQuad> WebViewImpl::getTouchHighlightQuads(const WebPoint& point, + int padding, + WebTouchCandidatesInfo& outTouchInfo, + WebColor& outTapHighlightColor) +{ + // FIXME: Upstream this function from the chromium-android branch. + notImplemented(); + + return WebVector<WebFloatQuad>(); +} + bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) { ASSERT((event.type == WebInputEvent::RawKeyDown) @@ -1112,7 +1131,7 @@ void WebViewImpl::animateZoomAroundPoint(const IntPoint& point, AutoZoomType zoo computeScaleAndScrollForHitRect(WebRect(point.x(), point.y(), 0, 0), zoomType, scale, scroll); bool isDoubleTap = (zoomType == DoubleTap); - double durationInSeconds = isDoubleTap ? doubleTabZoomAnimationDurationInSeconds : 0; + double durationInSeconds = isDoubleTap ? doubleTapZoomAnimationDurationInSeconds : 0; startPageScaleAnimation(scroll, isDoubleTap, scale, durationInSeconds); #endif } @@ -1611,7 +1630,7 @@ void WebViewImpl::didBeginFrame() void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) { #if ENABLE(REQUEST_ANIMATION_FRAME) - TRACE_EVENT("WebViewImpl::updateAnimations", this, 0); + TRACE_EVENT0("webkit", "WebViewImpl::updateAnimations"); WebFrameImpl* webframe = mainFrameImpl(); if (!webframe) @@ -1634,7 +1653,7 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) void WebViewImpl::layout() { - TRACE_EVENT("WebViewImpl::layout", this, 0); + TRACE_EVENT0("webkit", "WebViewImpl::layout"); PageWidgetDelegate::layout(m_page.get()); } @@ -1677,7 +1696,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) if (canvas) { // Clip rect to the confines of the rootLayerTexture. IntRect resizeRect(rect); - resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView.viewportSize())); + resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView.deviceViewportSize())); doPixelReadbackToCanvas(canvas, resizeRect); } #endif @@ -1704,7 +1723,7 @@ void WebViewImpl::themeChanged() void WebViewImpl::composite(bool) { #if USE(ACCELERATED_COMPOSITING) - if (CCProxy::hasImplThread()) + if (WebCompositor::threadingEnabled()) m_layerTreeView.setNeedsRedraw(); else { ASSERT(isAcceleratedCompositingActive()); @@ -3509,7 +3528,7 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) } if (layer) - m_rootLayer = WebLayer(layer->platformLayer()); + m_rootLayer = *layer->platformLayer(); if (!m_layerTreeView.isNull()) m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0); @@ -3564,7 +3583,7 @@ WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() void WebViewImpl::scheduleAnimation() { if (isAcceleratedCompositingActive()) { - if (CCProxy::hasImplThread()) { + if (WebCompositor::threadingEnabled()) { ASSERT(!m_layerTreeView.isNull()); m_layerTreeView.setNeedsAnimate(); } else @@ -3609,14 +3628,14 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); } else { - TRACE_EVENT("WebViewImpl::setIsAcceleratedCompositingActive(true)", this, 0); + TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(true)"); WebLayerTreeView::Settings layerTreeViewSettings; layerTreeViewSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); layerTreeViewSettings.showFPSCounter = settingsImpl()->showFPSCounter(); layerTreeViewSettings.showPlatformLayerTree = settingsImpl()->showPlatformLayerTree(); layerTreeViewSettings.showPaintRects = settingsImpl()->showPaintRects(); - layerTreeViewSettings.forceSoftwareCompositing = settings()->forceSoftwareCompositing(); + layerTreeViewSettings.renderVSyncEnabled = settingsImpl()->renderVSyncEnabled(); layerTreeViewSettings.defaultTileSize = settingsImpl()->defaultTileSize(); layerTreeViewSettings.maxUntiledLayerSize = settingsImpl()->maxUntiledLayerSize(); @@ -3646,6 +3665,15 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_compositorCreationFailed = false; if (m_pageOverlays) m_pageOverlays->update(); + + // Only allocate the font atlas if we have reason to use the heads-up display. + if (layerTreeViewSettings.showFPSCounter || layerTreeViewSettings.showPlatformLayerTree) { + TRACE_EVENT0("cc", "WebViewImpl::setIsAcceleratedCompositingActive(true) initialize font atlas"); + WebRect asciiToRectTable[128]; + int fontHeight; + SkBitmap bitmap = WebCore::CompositorHUDFontAtlas::generateFontAtlas(asciiToRectTable, fontHeight); + m_layerTreeView.setFontAtlas(bitmap, asciiToRectTable, fontHeight); + } } else { m_nonCompositedContentHost.clear(); m_isAcceleratedCompositingActive = false; @@ -3659,47 +3687,63 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) #endif -PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D() -{ - if (settings()->forceSoftwareCompositing()) - CRASH(); +namespace { + +// Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until +// downstream code can be updated to produce output surfaces directly. +class WebGraphicsContextToOutputSurfaceAdapter : public WebCompositorOutputSurface { +public: + explicit WebGraphicsContextToOutputSurfaceAdapter(PassOwnPtr<WebGraphicsContext3D> context) + : m_context3D(context) + , m_client(0) + { + } + + virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE + { + ASSERT(client); + if (!m_context3D->makeContextCurrent()) + return false; + m_client = client; + return true; + } + + virtual const Capabilities& capabilities() const OVERRIDE + { + return m_capabilities; + } + + virtual WebGraphicsContext3D* context3D() const OVERRIDE + { + return m_context3D.get(); + } + + virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE + { + } - // Explicitly disable antialiasing for the compositor. As of the time of - // this writing, the only platform that supported antialiasing for the - // compositor was Mac OS X, because the on-screen OpenGL context creation - // code paths on Windows and Linux didn't yet have multisampling support. - // Mac OS X essentially always behaves as though it's rendering offscreen. - // Multisampling has a heavy cost especially on devices with relatively low - // fill rate like most notebooks, and the Mac implementation would need to - // be optimized to resolve directly into the IOSurface shared between the - // GPU and browser processes. For these reasons and to avoid platform - // disparities we explicitly disable antialiasing. +private: + OwnPtr<WebGraphicsContext3D> m_context3D; + Capabilities m_capabilities; + WebCompositorOutputSurfaceClient* m_client; +}; + +} // namespace + +WebGraphicsContext3D* WebViewImpl::createContext3D() +{ + // Temporarily, if the output surface can't be created, create a WebGraphicsContext3D + // directly. This allows bootstrapping the output surface system while downstream + // users of the API still use the old approach. WebKit::WebGraphicsContext3D::Attributes attributes; attributes.antialias = false; attributes.shareResources = true; - - OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(client()->createGraphicsContext3D(attributes)); - if (!webContext) - return nullptr; - - return webContext.release(); + return m_client->createGraphicsContext3D(attributes); } -WebKit::WebGraphicsContext3D* WebViewImpl::createContext3D() +WebCompositorOutputSurface* WebViewImpl::createOutputSurface() { - if (settings()->forceSoftwareCompositing()) - CRASH(); - - OwnPtr<WebKit::WebGraphicsContext3D> webContext; - - // If we've already created an onscreen context for this view, return that. - if (m_temporaryOnscreenGraphicsContext3D) - webContext = m_temporaryOnscreenGraphicsContext3D.release(); - else // Otherwise make a new one. - webContext = createCompositorGraphicsContext3D(); - // The caller takes ownership of this object, but since there's no equivalent of PassOwnPtr<> in the WebKit API - // we return a raw pointer. - return webContext.leakPtr(); + return m_client->createOutputSurface(); } void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta) @@ -3749,7 +3793,11 @@ void WebViewImpl::didCompleteSwapBuffers() void WebViewImpl::didRebindGraphicsContext(bool success) { + didRecreateOutputSurface(success); +} +void WebViewImpl::didRecreateOutputSurface(bool success) +{ // Switch back to software rendering mode, if necessary if (!success) { ASSERT(m_isAcceleratedCompositingActive); @@ -3768,7 +3816,7 @@ void WebViewImpl::didRebindGraphicsContext(bool success) void WebViewImpl::scheduleComposite() { - ASSERT(!CCProxy::hasImplThread()); + ASSERT(!WebCompositor::threadingEnabled()); m_client->scheduleComposite(); } @@ -3786,7 +3834,10 @@ void WebViewImpl::updateLayerTreeViewport() float deviceScale = m_deviceScaleInCompositor; m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin(), deviceScale); - m_layerTreeView.setViewportSize(size()); + IntSize layoutViewportSize = size(); + IntSize deviceViewportSize = size(); + deviceViewportSize.scale(deviceScale); + m_layerTreeView.setViewportSize(layoutViewportSize, deviceViewportSize); m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); } @@ -3804,6 +3855,34 @@ void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) m_autofillPopupClient->valueChanged(listIndex); } +bool WebViewImpl::detectContentIntentOnTouch(const WebPoint& position, WebInputEvent::Type touchType) +{ + ASSERT(touchType == WebInputEvent::GestureTap || touchType == WebInputEvent::GestureLongPress); + HitTestResult touchHit = hitTestResultForWindowPos(position); + + if (touchHit.isContentEditable()) + return false; + + Node* node = touchHit.innerNode(); + if (!node || !node->isTextNode()) + return false; + + // FIXME: Should we not detect content intents in nodes that have event listeners? + + WebContentDetectionResult content = m_client->detectContentIntentAround(touchHit); + if (!content.isValid()) + return false; + + if (touchType == WebInputEvent::GestureLongPress) { + // Select the detected content as a block. + focusedFrame()->selectRange(content.range()); + return true; + } + + m_client->scheduleContentIntent(content.intent()); + return true; +} + void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, bool isInitialState) { if (!page()) diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 639d5e61a..39783680f 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -31,16 +31,6 @@ #ifndef WebViewImpl_h #define WebViewImpl_h -#include "WebNavigationPolicy.h" -#include "platform/WebLayer.h" -#include "platform/WebLayerTreeView.h" -#include "platform/WebLayerTreeViewClient.h" -#include "platform/WebPoint.h" -#include "platform/WebRect.h" -#include "platform/WebSize.h" -#include "platform/WebString.h" -#include "WebView.h" - #include "ChromeClientImpl.h" #include "ContextMenuClientImpl.h" #include "DragClientImpl.h" @@ -56,7 +46,18 @@ #include "PageWidgetDelegate.h" #include "PlatformGestureCurveTarget.h" #include "UserMediaClientImpl.h" +#include "WebInputEvent.h" +#include "WebNavigationPolicy.h" +#include "WebView.h" #include "WebViewBenchmarkSupportImpl.h" +#include <public/WebFloatQuad.h> +#include <public/WebLayer.h> +#include <public/WebLayerTreeView.h> +#include <public/WebLayerTreeViewClient.h> +#include <public/WebPoint.h> +#include <public/WebRect.h> +#include <public/WebSize.h> +#include <public/WebString.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -301,13 +302,20 @@ public: virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); virtual WebViewBenchmarkSupport* benchmarkSupport(); + virtual WebVector<WebFloatQuad> getTouchHighlightQuads(const WebPoint&, + int padding, + WebTouchCandidatesInfo& outTouchInfo, + WebColor& outTapHighlightColor); + // WebLayerTreeViewClient virtual void willBeginFrame(); virtual void didBeginFrame(); virtual void updateAnimations(double monotonicFrameBeginTime); virtual void applyScrollAndScale(const WebSize&, float); - virtual WebGraphicsContext3D* createContext3D(); - virtual void didRebindGraphicsContext(bool); + virtual WebGraphicsContext3D* createContext3D() OVERRIDE; + virtual void didRebindGraphicsContext(bool success) OVERRIDE; + virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE; + virtual void didRecreateOutputSurface(bool success) OVERRIDE; virtual void willCommit(); virtual void didCommit(); virtual void didCommitAndDrawFrame(); @@ -382,6 +390,8 @@ public: // Event related methods: void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); + + bool detectContentIntentOnTouch(const WebPoint&, WebInputEvent::Type); void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds); void numberOfWheelEventHandlersChanged(unsigned); @@ -529,8 +539,6 @@ public: virtual WebGraphicsContext3D* sharedGraphicsContext3D(); - PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D(); - virtual void setVisibilityState(WebPageVisibilityState, bool); WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); } @@ -824,10 +832,6 @@ private: OwnPtr<SpeechRecognitionClientProxy> m_speechRecognitionClient; #endif - // If we attempt to fetch the on-screen GraphicsContext3D before - // the compositor has been turned on, we need to instantiate it - // early. This member holds on to the GC3D in this case. - OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D; OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; #if ENABLE(BATTERY_STATUS) diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index 80899919b..c6fd50589 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -59,13 +59,11 @@ #include "PlatformMessagePortChannel.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebMessagePortChannel.h" #include "WebPermissionClient.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" #include "WebViewImpl.h" +#include <public/WebString.h> +#include <public/WebURL.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp index 7a387c7ed..4a5f69dc2 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp @@ -40,8 +40,6 @@ #include "NotImplemented.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebWorkerBase.h" #include "WorkerAsyncFileWriterChromium.h" #include "WorkerContext.h" diff --git a/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp index 3ffb178c5..dd91c52a2 100644 --- a/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp +++ b/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp @@ -35,14 +35,13 @@ #include "AsyncFileWriterClient.h" #include "CrossThreadTask.h" -#include "platform/WebCString.h" #include "WebFileWriter.h" -#include "WebKit.h" #include "WebWorkerBase.h" #include "WorkerContext.h" #include "WorkerLoaderProxy.h" #include "WorkerThread.h" #include <public/Platform.h> +#include <public/WebCString.h> #include <public/WebFileSystem.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> diff --git a/Source/WebKit/chromium/src/js/DevTools.js b/Source/WebKit/chromium/src/js/DevTools.js index 12293f5b1..f555419e9 100644 --- a/Source/WebKit/chromium/src/js/DevTools.js +++ b/Source/WebKit/chromium/src/js/DevTools.js @@ -39,7 +39,6 @@ Preferences.localizeUI = false; Preferences.applicationTitle = "Developer Tools - %s"; Preferences.exposeDisableCache = true; - Preferences.exposeWorkersInspection = true; Preferences.showDockToRight = true; Preferences.exposeFileSystemInspection = true; })();} diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index e1b94a640..babb1f6cc 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -43,8 +43,7 @@ enum { NSEventPhaseStationary = 0x1 << 1, NSEventPhaseChanged = 0x1 << 2, NSEventPhaseEnded = 0x1 << 3, - NSEventPhaseCancelled = 0x1 << 4, - NSEventPhaseMayBegin = 0x1 << 5 + NSEventPhaseCancelled = 0x1 << 4 }; typedef NSUInteger NSEventPhase; @@ -55,6 +54,15 @@ typedef NSUInteger NSEventPhase; #endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1080 + +// Additional Mountain Lion APIs. +enum { + NSEventPhaseMayBegin = 0x1 << 5 +}; + +#endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1080 + // Do not __MAC_OS_X_VERSION_MAX_ALLOWED here because of a bug in the 10.5 SDK, // see <http://lists.webkit.org/pipermail/webkit-dev/2012-July/021442.html>. #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 @@ -759,7 +767,7 @@ WebMouseEvent WebInputEventFactory::mouseEvent(NSEvent* event, NSView* view) static WebMouseWheelEvent::Phase phaseForNSEventPhase(NSEventPhase eventPhase) { - uint32_t phase = WebMouseWheelEvent::PhaseNone; + uint32_t phase = WebMouseWheelEvent::PhaseNone; if (eventPhase & NSEventPhaseBegan) phase |= WebMouseWheelEvent::PhaseBegan; if (eventPhase & NSEventPhaseStationary) @@ -770,6 +778,8 @@ static WebMouseWheelEvent::Phase phaseForNSEventPhase(NSEventPhase eventPhase) phase |= WebMouseWheelEvent::PhaseEnded; if (eventPhase & NSEventPhaseCancelled) phase |= WebMouseWheelEvent::PhaseCancelled; + if (eventPhase & NSEventPhaseMayBegin) + phase |= WebMouseWheelEvent::PhaseMayBegin; return static_cast<WebMouseWheelEvent::Phase>(phase); } |