summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:48 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:57 +0100
commit4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch)
treebed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Source/WebKit2/UIProcess
parent01485457c9a5da3f1121015afd25bb53af77662e (diff)
downloadqtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPagePrivate.h1
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.cpp21
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/efl/WKView.cpp7
-rw-r--r--Source/WebKit2/UIProcess/API/C/efl/WKView.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp40
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h19
-rw-r--r--Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.cpp58
-rw-r--r--Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.h33
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp16
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_settings.h33
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h1
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/resources/big_button_theme.edjbin133487 -> 0 bytes
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.mm1
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.h2
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm10
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm14
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h6
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKConnection.mm24
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h1
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp5
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h1
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp109
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h11
-rw-r--r--Source/WebKit2/UIProcess/PageClient.h2
-rw-r--r--Source/WebKit2/UIProcess/PageViewportController.cpp4
-rw-r--r--Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp2
-rw-r--r--Source/WebKit2/UIProcess/WebContextUserMessageCoders.h21
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp19
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h6
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in2
-rw-r--r--Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp4
-rw-r--r--Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp30
-rw-r--r--Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h11
-rw-r--r--Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h5
-rw-r--r--Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm157
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm4
44 files changed, 513 insertions, 220 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
index 259bca727..ef871bb4c 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -764,3 +764,8 @@ WKArrayRef WKPageCopyRelatedPages(WKPageRef pageRef)
{
return toAPI(toImpl(pageRef)->relatedPages().leakRef());
}
+
+void WKPageSetMayStartMediaWhenInWindow(WKPageRef pageRef, bool mayStartMedia)
+{
+ toImpl(pageRef)->setMayStartMediaWhenInWindow(mayStartMedia);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
index 3a9de69af..4f0e85ba5 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
@@ -93,6 +93,7 @@ WK_EXPORT WKImageRef WKPageCreateSnapshotOfVisibleContent(WKPageRef page);
WK_EXPORT void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync);
WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
+WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia);
WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page);
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 068563d1f..cb4cff018 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -448,6 +448,16 @@ bool WKPreferencesGetWebGLEnabled(WKPreferencesRef preferencesRef)
return toImpl(preferencesRef)->webGLEnabled();
}
+void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setAccelerated2dCanvasEnabled(flag);
+}
+
+bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->accelerated2dCanvasEnabled();
+}
+
void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setCSSRegionsEnabled(flag);
@@ -953,3 +963,14 @@ bool WKPreferencesGetEncodingDetectorEnabled(WKPreferencesRef preferencesRef)
{
return toImpl(preferencesRef)->usesEncodingDetector();
}
+
+void WKPreferencesSetTextAutosizingEnabled(WKPreferencesRef preferencesRef, bool textAutosizingEnabled)
+{
+ toImpl(preferencesRef)->setTextAutosizingEnabled(textAutosizingEnabled);
+}
+
+bool WKPreferencesGetTextAutosizingEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->textAutosizingEnabled();
+}
+
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
index ff2e0a006..4033d8cf1 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
@@ -224,6 +224,10 @@ WK_EXPORT bool WKPreferencesGetPlugInSnapshottingEnabled(WKPreferencesRef prefer
WK_EXPORT void WKPreferencesSetEncodingDetectorEnabled(WKPreferencesRef preferencesRef, bool enabled);
WK_EXPORT bool WKPreferencesGetEncodingDetectorEnabled(WKPreferencesRef preferencesRef);
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetTextAutosizingEnabled(WKPreferencesRef preferences, bool textAutosizingEnabled);
+WK_EXPORT bool WKPreferencesGetTextAutosizingEnabled(WKPreferencesRef preferences);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
index af5f73b34..a796bcb43 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
@@ -91,6 +91,10 @@ WK_EXPORT bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef);
WK_EXPORT void WKPreferencesSetWebGLEnabled(WKPreferencesRef, bool);
WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef);
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef);
+
// Defaults to true
WK_EXPORT void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetCSSRegionsEnabled(WKPreferencesRef);
diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp
index 80a1ac381..f4436aedd 100644
--- a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp
+++ b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp
@@ -42,3 +42,10 @@ WKPageRef WKViewGetPage(WKViewRef viewRef)
return viewImpl->wkPage();
}
+
+WKImageRef WKViewGetSnapshot(WKViewRef viewRef)
+{
+ EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(toImpl(viewRef));
+
+ return viewImpl->takeSnapshot();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKView.h b/Source/WebKit2/UIProcess/API/C/efl/WKView.h
index db0da2c27..ca17a9945 100644
--- a/Source/WebKit2/UIProcess/API/C/efl/WKView.h
+++ b/Source/WebKit2/UIProcess/API/C/efl/WKView.h
@@ -34,6 +34,8 @@ WK_EXPORT WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef conte
WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
+WK_EXPORT WKImageRef WKViewGetSnapshot(WKViewRef viewRef);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
index 29161ff23..50e4cb205 100644
--- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
@@ -35,11 +35,13 @@
#include "PagePolicyClientEfl.h"
#include "PageUIClientEfl.h"
#include "ResourceLoadClientEfl.h"
+#include "SnapshotImageGL.h"
#include "WKDictionary.h"
#include "WKGeometry.h"
#include "WKNumber.h"
#include "WKString.h"
#include "WebContext.h"
+#include "WebImage.h"
#include "WebPageGroup.h"
#include "WebPageProxy.h"
#include "WebPopupMenuProxyEfl.h"
@@ -62,6 +64,7 @@
#include <Edje.h>
#include <WebCore/CairoUtilitiesEfl.h>
#include <WebCore/Cursor.h>
+#include <WebKit2/WKImageCairo.h>
#if ENABLE(VIBRATION)
#include "VibrationClientEfl.h"
@@ -288,8 +291,8 @@ AffineTransform EwkViewImpl::transformFromScene() const
AffineTransform transform;
#if USE(TILED_BACKING_STORE)
- transform.translate(m_scrollPosition.x(), m_scrollPosition.y());
transform.scale(1 / m_scaleFactor);
+ transform.translate(discretePagePosition().x(), discretePagePosition().y());
#endif
Ewk_View_Smart_Data* sd = smartData();
@@ -358,7 +361,7 @@ void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*)
#if USE(COORDINATED_GRAPHICS)
Ewk_View_Smart_Data* sd = smartData();
- evas_gl_make_current(evasGL(), evasGLSurface(), evasGLContext());
+ evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext());
// We are supposed to clip to the actual viewport, nothing less.
IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h);
@@ -380,8 +383,8 @@ void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*)
return;
RefPtr<cairo_t> graphicsContext = adoptRef(cairo_create(surface.get()));
+ cairo_translate(graphicsContext.get(), - discretePagePosition().x(), - discretePagePosition().y());
cairo_scale(graphicsContext.get(), m_scaleFactor, m_scaleFactor);
- cairo_translate(graphicsContext.get(), -m_scrollPosition.x(), -m_scrollPosition.y());
renderer->paintToGraphicsContext(graphicsContext.get());
evas_object_image_data_update_add(sd->image, 0, 0, viewport.width(), viewport.height());
}
@@ -632,7 +635,7 @@ bool EwkViewImpl::createGLSurface(const IntSize& viewSize)
}
if (!m_evasGLContext) {
- m_evasGLContext = EvasGLContext::create(evasGL());
+ m_evasGLContext = EvasGLContext::create(m_evasGL.get());
if (!m_evasGLContext) {
WARN("Failed to create GLContext.");
return false;
@@ -650,18 +653,20 @@ bool EwkViewImpl::createGLSurface(const IntSize& viewSize)
};
// Replaces if non-null, and frees existing surface after (OwnPtr).
- m_evasGLSurface = EvasGLSurface::create(evasGL(), &evasGLConfig, viewSize);
+ m_evasGLSurface = EvasGLSurface::create(m_evasGL.get(), &evasGLConfig, viewSize);
if (!m_evasGLSurface)
return false;
Evas_Native_Surface nativeSurface;
- evas_gl_native_surface_get(evasGL(), evasGLSurface(), &nativeSurface);
+ evas_gl_native_surface_get(m_evasGL.get(), evasGLSurface(), &nativeSurface);
evas_object_image_native_surface_set(sd->image, &nativeSurface);
- evas_gl_make_current(evasGL(), evasGLSurface(), evasGLContext());
+ evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext());
- Evas_GL_API* gl = evas_gl_api_get(evasGL());
+ Evas_GL_API* gl = evas_gl_api_get(m_evasGL.get());
gl->glViewport(0, 0, viewSize.width() + sd->view.x, viewSize.height() + sd->view.y);
+ gl->glClearColor(1.0, 1.0, 1.0, 0);
+ gl->glClear(GL_COLOR_BUFFER_BIT);
return true;
}
@@ -1012,3 +1017,22 @@ void EwkViewImpl::onFaviconChanged(const char* pageURL, void* eventInfo)
viewImpl->informIconChange();
}
+
+WKImageRef EwkViewImpl::takeSnapshot()
+{
+ Ewk_View_Smart_Data* sd = smartData();
+#if USE(ACCELERATED_COMPOSITING)
+ if (!m_isHardwareAccelerated)
+#endif
+ return WKImageCreateFromCairoSurface(createSurfaceForImage(sd->image).get(), 0);
+
+#if USE(ACCELERATED_COMPOSITING)
+ Evas_Native_Surface* nativeSurface = evas_object_image_native_surface_get(sd->image);
+ unsigned char* buffer = getImageFromCurrentTexture(sd->view.w, sd->view.h, nativeSurface->data.opengl.texture_id);
+ RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, sd->view.w, sd->view.h, sd->view.w * 4));
+ WKImageRef image = WKImageCreateFromCairoSurface(surface.get(), 0);
+ delete[] buffer;
+
+ return image;
+#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
index 379b57ebe..cb1875672 100644
--- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
+++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
@@ -28,6 +28,7 @@
#include "WKGeometry.h"
#include "WKRetainPtr.h"
#include <Evas.h>
+#include <WebCore/FloatPoint.h>
#include <WebCore/IntRect.h>
#include <WebCore/TextDirection.h>
#include <WebCore/Timer.h>
@@ -200,13 +201,8 @@ public:
void setScaleFactor(float scaleFactor) { m_scaleFactor = scaleFactor; }
float scaleFactor() const { return m_scaleFactor; }
- void setScrollPosition(WebCore::IntPoint position) { m_scrollPosition = position; }
- const WebCore::IntPoint scrollPosition() const { return m_scrollPosition; }
-#endif
-#if USE(ACCELERATED_COMPOSITING)
- Evas_GL* evasGL() { return m_evasGL.get(); }
- Evas_GL_Context* evasGLContext() { return m_evasGLContext ? m_evasGLContext->context() : 0; }
- Evas_GL_Surface* evasGLSurface() { return m_evasGLSurface ? m_evasGLSurface->surface() : 0; }
+ void setPagePosition(const WebCore::FloatPoint& position) { m_pagePosition = position; }
+ const WebCore::IntPoint discretePagePosition() const { return roundedIntPoint(m_pagePosition); }
#endif
// FIXME: needs refactoring (split callback invoke)
@@ -215,7 +211,14 @@ public:
bool isHardwareAccelerated() const { return m_isHardwareAccelerated; }
void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
+ WKImageRef takeSnapshot();
+
private:
+#if USE(ACCELERATED_COMPOSITING)
+ Evas_GL_Context* evasGLContext() { return m_evasGLContext ? m_evasGLContext->context() : 0; }
+ Evas_GL_Surface* evasGLSurface() { return m_evasGLSurface ? m_evasGLSurface->surface() : 0; }
+#endif
+
inline Ewk_View_Smart_Data* smartData() const;
void displayTimerFired(WebCore::Timer<EwkViewImpl>*);
@@ -259,7 +262,7 @@ private:
OwnPtr<EwkBackForwardList> m_backForwardList;
#if USE(TILED_BACKING_STORE)
float m_scaleFactor;
- WebCore::IntPoint m_scrollPosition;
+ WebCore::FloatPoint m_pagePosition;
#endif
OwnPtr<EwkSettings> m_settings;
RefPtr<EwkWindowFeatures> m_windowFeatures;
diff --git a/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.cpp b/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.cpp
new file mode 100644
index 000000000..cd901efee
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+#include "SnapshotImageGL.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+#if USE(OPENGL_ES_2)
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#else
+#include "OpenGLShims.h"
+#endif
+
+unsigned char* getImageFromCurrentTexture(int width, int height, int textureId)
+{
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ unsigned char* buffer = new unsigned char[width * height * 4];
+ glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, buffer);
+
+ // Textures are flipped on the Y axis, so we need to flip the image back.
+ unsigned tmp;
+ unsigned* buf = reinterpret_cast<unsigned*>(buffer);
+
+ for (int i = 0; i < height / 2; ++i) {
+ for (int j = 0; j < width; ++j) {
+ tmp = buf[i * width + j];
+ buf[i * width + j] = buf[(height - i - 1) * width + j];
+ buf[(height - i - 1) * width + j] = tmp;
+ }
+ }
+
+ return buffer;
+}
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.h b/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.h
new file mode 100644
index 000000000..6c228b126
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SnapshotImageGL_h
+#define SnapshotImageGL_h
+
+#if USE(ACCELERATED_COMPOSITING)
+unsigned char* getImageFromCurrentTexture(int width, int height, int textureId);
+#endif
+
+#endif // SnapshotImageGL_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
index c61703078..7f7c49467 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
@@ -332,3 +332,19 @@ Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings* settings
return settings->preferences()->javaScriptCanOpenWindowsAutomatically();
}
+
+Eina_Bool ewk_settings_local_storage_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+ settings->preferences()->setLocalStorageEnabled(enable);
+
+ return true;
+}
+
+Eina_Bool ewk_settings_local_storage_enabled_get(const Ewk_Settings* settings)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+ return settings->preferences()->localStorageEnabled();
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
index 856daaa00..eb8cb1683 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
@@ -391,6 +391,39 @@ EAPI Eina_Bool ewk_settings_scripts_can_open_windows_set(Ewk_Settings *settings,
*/
EAPI Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings *settings);
+/**
+ * Enables/disables the HTML5 local storage functionality.
+ *
+ * Local storage provides simple synchronous storage access.
+ * HTML5 local storage specification is available at
+ * http://dev.w3.org/html5/webstorage/.
+ *
+ * By default, the HTML5 local storage is enabled.
+ *
+ * @param settings settings object to set the HTML5 local storage state
+ * @param enable @c EINA_TRUE to enable HTML5 local storage,
+ * @c EINA_FALSE to disable
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_settings_local_storage_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
+
+/**
+ * Returns whether the HTML5 local storage functionality is enabled or not.
+ *
+ * Local storage provides simple synchronous storage access.
+ * HTML5 local storage specification is available at
+ * http://dev.w3.org/html5/webstorage/.
+ *
+ * By default, the HTML5 local storage is enabled.
+ *
+ * @param settings settings object to query whether HTML5 local storage is enabled
+ *
+ * @return @c EINA_TRUE if the HTML5 local storage is enabled
+ * @c EINA_FALSE if disabled or on failure
+ */
+EAPI Eina_Bool ewk_settings_local_storage_enabled_get(const Ewk_Settings *settings);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp
index f9e0f7b73..e626ee745 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp
@@ -60,4 +60,12 @@ CString EWK2UnitTestEnvironment::pathForResource(const char* resource)
return builder.toString().utf8();
}
+CString EWK2UnitTestEnvironment::pathForTheme(const char* theme)
+{
+ StringBuilder builder;
+ builder.appendLiteral(TEST_THEME_DIR "/");
+ builder.append(theme);
+ return builder.toString().utf8();
+}
+
} // namespace EWK2UnitTest
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
index b5e4f0270..888ca0535 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
@@ -33,6 +33,7 @@ public:
const char* injectedBundleSample() const;
CString urlForResource(const char* resource);
CString pathForResource(const char* resource);
+ CString pathForTheme(const char* theme);
virtual unsigned int defaultWidth() const { return m_defaultWidth; }
virtual unsigned int defaultHeight() const { return m_defaultHeight; }
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/big_button_theme.edj b/Source/WebKit2/UIProcess/API/efl/tests/resources/big_button_theme.edj
deleted file mode 100644
index 2f30076db..000000000
--- a/Source/WebKit2/UIProcess/API/efl/tests/resources/big_button_theme.edj
+++ /dev/null
Binary files differ
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
index 3402e5bcc..7b7247928 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
@@ -207,3 +207,17 @@ TEST_F(EWK2UnitTestBase, ewk_settings_scripts_can_open_windows)
ASSERT_TRUE(ewk_settings_scripts_can_open_windows_set(settings, false));
ASSERT_FALSE(ewk_settings_scripts_can_open_windows_get(settings));
}
+
+TEST_F(EWK2UnitTestBase, ewk_settings_local_storage_enabled)
+{
+ Ewk_Settings* settings = ewk_view_settings_get(webView());
+
+ // HTML5 local storage should be enabled by default.
+ ASSERT_TRUE(ewk_settings_local_storage_enabled_get(settings));
+
+ ASSERT_TRUE(ewk_settings_local_storage_enabled_set(settings, false));
+ ASSERT_FALSE(ewk_settings_local_storage_enabled_get(settings));
+
+ ASSERT_TRUE(ewk_settings_local_storage_enabled_set(settings, true));
+ ASSERT_TRUE(ewk_settings_local_storage_enabled_get(settings));
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
index 1491cc7d9..25fe0698b 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
@@ -219,9 +219,9 @@ TEST_F(EWK2UnitTestBase, ewk_view_theme_set)
ewk_view_html_string_load(webView(), buttonHTML, "file:///", 0);
EXPECT_TRUE(waitUntilTitleChangedTo("30")); // the result should be same as default theme
- ewk_view_theme_set(webView(), environment->pathForResource("big_button_theme.edj").data());
+ ewk_view_theme_set(webView(), environment->pathForTheme("big_button_theme.edj").data());
ewk_view_html_string_load(webView(), buttonHTML, "file:///", 0);
- EXPECT_TRUE(waitUntilTitleChangedTo("299")); // button of big button theme has 299px as padding (150 to -150)
+ EXPECT_TRUE(waitUntilTitleChangedTo("299")); // button of big button theme has 299px as padding (15 to -285)
}
TEST_F(EWK2UnitTestBase, ewk_view_mouse_events_enabled)
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
index 4df0ef1c4..7b03a5645 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -36,7 +36,6 @@
#import "WebPreferences.h"
#import <PDFKit/PDFKit.h>
#import <WebCore/LocalizedStrings.h>
-#import <objc/objc-runtime.h>
#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
index b019c68dc..8768fd067 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -128,7 +128,7 @@ private:
virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
- virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&);
+ virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
virtual void dismissDictionaryLookupPanel();
virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 6bdc1b9eb..9ed7feea1 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -29,6 +29,7 @@
#if USE(DICTATION_ALTERNATIVES)
#import <AppKit/NSTextAlternatives.h>
#endif
+#import "AttributedString.h"
#import "ColorSpaceData.h"
#import "DataReference.h"
#import "DictionaryPopupInfo.h"
@@ -471,14 +472,9 @@ void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&)
notImplemented();
}
-void PageClientImpl::didPerformDictionaryLookup(const String& text, double scaleFactor, const DictionaryPopupInfo& dictionaryPopupInfo)
+void PageClientImpl::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo)
{
- NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)dictionaryPopupInfo.fontInfo.fontAttributeDictionary.get()];
- NSFont *font = [NSFont fontWithDescriptor:fontDescriptor size:((scaleFactor != 1) ? [fontDescriptor pointSize] * scaleFactor : 0)];
-
- RetainPtr<NSMutableAttributedString> attributedString(AdoptNS, [[NSMutableAttributedString alloc] initWithString:nsStringFromWebCoreString(text)]);
- [attributedString.get() addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [attributedString.get() length])];
-
+ RetainPtr<NSAttributedString> attributedString = text.string;
NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
index 8604de876..d91019f72 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
@@ -37,6 +37,7 @@
#import "WKURLRequest.h"
#import "WKURLRequestNS.h"
#import "WebContext.h"
+#import "WebPageProxy.h"
#import <wtf/RetainPtr.h>
#import "WKBrowsingContextLoadDelegate.h"
@@ -53,7 +54,6 @@ static inline NSURL *autoreleased(WKURLRef url)
return [(NSURL *)WKURLCopyCFURL(kCFAllocatorDefault, wkURL.get()) autorelease];
}
-
@interface WKBrowsingContextControllerData : NSObject {
@public
// Underlying WKPageRef.
@@ -68,13 +68,6 @@ static inline NSURL *autoreleased(WKURLRef url)
@end
-@interface WKBrowsingContextController ()
-
-@property(readonly) WKPageRef _pageRef;
-
-@end
-
-
@implementation WKBrowsingContextController
- (void)dealloc
@@ -418,6 +411,11 @@ static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext,
return self;
}
++ (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef
+{
+ return (WKBrowsingContextController *)WebKit::toImpl(pageRef)->loaderClient().client().clientInfo;
+}
+
+ (NSMutableSet *)customSchemes
{
static NSMutableSet *customSchemes = [[NSMutableSet alloc] init];
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
index d1d20ad04..fe895c923 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
@@ -29,6 +29,12 @@
/* This should only be called from associate view. */
- (id)_initWithPageRef:(WKPageRef)pageRef;
+
+/* Returns a WKBrowsingContextController associated with the WKPageRef. */
++ (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef;
+
+@property(readonly) WKPageRef _pageRef;
+
+ (NSMutableSet *)customSchemes;
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKConnection.mm b/Source/WebKit2/UIProcess/API/mac/WKConnection.mm
index 8040a6781..50efb79bc 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKConnection.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKConnection.mm
@@ -27,9 +27,7 @@
#import "WKConnection.h"
#import "WKConnectionInternal.h"
-#import "ArgumentCodersMac.h"
-#import "ArgumentDecoder.h"
-#import "ArgumentEncoder.h"
+#import "ObjCObjectGraph.h"
#import "WKConnectionRef.h"
#import "WKData.h"
#import "WKRetainPtr.h"
@@ -64,13 +62,10 @@ using namespace WebKit;
- (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody
{
- OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create();
- encode(*messageData, messageBody);
-
WKRetainPtr<WKStringRef> wkMessageName = adoptWK(WKStringCreateWithCFString((CFStringRef)messageName));
- WKRetainPtr<WKDataRef> wkMessageBody = adoptWK(WKDataCreate(messageData->buffer(), messageData->bufferSize()));
+ RefPtr<ObjCObjectGraph> wkMessageBody = ObjCObjectGraph::create(messageBody);
- WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), wkMessageBody.get());
+ WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), (WKTypeRef)wkMessageBody.get());
}
#pragma mark Delegates
@@ -93,17 +88,10 @@ static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRe
{
WKConnection *connection = (WKConnection *)clientInfo;
if ([connection.delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) {
- RetainPtr<CFStringRef> cfMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName));
-
- WKDataRef messageData = (WKDataRef)messageBody;
- OwnPtr<CoreIPC::ArgumentDecoder> decoder = CoreIPC::ArgumentDecoder::create(WKDataGetBytes(messageData), WKDataGetSize(messageData));
-
- RetainPtr<id> messageDictionary;
- // FIXME: Don't just silently drop decoding failures on the ground.
- if (!decode(decoder.get(), messageDictionary))
- return;
+ RetainPtr<NSString> nsMessageName = adoptNS((NSString *)WKStringCopyCFString(kCFAllocatorDefault, messageName));
+ RetainPtr<id> nsMessageBody = ((ObjCObjectGraph*)messageBody)->rootObject();
- [connection.delegate connection:connection didReceiveMessageWithName:(NSString *)cfMessageName.get() body:messageDictionary.get()];
+ [connection.delegate connection:connection didReceiveMessageWithName:nsMessageName.get() body:nsMessageBody.get()];
}
}
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 21ed5be10..a45636a79 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -325,6 +325,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
q_ptr->setAcceptedMouseButtons(Qt::MouseButtonMask);
q_ptr->setAcceptHoverEvents(true);
+ q_ptr->setFlags(QQuickItem::ItemAcceptsDrops);
}
void QQuickWebViewPrivate::loadDidStop()
@@ -889,15 +890,6 @@ void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos)
m_pageViewportController->pageDidRequestScroll(pos);
}
-void QQuickWebViewFlickablePrivate::handleMouseEvent(QMouseEvent* event)
-{
- if (!pageView->eventHandler())
- return;
-
- // FIXME: Update the axis locker for mouse events as well.
- pageView->eventHandler()->handleInputEvent(event);
-}
-
QQuickWebViewExperimental::QQuickWebViewExperimental(QQuickWebView *webView, QQuickWebViewPrivate* webViewPrivate)
: QObject(webView)
, q_ptr(webView)
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
index adedb6a31..8445fe2f7 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
@@ -223,7 +223,6 @@ public:
virtual void updateViewportSize();
virtual void pageDidRequestScroll(const QPoint& pos);
- virtual void handleMouseEvent(QMouseEvent*);
private:
QScopedPointer<WebKit::PageViewportController> m_pageViewportController;
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp
index dc1b213d4..4c0ced289 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp
@@ -92,11 +92,6 @@ void CoordinatedBackingStore::updateTile(int id, const IntRect& sourceRect, cons
it->value.setBackBuffer(tileRect, sourceRect, backBuffer, offset);
}
-bool CoordinatedBackingStore::isEmpty() const
-{
- return m_tiles.size() == m_tilesToRemove.size();
-}
-
PassRefPtr<BitmapTexture> CoordinatedBackingStore::texture() const
{
HashMap<int, CoordinatedBackingStoreTile>::const_iterator end = m_tiles.end();
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h
index b0baca635..4038a3724 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h
@@ -61,7 +61,6 @@ public:
void removeTile(int);
void removeAllTiles();
void updateTile(int, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface>, const WebCore::IntPoint&);
- bool isEmpty() const;
static PassRefPtr<CoordinatedBackingStore> create() { return adoptRef(new CoordinatedBackingStore); }
void commitTileOperations(WebCore::TextureMapper*);
PassRefPtr<WebCore::BitmapTexture> texture() const;
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
index 0c009ec48..7fae9a011 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
@@ -66,6 +66,11 @@ static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const
return FloatPoint(scrollPositionX, scrollPositionY);
}
+static bool layerShouldHaveBackingStore(GraphicsLayer* layer)
+{
+ return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty();
+}
+
LayerTreeRenderer::LayerTreeRenderer(LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy)
: m_layerTreeCoordinatorProxy(layerTreeCoordinatorProxy)
, m_isActive(false)
@@ -93,8 +98,11 @@ PassOwnPtr<GraphicsLayer> LayerTreeRenderer::createLayer(WebLayerID)
void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, TextureMapper::PaintFlags PaintFlags)
{
- if (!m_textureMapper)
+ if (!m_textureMapper) {
m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
+ static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
+ }
+
ASSERT(m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode);
syncRemoteContent();
@@ -351,6 +359,7 @@ void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerIn
m_fixedLayers.remove(id);
assignImageBackingToLayer(layer, layerInfo.imageID);
+ prepareContentBackingStore(layer);
// Never make the root layer clip.
layer->setMasksToBounds(layerInfo.isRootLayer ? false : layerInfo.masksToBounds);
@@ -403,34 +412,78 @@ void LayerTreeRenderer::setRootLayerID(WebLayerID layerID)
m_rootLayer->addChild(layer);
}
-PassRefPtr<CoordinatedBackingStore> LayerTreeRenderer::getBackingStore(GraphicsLayer* graphicsLayer)
+CoordinatedBackingStore* LayerTreeRenderer::getBackingStore(GraphicsLayer* graphicsLayer)
{
TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
ASSERT(layer);
- RefPtr<CoordinatedBackingStore> backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
- if (!backingStore) {
- backingStore = CoordinatedBackingStore::create();
- layer->setBackingStore(backingStore);
- }
- ASSERT(backingStore);
+ CoordinatedBackingStore* backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
+
+ BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
+ if (it != m_pendingSyncBackingStores.end())
+ backingStore = it->value.get();
return backingStore;
}
-void LayerTreeRenderer::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
+void LayerTreeRenderer::prepareContentBackingStore(GraphicsLayer* graphicsLayer)
+{
+ if (!layerShouldHaveBackingStore(graphicsLayer)) {
+ removeBackingStoreIfNeeded(graphicsLayer);
+ return;
+ }
+
+ createBackingStoreIfNeeded(graphicsLayer);
+}
+
+void LayerTreeRenderer::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
{
TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
ASSERT(layer);
- RefPtr<CoordinatedBackingStore> backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
- ASSERT(backingStore);
- if (backingStore->isEmpty())
- layer->setBackingStore(0);
+
+ // Make sure the layer does not already have a backing store (committed or pending).
+ BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
+ if (it != m_pendingSyncBackingStores.end()) {
+ if (!it->value) {
+ // There is a pending removal, cancel it.
+ m_pendingSyncBackingStores.remove(it);
+ }
+ // There is already a pending addition.
+ return;
+ }
+ if (layer->backingStore())
+ return; // The layer already has a backing store (and no pending removal).
+
+ RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create());
+ backingStore->setSize(graphicsLayer->size());
+ ASSERT(!m_pendingSyncBackingStores.contains(layer));
+ m_pendingSyncBackingStores.add(layer, backingStore);
}
-void LayerTreeRenderer::resetBackingStoreSizeToLayerSize(GraphicsLayer* graphicsLayer)
+void LayerTreeRenderer::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer)
{
TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer);
ASSERT(layer);
- RefPtr<CoordinatedBackingStore> backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
+
+ // Check if the layout already has a backing store (committed or pending).
+ BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer);
+ if (it != m_pendingSyncBackingStores.end()) {
+ if (it->value) {
+ // There is a pending addition, cancel it.
+ m_pendingSyncBackingStores.remove(it);
+ }
+ // There is already a pending removal.
+ return;
+ }
+
+ if (!layer->backingStore())
+ return; // The layer has no backing store (and no pending addition).
+
+ ASSERT(!m_pendingSyncBackingStores.contains(layer));
+ m_pendingSyncBackingStores.add(layer, 0);
+}
+
+void LayerTreeRenderer::resetBackingStoreSizeToLayerSize(GraphicsLayer* graphicsLayer)
+{
+ CoordinatedBackingStore* backingStore = getBackingStore(graphicsLayer);
ASSERT(backingStore);
backingStore->setSize(graphicsLayer->size());
}
@@ -439,7 +492,8 @@ void LayerTreeRenderer::createTile(WebLayerID layerID, int tileID, float scale)
{
GraphicsLayer* layer = layerByID(layerID);
ASSERT(layer);
- RefPtr<CoordinatedBackingStore> backingStore = getBackingStore(layer);
+ CoordinatedBackingStore* backingStore = getBackingStore(layer);
+ ASSERT(backingStore);
backingStore->createTile(tileID, scale);
resetBackingStoreSizeToLayerSize(layer);
}
@@ -448,11 +502,13 @@ void LayerTreeRenderer::removeTile(WebLayerID layerID, int tileID)
{
GraphicsLayer* layer = layerByID(layerID);
ASSERT(layer);
- RefPtr<CoordinatedBackingStore> backingStore = getBackingStore(layer);
+ CoordinatedBackingStore* backingStore = getBackingStore(layer);
+ if (!backingStore)
+ return;
+
backingStore->removeTile(tileID);
resetBackingStoreSizeToLayerSize(layer);
m_backingStoresWithPendingBuffers.add(backingStore);
- removeBackingStoreIfNeeded(layer);
}
void LayerTreeRenderer::updateTile(WebLayerID layerID, int tileID, const TileUpdate& update)
@@ -460,6 +516,7 @@ void LayerTreeRenderer::updateTile(WebLayerID layerID, int tileID, const TileUpd
GraphicsLayer* layer = layerByID(layerID);
ASSERT(layer);
RefPtr<CoordinatedBackingStore> backingStore = getBackingStore(layer);
+ ASSERT(backingStore);
backingStore->updateTile(tileID, update.sourceRect, update.tileRect, update.surface, update.offset);
resetBackingStoreSizeToLayerSize(layer);
m_backingStoresWithPendingBuffers.add(backingStore);
@@ -524,13 +581,22 @@ void LayerTreeRenderer::removeReleasedImageBackingsIfNeeded()
m_releasedImageBackings.clear();
}
-void LayerTreeRenderer::commitTileOperations()
+void LayerTreeRenderer::commitPendingBackingStoreOperations()
{
HashSet<RefPtr<CoordinatedBackingStore> >::iterator end = m_backingStoresWithPendingBuffers.end();
for (HashSet<RefPtr<CoordinatedBackingStore> >::iterator it = m_backingStoresWithPendingBuffers.begin(); it != end; ++it)
(*it)->commitTileOperations(m_textureMapper.get());
m_backingStoresWithPendingBuffers.clear();
+
+ {
+ BackingStoreMap::iterator end = m_pendingSyncBackingStores.end();
+ BackingStoreMap::iterator it = m_pendingSyncBackingStores.begin();
+ for (;it != end; ++it)
+ it->key->setBackingStore(it->value);
+
+ m_pendingSyncBackingStores.clear();
+ }
}
void LayerTreeRenderer::flushLayerChanges()
@@ -541,7 +607,7 @@ void LayerTreeRenderer::flushLayerChanges()
setAnimationsLocked(false);
m_rootLayer->flushCompositingState(FloatRect());
- commitTileOperations();
+ commitPendingBackingStoreOperations();
removeReleasedImageBackingsIfNeeded();
// The pending tiles state is on its way for the screen, tell the web process to render the next one.
@@ -586,8 +652,6 @@ void LayerTreeRenderer::syncRemoteContent()
for (size_t i = 0; i < renderQueue.size(); ++i)
renderQueue[i]();
-
- m_renderQueue.clear();
}
void LayerTreeRenderer::purgeGLResources()
@@ -608,6 +672,7 @@ void LayerTreeRenderer::purgeGLResources()
m_layers.clear();
m_fixedLayers.clear();
m_textureMapper.clear();
+ m_pendingSyncBackingStores.clear();
m_backingStoresWithPendingBuffers.clear();
setActive(false);
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
index b081c5e16..6f1056aac 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
@@ -41,6 +41,7 @@
namespace WebCore {
class CustomFilterProgram;
class CustomFilterProgramInfo;
+class TextureMapperLayer;
}
namespace WebKit {
@@ -138,14 +139,15 @@ private:
void renderNextFrame();
void purgeBackingStores();
-
void assignImageBackingToLayer(WebCore::GraphicsLayer*, CoordinatedImageBackingID);
void removeReleasedImageBackingsIfNeeded();
void ensureRootLayer();
void ensureLayer(WebLayerID);
- void commitTileOperations();
+ void commitPendingBackingStoreOperations();
- PassRefPtr<CoordinatedBackingStore> getBackingStore(WebCore::GraphicsLayer*);
+ CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*);
+ void prepareContentBackingStore(WebCore::GraphicsLayer*);
+ void createBackingStoreIfNeeded(WebCore::GraphicsLayer*);
void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*);
void resetBackingStoreSizeToLayerSize(WebCore::GraphicsLayer*);
@@ -163,6 +165,9 @@ private:
ImageBackingMap m_imageBackings;
Vector<RefPtr<CoordinatedBackingStore> > m_releasedImageBackings;
+ typedef HashMap<WebCore::TextureMapperLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap;
+ BackingStoreMap m_pendingSyncBackingStores;
+
HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers;
#if USE(GRAPHICS_SURFACE)
diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h
index 0c7b89017..dd0cd5a1c 100644
--- a/Source/WebKit2/UIProcess/PageClient.h
+++ b/Source/WebKit2/UIProcess/PageClient.h
@@ -211,7 +211,7 @@ public:
virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) = 0;
virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) = 0;
virtual CGContextRef containingWindowGraphicsContext() = 0;
- virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
+ virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&) = 0;
virtual void dismissDictionaryLookupPanel() = 0;
virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;
virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) = 0;
diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp
index 7c43a5546..ff135a2cf 100644
--- a/Source/WebKit2/UIProcess/PageViewportController.cpp
+++ b/Source/WebKit2/UIProcess/PageViewportController.cpp
@@ -195,8 +195,6 @@ void PageViewportController::didChangeViewportSize(const FloatSize& newSize)
// Let the WebProcess know about the new viewport size, so that
// it can resize the content accordingly.
m_webPageProxy->setViewportSize(roundedIntSize(newSize));
-
- syncVisibleContents();
}
void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewportPos, float viewportScale, const FloatPoint& trajectoryVector)
@@ -236,6 +234,8 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport
if (updateMinimumScaleToFit())
m_client->didChangeViewportAttributes();
+
+ syncVisibleContents();
}
WebCore::FloatSize PageViewportController::viewportSizeInContentsCoordinates() const
diff --git a/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp b/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp
index 679c6331d..8b4e3596f 100644
--- a/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp
@@ -207,7 +207,7 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData&
String output(reinterpret_cast<const UChar*>(outputBytes.constData()), outputBytes.size() / sizeof(UChar));
Vector<String> lines;
- output.split(UChar('\n'), lines);
+ output.split(UChar('\n'), true, lines);
ASSERT(lines.size() == 3);
result.name.swap(lines[0]);
diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
index d24c391cf..730dafeed 100644
--- a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
@@ -96,7 +96,7 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData&
free(stdOut);
Vector<String> lines;
- stdOutString.split(UChar('\n'), lines);
+ stdOutString.split(UChar('\n'), true, lines);
if (lines.size() < 3)
return false;
diff --git a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h
index 761c4a49c..29be36fc9 100644
--- a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h
+++ b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h
@@ -30,6 +30,10 @@
#include "WebPageGroupData.h"
#include "WebPageProxy.h"
+#if PLATFORM(MAC)
+#include "ObjCObjectGraphCoders.h"
+#endif
+
namespace WebKit {
// Adds
@@ -68,6 +72,13 @@ public:
encoder << pageGroup->data();
break;
}
+#if PLATFORM(MAC)
+ case APIObject::TypeObjCObjectGraph: {
+ ObjCObjectGraph* objectGraph = static_cast<ObjCObjectGraph*>(m_root);
+ encoder << WebContextObjCObjectGraphEncoder(objectGraph);
+ break;
+ }
+#endif
default:
ASSERT_NOT_REACHED();
break;
@@ -127,6 +138,16 @@ public:
coder.m_root = WebPageGroup::get(pageGroupID);
break;
}
+#if PLATFORM(MAC)
+ case APIObject::TypeObjCObjectGraph: {
+ RefPtr<ObjCObjectGraph> objectGraph;
+ WebContextObjCObjectGraphDecoder objectGraphDecoder(objectGraph, coder.m_process);
+ if (!decoder->decode(objectGraphDecoder))
+ return false;
+ coder.m_root = objectGraph.get();
+ break;
+ }
+#endif
default:
return false;
}
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 192c5cb7b..df416c09d 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -234,6 +234,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
, m_shouldSendEventsSynchronously(false)
, m_suppressVisibilityUpdates(false)
, m_mediaVolume(1)
+ , m_mayStartMediaWhenInWindow(true)
#if ENABLE(PAGE_VISIBILITY_API)
, m_visibilityState(PageVisibilityStateVisible)
#endif
@@ -296,11 +297,11 @@ bool WebPageProxy::isValid()
PassRefPtr<ImmutableArray> WebPageProxy::relatedPages() const
{
+ // pages() returns a list of pages in WebProcess, so this page may or may not be among them - a client can use a reference to WebPageProxy after the page has closed.
Vector<WebPageProxy*> pages = m_process->pages();
- ASSERT(pages.contains(this));
Vector<RefPtr<APIObject> > result;
- result.reserveCapacity(pages.size() - 1);
+ result.reserveCapacity(pages.size());
for (size_t i = 0; i < pages.size(); ++i) {
if (pages[i] != this)
result.append(pages[i]);
@@ -2782,6 +2783,19 @@ void WebPageProxy::setMediaVolume(float volume)
m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
}
+void WebPageProxy::setMayStartMediaWhenInWindow(bool mayStartMedia)
+{
+ if (mayStartMedia == m_mayStartMediaWhenInWindow)
+ return;
+
+ m_mayStartMediaWhenInWindow = mayStartMedia;
+
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::SetMayStartMediaWhenInWindow(mayStartMedia), m_pageID);
+}
+
#if PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK)
void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
{
@@ -3763,6 +3777,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
parameters.canRunModal = m_canRunModal;
parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
parameters.mediaVolume = m_mediaVolume;
+ parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow;
#if PLATFORM(MAC)
parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 91fad303e..9139b482e 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -736,6 +736,7 @@ public:
void printMainFrame();
void setMediaVolume(float);
+ void setMayStartMediaWhenInWindow(bool);
// WebPopupMenuProxy::Client
virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
@@ -754,6 +755,8 @@ public:
void endColorChooser();
#endif
+ const WebLoaderClient& loaderClient() { return m_loaderClient; }
+
private:
WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
@@ -948,7 +951,7 @@ private:
void searchWithSpotlight(const String&);
// Dictionary.
- void didPerformDictionaryLookup(const String&, const DictionaryPopupInfo&);
+ void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
#endif
// Spelling and grammar.
@@ -1238,6 +1241,7 @@ private:
bool m_suppressVisibilityUpdates;
float m_mediaVolume;
+ bool m_mayStartMediaWhenInWindow;
#if PLATFORM(QT)
WTF::HashSet<RefPtr<QtRefCountedNetworkRequestData> > m_applicationSchemeRequests;
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 7158d8127..f88eda49e 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -271,7 +271,7 @@ messages -> WebPageProxy {
#if PLATFORM(MAC)
# Dictionary support.
- DidPerformDictionaryLookup(WTF::String text, WebKit::DictionaryPopupInfo dictionaryPopupInfo)
+ DidPerformDictionaryLookup(WebKit::AttributedString text, WebKit::DictionaryPopupInfo dictionaryPopupInfo)
# Keyboard input support messages
InterpretQueuedKeyEvent(WebKit::EditorState state) -> (bool handled, Vector<WebCore::KeypressCommand> savedCommands)
diff --git a/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp b/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp
index 6f305bdd6..f62b8671a 100644
--- a/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp
+++ b/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp
@@ -49,7 +49,7 @@ void PageClientLegacyImpl::didCommitLoad()
void PageClientLegacyImpl::updateViewportSize(const WebCore::IntSize& size)
{
#if USE(TILED_BACKING_STORE)
- m_viewImpl->page()->drawingArea()->setVisibleContentsRect(IntRect(m_viewImpl->scrollPosition(), size), m_viewImpl->scaleFactor(), FloatPoint());
+ m_viewImpl->page()->drawingArea()->setVisibleContentsRect(IntRect(m_viewImpl->discretePagePosition(), size), m_viewImpl->scaleFactor(), FloatPoint());
#else
UNUSED_PARAM(size);
#endif
@@ -86,7 +86,7 @@ void PageClientLegacyImpl::didChangeContentsSize(const WebCore::IntSize& size)
#if USE(TILED_BACKING_STORE)
void PageClientLegacyImpl::pageDidRequestScroll(const IntPoint& position)
{
- m_viewImpl->setScrollPosition(position);
+ m_viewImpl->setPagePosition(FloatPoint(position));
m_viewImpl->update();
}
diff --git a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp
index cdd565008..fe2913969 100644
--- a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp
+++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp
@@ -40,7 +40,6 @@ namespace WebKit {
PageViewportControllerClientEfl::PageViewportControllerClientEfl(EwkViewImpl* viewImpl)
: m_viewImpl(viewImpl)
- , m_scaleFactor(1)
, m_controller(0)
{
ASSERT(m_viewImpl);
@@ -68,15 +67,6 @@ void PageViewportControllerClientEfl::updateViewportSize(const IntSize& viewport
m_controller->didChangeViewportSize(viewportSize);
}
-void PageViewportControllerClientEfl::setVisibleContentsRect(const IntPoint& newScrollPosition, float newScale, const FloatPoint& trajectory)
-{
- m_scaleFactor = newScale;
- m_scrollPosition = newScrollPosition;
-
- ASSERT(m_controller);
- m_controller->didChangeContentsVisibility(m_scrollPosition, m_scaleFactor, trajectory);
-}
-
void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize& contentsSize)
{
drawingArea()->layerTreeCoordinatorProxy()->setContentsSize(contentsSize);
@@ -85,25 +75,27 @@ void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSi
void PageViewportControllerClientEfl::setViewportPosition(const WebCore::FloatPoint& contentsPoint)
{
- IntPoint position(contentsPoint.x(), contentsPoint.y());
- setVisibleContentsRect(position, m_scaleFactor, FloatPoint());
- m_viewImpl->setScrollPosition(position);
+ m_contentPosition = roundedIntPoint(contentsPoint);
+
+ FloatPoint pos(contentsPoint);
+ pos.scale(scaleFactor(), scaleFactor());
+ m_viewImpl->setPagePosition(pos);
+
+ m_controller->didChangeContentsVisibility(m_contentPosition, scaleFactor());
}
void PageViewportControllerClientEfl::setContentsScale(float newScale, bool treatAsInitialValue)
{
- if (treatAsInitialValue) {
- m_scrollPosition = IntPoint();
- m_viewImpl->setScrollPosition(IntPoint());
- }
- m_scaleFactor = newScale;
+ if (treatAsInitialValue)
+ setViewportPosition(FloatPoint(0, 0));
+
m_viewImpl->setScaleFactor(newScale);
}
void PageViewportControllerClientEfl::didResumeContent()
{
ASSERT(m_controller);
- m_controller->didChangeContentsVisibility(m_scrollPosition, m_scaleFactor);
+ m_controller->didChangeContentsVisibility(m_contentPosition, scaleFactor());
}
void PageViewportControllerClientEfl::didChangeVisibleContents()
diff --git a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h
index ee9d37690..1ae6a541d 100644
--- a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h
+++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h
@@ -28,12 +28,11 @@
#if USE(TILED_BACKING_STORE)
+#include "EwkViewImpl.h"
#include "PageClientBase.h"
#include "PageViewportControllerClient.h"
#include <wtf/PassOwnPtr.h>
-class EwkViewImpl;
-
namespace WebKit {
class PageViewportControllerClientEfl : public PageViewportControllerClient {
@@ -46,11 +45,10 @@ public:
DrawingAreaProxy* drawingArea() const;
WebCore::IntSize viewSize() { return m_viewportSize; }
- float scaleFactor() const { return m_scaleFactor; }
- WebCore::IntPoint scrollPosition() { return m_scrollPosition; }
+ float scaleFactor() const { return m_viewImpl->scaleFactor(); }
+ WebCore::IntPoint contentPosition() const { return m_contentPosition; }
void updateViewportSize(const WebCore::IntSize& viewportSize);
- void setVisibleContentsRect(const WebCore::IntPoint&, float, const WebCore::FloatPoint&);
void setRendererActive(bool);
virtual void setViewportPosition(const WebCore::FloatPoint& contentsPoint);
@@ -68,8 +66,7 @@ private:
EwkViewImpl* m_viewImpl;
WebCore::IntSize m_viewportSize;
- WebCore::IntPoint m_scrollPosition;
- float m_scaleFactor;
+ WebCore::IntPoint m_contentPosition;
PageViewportController* m_controller;
};
diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h
index 9ce88ae5a..d832ab663 100644
--- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h
+++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h
@@ -38,13 +38,14 @@ class IntRect;
}
@class WKView;
+@class WebCoreFullScreenPlaceholderView;
@class WebWindowScaleAnimation;
@class WebWindowFadeAnimation;
-@interface WKFullScreenWindowController : NSWindowController {
+@interface WKFullScreenWindowController : NSWindowController<NSWindowDelegate> {
@private
WKView *_webView;
- RetainPtr<NSImageView> _webViewPlaceholder;
+ RetainPtr<WebCoreFullScreenPlaceholderView> _webViewPlaceholder;
RetainPtr<WebWindowScaleAnimation> _scaleAnimation;
RetainPtr<WebWindowFadeAnimation> _fadeAnimation;
RetainPtr<NSWindow> _backgroundWindow;
diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
index 238a67516..7a891cb71 100644
--- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
+++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
@@ -39,6 +39,8 @@
#import <WebCore/DisplaySleepDisabler.h>
#import <WebCore/FloatRect.h>
#import <WebCore/IntRect.h>
+#import <WebCore/LocalizedStrings.h>
+#import <WebCore/WebCoreFullScreenPlaceholderView.h>
#import <WebCore/WebCoreFullScreenWindow.h>
#import <WebCore/WebWindowAnimation.h>
#import <WebKit/WebNSWindowExtras.h>
@@ -53,8 +55,12 @@ static RetainPtr<NSWindow> createBackgroundFullscreenWindow(NSRect frame);
static const CFTimeInterval defaultAnimationDuration = 0.5;
static const NSTimeInterval DefaultWatchdogTimerInterval = 1;
+@interface NSWindow (WebNSWindowDetails)
+- (void)exitFullScreenMode:(id)sender;
+- (void)enterFullScreenMode:(id)sender;
+@end
+
@interface WKFullScreenWindowController(Private)<NSAnimationDelegate>
-- (void)_updateMenuAndDockForFullScreen;
- (void)_replaceView:(NSView*)view with:(NSView*)otherView;
- (WebPageProxy*)_page;
- (WebFullScreenManagerProxy*)_manager;
@@ -87,11 +93,12 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
#pragma mark Initialization
- (id)init
{
- NSWindow *window = [[WebCoreFullScreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
- self = [super initWithWindow:window];
- [window release];
+ RetainPtr<NSWindow> window = adoptNS([[WebCoreFullScreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+ self = [super initWithWindow:window.get()];
if (!self)
return nil;
+ [window.get() setDelegate:self];
+ [window.get() setCollectionBehavior:([window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary)];
[self windowDidLoad];
return self;
@@ -100,6 +107,7 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
- (void)dealloc
{
[self setWebView:nil];
+ [[self window] setDelegate:nil];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
@@ -174,7 +182,6 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
// the Dock's size or location, or they may have changed the fullScreen screen's dimensions.
// Update our presentation parameters, and ensure that the full screen window occupies the
// entire screen:
- [self _updateMenuAndDockForFullScreen];
NSWindow* window = [self window];
NSRect screenFrame = [[window screen] frame];
[window setFrame:screenFrame display:YES];
@@ -212,8 +219,6 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
return;
_isFullScreen = YES;
- [self _updateMenuAndDockForFullScreen];
-
if (!screen)
screen = [NSScreen mainScreen];
NSRect screenFrame = [screen frame];
@@ -246,11 +251,11 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
// Swap the webView placeholder into place.
if (!_webViewPlaceholder) {
- _webViewPlaceholder.adoptNS([[NSImageView alloc] init]);
- [_webViewPlaceholder.get() setLayer:[CALayer layer]];
- [_webViewPlaceholder.get() setWantsLayer:YES];
+ _webViewPlaceholder.adoptNS([[WebCoreFullScreenPlaceholderView alloc] initWithFrame:[_webView frame]]);
+ [_webViewPlaceholder.get() setTarget:self];
+ [_webViewPlaceholder.get() setAction:@selector(cancelOperation:)];
}
- [[_webViewPlaceholder.get() layer] setContents:(id)webViewContents.get()];
+ [_webViewPlaceholder.get() setContents:(id)webViewContents.get()];
[self _replaceView:_webView with:_webViewPlaceholder.get()];
// Then insert the WebView into the full screen window
@@ -273,9 +278,10 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
_initialFrame = initialFrame;
_finalFrame = finalFrame;
- [self _updateMenuAndDockForFullScreen];
+ if (!_backgroundWindow)
+ _backgroundWindow = createBackgroundFullscreenWindow(NSZeroRect);
- [self _startEnterFullScreenAnimationWithDuration:defaultAnimationDuration];
+ [[self window] enterFullScreenMode:self];
}
- (void)finishedEnterFullScreenAnimation:(bool)completed
@@ -294,24 +300,14 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
windowBounds.origin = NSZeroPoint;
WKWindowSetClipRect([self window], windowBounds);
- NSWindow *webWindow = [_webViewPlaceholder.get() window];
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
- // behavior here, making sure to reset the animation behavior afterward.
- NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
- [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
-#endif
- [webWindow orderOut:self];
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- [webWindow setAnimationBehavior:animationBehavior];
-#endif
-
[_fadeAnimation.get() stopAnimation];
[_fadeAnimation.get() setWindow:nil];
_fadeAnimation = nullptr;
[_backgroundWindow.get() orderOut:self];
[_backgroundWindow.get() setFrame:NSZeroRect display:YES];
+
+ [_webViewPlaceholder.get() setExitWarningVisible:YES];
NSEnableScreenUpdates();
} else
[_scaleAnimation.get() stopAnimation];
@@ -328,7 +324,9 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
return;
_isFullScreen = NO;
- // Screen updates to be re-enabled in _startExitFullScreenAnimationWithDuration:
+ [_webViewPlaceholder.get() setExitWarningVisible:NO];
+
+ // Screen updates to be re-enabled in _startExitFullScreenAnimationWithDuration: or beganExitFullScreenWithInitialFrame:finalFrame:
NSDisableScreenUpdates();
[[self window] setAutodisplay:NO];
@@ -349,30 +347,18 @@ static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage)
if (_isEnteringFullScreen)
[self finishedEnterFullScreenAnimation:NO];
- [self _updateMenuAndDockForFullScreen];
-
- NSWindow* webWindow = [_webViewPlaceholder.get() window];
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that
- // behavior here, making sure to reset the animation behavior afterward.
- NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior];
- [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
-#endif
- // If the user has moved the fullScreen window into a new space, temporarily change
- // the collectionBehavior of the webView's window so that it is pulled into the active space:
- if (!([webWindow respondsToSelector:@selector(isOnActiveSpace)] ? [webWindow isOnActiveSpace] : YES)) {
- NSWindowCollectionBehavior behavior = [webWindow collectionBehavior];
- [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
- [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
- [webWindow setCollectionBehavior:behavior];
- } else
- [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]];
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- [webWindow setAnimationBehavior:animationBehavior];
-#endif
+ if (![[self window] isOnActiveSpace]) {
+ // If the full screen window is not in the active space, the NSWindow full screen animation delegate methods
+ // will never be called. So call finishedExitFullScreenAnimation explicitly.
+ [self finishedExitFullScreenAnimation:YES];
- [self _startExitFullScreenAnimationWithDuration:defaultAnimationDuration];
+ // Because we are breaking the normal animation pattern, re-enable screen updates
+ // as exitFullScreen has disabled them, but _startExitFullScreenAnimationWithDuration:
+ // will never be called.
+ NSEnableScreenUpdates();
+ }
+
+ [[self window] exitFullScreenMode:self];
}
static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void*);
@@ -383,8 +369,6 @@ static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void*)
return;
_isExitingFullScreen = NO;
- [self _updateMenuAndDockForFullScreen];
-
// Screen updates to be re-enabled in completeFinishExitFullScreenAnimationAfterRepaint.
NSDisableScreenUpdates();
[[_webViewPlaceholder.get() window] setAutodisplay:NO];
@@ -444,46 +428,51 @@ static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void*
}
#pragma mark -
-#pragma mark NSAnimation delegate
+#pragma mark Custom NSWindow Full Screen Animation
-- (void)animationDidEnd:(NSAnimation*)animation
+- (NSArray *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
{
- if (_isFullScreen)
- [self finishedEnterFullScreenAnimation:YES];
- else
- [self finishedExitFullScreenAnimation:YES];
+ return [NSArray arrayWithObjects:[self window], _backgroundWindow.get(), nil];
}
-#pragma mark -
-#pragma mark Internal Interface
+- (NSArray *)customWindowsToExitFullScreenForWindow:(NSWindow *)window
+{
+ return [NSArray arrayWithObjects:[self window], _backgroundWindow.get(), nil];
+}
-- (void)_updateMenuAndDockForFullScreen
+- (void)window:(NSWindow *)window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration
{
- // NSApplicationPresentationOptions is available on > 10.6 only:
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
- NSScreen* fullScreenScreen = [[self window] screen];
-
- if (_isFullScreen) {
- // Auto-hide the menu bar if the fullScreenScreen contains the menu bar:
- // NOTE: if the fullScreenScreen contains the menu bar but not the dock, we must still
- // auto-hide the dock, or an exception will be thrown.
- if ([[NSScreen screens] objectAtIndex:0] == fullScreenScreen)
- options |= (NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock);
- // Check if the current screen contains the dock by comparing the screen's frame to its
- // visibleFrame; if a dock is present, the visibleFrame will differ. If the current screen
- // contains the dock, hide it.
- else if (!NSEqualRects([fullScreenScreen frame], [fullScreenScreen visibleFrame]))
- options |= NSApplicationPresentationAutoHideDock;
- }
-
- if ([NSApp respondsToSelector:@selector(setPresentationOptions:)])
- [NSApp setPresentationOptions:options];
- else
-#endif
- SetSystemUIMode(_isFullScreen ? kUIModeAllHidden : kUIModeNormal, 0);
+ [self _startEnterFullScreenAnimationWithDuration:duration];
+}
+
+- (void)window:(NSWindow *)window startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration
+{
+ [self _startExitFullScreenAnimationWithDuration:duration];
+}
+
+- (void)windowDidFailToEnterFullScreen:(NSWindow *)window
+{
+ [self finishedEnterFullScreenAnimation:NO];
+}
+
+- (void)windowDidEnterFullScreen:(NSNotification*)notification
+{
+ [self finishedEnterFullScreenAnimation:YES];
+}
+
+- (void)windowDidFailToExitFullScreen:(NSWindow *)window
+{
+ [self finishedExitFullScreenAnimation:NO];
}
+- (void)windowDidExitFullScreen:(NSNotification*)notification
+{
+ [self finishedExitFullScreenAnimation:YES];
+}
+
+#pragma mark -
+#pragma mark Internal Interface
+
- (WebPageProxy*)_page
{
return toImpl([_webView pageRef]);
@@ -543,7 +532,6 @@ static NSRect windowFrameFromApparentFrames(NSRect screenFrame, NSRect initialFr
_scaleAnimation.adoptNS([[WebWindowScaleAnimation alloc] initWithHintedDuration:duration window:[self window] initalFrame:initialWindowFrame finalFrame:screenFrame]);
[_scaleAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
- [_scaleAnimation.get() setDelegate:self];
[_scaleAnimation.get() setCurrentProgress:0];
[_scaleAnimation.get() startAnimation];
@@ -596,7 +584,6 @@ static NSRect windowFrameFromApparentFrames(NSRect screenFrame, NSRect initialFr
_scaleAnimation.adoptNS([[WebWindowScaleAnimation alloc] initWithHintedDuration:duration window:[self window] initalFrame:currentFrame finalFrame:initialWindowFrame]);
[_scaleAnimation.get() setAnimationBlockingMode:NSAnimationNonblocking];
- [_scaleAnimation.get() setDelegate:self];
[_scaleAnimation.get() setCurrentProgress:0];
[_scaleAnimation.get() startAnimation];
diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
index 6f0956e6d..137c22f2c 100644
--- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
@@ -400,9 +400,9 @@ void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled)
process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID);
}
-void WebPageProxy::didPerformDictionaryLookup(const String& text, const DictionaryPopupInfo& dictionaryPopupInfo)
+void WebPageProxy::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo)
{
- m_pageClient->didPerformDictionaryLookup(text, m_pageScaleFactor, dictionaryPopupInfo);
+ m_pageClient->didPerformDictionaryLookup(text, dictionaryPopupInfo);
}
void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataReference& data)