diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-18 14:03:11 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-18 14:03:11 +0200 |
| commit | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch) | |
| tree | cdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Source/WebKit/chromium/src | |
| parent | 1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff) | |
| download | qtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz | |
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Source/WebKit/chromium/src')
58 files changed, 1194 insertions, 293 deletions
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 322f15046..cd0f07ff6 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -62,7 +62,9 @@ #include "PeerConnection00.h" #include "PlatformCursor.h" #include "ReferrerPolicy.h" +#include "ResourceResponse.h" #include "Settings.h" +#include "SpeechRecognitionError.h" #include "StorageInfo.h" #include "TextAffinity.h" #include "TextChecking.h" @@ -92,6 +94,7 @@ #include "WebPageVisibilityState.h" #include "WebScrollbar.h" #include "WebSettings.h" +#include "WebSpeechRecognizerClient.h" #include "WebStorageQuotaError.h" #include "WebStorageQuotaType.h" #include "WebTextAffinity.h" @@ -107,6 +110,7 @@ #include <public/WebFileSystem.h> #include <public/WebFilterOperation.h> #include <public/WebReferrerPolicy.h> +#include <public/WebURLResponse.h> #include <wtf/Assertions.h> #include <wtf/text/StringImpl.h> @@ -563,6 +567,18 @@ COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateFailed, P COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateClosed, PeerConnection00::ICE_CLOSED); #endif +#if ENABLE(SCRIPTED_SPEECH) +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::OtherError, SpeechRecognitionError::OTHER); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NoSpeechError, SpeechRecognitionError::NO_SPEECH); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AbortedError, SpeechRecognitionError::ABORTED); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AudioCaptureError, SpeechRecognitionError::AUDIO_CAPTURE); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NetworkError, SpeechRecognitionError::NETWORK); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NotAllowedError, SpeechRecognitionError::NOT_ALLOWED); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::ServiceNotAllowedError, SpeechRecognitionError::SERVICE_NOT_ALLOWED); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::BadGrammarError, SpeechRecognitionError::BAD_GRAMMAR); +COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::LanguageNotSupportedError, SpeechRecognitionError::LANGUAGE_NOT_SUPPORTED); +#endif + COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, ReferrerPolicyAlways); COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, ReferrerPolicyDefault); COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, ReferrerPolicyNever); @@ -570,3 +586,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyOrigin, ReferrerPolicyOrigin); COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeReportOnly, ContentSecurityPolicy::ReportOnly); COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeEnforcePolicy, ContentSecurityPolicy::EnforcePolicy); + +COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::Unknown, ResourceResponse::Unknown); +COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_0_9, ResourceResponse::HTTP_0_9); +COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_0, ResourceResponse::HTTP_1_0); +COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_1, ResourceResponse::HTTP_1_1); diff --git a/Source/WebKit/chromium/src/BlobRegistryProxy.cpp b/Source/WebKit/chromium/src/BlobRegistryProxy.cpp index 2bbc51f44..05fbb3638 100644 --- a/Source/WebKit/chromium/src/BlobRegistryProxy.cpp +++ b/Source/WebKit/chromium/src/BlobRegistryProxy.cpp @@ -38,10 +38,10 @@ #include "KURL.h" #include "ResourceHandle.h" #include "WebKit.h" -#include "platform/WebBlobData.h" -#include "platform/WebBlobRegistry.h" -#include "platform/WebKitPlatformSupport.h" #include "platform/WebURL.h" +#include <public/Platform.h> +#include <public/WebBlobData.h> +#include <public/WebBlobRegistry.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> @@ -58,7 +58,7 @@ BlobRegistry& blobRegistry() } BlobRegistryProxy::BlobRegistryProxy() - : m_webBlobRegistry(WebKit::webKitPlatformSupport()->blobRegistry()) + : m_webBlobRegistry(WebKit::Platform::current()->blobRegistry()) { } diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 8808e5d6a..70d565c2e 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -586,15 +586,6 @@ void ChromeClientImpl::contentsSizeChanged(Frame* frame, const IntSize& size) co void ChromeClientImpl::layoutUpdated(Frame* frame) const { -#if ENABLE(VIEWPORT) - if (!m_webView->isPageScaleFactorSet() && frame == frame->page()->mainFrame()) { - // If the page does not have a viewport tag, then compute a scale - // factor to make the page width fit the device width based on the - // default viewport parameters. - ViewportArguments viewport = frame->document()->viewportArguments(); - dispatchViewportPropertiesDidChange(viewport); - } -#endif m_webView->layoutUpdated(WebFrameImpl::fromFrame(frame)); } diff --git a/Source/WebKit/chromium/src/DeliveredIntentClientImpl.cpp b/Source/WebKit/chromium/src/DeliveredIntentClientImpl.cpp new file mode 100644 index 000000000..787efd464 --- /dev/null +++ b/Source/WebKit/chromium/src/DeliveredIntentClientImpl.cpp @@ -0,0 +1,60 @@ +/* + * 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: + * + * * 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 "DeliveredIntentClientImpl.h" + +#include "WebDeliveredIntentClient.h" +#include "platform/WebSerializedScriptValue.h" + +namespace WebKit { + +DeliveredIntentClientImpl::DeliveredIntentClientImpl(WebDeliveredIntentClient* client) + : m_client(client) +{ +} + +DeliveredIntentClientImpl::~DeliveredIntentClientImpl() +{ + m_client->destroy(); + m_client = 0; +} + +void DeliveredIntentClientImpl::postResult(PassRefPtr<WebCore::SerializedScriptValue> data) +{ + m_client->postResult(data); +} + +void DeliveredIntentClientImpl::postFailure(PassRefPtr<WebCore::SerializedScriptValue> data) +{ + m_client->postFailure(data); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h b/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h new file mode 100644 index 000000000..a94d39b7c --- /dev/null +++ b/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h @@ -0,0 +1,64 @@ +/* + * 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DeliveredIntentClientImpl_h +#define DeliveredIntentClientImpl_h + +#include "DeliveredIntent.h" +#include "SerializedScriptValue.h" +#include "platform/WebCommon.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebDeliveredIntentClient; +class WebSerializedScriptValue; + +// The embedder implements this interface to receive reply calls from the service +// in response to the delivery of a web intent. This client must remain valid +// until the destroy() method is called, or until the WebFrame to which it is +// delivered is destroyed. +// See spec at http://www.chromium.org/developers/design-documents/webintentsapi +class DeliveredIntentClientImpl : public WebCore::DeliveredIntentClient { + WTF_MAKE_NONCOPYABLE(DeliveredIntentClientImpl); +public: + explicit DeliveredIntentClientImpl(WebDeliveredIntentClient*); + virtual ~DeliveredIntentClientImpl(); + + virtual void postResult(PassRefPtr<WebCore::SerializedScriptValue> data); + virtual void postFailure(PassRefPtr<WebCore::SerializedScriptValue> data); + +private: + WebDeliveredIntentClient* m_client; +}; + +} // namespace WebKit + +#endif // DeliveredIntentClientImpl_h diff --git a/Source/WebKit/chromium/src/DragClientImpl.cpp b/Source/WebKit/chromium/src/DragClientImpl.cpp index afa570611..a6fb0bd33 100644 --- a/Source/WebKit/chromium/src/DragClientImpl.cpp +++ b/Source/WebKit/chromium/src/DragClientImpl.cpp @@ -87,10 +87,7 @@ void DragClientImpl::startDrag(DragImageRef dragImage, IntSize offsetSize(eventPos - dragImageOrigin); WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); - m_webView->startDragging( - dragData, static_cast<WebDragOperationsMask>(dragOperationMask), - dragImage ? WebImage(*dragImage) : WebImage(), - offsetPoint); + m_webView->startDragging(frame, dragData, static_cast<WebDragOperationsMask>(dragOperationMask), dragImage ? WebImage(*dragImage) : WebImage(), offsetPoint); } void DragClientImpl::dragControllerDestroyed() diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index 934281a29..8d4774dbe 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -39,6 +39,7 @@ #include "PlatformKeyboardEvent.h" #include "PlatformString.h" #include "RenderObject.h" +#include "Settings.h" #include "SpellChecker.h" #include "UndoStep.h" @@ -87,6 +88,21 @@ void EditorClientImpl::pageDestroyed() // Our lifetime is bound to the WebViewImpl. } +void EditorClientImpl::frameWillDetachPage(WebCore::Frame* frame) +{ + HashSet<WebTextCheckingCompletionImpl*> validRequests; + + for (HashSet<WebTextCheckingCompletionImpl*>::iterator i = m_pendingTextChecks.begin(); + i != m_pendingTextChecks.end(); ++i) { + if (frame->editor()->spellChecker() == (*i)->spellChecker()) + (*i)->invalidate(); + else + validRequests.add(*i); + } + + m_pendingTextChecks.swap(validRequests); +} + bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem) { // Normally, we don't care to show WebCore's deletion UI, so we only enable @@ -694,6 +710,12 @@ void EditorClientImpl::textDidChangeInTextArea(Element*) { } +bool EditorClientImpl::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const +{ + const Frame* frame = m_webView->focusedWebCoreFrame(); + return !frame || !frame->settings() || !frame->settings()->asynchronousSpellCheckingEnabled(); +} + void EditorClientImpl::ignoreWordInSpellDocument(const String&) { notImplemented(); @@ -731,8 +753,17 @@ void EditorClientImpl::checkSpellingOfString(const UChar* text, int length, void EditorClientImpl::requestCheckingOfString(SpellChecker* sender, const WebCore::TextCheckingRequest& request) { - if (m_webView->spellCheckClient()) - m_webView->spellCheckClient()->requestCheckingOfText(request.text(), new WebTextCheckingCompletionImpl(request.sequence(), sender)); + if (!m_webView->spellCheckClient()) + return; + + WebTextCheckingCompletionImpl* completion = new WebTextCheckingCompletionImpl(request.sequence(), sender, this); + m_pendingTextChecks.add(completion); + m_webView->spellCheckClient()->requestCheckingOfText(request.text(), completion); +} + +void EditorClientImpl::didCheckString(WebTextCheckingCompletionImpl* completion) +{ + m_pendingTextChecks.remove(completion); } String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index b167b6c2d..47e8c508f 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -35,6 +35,7 @@ #include "TextCheckerClient.h" #include "Timer.h" #include <wtf/Deque.h> +#include <wtf/HashSet.h> namespace WebCore { class Frame; @@ -44,6 +45,7 @@ class SpellChecker; namespace WebKit { class WebViewImpl; +class WebTextCheckingCompletionImpl; class EditorClientImpl : public WebCore::EditorClient, public WebCore::TextCheckerClient { public: @@ -51,6 +53,7 @@ public: virtual ~EditorClientImpl(); virtual void pageDestroyed(); + virtual void frameWillDetachPage(WebCore::Frame*) OVERRIDE; virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*); virtual bool smartInsertDeleteEnabled(); @@ -94,6 +97,7 @@ public: virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*); virtual void textWillBeDeletedInTextField(WebCore::Element*); virtual void textDidChangeInTextArea(WebCore::Element*); + virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const; virtual void ignoreWordInSpellDocument(const WTF::String&); virtual void learnWord(const WTF::String&); virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); @@ -113,6 +117,8 @@ public: virtual WebCore::TextCheckerClient* textChecker() { return this; } + void didCheckString(WebTextCheckingCompletionImpl*); + private: void modifySelection(WebCore::Frame*, WebCore::KeyboardEvent*); @@ -140,6 +146,8 @@ private: SpellCheckForcedOff }; int m_spellCheckThisFieldStatus; + + WTF::HashSet<WebTextCheckingCompletionImpl*> m_pendingTextChecks; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp index 60919a20c..3ef8cf8a2 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp +++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp @@ -34,38 +34,21 @@ #include "GraphicsContext3D.h" -#include "CachedImage.h" -#include "CanvasRenderingContext.h" -#include "Chrome.h" -#include "ChromeClientImpl.h" #include "DrawingBuffer.h" #include "Extensions3DChromium.h" +#include "GrContext.h" +#include "GrGLInterface.h" #include "GraphicsContext3DPrivate.h" -#include "HTMLCanvasElement.h" -#include "HTMLImageElement.h" #include "ImageBuffer.h" #include "ImageData.h" -#include "WebKit.h" -#include "WebViewClient.h" -#include "WebViewImpl.h" -#include "platform/WebGraphicsContext3D.h" -#include "platform/WebKitPlatformSupport.h" +#include <public/Platform.h> +#include <public/WebGraphicsContext3D.h> #include <stdio.h> #include <wtf/FastMalloc.h> #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> -#if USE(CG) -#include "GraphicsContext.h" -#include "WebGLRenderingContext.h" -#include <CoreGraphics/CGContext.h> -#include <CoreGraphics/CGImage.h> -#endif - -#if USE(SKIA) -#include "GrContext.h" -#include "GrGLInterface.h" -#endif namespace { @@ -100,24 +83,16 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphic , m_layerComposited(false) , m_preserveDrawingBuffer(preserveDrawingBuffer) , m_resourceSafety(ResourceSafetyUnknown) -#if USE(SKIA) , m_grContext(0) -#elif USE(CG) - , m_renderOutputSize(0) -#else -#error Must port to your platform -#endif { } GraphicsContext3DPrivate::~GraphicsContext3DPrivate() { -#if USE(SKIA) if (m_grContext) { m_grContext->contextDestroyed(); GrSafeUnref(m_grContext); } -#endif } PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::RenderStyle renderStyle, bool preserveDrawingBuffer) @@ -166,7 +141,6 @@ Platform3DObject GraphicsContext3DPrivate::platformTexture() const return m_impl->getPlatformTextureId(); } -#if USE(SKIA) class GrMemoryAllocationChangedCallback : public Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM { public: GrMemoryAllocationChangedCallback(GraphicsContext3DPrivate* context) @@ -205,7 +179,6 @@ GrContext* GraphicsContext3DPrivate::grContext() } return m_grContext; } -#endif void GraphicsContext3DPrivate::prepareTexture() { @@ -231,7 +204,7 @@ void GraphicsContext3DPrivate::paintFramebufferToCanvas(int framebuffer, int wid { unsigned char* pixels = 0; size_t bufferSize = 4 * width * height; -#if USE(SKIA) + const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap(); const SkBitmap* readbackBitmap = 0; ASSERT(canvasBitmap->config() == SkBitmap::kARGB_8888_Config); @@ -257,16 +230,6 @@ void GraphicsContext3DPrivate::paintFramebufferToCanvas(int framebuffer, int wid // Read back the frame buffer. SkAutoLockPixels bitmapLock(*readbackBitmap); pixels = static_cast<unsigned char*>(readbackBitmap->getPixels()); -#elif USE(CG) - if (!m_renderOutput || m_renderOutputSize != bufferSize) { - m_renderOutput = adoptArrayPtr(new unsigned char[bufferSize]); - m_renderOutputSize = bufferSize; - } - - pixels = m_renderOutput.get(); -#else -#error Must port to your platform -#endif m_impl->readBackFramebuffer(pixels, 4 * width * height, framebuffer, width, height); @@ -278,7 +241,6 @@ void GraphicsContext3DPrivate::paintFramebufferToCanvas(int framebuffer, int wid } } -#if USE(SKIA) readbackBitmap->notifyPixelsChanged(); if (m_resizingBitmap.readyToDraw()) { // We need to draw the resizing bitmap into the canvas's backing store. @@ -287,23 +249,17 @@ void GraphicsContext3DPrivate::paintFramebufferToCanvas(int framebuffer, int wid dst.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(canvasBitmap->width()), SkIntToScalar(canvasBitmap->height())); canvas.drawBitmapRect(m_resizingBitmap, 0, dst); } -#elif USE(CG) - GraphicsContext3D::paintToCanvas(pixels, width, height, imageBuffer->width(), imageBuffer->height(), imageBuffer->context()->platformContext()); -#else -#error Must port to your platform -#endif } -void GraphicsContext3DPrivate::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer* drawingBuffer) +void GraphicsContext3DPrivate::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer* drawingBuffer) { - ImageBuffer* imageBuffer = context->canvas()->buffer(); Platform3DObject framebufferId; int width, height; getDrawingParameters(drawingBuffer, m_impl.get(), &framebufferId, &width, &height); paintFramebufferToCanvas(framebufferId, width, height, !m_impl->getContextAttributes().premultipliedAlpha, imageBuffer); } -bool GraphicsContext3DPrivate::paintCompositedResultsToCanvas(CanvasRenderingContext* context) +bool GraphicsContext3DPrivate::paintCompositedResultsToCanvas(ImageBuffer*) { return false; } @@ -1043,7 +999,7 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri webAttributes.shareResources = attrs.shareResources; webAttributes.preferDiscreteGPU = attrs.preferDiscreteGPU; - OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes)); + OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::Platform::current()->createOffscreenGraphicsContext3D(webAttributes)); if (!webContext) return 0; @@ -1060,12 +1016,10 @@ Platform3DObject GraphicsContext3D::platformTexture() const return m_private->platformTexture(); } -#if USE(SKIA) GrContext* GraphicsContext3D::grContext() { return m_private->grContext(); } -#endif void GraphicsContext3D::prepareTexture() { @@ -1244,9 +1198,9 @@ bool GraphicsContext3D::layerComposited() const return m_private->layerComposited(); } -void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer* drawingBuffer) +void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer* drawingBuffer) { - return m_private->paintRenderingResultsToCanvas(context, drawingBuffer); + return m_private->paintRenderingResultsToCanvas(imageBuffer, drawingBuffer); } PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(DrawingBuffer* drawingBuffer) @@ -1254,7 +1208,7 @@ PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(Drawin return m_private->paintRenderingResultsToImageData(drawingBuffer); } -DELEGATE_TO_INTERNAL_1R(paintCompositedResultsToCanvas, CanvasRenderingContext*, bool) +DELEGATE_TO_INTERNAL_1R(paintCompositedResultsToCanvas, ImageBuffer*, bool) DELEGATE_TO_INTERNAL_R(createBuffer, Platform3DObject) DELEGATE_TO_INTERNAL_R(createFramebuffer, Platform3DObject) diff --git a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h index b79898971..a269192a4 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h +++ b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h @@ -28,16 +28,12 @@ #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" +#include "SkBitmap.h" #include <wtf/HashSet.h> #include <wtf/OwnArrayPtr.h> #include <wtf/OwnPtr.h> -#if USE(SKIA) -#include "SkBitmap.h" -#endif -#if USE(SKIA) class GrContext; -#endif namespace WebKit { class WebGraphicsContext3D; @@ -68,9 +64,7 @@ public: PlatformGraphicsContext3D platformGraphicsContext3D() const; Platform3DObject platformTexture() const; -#if USE(SKIA) GrContext* grContext(); -#endif bool makeContextCurrent(); @@ -82,10 +76,10 @@ public: bool layerComposited() const; void markLayerComposited(); - void paintRenderingResultsToCanvas(CanvasRenderingContext*, DrawingBuffer*); + void paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer*); void paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer*); PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*); - bool paintCompositedResultsToCanvas(CanvasRenderingContext*); + bool paintCompositedResultsToCanvas(ImageBuffer*); void prepareTexture(); @@ -324,6 +318,8 @@ public: private: GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphicsContext3D>, bool preserveDrawingBuffer); + void initializeExtensions(); + OwnPtr<WebKit::WebGraphicsContext3D> m_impl; OwnPtr<Extensions3DChromium> m_extensions; OwnPtr<GraphicsContextLostCallbackAdapter> m_contextLostCallbackAdapter; @@ -343,7 +339,6 @@ private: }; ResourceSafety m_resourceSafety; -#if USE(SKIA) // If the width and height of the Canvas's backing store don't // match those that we were given in the most recent call to // reshape(), then we need an intermediate bitmap to read back the @@ -352,14 +347,6 @@ private: SkBitmap m_resizingBitmap; GrContext* m_grContext; -#endif - -#if USE(CG) - OwnArrayPtr<unsigned char> m_renderOutput; - size_t m_renderOutputSize; -#endif - - void initializeExtensions(); }; } // namespace WebCore diff --git a/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp index 0014f2959..fc746aa6b 100644 --- a/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp @@ -60,11 +60,6 @@ String IDBIndexBackendProxy::name() return m_webIDBIndex->name(); } -String IDBIndexBackendProxy::storeName() -{ - return m_webIDBIndex->storeName(); -} - String IDBIndexBackendProxy::keyPath() { return m_webIDBIndex->keyPath().string(); diff --git a/Source/WebKit/chromium/src/IDBIndexBackendProxy.h b/Source/WebKit/chromium/src/IDBIndexBackendProxy.h index 42e0eabbe..d5cc8bbfe 100644 --- a/Source/WebKit/chromium/src/IDBIndexBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBIndexBackendProxy.h @@ -42,7 +42,6 @@ public: virtual ~IDBIndexBackendProxy(); virtual String name(); - virtual String storeName(); virtual String keyPath(); virtual bool unique(); virtual bool multiEntry(); diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index 21a5dd856..24f23a595 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -74,6 +74,11 @@ PassRefPtr<DOMStringList> IDBObjectStoreBackendProxy::indexNames() const return m_webIDBObjectStore->indexNames(); } +bool IDBObjectStoreBackendProxy::autoIncrement() const +{ + return m_webIDBObjectStore->autoIncrement(); +} + void IDBObjectStoreBackendProxy::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index 5e1189186..fb7781d60 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -45,6 +45,7 @@ public: virtual String name() const; virtual String keyPath() const; virtual PassRefPtr<WebCore::DOMStringList> indexNames() const; + virtual bool autoIncrement() const; virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void put(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 6d11d8a59..b1eecddac 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -39,6 +39,7 @@ namespace WebKit { NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint) : m_contentPaint(contentPaint) , m_showDebugBorders(false) + , m_deviceScaleFactor(1.0) { m_graphicsLayer = WebCore::GraphicsLayer::create(this); #ifndef NDEBUG @@ -92,7 +93,7 @@ static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::Layer layer->setAlwaysReserveTextures(true); } -void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX) +void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX) { if (!scrollLayer()) return; @@ -105,6 +106,8 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. scrollLayer()->setScrollable(true); + m_deviceScaleFactor = deviceScale; + m_graphicsLayer->deviceOrPageScaleFactorChanged(); m_graphicsLayer->setSize(contentsSize); m_layerAdjustX = layerAdjustX; @@ -119,9 +122,6 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, } else if (visibleRectChanged) m_graphicsLayer->setNeedsDisplay(); - if (m_graphicsLayer->pageScaleFactor() != pageScale) - m_graphicsLayer->deviceOrPageScaleFactorChanged(); - WebCore::LayerChromium* clipLayer = scrollLayer()->parent(); WebCore::LayerChromium* rootLayer = clipLayer; while (rootLayer->parent()) diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index be9f509a2..ace408af2 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -57,7 +57,7 @@ public: void invalidateRect(const WebCore::IntRect&); void setBackgroundColor(const WebCore::Color&); void setScrollLayer(WebCore::GraphicsLayer*); - void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX); + void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX); void protectVisibleTileTextures(); WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); } @@ -73,6 +73,11 @@ private: virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; + // The deviceScaleFactor given to the GraphicsLayer can be non-1 when the + // contents are scaled in the compositor instead of by the pageScaleFactor. + // However, the pageScaleFactor is always baked into the GraphicsLayer's + // size, so it is always 1 for the GraphicsLayer. + virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; } WebCore::LayerChromium* scrollLayer(); @@ -81,6 +86,7 @@ private: WebCore::IntSize m_viewportSize; int m_layerAdjustX; bool m_showDebugBorders; + float m_deviceScaleFactor; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 717455688..bbd07ca7c 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -48,7 +48,6 @@ #include "WebViewClient.h" #include "WebViewImpl.h" #include "WebWorkerClientImpl.h" -#include "WebWorkerRunLoop.h" #include "platform/WebAudioBus.h" #include "platform/WebCookie.h" #include "platform/WebCookieJar.h" @@ -61,10 +60,6 @@ #include "platform/WebURL.h" #include "platform/WebVector.h" -#if USE(CG) -#include <CoreGraphics/CGContext.h> -#endif - #if OS(WINDOWS) #include "platform/WebRect.h" #include "platform/win/WebThemeEngine.h" @@ -100,6 +95,7 @@ #include "WorkerContextProxy.h" #include <public/WebClipboard.h> #include <public/WebMimeRegistry.h> +#include <public/WebWorkerRunLoop.h> #include <wtf/Assertions.h> // We are part of the WebKit implementation. @@ -305,33 +301,33 @@ bool PlatformSupport::cookiesEnabled(const Document* document) bool PlatformSupport::fileExists(const String& path) { - return webKitPlatformSupport()->fileUtilities()->fileExists(path); + return WebKit::Platform::current()->fileUtilities()->fileExists(path); } bool PlatformSupport::deleteFile(const String& path) { - return webKitPlatformSupport()->fileUtilities()->deleteFile(path); + return WebKit::Platform::current()->fileUtilities()->deleteFile(path); } bool PlatformSupport::deleteEmptyDirectory(const String& path) { - return webKitPlatformSupport()->fileUtilities()->deleteEmptyDirectory(path); + return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path); } bool PlatformSupport::getFileSize(const String& path, long long& result) { - return webKitPlatformSupport()->fileUtilities()->getFileSize(path, result); + return WebKit::Platform::current()->fileUtilities()->getFileSize(path, result); } void PlatformSupport::revealFolderInOS(const String& path) { - webKitPlatformSupport()->fileUtilities()->revealFolderInOS(path); + WebKit::Platform::current()->fileUtilities()->revealFolderInOS(path); } bool PlatformSupport::getFileModificationTime(const String& path, time_t& result) { double modificationTime; - if (!webKitPlatformSupport()->fileUtilities()->getFileModificationTime(path, modificationTime)) + if (!WebKit::Platform::current()->fileUtilities()->getFileModificationTime(path, modificationTime)) return false; result = static_cast<time_t>(modificationTime); return true; @@ -339,62 +335,62 @@ bool PlatformSupport::getFileModificationTime(const String& path, time_t& result String PlatformSupport::directoryName(const String& path) { - return webKitPlatformSupport()->fileUtilities()->directoryName(path); + return WebKit::Platform::current()->fileUtilities()->directoryName(path); } String PlatformSupport::pathByAppendingComponent(const String& path, const String& component) { - return webKitPlatformSupport()->fileUtilities()->pathByAppendingComponent(path, component); + return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component); } bool PlatformSupport::makeAllDirectories(const String& path) { - return webKitPlatformSupport()->fileUtilities()->makeAllDirectories(path); + return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path); } String PlatformSupport::getAbsolutePath(const String& path) { - return webKitPlatformSupport()->fileUtilities()->getAbsolutePath(path); + return WebKit::Platform::current()->fileUtilities()->getAbsolutePath(path); } bool PlatformSupport::isDirectory(const String& path) { - return webKitPlatformSupport()->fileUtilities()->isDirectory(path); + return WebKit::Platform::current()->fileUtilities()->isDirectory(path); } KURL PlatformSupport::filePathToURL(const String& path) { - return webKitPlatformSupport()->fileUtilities()->filePathToURL(path); + return WebKit::Platform::current()->fileUtilities()->filePathToURL(path); } PlatformFileHandle PlatformSupport::openFile(const String& path, FileOpenMode mode) { - return webKitPlatformSupport()->fileUtilities()->openFile(path, mode); + return WebKit::Platform::current()->fileUtilities()->openFile(path, mode); } void PlatformSupport::closeFile(PlatformFileHandle& handle) { - webKitPlatformSupport()->fileUtilities()->closeFile(handle); + WebKit::Platform::current()->fileUtilities()->closeFile(handle); } long long PlatformSupport::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) { - return webKitPlatformSupport()->fileUtilities()->seekFile(handle, offset, origin); + return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin); } bool PlatformSupport::truncateFile(PlatformFileHandle handle, long long offset) { - return webKitPlatformSupport()->fileUtilities()->truncateFile(handle, offset); + return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset); } int PlatformSupport::readFromFile(PlatformFileHandle handle, char* data, int length) { - return webKitPlatformSupport()->fileUtilities()->readFromFile(handle, data, length); + return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length); } int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, int length) { - return webKitPlatformSupport()->fileUtilities()->writeToFile(handle, data, length); + return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length); } #if ENABLE(FILE_SYSTEM) @@ -830,11 +826,6 @@ LinkHash PlatformSupport::visitedLinkHash(const KURL& base, return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length()); } -bool PlatformSupport::isLinkVisited(LinkHash visitedLinkHash) -{ - return webKitPlatformSupport()->isLinkVisited(visitedLinkHash); -} - // These are temporary methods that the WebKit layer can use to call to the // Glue layer. Once the Glue layer moves entirely into the WebKit layer, these // methods will be deleted. @@ -915,12 +906,12 @@ bool PlatformSupport::popupsAllowed(NPP npp) #if ENABLE(WORKERS) void PlatformSupport::didStartWorkerRunLoop(WorkerRunLoop* loop) { - webKitPlatformSupport()->didStartWorkerRunLoop(WebWorkerRunLoop(loop)); + WebKit::Platform::current()->didStartWorkerRunLoop(WebWorkerRunLoop(loop)); } void PlatformSupport::didStopWorkerRunLoop(WorkerRunLoop* loop) { - webKitPlatformSupport()->didStopWorkerRunLoop(WebWorkerRunLoop(loop)); + WebKit::Platform::current()->didStopWorkerRunLoop(WebWorkerRunLoop(loop)); } WorkerContextProxy* WorkerContextProxy::create(Worker* worker) diff --git a/Source/WebKit/chromium/src/PrerendererClientImpl.cpp b/Source/WebKit/chromium/src/PrerendererClientImpl.cpp new file mode 100644 index 000000000..4651d279d --- /dev/null +++ b/Source/WebKit/chromium/src/PrerendererClientImpl.cpp @@ -0,0 +1,59 @@ +/* + * 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: + * + * * 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 "PrerendererClientImpl.h" + +#include "Document.h" +#include "Frame.h" +#include "Prerender.h" +#include "PrerenderHandle.h" +#include "WebPrerendererClient.h" +#include "WebViewImpl.h" +#include <public/WebPrerender.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +PrerendererClientImpl::PrerendererClientImpl(WebPrerendererClient* client) + : m_client(client) +{ +} + +void PrerendererClientImpl::willAddPrerender(WebCore::PrerenderHandle* prerenderHandle) +{ + if (!m_client) + return; + WebPrerender webPrerender(prerenderHandle->prerender()); + m_client->willAddPrerender(&webPrerender); +} + +} diff --git a/Source/WebKit/chromium/src/PrerendererClientImpl.h b/Source/WebKit/chromium/src/PrerendererClientImpl.h new file mode 100644 index 000000000..8517632ae --- /dev/null +++ b/Source/WebKit/chromium/src/PrerendererClientImpl.h @@ -0,0 +1,60 @@ +/* + * 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef PrerendererClientImpl_h +#define PrerendererClientImpl_h + +#include "PrerendererClient.h" +#include <wtf/Noncopyable.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { +class PrerenderHandle; +} + +namespace WebKit { + +class WebPrerendererClient; + +class PrerendererClientImpl : public WebCore::PrerendererClient { + WTF_MAKE_NONCOPYABLE(PrerendererClientImpl); +public: + explicit PrerendererClientImpl(WebPrerendererClient*); + + void willAddPrerender(WebCore::PrerenderHandle*) OVERRIDE; + +private: + WebPrerendererClient* m_client; +}; + +} + +#endif // PrerendererClientImpl_h diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp index 2754c415a..cd35b2620 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp @@ -26,11 +26,14 @@ #include "config.h" #include "SpeechRecognitionClientProxy.h" +#include "ScriptExecutionContext.h" +#include "SecurityOrigin.h" #include "SpeechGrammarList.h" #include "SpeechRecognition.h" #include "SpeechRecognitionError.h" #include "SpeechRecognitionResult.h" #include "SpeechRecognitionResultList.h" +#include "WebSecurityOrigin.h" #include "WebSpeechGrammar.h" #include "WebSpeechRecognitionHandle.h" #include "WebSpeechRecognitionParams.h" @@ -58,7 +61,8 @@ void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S for (unsigned long i = 0; i < grammarList->length(); ++i) webSpeechGrammars[i] = grammarList->item(i); - m_recognizer->start(WebSpeechRecognitionHandle(recognition), WebSpeechRecognitionParams(webSpeechGrammars, lang, continuous), this); + WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, WebSecurityOrigin(recognition->scriptExecutionContext()->securityOrigin())); + m_recognizer->start(WebSpeechRecognitionHandle(recognition), params, this); } void SpeechRecognitionClientProxy::stop(SpeechRecognition* recognition) @@ -136,7 +140,7 @@ void SpeechRecognitionClientProxy::didDeleteResult(const WebSpeechRecognitionHan recognition->didDeleteResult(resultIndex, SpeechRecognitionResultList::create(resultHistoryVector)); } -void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, unsigned short code) +void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, WebSpeechRecognizerClient::ErrorCode code) { RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); SpeechRecognitionError::Code errorCode = static_cast<SpeechRecognitionError::Code>(code); diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h index a35541ea4..0c3ecebaa 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h @@ -60,7 +60,7 @@ public: virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE; virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) OVERRIDE; virtual void didDeleteResult(const WebSpeechRecognitionHandle&, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE; - virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, unsigned short code) OVERRIDE; + virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, WebSpeechRecognizerClient::ErrorCode) OVERRIDE; virtual void didStart(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didEnd(const WebSpeechRecognitionHandle&) OVERRIDE; diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 00cc4433b..11eb7cec3 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -80,29 +80,42 @@ String StorageAreaProxy::getItem(const String& key, Frame* frame) const return String(); } -void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) +String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; + WebKit::WebString oldValue; if (!canAccessStorage(frame)) ec = QUOTA_EXCEEDED_ERR; else { - WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; - m_storageArea->setItem(key, value, frame->document()->url(), result); + m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue); ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; + String oldValueString = oldValue; + if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK) + storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame); } + return oldValue; } -void StorageAreaProxy::removeItem(const String& key, Frame* frame) +String StorageAreaProxy::removeItem(const String& key, Frame* frame) { if (!canAccessStorage(frame)) - return; - m_storageArea->removeItem(key, frame->document()->url()); + return String(); + WebKit::WebString oldValue; + m_storageArea->removeItem(key, frame->document()->url(), oldValue); + if (!oldValue.isNull()) + storageEvent(key, oldValue, String(), m_storageType, frame->document()->securityOrigin(), frame); + return oldValue; } -void StorageAreaProxy::clear(Frame* frame) +bool StorageAreaProxy::clear(Frame* frame) { if (!canAccessStorage(frame)) - return; - m_storageArea->clear(frame->document()->url()); + return false; + bool clearedSomething; + m_storageArea->clear(frame->document()->url(), clearedSomething); + if (clearedSomething) + storageEvent(String(), String(), String(), m_storageType, frame->document()->securityOrigin(), frame); + return clearedSomething; } bool StorageAreaProxy::contains(const String& key, Frame* frame) const @@ -110,6 +123,54 @@ bool StorageAreaProxy::contains(const String& key, Frame* frame) const return !getItem(key, frame).isNull(); } +// FIXME: remove this method and the calls to it from our setters after multi-side patch landing is done. +// Copied from WebCore/storage/StorageEventDispatcher.cpp out of necessity. It's probably best to keep it current. +void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame) +{ + Page* page = sourceFrame->page(); + if (!page) + return; + + // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree + // of any given page in the group or mutate the page group itself. + Vector<RefPtr<Frame> > frames; + if (storageType == SessionStorage) { + // Send events only to our page. + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) + frames.append(frame); + } + + for (unsigned i = 0; i < frames.size(); ++i) { + // FIXME: maybe only raise if the window has an onstorage listener + // attached to avoid creating the Storage instance. + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->sessionStorage(ec); + if (!ec) + frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } + } else { + // Send events to every page. + const HashSet<Page*>& pages = page->group().pages(); + HashSet<Page*>::const_iterator end = pages.end(); + for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { + for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) + frames.append(frame); + } + } + + for (unsigned i = 0; i < frames.size(); ++i) { + // FIXME: maybe only raise if the window has an onstorage listener + // attached to avoid creating the Storage instance. + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->localStorage(ec); + if (!ec) + frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } + } +} + bool StorageAreaProxy::canAccessStorage(Frame* frame) const { if (!frame->page()) @@ -119,10 +180,18 @@ bool StorageAreaProxy::canAccessStorage(Frame* frame) const return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); } -void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - const HashSet<Page*>& pages = pageGroup->pages(); + // FIXME: Multi-sided patch engineering alert ! + // step 1: this method gets defined and implemented in webkit/webcore with the early return. + // step 2: this method starts getting called by chromium still with the early return. + // step 3: This class's setters are modified to no longer raise SessionStorage + // events for inprocess changes and this early return is removed. + if (originatedInProcess) + return; + + const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalLocalStorage(), sourceAreaInstance)) { @@ -136,9 +205,9 @@ void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const Str } } -static Page* findPageWithSessionStorageNamespace(PageGroup* pageGroup, const WebKit::WebStorageNamespace& sessionNamespace) +static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, const WebKit::WebStorageNamespace& sessionNamespace) { - const HashSet<Page*>& pages = pageGroup->pages(); + const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { const bool createIfNeeded = true; StorageNamespaceProxy* proxy = static_cast<StorageNamespaceProxy*>((*it)->sessionStorage(createIfNeeded)); @@ -148,11 +217,19 @@ static Page* findPageWithSessionStorageNamespace(PageGroup* pageGroup, const Web return 0; } -void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchSessionStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - Page* page = findPageWithSessionStorageNamespace(pageGroup, sessionNamespace); + // FIXME: Multi-sided patch engineering alert ! + // step 1: this method gets defined and implemented in webkit/webcore with the early return. + // step 2: this method starts getting called by chromium still with the early return. + // step 3: This class's setters are modified to no longer raise SessionStorage + // events for inprocess changes and this early return is removed. + if (originatedInProcess) + return; + + Page* page = findPageWithSessionStorageNamespace(pageGroupName, sessionNamespace); if (!page) return; diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h index 83f2eae17..ab2357470 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.h +++ b/Source/WebKit/chromium/src/StorageAreaProxy.h @@ -38,7 +38,6 @@ namespace WebCore { class Frame; class KURL; class Page; -class PageGroup; class SecurityOrigin; class Storage; @@ -51,22 +50,23 @@ public: virtual unsigned length(Frame* sourceFrame) const; virtual String key(unsigned index, Frame* sourceFrame) const; virtual String getItem(const String& key, Frame* sourceFrame) const; - virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame); - virtual void removeItem(const String& key, Frame* sourceFrame); - virtual void clear(Frame* sourceFrame); + virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame); + virtual String removeItem(const String& key, Frame* sourceFrame); + virtual bool clear(Frame* sourceFrame); virtual bool contains(const String& key, Frame* sourceFrame) const; virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; } static void dispatchLocalStorageEvent( - PageGroup*, const String& key, const String& oldValue, const String& newValue, + const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); static void dispatchSessionStorageEvent( - PageGroup*, const String& key, const String& oldValue, const String& newValue, + const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); private: + void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame); bool canAccessStorage(Frame*) const; static bool isEventSource(Storage*, WebKit::WebStorageArea* sourceAreaInstance); diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp new file mode 100644 index 000000000..e948b597c --- /dev/null +++ b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp @@ -0,0 +1,83 @@ +/* + * 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 "StorageEventDispatcherImpl.h" + +#include "DOMWindow.h" +#include "Document.h" +#include "EventNames.h" +#include "Frame.h" +#include "KURL.h" +#include "Page.h" +#include "PageGroup.h" +#include "SecurityOrigin.h" +#include "StorageEvent.h" + +// FIXME: delete this almost obsolete file soon + +namespace WebCore { + +StorageEventDispatcherImpl::StorageEventDispatcherImpl(const String& groupName) + : m_pageGroup(PageGroup::pageGroup(groupName)) +{ + ASSERT(m_pageGroup); +} + +void StorageEventDispatcherImpl::dispatchStorageEvent(const String& key, const String& oldValue, + const String& newValue, SecurityOrigin* securityOrigin, + const KURL& url, StorageType storageType) +{ + // FIXME: Implement + if (storageType == SessionStorage) + return; + + // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree + // of any given page in the group or mutate the page group itself. + Vector<RefPtr<Frame> > frames; + + const HashSet<Page*>& pages = m_pageGroup->pages(); + HashSet<Page*>::const_iterator end = pages.end(); + for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { + for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (frame->document()->securityOrigin()->equal(securityOrigin)) + frames.append(frame); + } + } + + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->localStorage(ec); + if (!ec) + frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, storage)); + } +} + +} // namespace WebCore diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h new file mode 100644 index 000000000..d3433851f --- /dev/null +++ b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#ifndef StorageEventDispatcherImpl_h +#define StorageEventDispatcherImpl_h + +#include "PlatformString.h" +#include "StorageArea.h" + +namespace WebCore { + +class KURL; +class PageGroup; +class SecurityOrigin; + +class StorageEventDispatcherImpl { +public: + StorageEventDispatcherImpl(const String& groupName); + + void dispatchStorageEvent(const String& key, const String& oldValue, + const String& newValue, SecurityOrigin*, + const KURL&, StorageType); + +private: + PageGroup* m_pageGroup; +}; + +} // namespace WebCore + +#endif // StorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebBlobData.cpp b/Source/WebKit/chromium/src/WebBlobData.cpp index c1f4ff1b8..c767d1bdd 100644 --- a/Source/WebKit/chromium/src/WebBlobData.cpp +++ b/Source/WebKit/chromium/src/WebBlobData.cpp @@ -29,9 +29,9 @@ */ #include "config.h" -#include "platform/WebBlobData.h" #include "BlobData.h" +#include <public/WebBlobData.h> #include <wtf/PassOwnPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebContentLayer.cpp b/Source/WebKit/chromium/src/WebContentLayer.cpp index 5290e2f35..2c041c2cb 100644 --- a/Source/WebKit/chromium/src/WebContentLayer.cpp +++ b/Source/WebKit/chromium/src/WebContentLayer.cpp @@ -24,11 +24,13 @@ */ #include "config.h" -#include "platform/WebContentLayer.h" +#include <public/WebContentLayer.h> -#include "platform/WebFloatRect.h" +#include "ContentLayerChromium.h" #include "WebContentLayerImpl.h" +using namespace WebCore; + namespace WebKit { WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient) @@ -36,30 +38,35 @@ WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient) return WebContentLayer(WebContentLayerImpl::create(contentClient)); } -void WebContentLayer::setDrawsContent(bool drawsContent) +void WebContentLayer::clearClient() +{ + unwrap<ContentLayerChromium>()->clearDelegate(); +} + +void WebContentLayer::setDoubleSided(bool doubleSided) { - unwrap<WebContentLayerImpl>()->setDrawsContent(drawsContent); + m_private->setDoubleSided(doubleSided); } -bool WebContentLayer::drawsContent() const +void WebContentLayer::setContentsScale(float scale) { - return constUnwrap<WebContentLayerImpl>()->drawsContent(); + m_private->setContentsScale(scale); } -WebContentLayer::WebContentLayer(const PassRefPtr<WebContentLayerImpl>& node) +WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node) : WebLayer(node) { } -WebContentLayer& WebContentLayer::operator=(const PassRefPtr<WebContentLayerImpl>& node) +WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node) { m_private = node; return *this; } -WebContentLayer::operator PassRefPtr<WebContentLayerImpl>() const +WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const { - return static_cast<WebContentLayerImpl*>(m_private.get()); + return static_cast<ContentLayerChromium*>(m_private.get()); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index 4d476095d..222fa2fa7 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -53,11 +53,6 @@ WebContentLayerImpl::~WebContentLayerImpl() clearDelegate(); } -void WebContentLayerImpl::setDrawsContent(bool drawsContent) -{ - setIsDrawable(drawsContent); -} - void WebContentLayerImpl::paintContents(GraphicsContext& gc, const IntRect& clip) { if (!m_contentClient) diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index 51f344f7c..a06cf9082 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -36,8 +36,6 @@ class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore public: static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient); - void setDrawsContent(bool); - protected: explicit WebContentLayerImpl(WebContentLayerClient* contentClient); virtual ~WebContentLayerImpl(); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 6cccb9316..1464f929e 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -78,6 +78,9 @@ #include "Console.h" #include "DOMUtilitiesPrivate.h" #include "DOMWindow.h" +#include "DOMWindowIntents.h" +#include "DeliveredIntent.h" +#include "DeliveredIntentClientImpl.h" #include "Document.h" #include "DocumentLoader.h" #include "DocumentMarker.h" @@ -130,6 +133,7 @@ #include "ScrollbarTheme.h" #include "SecurityPolicy.h" #include "Settings.h" +#include "ShadowRoot.h" #include "SkiaUtils.h" #include "SpellChecker.h" #include "SubstituteData.h" @@ -141,6 +145,7 @@ #include "WebDOMEvent.h" #include "WebDOMEventListener.h" #include "WebDataSourceImpl.h" +#include "WebDeliveredIntentClient.h" #include "WebDevToolsAgentPrivate.h" #include "WebDocument.h" #include "WebFindOptions.h" @@ -149,10 +154,12 @@ #include "WebHistoryItem.h" #include "WebIconURL.h" #include "WebInputElement.h" +#include "WebIntent.h" #include "WebNode.h" #include "WebPerformance.h" #include "WebPlugin.h" #include "WebPluginContainerImpl.h" +#include "WebPrintParams.h" #include "WebRange.h" #include "WebScriptSource.h" #include "WebSecurityOrigin.h" @@ -162,6 +169,7 @@ #include "painting/GraphicsContextBuilder.h" #include "platform/WebPoint.h" #include "platform/WebRect.h" +#include "platform/WebSerializedScriptValue.h" #include "platform/WebSize.h" #include "platform/WebURLError.h" #include "platform/WebVector.h" @@ -169,6 +177,7 @@ #include <algorithm> #include <public/Platform.h> #include <wtf/CurrentTime.h> +#include <wtf/HashMap.h> #if USE(V8) #include "AsyncFileSystem.h" @@ -443,8 +452,8 @@ private: // want to delegate all printing related calls to the plugin. class ChromePluginPrintContext : public ChromePrintContext { public: - ChromePluginPrintContext(Frame* frame, WebPluginContainerImpl* plugin, int printerDPI) - : ChromePrintContext(frame), m_plugin(plugin), m_pageCount(0), m_printerDPI(printerDPI) + ChromePluginPrintContext(Frame* frame, WebPluginContainerImpl* plugin, const WebPrintParams& printParams) + : ChromePrintContext(frame), m_plugin(plugin), m_pageCount(0), m_printParams(printParams) { } @@ -467,7 +476,8 @@ public: virtual void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight) { - m_pageCount = m_plugin->printBegin(IntRect(printRect), m_printerDPI); + m_printParams.printContentArea = IntRect(printRect); + m_pageCount = m_plugin->printBegin(m_printParams); } virtual int pageCount() const @@ -493,7 +503,9 @@ private: // Set when printing. WebPluginContainerImpl* m_plugin; int m_pageCount; - int m_printerDPI; + WebPrintParams m_printParams; + WebPrintScalingOption m_printScalingOption; + }; static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader) @@ -501,7 +513,6 @@ static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader) return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : 0; } - // WebFrame ------------------------------------------------------------------- class WebFrameImpl::DeferredScopeStringMatches { @@ -1438,9 +1449,23 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin return node->renderer()->positionForPoint(result.localPoint()); } -int WebFrameImpl::printBegin(const WebSize& pageSize, +// TODO(kmadhusu@chromium.org): Remove this function after fixing +// crbug.com/85132. For more information, please refer to the comments in +// WebFrame.h +int WebFrameImpl::printBegin(const WebSize& printContentSize, const WebNode& constrainToNode, int printerDPI, + bool* useBrowserOverlays) { + WebRect printableArea(0, 0, printContentSize.width, printContentSize.height); + WebSize paperSize(printContentSize); + WebRect printContentArea(0, 0, printContentSize.width, printContentSize.height); + WebPrintParams printParams(printContentArea, printableArea, paperSize, + printerDPI, WebPrintScalingOptionSourceSize); + return printBegin(printParams, constrainToNode, useBrowserOverlays); +} + +int WebFrameImpl::printBegin(const WebPrintParams& printParams, + const WebNode& constrainToNode, bool* useBrowserOverlays) { ASSERT(!frame()->document()->isFrameSet()); @@ -1455,12 +1480,12 @@ int WebFrameImpl::printBegin(const WebSize& pageSize, } if (pluginContainer && pluginContainer->supportsPaginatedPrint()) - m_printContext = adoptPtr(new ChromePluginPrintContext(frame(), pluginContainer, printerDPI)); + m_printContext = adoptPtr(new ChromePluginPrintContext(frame(), pluginContainer, printParams)); else m_printContext = adoptPtr(new ChromePrintContext(frame())); - FloatRect rect(0, 0, static_cast<float>(pageSize.width), - static_cast<float>(pageSize.height)); + FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), + static_cast<float>(printParams.printContentArea.height)); m_printContext->begin(rect.width(), rect.height()); float pageHeight; // We ignore the overlays calculation for now since they are generated in the @@ -1765,7 +1790,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, // text nodes. searchRange->setStart(resultRange->endContainer(ec), resultRange->endOffset(ec), ec); - Node* shadowTreeRoot = searchRange->shadowTreeRootNode(); + Node* shadowTreeRoot = searchRange->shadowRoot(); if (searchRange->collapsed(ec) && shadowTreeRoot) searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), ec); @@ -1851,14 +1876,6 @@ void WebFrameImpl::resetMatchCount() m_framesScopingCount = 0; } -void WebFrameImpl::handleIntentResult(int intentIdentifier, const WebString& reply) -{ -} - -void WebFrameImpl::handleIntentFailure(int intentIdentifier, const WebString& reply) -{ -} - void WebFrameImpl::sendOrientationChangeEvent(int orientation) { #if ENABLE(ORIENTATION_EVENTS) @@ -1899,6 +1916,20 @@ void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); } +void WebFrameImpl::deliverIntent(const WebIntent& intent, WebDeliveredIntentClient* intentClient) +{ +#if ENABLE(WEB_INTENTS) + OwnPtr<WebCore::DeliveredIntentClient> client(adoptPtr(new DeliveredIntentClientImpl(intentClient))); + + OwnPtr<MessagePortArray> ports; + WebSerializedScriptValue intentData = WebSerializedScriptValue::fromString(intent.data()); + const WebCore::Intent* webcoreIntent = intent; + RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, ports.release(), webcoreIntent->extras()); + + DOMWindowIntents::from(m_frame->domWindow())->deliver(deliveredIntent.release()); +#endif +} + WebString WebFrameImpl::contentAsText(size_t maxChars) const { if (!m_frame) diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 389946d05..5061cfadf 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -55,12 +55,15 @@ struct WindowFeatures; namespace WebKit { class ChromePrintContext; class WebDataSourceImpl; +class WebDeliveredIntentClient; class WebInputElement; +class WebIntent; class WebFrameClient; class WebPerformance; class WebPluginContainerImpl; class WebView; class WebViewImpl; +struct WebPrintParams; template <typename T> class WebVector; @@ -175,10 +178,15 @@ public: virtual bool selectWordAroundCaret(); virtual void selectRange(const WebPoint& start, const WebPoint& end); virtual void selectRange(const WebRange&); - virtual int printBegin(const WebSize& pageSize, + // FIXME: Remove this function after fixing crbug.com/85132. For detailed + // information, please refer to the comments in WebFrame.h + virtual int printBegin(const WebSize& printContentSize, const WebNode& constrainToNode, int printerDPI, bool* useBrowserOverlays); + virtual int printBegin(const WebPrintParams&, + const WebNode& constrainToNode, + bool* useBrowserOverlays); virtual float printPage(int pageToPrint, WebCanvas*); virtual float getPrintPageShrink(int page); virtual void printEnd(); @@ -204,9 +212,6 @@ public: virtual void increaseMatchCount(int count, int identifier); virtual void resetMatchCount(); - virtual void handleIntentResult(int, const WebString&); - virtual void handleIntentFailure(int, const WebString&); - virtual void sendOrientationChangeEvent(int orientation); virtual void addEventListener(const WebString& eventType, @@ -218,6 +223,8 @@ public: const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent&); + virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*); + virtual WebString contentAsText(size_t maxChars) const; virtual WebString contentAsMarkup() const; virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const; diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp index 170939567..752a86263 100644 --- a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp @@ -53,11 +53,6 @@ WebString WebIDBIndexImpl::name() const return m_backend->name(); } -WebString WebIDBIndexImpl::storeName() const -{ - return m_backend->storeName(); -} - WebIDBKeyPath WebIDBIndexImpl::keyPath() const { return WebIDBKeyPath(m_backend->keyPath()); diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.h b/Source/WebKit/chromium/src/WebIDBIndexImpl.h index d8b1129d0..90d836669 100644 --- a/Source/WebKit/chromium/src/WebIDBIndexImpl.h +++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.h @@ -44,7 +44,6 @@ public: virtual ~WebIDBIndexImpl(); virtual WebString name() const; - virtual WebString storeName() const; virtual WebIDBKeyPath keyPath() const; // FIXME: Remove this method once callers are updated. // http://webkit.org/b/84207 diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 624a4e5b3..5ec35df0f 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -74,6 +74,11 @@ WebDOMStringList WebIDBObjectStoreImpl::indexNames() const return m_objectStore->indexNames(); } +bool WebIDBObjectStoreImpl::autoIncrement() const +{ + return m_objectStore->autoIncrement(); +} + void WebIDBObjectStoreImpl::get(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { m_objectStore->get(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index ee3b222ac..96ff6ee28 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -51,6 +51,7 @@ public: // http://webkit.org/b/84207 WebString keyPathString() const; WebDOMStringList indexNames() const; + bool autoIncrement() const; void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index c0037a0ef..adae9dac8 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -98,6 +98,16 @@ WebString WebInputElement::value() const return constUnwrap<HTMLInputElement>()->value(); } +WebString WebInputElement::editingValue() const +{ + return constUnwrap<HTMLInputElement>()->innerTextValue(); +} + +void WebInputElement::setEditingValue(const WebString& value) +{ + unwrap<HTMLInputElement>()->setEditingValue(value); +} + void WebInputElement::setSuggestedValue(const WebString& value) { unwrap<HTMLInputElement>()->setSuggestedValue(value); diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp index d204dfac2..e61b4ac65 100644 --- a/Source/WebKit/chromium/src/WebInputEvent.cpp +++ b/Source/WebKit/chromium/src/WebInputEvent.cpp @@ -60,7 +60,7 @@ class SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent { }; class SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent { - int gestureData[8]; + int gestureData[6]; }; class SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent { diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index b4055a91e..a45cae102 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -128,6 +128,9 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo m_phase = static_cast<WebCore::PlatformWheelEventPhase>(e.phase); m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(e.momentumPhase); m_timestamp = e.timeStampSeconds; + m_scrollCount = 0; + m_unacceleratedScrollingDeltaX = e.deltaX; + m_unacceleratedScrollingDeltaY = e.deltaY; #endif } @@ -148,6 +151,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureTap: m_type = PlatformEvent::GestureTap; + m_area = IntSize(e.deltaX * 2, e.deltaY * 2); break; case WebInputEvent::GestureTapDown: m_type = PlatformEvent::GestureTapDown; @@ -174,8 +178,6 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W m_globalPosition = IntPoint(e.globalX, e.globalY); m_deltaX = e.deltaX; m_deltaY = e.deltaY; - m_gammaX = e.gammaX; - m_gammaY = e.gammaY; m_timestamp = e.timeStampSeconds; m_modifiers = 0; diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp index ce4e15bd6..67723bf93 100644 --- a/Source/WebKit/chromium/src/WebIntent.cpp +++ b/Source/WebKit/chromium/src/WebIntent.cpp @@ -32,12 +32,26 @@ #include "WebIntent.h" #include "Intent.h" +#include "MessagePort.h" #include "PlatformMessagePortChannel.h" #include "SerializedScriptValue.h" #include <wtf/HashMap.h> namespace WebKit { +WebIntent::WebIntent(const WebString& action, const WebString& type, const WebString& data) +{ +#if ENABLE(WEB_INTENTS) + WebCore::ExceptionCode ec = 0; + WebCore::MessagePortArray ports; + RefPtr<WebCore::Intent> intent = WebCore::Intent::create(action, type, WebCore::SerializedScriptValue::createFromWire(data), ports, ec); + if (ec) + return; + + m_private = intent.release(); +#endif +} + #if ENABLE(WEB_INTENTS) WebIntent::WebIntent(const PassRefPtr<WebCore::Intent>& intent) : m_private(intent) @@ -130,6 +144,11 @@ WebMessagePortChannelArray* WebIntent::messagePortChannelsRelease() const return webChannels; } +WebIntent::operator WebCore::Intent*() const +{ + return m_private.get(); +} + WebVector<WebString> WebIntent::extrasNames() const { #if ENABLE(WEB_INTENTS) diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp index da54cca50..ee999a916 100644 --- a/Source/WebKit/chromium/src/WebKit.cpp +++ b/Source/WebKit/chromium/src/WebKit.cpp @@ -46,6 +46,7 @@ #include "platform/WebThread.h" #include "v8.h" #include <public/Platform.h> +#include <public/WebPrerenderingSupport.h> #include <wtf/Assertions.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> @@ -163,6 +164,7 @@ void shutdown() #endif s_webKitPlatformSupport = 0; Platform::shutdown(); + WebPrerenderingSupport::shutdown(); } WebKitPlatformSupport* webKitPlatformSupport() diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index ecf7452fc..3e6db47f5 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -35,6 +35,7 @@ #include <public/WebFloatPoint.h> #include <public/WebFloatRect.h> #include <public/WebSize.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; @@ -228,6 +229,11 @@ void WebLayer::setSublayerTransform(const SkMatrix44& matrix) m_private->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); } +void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix) +{ + m_private->setSublayerTransform(matrix.toWebCoreTransform()); +} + SkMatrix44 WebLayer::sublayerTransform() const { return skMatrix44FromTransformationMatrix(m_private->sublayerTransform()); @@ -238,19 +244,34 @@ void WebLayer::setTransform(const SkMatrix44& matrix) m_private->setTransform(transformationMatrixFromSkMatrix44(matrix)); } +void WebLayer::setTransform(const WebTransformationMatrix& matrix) +{ + m_private->setTransform(matrix.toWebCoreTransform()); +} + SkMatrix44 WebLayer::transform() const { return skMatrix44FromTransformationMatrix(m_private->transform()); } -void WebLayer::setDebugBorderColor(const WebColor& color) +void WebLayer::setDrawsContent(bool drawsContent) { - m_private->setDebugBorderColor(color); + m_private->setIsDrawable(drawsContent); } -void WebLayer::setDebugBorderWidth(float width) +bool WebLayer::drawsContent() const { - m_private->setDebugBorderWidth(width); + return m_private->drawsContent(); +} + +void WebLayer::setPreserves3D(bool preserve3D) +{ + m_private->setPreserves3D(preserve3D); +} + +void WebLayer::setBackgroundColor(WebColor color) +{ + m_private->setBackgroundColor(color); } void WebLayer::setFilters(const WebFilterOperations& filters) @@ -263,6 +284,16 @@ void WebLayer::setBackgroundFilters(const WebFilterOperations& filters) m_private->setBackgroundFilters(filters.toFilterOperations()); } +void WebLayer::setDebugBorderColor(const WebColor& color) +{ + m_private->setDebugBorderColor(color); +} + +void WebLayer::setDebugBorderWidth(float width) +{ + m_private->setDebugBorderWidth(width); +} + 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 6c18f6742..a4d7d918a 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -43,10 +43,14 @@ WebLayerTreeView::Settings::operator CCSettings() const settings.acceleratePainting = acceleratePainting; settings.showFPSCounter = showFPSCounter; settings.showPlatformLayerTree = showPlatformLayerTree; + settings.showPaintRects = showPaintRects; settings.refreshRate = refreshRate; settings.perTilePainting = perTilePainting; settings.partialSwapEnabled = partialSwapEnabled; settings.threadedAnimationEnabled = threadedAnimationEnabled; + settings.defaultTileSize = defaultTileSize; + settings.maxUntiledLayerSize = maxUntiledLayerSize; + settings.deviceScaleFactor = deviceScaleFactor; // FIXME: showFPSCounter / showPlatformLayerTree / maxPartialTextureUpdates aren't supported currently. return settings; diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 8ba03f04a..950068d2f 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -340,11 +340,10 @@ void WebMediaPlayerClientImpl::pause() } #if USE(NATIVE_FULLSCREEN_VIDEO) -bool WebMediaPlayerClientImpl::enterFullscreen() const +void WebMediaPlayerClientImpl::enterFullscreen() { if (m_webMediaPlayer) - return m_webMediaPlayer->enterFullscreen(); - return false; + m_webMediaPlayer->enterFullscreen(); } void WebMediaPlayerClientImpl::exitFullscreen() @@ -352,6 +351,11 @@ void WebMediaPlayerClientImpl::exitFullscreen() if (m_webMediaPlayer) m_webMediaPlayer->exitFullscreen(); } + +bool WebMediaPlayerClientImpl::canEnterFullscreen() const +{ + return m_webMediaPlayer && m_webMediaPlayer->canEnterFullscreen(); +} #endif #if ENABLE(MEDIA_SOURCE) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 3afb1f5e5..e06d3e523 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -135,8 +135,9 @@ public: virtual unsigned audioDecodedByteCount() const; virtual unsigned videoDecodedByteCount() const; #if USE(NATIVE_FULLSCREEN_VIDEO) - virtual bool enterFullscreen() const; + virtual void enterFullscreen(); virtual void exitFullscreen(); + virtual bool canEnterFullscreen() const; #endif #if ENABLE(WEB_AUDIO) diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 6ee01efdd..400aabb00 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -72,6 +72,7 @@ #include "ScrollView.h" #include "ScrollbarTheme.h" #include "UserGestureIndicator.h" +#include "WebPrintParams.h" #include "WheelEvent.h" #include <public/Platform.h> #include <public/WebClipboard.h> @@ -233,6 +234,14 @@ void WebPluginContainerImpl::setParent(ScrollView* view) reportGeometry(); } +void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) +{ + if (plugin != m_webPlugin) { + m_element->resetInstance(); + m_webPlugin = plugin; + } +} + bool WebPluginContainerImpl::supportsPaginatedPrint() const { return m_webPlugin->supportsPaginatedPrint(); @@ -243,10 +252,12 @@ bool WebPluginContainerImpl::isPrintScalingDisabled() const return m_webPlugin->isPrintScalingDisabled(); } -int WebPluginContainerImpl::printBegin(const IntRect& printableArea, - int printerDPI) const +int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const { - return m_webPlugin->printBegin(printableArea, printerDPI); + return m_webPlugin->printBegin(printParams.printContentArea, printParams.printerDPI); + // FIXME: After committing this CL, update the chrome plugin printBegin() + // function to use the overloaded printBegin function. + // return m_webPlugin->printBegin(printParams); } bool WebPluginContainerImpl::printPage(int pageNumber, diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 04878455c..415cc544b 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -61,6 +61,8 @@ class PlatformGestureEvent; namespace WebKit { +struct WebPrintParams; + class ScrollbarGroup; class WebPlugin; class WebPluginLoadObserver; @@ -110,7 +112,7 @@ public: // This cannot be null. WebPlugin* plugin() { return m_webPlugin; } - void setPlugin(WebPlugin* plugin) { m_webPlugin = plugin; } + void setPlugin(WebPlugin*); // Printing interface. The plugin can support custom printing // (which means it controls the layout, number of pages etc). @@ -120,10 +122,8 @@ public: // If the plugin content should not be scaled to the printable area of // the page, then this method should return true. bool isPrintScalingDisabled() const; - // Sets up printing at the given print rect and printer DPI. printableArea - // is in points (a point is 1/72 of an inch).Returns the number of pages to - // be printed at these settings. - int printBegin(const WebCore::IntRect& printableArea, int printerDPI) const; + // Sets up printing at the specified WebPrintParams. Returns the number of pages to be printed at these settings. + int printBegin(const WebPrintParams&) const; // Prints the page specified by pageNumber (0-based index) into the supplied canvas. bool printPage(int pageNumber, WebCore::GraphicsContext* gc); // Ends the print operation. diff --git a/Source/WebKit/chromium/src/WebRange.cpp b/Source/WebKit/chromium/src/WebRange.cpp index be24dd793..85df0a3ba 100644 --- a/Source/WebKit/chromium/src/WebRange.cpp +++ b/Source/WebKit/chromium/src/WebRange.cpp @@ -32,9 +32,11 @@ #include "WebRange.h" #include "Document.h" +#include "Element.h" #include "Frame.h" #include "FrameView.h" #include "Range.h" +#include "ShadowRoot.h" #include "TextIterator.h" #include "WebFrameImpl.h" #include "WebNode.h" @@ -97,7 +99,7 @@ WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length) { WebCore::Frame* webFrame = static_cast<WebFrameImpl*>(frame)->frame(); Element* selectionRoot = webFrame->selection()->rootEditableElement(); - Element* scope = selectionRoot ? selectionRoot : webFrame->document()->documentElement(); + ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()->documentElement(); return TextIterator::rangeFromLocationAndLength(scope, start, length); } diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 190981988..a9b729df6 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -49,7 +49,11 @@ WebSettingsImpl::WebSettingsImpl(Settings* settings) : m_settings(settings) , m_showFPSCounter(false) , m_showPlatformLayerTree(false) + , m_showPaintRects(false) , m_viewportEnabled(false) + , m_applyDefaultDeviceScaleFactorInCompositor(false) + , m_defaultTileSize(WebSize(256, 256)) + , m_maxUntiledLayerSize(WebSize(512, 512)) { ASSERT(settings); } @@ -114,6 +118,11 @@ void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor) m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor); } +void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor) +{ + m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor; +} + void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding) { m_settings->setDefaultTextEncodingName((String)encoding); @@ -333,6 +342,11 @@ void WebSettingsImpl::setShowPlatformLayerTree(bool show) m_showPlatformLayerTree = show; } +void WebSettingsImpl::setShowPaintRects(bool show) +{ + m_showPaintRects = show; +} + void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior) { m_settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(behavior)); @@ -567,4 +581,14 @@ void WebSettingsImpl::setViewportEnabled(bool enabled) m_viewportEnabled = enabled; } +void WebSettingsImpl::setDefaultTileSize(WebSize size) +{ + m_defaultTileSize = size; +} + +void WebSettingsImpl::setMaxUntiledLayerSize(WebSize size) +{ + m_maxUntiledLayerSize = size; +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 3ea9dce38..ebea771fe 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -55,6 +55,7 @@ public: virtual void setMinimumFontSize(int); virtual void setMinimumLogicalFontSize(int); virtual void setDefaultDeviceScaleFactor(int); + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); virtual void setDefaultTextEncodingName(const WebString&); virtual void setJavaScriptEnabled(bool); virtual void setWebSecurityEnabled(bool); @@ -96,9 +97,10 @@ public: virtual void setWebGLErrorsToConsoleEnabled(bool); virtual void setShowDebugBorders(bool); virtual void setShowFPSCounter(bool); - virtual bool showFPSCounter() const { return m_showFPSCounter; } virtual void setShowPlatformLayerTree(bool); - virtual bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } + virtual void setShowPaintRects(bool); + virtual void setDefaultTileSize(WebSize); + virtual void setMaxUntiledLayerSize(WebSize); virtual void setEditingBehavior(EditingBehavior); virtual void setAcceleratedCompositingEnabled(bool); virtual void setForceCompositingMode(bool); @@ -142,11 +144,22 @@ public: virtual void setViewportEnabled(bool); virtual bool viewportEnabled() const { return m_viewportEnabled; } + bool showFPSCounter() const { return m_showFPSCounter; } + bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } + bool showPaintRects() const { return m_showPaintRects; } + 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_showFPSCounter; bool m_showPlatformLayerTree; + bool m_showPaintRects; bool m_viewportEnabled; + bool m_applyDefaultDeviceScaleFactorInCompositor; + WebSize m_defaultTileSize; + WebSize m_maxUntiledLayerSize; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp index cd77cb46b..c8036aa74 100644 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp +++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp @@ -29,20 +29,19 @@ */ #include "config.h" -#include "WebStorageEventDispatcher.h" +#include "WebStorageEventDispatcherImpl.h" #include "KURL.h" #include "SecurityOrigin.h" #include "StorageAreaProxy.h" -#include "WebViewImpl.h" #include "platform/WebURL.h" #include <wtf/PassOwnPtr.h> -// FIXME: move this file to WebStorageEventDispatcher.cpp - namespace WebKit { +extern const char* pageGroupName; + void WebStorageEventDispatcher::dispatchLocalStorageEvent( const WebString& key, const WebString& oldValue, const WebString& newValue, const WebURL& origin, @@ -51,7 +50,7 @@ void WebStorageEventDispatcher::dispatchLocalStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchLocalStorageEvent( - WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, + pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, sourceAreaInstance, originatedInProcess); } @@ -63,8 +62,31 @@ void WebStorageEventDispatcher::dispatchSessionStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchSessionStorageEvent( - WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, + pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, sessionNamespace, sourceAreaInstance, originatedInProcess); } + +// FIXME: remove the WebStorageEventDispatcherImpl class soon. + +WebStorageEventDispatcher* WebStorageEventDispatcher::create() +{ + return new WebStorageEventDispatcherImpl(); +} + +WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() + : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGroupName))) +{ + ASSERT(m_eventDispatcher); +} + +void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue, + const WebString& newValue, const WebString& origin, + const WebURL& pageURL, bool isLocalStorage) +{ + WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage; + RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin); + m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), pageURL, storageType); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h new file mode 100644 index 000000000..b03c6b7a6 --- /dev/null +++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef WebStorageEventDispatcherImpl_h +#define WebStorageEventDispatcherImpl_h + +#include "StorageEventDispatcherImpl.h" +#include "WebStorageEventDispatcher.h" +#include <wtf/OwnPtr.h> + +namespace WebKit { + +// DEPRECATED - to be removed when removing the instance methods in the public api. +class WebStorageEventDispatcherImpl : public WebStorageEventDispatcher { +public: + WebStorageEventDispatcherImpl(); + virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, + const WebString& newValue, const WebString& origin, + const WebURL&, bool isLocalStorage); +private: + OwnPtr<WebCore::StorageEventDispatcherImpl> m_eventDispatcher; +}; + +} // namespace WebKit + +#endif // WebStorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp index 957663634..d7a9be01c 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebTextCheckingCompletionImpl.h" +#include "EditorClientImpl.h" #include "SpellChecker.h" #include "TextCheckerClient.h" #include "WebTextCheckingResult.h" @@ -51,14 +52,28 @@ static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingR void WebTextCheckingCompletionImpl::didFinishCheckingText(const WebVector<WebTextCheckingResult>& results) { - m_spellChecker->didCheckSucceeded(m_identifier, toCoreResults(results)); + if (m_spellChecker) { + m_spellChecker->didCheckSucceeded(m_identifier, toCoreResults(results)); + m_editorClient->didCheckString(this); + } + delete this; } void WebTextCheckingCompletionImpl::didCancelCheckingText() { - m_spellChecker->didCheckCanceled(m_identifier); + if (m_spellChecker) { + m_spellChecker->didCheckCanceled(m_identifier); + m_editorClient->didCheckString(this); + } + delete this; } +void WebTextCheckingCompletionImpl::invalidate() +{ + m_spellChecker = 0; + m_editorClient = 0; +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h index 175d25cd4..06e34addc 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h @@ -39,21 +39,29 @@ class SpellChecker; namespace WebKit { +class EditorClientImpl; + class WebTextCheckingCompletionImpl : public WebTextCheckingCompletion { public: - WebTextCheckingCompletionImpl(int identifier, WebCore::SpellChecker* spellchecker) - : m_identifier(identifier), m_spellChecker(spellchecker) + WebTextCheckingCompletionImpl(int identifier, WebCore::SpellChecker* spellchecker, EditorClientImpl* editorClient) + : m_identifier(identifier) + , m_spellChecker(spellchecker) + , m_editorClient(editorClient) { } virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&); virtual void didCancelCheckingText(); + void invalidate(); + WebCore::SpellChecker* spellChecker() const { return m_spellChecker; } + private: virtual ~WebTextCheckingCompletionImpl() { } int m_identifier; WebCore::SpellChecker* m_spellChecker; + EditorClientImpl* m_editorClient; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 626da8a21..f74c802a9 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -99,6 +99,7 @@ #include "PointerLockController.h" #include "PopupContainer.h" #include "PopupMenuClient.h" +#include "PrerendererClientImpl.h" #include "ProgressTracker.h" #include "RenderLayerCompositor.h" #include "RenderView.h" @@ -164,11 +165,6 @@ #include "PlatformGestureEvent.h" #endif -#if USE(CG) -#include <CoreGraphics/CGBitmapContext.h> -#include <CoreGraphics/CGContext.h> -#endif - #if OS(WINDOWS) #include "RenderThemeChromiumWin.h" #else @@ -243,6 +239,20 @@ static const PopupContainerSettings autofillPopupSettings = { static bool shouldUseExternalPopupMenus = false; +static int webInputEventKeyStateToPlatformEventKeyState(int webInputEventKeyState) +{ + int platformEventKeyState = 0; + if (webInputEventKeyState & WebInputEvent::ShiftKey) + platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::ShiftKey; + if (webInputEventKeyState & WebInputEvent::ControlKey) + platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::CtrlKey; + if (webInputEventKeyState & WebInputEvent::AltKey) + platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::AltKey; + if (webInputEventKeyState & WebInputEvent::MetaKey) + platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::MetaKey; + return platformEventKeyState; +} + // WebView ---------------------------------------------------------------- WebView* WebView::create(WebViewClient* client) @@ -321,6 +331,11 @@ void WebViewImpl::setPermissionClient(WebPermissionClient* permissionClient) m_permissionClient = permissionClient; } +void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient) +{ + providePrerendererClientTo(m_page.get(), new PrerendererClientImpl(prerendererClient)); +} + void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient) { m_spellCheckClient = spellCheckClient; @@ -381,6 +396,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_compositorCreationFailed(false) , m_recreatingGraphicsContext(false) , m_compositorSurfaceReady(false) + , m_deviceScaleInCompositor(1) #endif #if ENABLE(INPUT_SPEECH) , m_speechInputClient(SpeechInputClientImpl::create(client)) @@ -1261,11 +1277,6 @@ WebViewImpl* WebViewImpl::fromPage(Page* page) return static_cast<WebViewImpl*>(chromeClient->webView()); } -PageGroup* WebViewImpl::defaultPageGroup() -{ - return PageGroup::pageGroup(pageGroupName); -} - // WebWidget ------------------------------------------------------------------ void WebViewImpl::close() @@ -1310,6 +1321,13 @@ void WebViewImpl::resize(const WebSize& newSize) return; m_size = newSize; +#if ENABLE(VIEWPORT) + if (settings()->viewportEnabled()) { + ViewportArguments viewportArguments = mainFrameImpl()->frame()->document()->viewportArguments(); + m_page->chrome()->client()->dispatchViewportPropertiesDidChange(viewportArguments); + } +#endif + WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); if (agentPrivate && agentPrivate->metricsOverridden()) agentPrivate->webViewResized(); @@ -1476,18 +1494,13 @@ void WebViewImpl::layout() void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) { ASSERT(!m_layerTreeView.isNull()); -#if USE(SKIA) + PlatformContextSkia context(canvas); // PlatformGraphicsContext is actually a pointer to PlatformContextSkia GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); int bitmapHeight = canvas->getDevice()->accessBitmap(false).height(); -#elif USE(CG) - GraphicsContext gc(canvas); - int bitmapHeight = CGBitmapContextGetHeight(reinterpret_cast<CGContextRef>(canvas)); -#else - notImplemented(); -#endif + // Compute rect to sample from inverted GPU buffer. IntRect invertRect(rect.x(), bitmapHeight - rect.maxY(), rect.width(), rect.height()); @@ -1602,8 +1615,10 @@ void WebViewImpl::enterFullScreenForElement(WebCore::Element* element) #if USE(NATIVE_FULLSCREEN_VIDEO) if (element && element->isMediaElement()) { HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(element); - if (mediaElement->player() && mediaElement->player()->enterFullscreen()) + if (mediaElement->player() && mediaElement->player()->canEnterFullscreen()) { + mediaElement->player()->enterFullscreen(); m_provisionalFullScreenElement = element; + } return; } #endif @@ -1965,6 +1980,21 @@ bool WebViewImpl::selectionBounds(WebRect& start, WebRect& end) const return true; } +bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const +{ + const Frame* frame = focusedWebCoreFrame(); + if (!frame) + return false; + FrameSelection* selection = frame->selection(); + if (!selection) + return false; + if (!selection->toNormalizedRange()) + return false; + start = selection->start().primaryDirection() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight; + end = selection->end().primaryDirection() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight; + return true; +} + bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) { const Frame* focused = focusedWebCoreFrame(); @@ -2058,7 +2088,7 @@ void WebViewImpl::didChangeWindowResizerRect() // WebView -------------------------------------------------------------------- -WebSettings* WebViewImpl::settings() +WebSettingsImpl* WebViewImpl::settingsImpl() { if (!m_webSettings) m_webSettings = adoptPtr(new WebSettingsImpl(m_page->settings())); @@ -2066,6 +2096,11 @@ WebSettings* WebViewImpl::settings() return m_webSettings.get(); } +WebSettings* WebViewImpl::settings() +{ + return settingsImpl(); +} + WebString WebViewImpl::pageEncoding() const { if (!m_page) @@ -2327,6 +2362,12 @@ void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin) if (!scaleFactor) scaleFactor = 1; + if (m_deviceScaleInCompositor != 1) { + // Don't allow page scaling when compositor scaling is being used, + // as they are currently incompatible. + ASSERT(scaleFactor == 1); + } + scaleFactor = clampPageScaleFactorToLimits(scaleFactor); WebPoint clampedOrigin = clampOffsetAtScale(origin, scaleFactor); page()->setPageScaleFactor(scaleFactor, clampedOrigin); @@ -2347,6 +2388,13 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) return; page()->setDeviceScaleFactor(scaleFactor); + + if (m_deviceScaleInCompositor != 1) { + // Don't allow page scaling when compositor scaling is being used, + // as they are currently incompatible. This means the deviceScale + // needs to match the one in the compositor. + ASSERT(scaleFactor == m_deviceScaleInCompositor); + } } bool WebViewImpl::isFixedLayoutModeEnabled() const @@ -2374,10 +2422,8 @@ void WebViewImpl::enableFixedLayoutMode(bool enable) #if USE(ACCELERATED_COMPOSITING) // Also notify the base layer, which RenderLayerCompositor does not see. - if (m_nonCompositedContentHost) { - m_nonCompositedContentHost->topLevelRootLayer()->deviceOrPageScaleFactorChanged(); + if (m_nonCompositedContentHost) updateLayerTreeViewport(); - } #endif } @@ -2411,8 +2457,8 @@ bool WebViewImpl::computePageScaleFactorLimits() if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()->view()) return false; - m_minimumPageScaleFactor = min(max(m_pageDefinedMinimumPageScaleFactor, minPageScaleFactor), maxPageScaleFactor) * deviceScaleFactor(); - m_maximumPageScaleFactor = max(min(m_pageDefinedMaximumPageScaleFactor, maxPageScaleFactor), minPageScaleFactor) * deviceScaleFactor(); + m_minimumPageScaleFactor = min(max(m_pageDefinedMinimumPageScaleFactor, minPageScaleFactor), maxPageScaleFactor) * (deviceScaleFactor() / m_deviceScaleInCompositor); + m_maximumPageScaleFactor = max(min(m_pageDefinedMaximumPageScaleFactor, maxPageScaleFactor), minPageScaleFactor) * (deviceScaleFactor() / m_deviceScaleInCompositor); int viewWidthNotIncludingScrollbars = page()->mainFrame()->view()->visibleContentRect(false).width(); int contentsWidth = mainFrame()->contentsSize().width; @@ -2588,12 +2634,22 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed) { + return dragTargetDragEnter(webDragData, clientPoint, screenPoint, operationsAllowed, 0); +} + +WebDragOperation WebViewImpl::dragTargetDragEnter( + const WebDragData& webDragData, + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed, + int keyModifiers) +{ ASSERT(!m_currentDragData); m_currentDragData = webDragData; m_operationsAllowed = operationsAllowed; - return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter); + return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, keyModifiers); } WebDragOperation WebViewImpl::dragTargetDragOver( @@ -2601,9 +2657,18 @@ WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed) { + return dragTargetDragOver(clientPoint, screenPoint, operationsAllowed, 0); +} + +WebDragOperation WebViewImpl::dragTargetDragOver( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed, + int keyModifiers) +{ m_operationsAllowed = operationsAllowed; - return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver); + return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, keyModifiers); } void WebViewImpl::dragTargetDragLeave() @@ -2627,6 +2692,13 @@ void WebViewImpl::dragTargetDragLeave() void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, const WebPoint& screenPoint) { + dragTargetDrop(clientPoint, screenPoint, 0); +} + +void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, + const WebPoint& screenPoint, + int keyModifiers) +{ ASSERT(m_currentDragData); // If this webview transitions from the "drop accepting" state to the "not @@ -2641,6 +2713,7 @@ void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, return; } + m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventKeyState(keyModifiers)); DragData dragData( m_currentDragData.get(), clientPoint, @@ -2655,10 +2728,11 @@ void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, m_dragScrollTimer->stop(); } -WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPoint, const WebPoint& screenPoint, DragAction dragAction) +WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPoint, const WebPoint& screenPoint, DragAction dragAction, int keyModifiers) { ASSERT(m_currentDragData); + m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventKeyState(keyModifiers)); DragData dragData( m_currentDragData.get(), clientPoint, @@ -2993,9 +3067,21 @@ void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) void WebViewImpl::didChangeContentsSize() { - bool didClampScale = computePageScaleFactorLimits(); +#if ENABLE(VIEWPORT) + if (!settings()->viewportEnabled()) + return; - if (!didClampScale) + bool didChangeScale = false; + if (!isPageScaleFactorSet()) { + // If the viewport tag failed to be processed earlier, we need + // to recompute it now. + ViewportArguments viewportArguments = mainFrameImpl()->frame()->document()->viewportArguments(); + m_page->chrome()->client()->dispatchViewportPropertiesDidChange(viewportArguments); + didChangeScale = true; + } else + didChangeScale = computePageScaleFactorLimits(); + + if (!didChangeScale) return; if (!mainFrameImpl()) @@ -3004,6 +3090,7 @@ void WebViewImpl::didChangeContentsSize() FrameView* view = mainFrameImpl()->frameView(); if (view && view->needsLayout()) view->layout(); +#endif } bool WebViewImpl::useExternalPopupMenus() @@ -3047,7 +3134,8 @@ bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button, return true; } -void WebViewImpl::startDragging(const WebDragData& dragData, +void WebViewImpl::startDragging(Frame* frame, + const WebDragData& dragData, WebDragOperationsMask mask, const WebImage& dragImage, const WebPoint& dragImageOffset) @@ -3056,7 +3144,7 @@ void WebViewImpl::startDragging(const WebDragData& dragData, return; ASSERT(!m_doingDragAndDrop); m_doingDragAndDrop = true; - m_client->startDragging(dragData, mask, dragImage, dragImageOffset); + m_client->startDragging(WebFrameImpl::fromFrame(frame), dragData, mask, dragImage, dragImageOffset); } void WebViewImpl::observeNewNavigation() @@ -3306,16 +3394,31 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) WebLayerTreeView::Settings layerTreeViewSettings; layerTreeViewSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); - layerTreeViewSettings.showFPSCounter = settings()->showFPSCounter(); - layerTreeViewSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); + layerTreeViewSettings.showFPSCounter = settingsImpl()->showFPSCounter(); + layerTreeViewSettings.showPlatformLayerTree = settingsImpl()->showPlatformLayerTree(); + layerTreeViewSettings.showPaintRects = settingsImpl()->showPaintRects(); layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawingEnabled(); layerTreeViewSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled(); layerTreeViewSettings.threadedAnimationEnabled = page()->settings()->threadedAnimationEnabled(); + layerTreeViewSettings.defaultTileSize = settingsImpl()->defaultTileSize(); + layerTreeViewSettings.maxUntiledLayerSize = settingsImpl()->maxUntiledLayerSize(); + m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this)); m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); + if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->settings()->defaultDeviceScaleFactor() != 1) { + ASSERT(page()->settings()->defaultDeviceScaleFactor()); + + m_deviceScaleInCompositor = page()->settings()->defaultDeviceScaleFactor(); + layerTreeViewSettings.deviceScaleFactor = m_deviceScaleInCompositor; + setDeviceScaleFactor(m_deviceScaleInCompositor); + // When applying a scale factor in the compositor, we disallow page + // scaling as they are currently incompatible. + setPageScaleFactorLimits(1, 1); + } + m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings); if (!m_layerTreeView.isNull()) { m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); @@ -3459,7 +3562,12 @@ void WebViewImpl::updateLayerTreeViewport() // layer. layerAdjustX = -view->contentsSize().width() + view->visibleContentRect(false).width(); } - m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, pageScaleFactor(), layerAdjustX); + + // This part of the deviceScale will be used to scale the contents of + // the NCCH's GraphicsLayer. + float deviceScale = m_deviceScaleInCompositor; + m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, deviceScale, layerAdjustX); + m_layerTreeView.setViewportSize(size()); m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 9b44fb68d..db67dd54a 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -69,7 +69,6 @@ class HistoryItem; class HitTestResult; class KeyboardEvent; class Page; -class PageGroup; class PagePopup; class PagePopupClient; class PlatformGestureCurveTarget; @@ -91,6 +90,7 @@ class DeviceOrientationClientProxy; class DragScrollTimer; class GeolocationClientProxy; class NonCompositedContentHost; +class PrerendererClientImpl; class SpeechInputClientImpl; class SpeechRecognitionClientProxy; class UserMediaClientImpl; @@ -101,6 +101,7 @@ class WebDevToolsAgentPrivate; class WebFrameImpl; class WebGestureEvent; class WebPagePopupImpl; +class WebPrerendererClient; class WebImage; class WebKeyboardEvent; class WebMouseEvent; @@ -146,6 +147,7 @@ public: virtual bool compositionRange(size_t* location, size_t* length); virtual WebTextInputType textInputType(); virtual bool selectionBounds(WebRect& start, WebRect& end) const; + virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const; virtual bool caretOrSelectionRange(size_t* location, size_t* length); virtual void setTextDirection(WebTextDirection direction); virtual bool isAcceleratedCompositingActive() const; @@ -161,6 +163,7 @@ public: virtual void setAutofillClient(WebAutofillClient*); virtual void setDevToolsAgentClient(WebDevToolsAgentClient*); virtual void setPermissionClient(WebPermissionClient*); + virtual void setPrerendererClient(WebPrerendererClient*) OVERRIDE; virtual void setSpellCheckClient(WebSpellCheckClient*); virtual void addTextFieldDecoratorClient(WebTextFieldDecoratorClient*) OVERRIDE; virtual WebSettings* settings(); @@ -229,14 +232,29 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed); + virtual WebDragOperation dragTargetDragEnter( + const WebDragData&, + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed, + int keyModifiers); virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed); + virtual WebDragOperation dragTargetDragOver( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed, + int keyModifiers); virtual void dragTargetDragLeave(); virtual void dragTargetDrop( const WebPoint& clientPoint, const WebPoint& screenPoint); + virtual void dragTargetDrop( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + int keyModifiers); virtual unsigned long createUniqueIdentifierForRequest(); virtual void inspectElementAt(const WebPoint& point); virtual WebString inspectorSettings() const; @@ -301,12 +319,6 @@ public: static WebViewImpl* fromPage(WebCore::Page*); - // A pageGroup identifies a namespace of pages. Page groups are used on PLATFORM(MAC) - // for some programs that use HTML views to display things that don't seem like - // web pages to the user (so shouldn't have visited link coloring). We only use - // one page group. - static WebCore::PageGroup* defaultPageGroup(); - WebViewClient* client() { return m_client; @@ -436,6 +448,7 @@ public: // Start a system drag and drop operation. void startDragging( + WebCore::Frame*, const WebDragData& dragData, WebDragOperationsMask mask, const WebImage& dragImage, @@ -582,7 +595,8 @@ private: // should be true. WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint, const WebPoint& screenPoint, - DragAction); + DragAction, + int keyModifiers); void configureAutoResizeMode(); @@ -615,6 +629,8 @@ private: virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE; virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE; + WebSettingsImpl* settingsImpl(); + WebViewClient* m_client; WebAutofillClient* m_autofillClient; WebPermissionClient* m_permissionClient; @@ -763,6 +779,7 @@ private: // If true, the graphics context is being restored. bool m_recreatingGraphicsContext; bool m_compositorSurfaceReady; + float m_deviceScaleInCompositor; #endif static const WebInputEvent* m_currentInputEvent; diff --git a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp index 13166f344..fb723223b 100644 --- a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp @@ -66,23 +66,20 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(WebInputEvent::Type type, return result; } -WebMouseEvent WebInputEventFactory::mouseEvent(int x, int y, - int windowX, int windowY, - MouseEventType type, +WebMouseEvent WebInputEventFactory::mouseEvent(MouseEventType type, + WebMouseEvent::Button button, double timeStampSeconds, + int windowX, + int windowY, int modifiers, - int clickCount, - WebMouseEvent::Button button) + int clickCount) { WebMouseEvent result; - result.x = x; - result.y = y; + result.x = windowX; + result.y = windowY; result.windowX = windowX; result.windowY = windowY; - // FIXME: We need to decide what to use for the globalX/Y. - result.globalX = windowX; - result.globalY = windowY; result.timeStampSeconds = timeStampSeconds; result.clickCount = clickCount; result.modifiers = modifiers; @@ -105,4 +102,69 @@ WebMouseEvent WebInputEventFactory::mouseEvent(int x, int y, return result; } +// WebMouseWheelEvent ------------------------------------------------------------ + +WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(MouseWheelDirectionType direction, + double timeStampSeconds, + int windowX, + int windowY) +{ + WebMouseWheelEvent result; + + result.type = WebInputEvent::MouseWheel; + result.x = windowX; + result.y = windowY; + result.windowX = windowX; + result.windowY = windowY; + result.timeStampSeconds = timeStampSeconds; + result.button = WebMouseEvent::ButtonNone; + + // The below choices are matched from GTK. + static const float scrollbarPixelsPerTick = 160.0f / 3.0f; + + switch (direction) { + case MouseWheelDirectionTypeUp: + result.deltaY = scrollbarPixelsPerTick; + result.wheelTicksY = 1; + break; + case MouseWheelDirectionTypeDown: + result.deltaY = -scrollbarPixelsPerTick; + result.wheelTicksY = -1; + break; + case MouseWheelDirectionTypeLeft: + result.deltaX = scrollbarPixelsPerTick; + result.wheelTicksX = 1; + break; + case MouseWheelDirectionTypeRight: + result.deltaX = -scrollbarPixelsPerTick; + result.wheelTicksX = -1; + break; + } + + return result; +} + +// WebGestureEvent ------------------------------------------------------------ + +WebGestureEvent WebInputEventFactory::gestureEvent(WebInputEvent::Type type, + double timeStampSeconds, + int x, + int y, + float deltaX, + float deltaY, + int modifiers) +{ + WebGestureEvent result; + + result.type = type; + result.x = x; + result.y = y; + result.deltaX = deltaX; + result.deltaY = deltaY; + result.timeStampSeconds = timeStampSeconds; + result.modifiers = modifiers; + + return result; +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/js/DevTools.js b/Source/WebKit/chromium/src/js/DevTools.js index 499b6047d..c4d54238d 100644 --- a/Source/WebKit/chromium/src/js/DevTools.js +++ b/Source/WebKit/chromium/src/js/DevTools.js @@ -54,3 +54,8 @@ WebInspector.setInspectedTabId = function(tabId) { WebInspector._inspectedTabId = tabId; } + +WebInspector.clipboardAccessDeniedMessage = function() +{ + return "You need to install a Chrome extension that grants clipboard access to Developer Tools."; +} diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index 8c7e26ab4..f7e3810c5 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -254,14 +254,14 @@ TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() var test = this; this.assertEquals(WebInspector.panels.elements, WebInspector.inspectorView.currentPanel(), "Elements panel should be current one."); - WebInspector.debuggerPresentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerReset, waitUntilScriptIsParsed); + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, waitUntilScriptIsParsed); // Reload inspected page. It will reset the debugger agent. test.evaluateInConsole_("window.location.reload(true);", function(resultText) {}); function waitUntilScriptIsParsed() { - WebInspector.debuggerPresentationModel.removeEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerReset, waitUntilScriptIsParsed); + WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, waitUntilScriptIsParsed); test.showPanel("scripts"); test._waitUntilScriptsAreParsed(["debugger_test_page.html"], function() { @@ -649,7 +649,7 @@ TestSuite.prototype.nonAnonymousUISourceCodes_ = function() return !!uiSourceCode.url; } - var uiSourceCodes = WebInspector.panels.scripts._presentationModel.uiSourceCodes(); + var uiSourceCodes = WebInspector.panels.scripts._uiSourceCodeProvider.uiSourceCodes(); return uiSourceCodes.filter(filterOutAnonymous); }; |
