summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--Source/WebCore/ChangeLog50
-rw-r--r--Source/WebCore/WebCore.exp.in2
-rw-r--r--Source/WebCore/bindings/scripts/CodeGeneratorV8.pm5
-rw-r--r--Source/WebCore/dom/ViewportArguments.cpp28
-rw-r--r--Source/WebCore/dom/ViewportArguments.h6
-rw-r--r--Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h4
-rw-r--r--Source/WebCore/testing/InternalSettings.cpp2
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.cpp11
-rw-r--r--Source/WebKit/chromium/src/ChromeClientImpl.cpp7
-rw-r--r--Source/WebKit/efl/ChangeLog11
-rw-r--r--Source/WebKit/efl/ewk/ewk_view.cpp9
-rw-r--r--Source/WebKit/gtk/ChangeLog11
-rw-r--r--Source/WebKit/gtk/webkit/webkitviewportattributes.cpp7
-rw-r--r--Source/WebKit/qt/Api/qwebpage.cpp10
-rw-r--r--Source/WebKit/qt/ChangeLog15
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp5
-rw-r--r--Source/WebKit2/ChangeLog95
-rw-r--r--Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context.cpp289
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp41
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_private.h91
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp23
-rw-r--r--Source/WebKit2/UIProcess/PageViewportController.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp1
-rw-r--r--Source/WebKit2/win/WebKit2.def2
-rw-r--r--Source/WebKit2/win/WebKit2CFLite.def2
-rw-r--r--Source/autotools/symbols.filter2
-rw-r--r--Tools/ChangeLog9
-rw-r--r--Tools/qmake/mkspecs/features/features.prf7
32 files changed, 540 insertions, 245 deletions
diff --git a/ChangeLog b/ChangeLog
index 12a41fb61..ec3f010c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-10-23 Andras Becsi <andras.becsi@digia.com>
+
+ Remove devicePixelRatio from ViewportAttributes
+ https://bugs.webkit.org/show_bug.cgi?id=99845
+
+ Reviewed by Adam Barth.
+
+ * Source/autotools/symbols.filter: Update symbol.
+
2012-10-22 Pavel Feldman <pfeldman@chromium.org>
Web Inspector: merge "docked" state into the "dock side" enum.
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index df6e122eb..c654f137d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,53 @@
+2012-10-23 Simon Hausmann <simon.hausmann@digia.com>
+
+ Unreviewed trivial Qt build fix: Fix build without USE_3D_GRAPHICS
+
+ Move the #if USE(GRAPHICS_SURFACE) up to protect the inclusion of
+ GraphicsContext3D.h to be done only if we use the surface.
+
+ * platform/graphics/surfaces/GraphicsSurface.h:
+
+2012-10-23 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r132033.
+ http://trac.webkit.org/changeset/132033
+ https://bugs.webkit.org/show_bug.cgi?id=100097
+
+ Broke calendar picker (Requested by tkent on #webkit).
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateImplementation):
+
+2012-10-23 Andras Becsi <andras.becsi@digia.com>
+
+ Remove devicePixelRatio from ViewportAttributes
+ https://bugs.webkit.org/show_bug.cgi?id=99845
+
+ Reviewed by Adam Barth.
+
+ Since r121555 the devicePixelRatio is not calculated any more
+ and the scale factor is stored in Page::m_deviceScaleFactor,
+ thus it can be removed from ViewportAttributes to reduce
+ redundancy and unnecessary client code.
+ Use a new parameter in viewport calculation functions using
+ the visible viewport size (instead of passing the adjusted
+ viewport size) so that after this change clients do not end
+ up using the unadjusted viewport size for calculations.
+
+ No behavioural change, no new tests needed.
+
+ * WebCore.exp.in:
+ * dom/ViewportArguments.cpp:
+ (WebCore::computeViewportAttributes):
+ (WebCore::computeMinimumScaleFactorForContentContained):
+ Add the devicePixelRatio as a parameter.
+ (WebCore::restrictMinimumScaleFactorToViewportSize): Ditto.
+ * dom/ViewportArguments.h:
+ (ViewportAttributes):
+ (WebCore):
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::configurationForViewport):
+
2012-10-23 Kent Tamura <tkent@chromium.org>
Support full month names in DateTimeEditElement, and use them in input[type=month] by default
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index 278d224c9..2677c88a6 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -656,7 +656,7 @@ __ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope11moveWidgetsEv
__ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE
__ZN7WebCore3macERKNS_10CredentialE
__ZN7WebCore3macERKNS_23AuthenticationChallengeE
-__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
+__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf
__ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURLl
__ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString
__ZN7WebCore4Font11setCodePathENS0_8CodePathE
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
index a90306cd4..b3f30c6a0 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -3057,9 +3057,8 @@ END
void ${className}::installPerContextProperties(v8::Handle<v8::Object> instance, ${nativeType}* impl)
{
v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype());
- ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationContext());
// When building QtWebkit with V8 this variable is unused when none of the features are enabled.
- UNUSED_PARAM(context);
+ UNUSED_PARAM(proto);
END
# Setup the enable-by-settings attrs if we have them
@@ -3067,7 +3066,7 @@ END
my $enableFunction = GetContextEnableFunction($runtimeAttr->signature);
my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeAttr->signature);
push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
- push(@implContent, " if (context && context->isDocument() && ${enableFunction}(static_cast<Document*>(context))) {\n");
+ push(@implContent, " if (${enableFunction}(impl->document())) {\n");
push(@implContent, " static const V8DOMConfiguration::BatchedAttribute attrData =\\\n");
GenerateSingleBatchedAttribute($interfaceName, $runtimeAttr, ";", " ");
push(@implContent, <<END);
diff --git a/Source/WebCore/dom/ViewportArguments.cpp b/Source/WebCore/dom/ViewportArguments.cpp
index dc16bd63a..0151294cc 100644
--- a/Source/WebCore/dom/ViewportArguments.cpp
+++ b/Source/WebCore/dom/ViewportArguments.cpp
@@ -52,14 +52,12 @@ ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktop
ASSERT(availableWidth > 0 && availableHeight > 0);
- result.devicePixelRatio = devicePixelRatio;
-
// Resolve non-'auto' width and height to pixel values.
- if (result.devicePixelRatio != 1.0) {
- availableWidth /= result.devicePixelRatio;
- availableHeight /= result.devicePixelRatio;
- deviceWidth /= result.devicePixelRatio;
- deviceHeight /= result.devicePixelRatio;
+ if (devicePixelRatio != 1.0) {
+ availableWidth /= devicePixelRatio;
+ availableHeight /= devicePixelRatio;
+ deviceWidth /= devicePixelRatio;
+ deviceHeight /= devicePixelRatio;
}
switch (int(args.width)) {
@@ -158,27 +156,27 @@ ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktop
return result;
}
-float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentsSize)
+float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentsSize, float devicePixelRatio)
{
float availableWidth = viewportSize.width();
float availableHeight = viewportSize.height();
- if (result.devicePixelRatio != 1.0) {
- availableWidth /= result.devicePixelRatio;
- availableHeight /= result.devicePixelRatio;
+ if (devicePixelRatio != 1.0) {
+ availableWidth /= devicePixelRatio;
+ availableHeight /= devicePixelRatio;
}
return max<float>(result.minimumScale, max(availableWidth / contentsSize.width(), availableHeight / contentsSize.height()));
}
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport)
+void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio)
{
float availableWidth = visibleViewport.width();
float availableHeight = visibleViewport.height();
- if (result.devicePixelRatio != 1.0) {
- availableWidth /= result.devicePixelRatio;
- availableHeight /= result.devicePixelRatio;
+ if (devicePixelRatio != 1.0) {
+ availableWidth /= devicePixelRatio;
+ availableHeight /= devicePixelRatio;
}
result.minimumScale = max<float>(result.minimumScale, max(availableWidth / result.layoutSize.width(), availableHeight / result.layoutSize.height()));
diff --git a/Source/WebCore/dom/ViewportArguments.h b/Source/WebCore/dom/ViewportArguments.h
index 94fb1fab8..fc0d125f0 100644
--- a/Source/WebCore/dom/ViewportArguments.h
+++ b/Source/WebCore/dom/ViewportArguments.h
@@ -45,8 +45,6 @@ enum ViewportErrorCode {
struct ViewportAttributes {
FloatSize layoutSize;
- float devicePixelRatio;
-
float initialScale;
float minimumScale;
float maximumScale;
@@ -116,9 +114,9 @@ struct ViewportArguments {
ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport);
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport);
+void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio);
void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
-float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentSize);
+float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentSize, float devicePixelRatio);
void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);
diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
index bdbb34eb9..13ac33051 100644
--- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
+++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
@@ -20,6 +20,8 @@
#ifndef GraphicsSurface_h
#define GraphicsSurface_h
+#if USE(GRAPHICS_SURFACE)
+
#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "GraphicsSurfaceToken.h"
@@ -29,8 +31,6 @@
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#if USE(GRAPHICS_SURFACE)
-
#if OS(DARWIN)
typedef struct __IOSurface* IOSurfaceRef;
typedef IOSurfaceRef PlatformGraphicsSurface;
diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp
index 8d8f0cb40..d101e2a59 100644
--- a/Source/WebCore/testing/InternalSettings.cpp
+++ b/Source/WebCore/testing/InternalSettings.cpp
@@ -645,7 +645,7 @@ String InternalSettings::configurationForViewport(float devicePixelRatio, int de
ViewportArguments arguments = page()->viewportArguments();
ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));
- restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight));
+ restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio);
restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp
index d2b7f7898..d008c02df 100644
--- a/Source/WebKit/blackberry/Api/WebPage.cpp
+++ b/Source/WebKit/blackberry/Api/WebPage.cpp
@@ -3445,16 +3445,17 @@ IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments()
int desktopWidth = DEFAULT_MAX_LAYOUT_WIDTH;
int deviceWidth = Platform::Graphics::Screen::primaryScreen()->width();
int deviceHeight = Platform::Graphics::Screen::primaryScreen()->height();
- ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, m_webSettings->devicePixelRatio(), m_defaultLayoutSize);
- m_page->setDeviceScaleFactor(result.devicePixelRatio);
+ float devicePixelRatio = m_webSettings->devicePixelRatio();
+ ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, devicePixelRatio, m_defaultLayoutSize);
+ m_page->setDeviceScaleFactor(devicePixelRatio);
setUserScalable(m_webSettings->isUserScalable() && result.userScalable);
if (result.initialScale > 0)
- setInitialScale(result.initialScale * result.devicePixelRatio);
+ setInitialScale(result.initialScale * devicePixelRatio);
if (result.minimumScale > 0)
- setMinimumScale(result.minimumScale * result.devicePixelRatio);
+ setMinimumScale(result.minimumScale * devicePixelRatio);
if (result.maximumScale > 0)
- setMaximumScale(result.maximumScale * result.devicePixelRatio);
+ setMaximumScale(result.maximumScale * devicePixelRatio);
return IntSize(result.layoutSize.width(), result.layoutSize.height());
}
diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
index 9d0961c46..9d8a656bd 100644
--- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -647,10 +647,11 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen
return;
Settings* settings = m_webView->page()->settings();
+ float devicePixelRatio = dpi / ViewportArguments::deprecatedTargetDPI;
// Call the common viewport computing logic in ViewportArguments.cpp.
ViewportAttributes computed = computeViewportAttributes(
args, settings->layoutFallbackWidth(), deviceRect.width, deviceRect.height,
- dpi / ViewportArguments::deprecatedTargetDPI, IntSize(deviceRect.width, deviceRect.height));
+ devicePixelRatio, IntSize(deviceRect.width, deviceRect.height));
restrictScaleFactorToInitialScaleIfNotUserScalable(computed);
@@ -664,10 +665,10 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen
m_webView->setFixedLayoutSize(IntSize(layoutWidth, layoutHeight));
bool needInitializePageScale = !m_webView->isPageScaleFactorSet();
- m_webView->setDeviceScaleFactor(computed.devicePixelRatio);
+ m_webView->setDeviceScaleFactor(devicePixelRatio);
m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumScale);
if (needInitializePageScale)
- m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio);
+ m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * devicePixelRatio);
#endif
}
diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog
index 77773bf25..e84aa244b 100644
--- a/Source/WebKit/efl/ChangeLog
+++ b/Source/WebKit/efl/ChangeLog
@@ -1,3 +1,14 @@
+2012-10-23 Andras Becsi <andras.becsi@digia.com>
+
+ Remove devicePixelRatio from ViewportAttributes
+ https://bugs.webkit.org/show_bug.cgi?id=99845
+
+ Reviewed by Adam Barth.
+
+ * ewk/ewk_view.cpp:
+ (_ewk_view_viewport_attributes_compute):
+ Pass the device pixel ratio as a function argument.
+
2012-10-22 Ryuan Choi <ryuan.choi@gmail.com>
[EFL] pc files should use DATA_INSTALL_DIR for datadir
diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp
index 3a8b7138c..392199c11 100644
--- a/Source/WebKit/efl/ewk/ewk_view.cpp
+++ b/Source/WebKit/efl/ewk/ewk_view.cpp
@@ -1271,16 +1271,17 @@ static void _ewk_view_zoom_animation_start(Ewk_View_Smart_Data* smartData)
(_ewk_view_zoom_animator_cb, smartData);
}
-static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(const Ewk_View_Private_Data* priv)
+static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(Ewk_View_Private_Data* priv)
{
int desktopWidth = 980;
int deviceDPI = WebCore::getDPI();
+ priv->settings.devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI;
WebCore::IntRect availableRect = enclosingIntRect(priv->page->chrome()->client()->pageRect());
WebCore::IntRect deviceRect = enclosingIntRect(priv->page->chrome()->client()->windowRect());
- WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI, availableRect.size());
- WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size());
+ WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), priv->settings.devicePixelRatio, availableRect.size());
+ WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size(), priv->settings.devicePixelRatio);
WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
return attributes;
@@ -3977,7 +3978,7 @@ void ewk_view_viewport_attributes_get(const Evas_Object* ewkView, int* width, in
if (minScale)
*minScale = attributes.minimumScale;
if (devicePixelRatio)
- *devicePixelRatio = attributes.devicePixelRatio;
+ *devicePixelRatio = priv->settings.devicePixelRatio;
if (userScalable)
*userScalable = static_cast<bool>(attributes.userScalable);
}
diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog
index f66a29871..f10856446 100644
--- a/Source/WebKit/gtk/ChangeLog
+++ b/Source/WebKit/gtk/ChangeLog
@@ -1,3 +1,14 @@
+2012-10-23 Andras Becsi <andras.becsi@digia.com>
+
+ Remove devicePixelRatio from ViewportAttributes
+ https://bugs.webkit.org/show_bug.cgi?id=99845
+
+ Reviewed by Adam Barth.
+
+ * webkit/webkitviewportattributes.cpp:
+ (webkitViewportAttributesRecompute):
+ Pass the device pixel ratio as a function argument.
+
2012-10-22 Jocelyn Turcotte <jocelyn.turcotte@digia.com>
[Qt] Fix "ASSERTION FAILED: !document->inPageCache()" when loading a page
diff --git a/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp b/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp
index 138bdc321..d1a837869 100644
--- a/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp
+++ b/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp
@@ -534,8 +534,9 @@ void webkitViewportAttributesRecompute(WebKitViewportAttributes* viewportAttribu
ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
- ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, priv->deviceDPI / ViewportArguments::deprecatedTargetDPI, IntSize(priv->availableWidth, priv->availableHeight));
- restrictMinimumScaleFactorToViewportSize(attributes, IntSize(priv->availableWidth, priv->availableHeight));
+ float devicePixelRatio = priv->deviceDPI / ViewportArguments::deprecatedTargetDPI;
+ ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, devicePixelRatio, IntSize(priv->availableWidth, priv->availableHeight));
+ restrictMinimumScaleFactorToViewportSize(attributes, IntSize(priv->availableWidth, priv->availableHeight), devicePixelRatio);
restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
priv->width = attributes.layoutSize.width();
@@ -543,7 +544,7 @@ void webkitViewportAttributesRecompute(WebKitViewportAttributes* viewportAttribu
priv->initialScaleFactor = attributes.initialScale;
priv->minimumScaleFactor = attributes.minimumScale;
priv->maximumScaleFactor = attributes.maximumScale;
- priv->devicePixelRatio = attributes.devicePixelRatio;
+ priv->devicePixelRatio = devicePixelRatio;
priv->userScalable = static_cast<bool>(arguments.userScalable);
if (!priv->isValid) {
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp
index a9eb9a099..c2c9823f9 100644
--- a/Source/WebKit/qt/Api/qwebpage.cpp
+++ b/Source/WebKit/qt/Api/qwebpage.cpp
@@ -2581,8 +2581,10 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av
deviceHeight = size.height();
}
- WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, qt_defaultDpi() / WebCore::ViewportArguments::deprecatedTargetDPI, availableSize);
- WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+ float devicePixelRatio = qt_defaultDpi() / WebCore::ViewportArguments::deprecatedTargetDPI;
+
+ WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, devicePixelRatio, availableSize);
+ WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio);
WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
result.m_isValid = true;
@@ -2590,10 +2592,10 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av
result.m_initialScaleFactor = conf.initialScale;
result.m_minimumScaleFactor = conf.minimumScale;
result.m_maximumScaleFactor = conf.maximumScale;
- result.m_devicePixelRatio = conf.devicePixelRatio;
+ result.m_devicePixelRatio = devicePixelRatio;
result.m_isUserScalable = static_cast<bool>(conf.userScalable);
- d->page->setDeviceScaleFactor(conf.devicePixelRatio);
+ d->page->setDeviceScaleFactor(devicePixelRatio);
return result;
}
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index 4cc7e72c2..9a085047c 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,18 @@
+2012-10-23 Andras Becsi <andras.becsi@digia.com>
+
+ Remove devicePixelRatio from ViewportAttributes
+ https://bugs.webkit.org/show_bug.cgi?id=99845
+
+ Reviewed by Adam Barth.
+
+ Pass the device pixel ratio as a function argument to
+ match the new API.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::viewportAttributesForSize):
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+ (DumpRenderTreeSupportQt::viewportAsText):
+
2012-10-23 Simon Hausmann <simon.hausmann@digia.com>
Unreviewed build fix with newer Qt 5.
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 77a5c2994..c5adc9aac 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -689,13 +689,14 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c
{
WebCore::ViewportArguments args = page->d->viewportArguments();
+ float devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI;
WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args,
/* desktop-width */ 980,
/* device-width */ deviceSize.width(),
/* device-height */ deviceSize.height(),
- /* devicePixelRatio */ deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI,
+ devicePixelRatio,
availableSize);
- WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+ WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio);
WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
QString res;
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index fd2f47ef0..04a92a04e 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,98 @@
+2012-10-23 Andras Becsi <andras.becsi@digia.com>
+
+ Remove devicePixelRatio from ViewportAttributes
+ https://bugs.webkit.org/show_bug.cgi?id=99845
+
+ Reviewed by Adam Barth.
+
+ Update PageViewportController and co. to pass the device pixel ratio
+ as an argument to functions that need to adjust the visible viewport size.
+
+ * UIProcess/PageViewportController.cpp:
+ (WebKit::PageViewportController::PageViewportController):
+ (WebKit::PageViewportController::updateMinimumScaleToFit):
+ * UIProcess/qt/PageViewportControllerClientQt.cpp:
+ (WebKit::PageViewportControllerClientQt::didChangeViewportAttributes):
+
+2012-10-23 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
+
+ [EFL][WK2] Refactor Ewk_Context
+ https://bugs.webkit.org/show_bug.cgi?id=99594
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Ewk_Context is now encapsulated to a C++ class inherited from WTF::RefCounted.
+ Also the same instance of Ewk_Context is returned for the same instance of
+ WKContext, so memory leak in ewk_view is also fixed.
+
+ * UIProcess/API/efl/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::handleDownloadRequest):
+ * UIProcess/API/efl/ewk_context.cpp:
+ (contextMap):
+ (Ewk_Context::Ewk_Context):
+ (Ewk_Context::~Ewk_Context):
+ (Ewk_Context::create):
+ (Ewk_Context::defaultContext):
+ (Ewk_Context::cookieManager):
+ (Ewk_Context::faviconDatabase):
+ (Ewk_Context::registerURLScheme):
+ (Ewk_Context::vibrationProvider):
+ (Ewk_Context::addVisitedLink):
+ (Ewk_Context::setCacheModel):
+ (Ewk_Context::cacheModel):
+ (ewk_context_ref):
+ (ewk_context_unref):
+ (ewk_context_cookie_manager_get):
+ (ewk_context_favicon_database_get):
+ (Ewk_Context::wkContext):
+ (Ewk_Context::addDownloadJob):
+ (Ewk_Context::downloadJob):
+ (Ewk_Context::removeDownloadJob):
+ (Ewk_Context::requestManager):
+ (Ewk_Context::urlSchemeRequestReceived):
+ (ewk_context_default_get):
+ (ewk_context_new):
+ (ewk_context_new_with_injected_bundle_path):
+ (ewk_context_url_scheme_register):
+ (ewk_context_vibration_client_callbacks_set):
+ (ewk_context_history_callbacks_set):
+ (ewk_context_visited_link_add):
+ (ewk_context_cache_model_set):
+ (ewk_context_cache_model_get):
+ * UIProcess/API/efl/ewk_context_download_client.cpp:
+ (decideDestinationWithSuggestedFilename):
+ (didReceiveResponse):
+ (didCreateDestination):
+ (didReceiveData):
+ (didFail):
+ (didCancel):
+ (didFinish):
+ (ewk_context_download_client_attach):
+ * UIProcess/API/efl/ewk_context_history_client.cpp:
+ (getEwkHistoryClient):
+ (didNavigateWithNavigationData):
+ (didPerformClientRedirect):
+ (didPerformServerRedirect):
+ (didUpdateHistoryTitle):
+ (populateVisitedLinks):
+ (ewk_context_history_client_attach):
+ * UIProcess/API/efl/ewk_context_private.h:
+ (Ewk_Context):
+ (Ewk_Context::historyClient):
+ * UIProcess/API/efl/ewk_context_request_manager_client.cpp:
+ (didReceiveURIRequest):
+ (ewk_context_request_manager_client_attach):
+ * UIProcess/API/efl/ewk_view.cpp:
+ (Ewk_View_Private_Data):
+ (Ewk_View_Private_Data::Ewk_View_Private_Data):
+ (Ewk_View_Private_Data::~Ewk_View_Private_Data):
+ (_ewk_view_priv_del):
+ (_ewk_view_initialize):
+ (ewk_view_base_add):
+ (ewk_view_add_with_context):
+ (ewk_view_context_get):
+ (ewk_view_update_icon):
+
2012-10-23 Christophe Dumez <christophe.dumez@intel.com>
[EFL][WK2] Make page load client a C++ class
diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
index 0ca7569b9..054bfcbf7 100644
--- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
@@ -284,7 +284,7 @@ void PageClientImpl::countStringMatchesInCustomRepresentation(const String&, Fin
void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
{
RefPtr<Ewk_Download_Job> ewkDownload = Ewk_Download_Job::create(download, m_viewWidget);
- ewk_context_download_job_add(ewk_view_context_get(m_viewWidget), ewkDownload.get());
+ ewk_view_context_get(m_viewWidget)->addDownloadJob(ewkDownload.get());
}
#if USE(TILED_BACKING_STORE)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
index 9fb889213..32991c5c8 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
@@ -31,6 +31,7 @@
#include "WKString.h"
#include "WebContext.h"
#include "WebIconDatabase.h"
+#include "WebSoupRequestManagerProxy.h"
#include "ewk_context_download_client_private.h"
#include "ewk_context_history_client_private.h"
#include "ewk_context_private.h"
@@ -69,148 +70,199 @@ struct Ewk_Url_Scheme_Handler {
{ }
};
-typedef HashMap<String, Ewk_Url_Scheme_Handler> URLSchemeHandlerMap;
+typedef HashMap<WKContextRef, Ewk_Context*> ContextMap;
-struct Ewk_Context {
- unsigned __ref; /**< the reference count of the object */
- WKRetainPtr<WKContextRef> context;
-
- OwnPtr<Ewk_Cookie_Manager> cookieManager;
- OwnPtr<Ewk_Favicon_Database> faviconDatabase;
-#if ENABLE(BATTERY_STATUS)
- RefPtr<BatteryProvider> batteryProvider;
-#endif
-#if ENABLE(NETWORK_INFO)
- RefPtr<NetworkInfoProvider> networkInfoProvider;
-#endif
-#if ENABLE(VIBRATION)
- RefPtr<VibrationProvider> vibrationProvider;
-#endif
- HashMap<uint64_t, RefPtr<Ewk_Download_Job> > downloadJobs;
-
- WKRetainPtr<WKSoupRequestManagerRef> requestManager;
- URLSchemeHandlerMap urlSchemeHandlers;
+static inline ContextMap& contextMap()
+{
+ DEFINE_STATIC_LOCAL(ContextMap, map, ());
+ return map;
+}
- Ewk_Context_History_Client historyClient;
+Ewk_Context::Ewk_Context(WKContextRef context)
+ : m_context(context)
+ , m_requestManager(WKContextGetSoupRequestManager(context))
+ , m_historyClient()
+{
+ ContextMap::AddResult result = contextMap().add(context, this);
+ ASSERT_UNUSED(result, result.isNewEntry);
- Ewk_Context(WKRetainPtr<WKContextRef> contextRef)
- : __ref(1)
- , context(contextRef)
- , requestManager(WKContextGetSoupRequestManager(contextRef.get()))
- , historyClient()
- {
#if ENABLE(BATTERY_STATUS)
- batteryProvider = BatteryProvider::create(context.get());
+ m_batteryProvider = BatteryProvider::create(context);
#endif
#if ENABLE(NETWORK_INFO)
- networkInfoProvider = NetworkInfoProvider::create(context.get());
+ m_networkInfoProvider = NetworkInfoProvider::create(context);
#endif
#if ENABLE(VIBRATION)
- vibrationProvider = VibrationProvider::create(context.get());
+ m_vibrationProvider = VibrationProvider::create(context);
#endif
#if ENABLE(MEMORY_SAMPLER)
- static bool initializeMemorySampler = false;
- static const char environmentVariable[] = "SAMPLE_MEMORY";
+ static bool initializeMemorySampler = false;
+ static const char environmentVariable[] = "SAMPLE_MEMORY";
- if (!initializeMemorySampler && getenv(environmentVariable)) {
- WKRetainPtr<WKDoubleRef> interval(AdoptWK, WKDoubleCreate(0.0));
- WKContextStartMemorySampler(context.get(), interval.get());
- initializeMemorySampler = true;
- }
+ if (!initializeMemorySampler && getenv(environmentVariable)) {
+ WKRetainPtr<WKDoubleRef> interval(AdoptWK, WKDoubleCreate(0.0));
+ WKContextStartMemorySampler(context, interval.get());
+ initializeMemorySampler = true;
+ }
#endif
- ewk_context_request_manager_client_attach(this);
- ewk_context_download_client_attach(this);
- ewk_context_history_client_attach(this);
+
#if ENABLE(SPELLCHECK)
- ewk_text_checker_client_attach();
- if (ewk_settings_continuous_spell_checking_enabled_get()) {
- // Load the default language.
- ewk_settings_spell_checking_languages_set(0);
- }
-#endif
+ ewk_text_checker_client_attach();
+ if (ewk_settings_continuous_spell_checking_enabled_get()) {
+ // Load the default language.
+ ewk_settings_spell_checking_languages_set(0);
}
-};
+#endif
-Ewk_Context* ewk_context_ref(Ewk_Context* ewkContext)
+ ewk_context_request_manager_client_attach(this);
+ ewk_context_download_client_attach(this);
+ ewk_context_history_client_attach(this);
+}
+
+Ewk_Context::~Ewk_Context()
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
- ++ewkContext->__ref;
+ ASSERT(contextMap().get(m_context.get()) == this);
+ contextMap().remove(m_context.get());
+}
- return ewkContext;
+PassRefPtr<Ewk_Context> Ewk_Context::create(WKContextRef context)
+{
+ if (contextMap().contains(context))
+ return contextMap().get(context); // Will be ref-ed automatically.
+
+ return adoptRef(new Ewk_Context(context));
}
-void ewk_context_unref(Ewk_Context* ewkContext)
+PassRefPtr<Ewk_Context> Ewk_Context::create()
{
- EINA_SAFETY_ON_NULL_RETURN(ewkContext);
- EINA_SAFETY_ON_FALSE_RETURN(ewkContext->__ref > 0);
+ return create(adoptWK(WKContextCreate()).get());
+}
- if (--ewkContext->__ref)
- return;
+PassRefPtr<Ewk_Context> Ewk_Context::create(const String& injectedBundlePath)
+{
+ if (!fileExists(injectedBundlePath))
+ return 0;
+
+ WKRetainPtr<WKStringRef> injectedBundlePathWK = adoptWK(toCopiedAPI(injectedBundlePath));
+ WKRetainPtr<WKContextRef> contextWK = adoptWK(WKContextCreateWithInjectedBundlePath(injectedBundlePathWK.get()));
- delete ewkContext;
+ return create(contextWK.get());
}
-Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext)
+PassRefPtr<Ewk_Context> Ewk_Context::defaultContext()
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
-
- if (!ewkContext->cookieManager)
- const_cast<Ewk_Context*>(ewkContext)->cookieManager = Ewk_Cookie_Manager::create(WKContextGetCookieManager(ewkContext->context.get()));
+ static RefPtr<Ewk_Context> defaultInstance = create(adoptWK(WKContextCreate()).get());
- return ewkContext->cookieManager.get();
+ return defaultInstance;
}
-Ewk_Favicon_Database* ewk_context_favicon_database_get(const Ewk_Context* ewkContext)
+Ewk_Cookie_Manager* Ewk_Context::cookieManager()
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
+ if (!m_cookieManager)
+ m_cookieManager = Ewk_Cookie_Manager::create(WKContextGetCookieManager(m_context.get()));
+
+ return m_cookieManager.get();
+}
- if (!ewkContext->faviconDatabase) {
- WKRetainPtr<WKIconDatabaseRef> iconDatabase = WKContextGetIconDatabase(ewkContext->context.get());
+Ewk_Favicon_Database* Ewk_Context::faviconDatabase()
+{
+ if (!m_faviconDatabase) {
+ WKRetainPtr<WKIconDatabaseRef> iconDatabase = WKContextGetIconDatabase(m_context.get());
// Set the database path if it is not open yet.
if (!toImpl(iconDatabase.get())->isOpen()) {
- WebContext* webContext = toImpl(ewkContext->context.get());
+ WebContext* webContext = toImpl(m_context.get());
String databasePath = webContext->iconDatabasePath() + "/" + WebCore::IconDatabase::defaultDatabaseFilename();
webContext->setIconDatabasePath(databasePath);
}
- const_cast<Ewk_Context*>(ewkContext)->faviconDatabase = Ewk_Favicon_Database::create(iconDatabase.get());
+ m_faviconDatabase = Ewk_Favicon_Database::create(iconDatabase.get());
}
- return ewkContext->faviconDatabase.get();
+ return m_faviconDatabase.get();
}
-WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext)
+bool Ewk_Context::registerURLScheme(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData)
{
- return ewkContext->context.get();
+ EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
+
+ m_urlSchemeHandlers.set(scheme, Ewk_Url_Scheme_Handler(callback, userData));
+ toImpl(m_requestManager.get())->registerURIScheme(scheme);
+
+ return true;
}
-/**
- * @internal
- * Create Ewk_Context from WKContext.
- */
-Ewk_Context* ewk_context_new_from_WKContext(WKContextRef contextRef)
+#if ENABLE(VIBRATION)
+PassRefPtr<VibrationProvider> Ewk_Context::vibrationProvider()
+{
+ return m_vibrationProvider;
+}
+#endif
+
+void Ewk_Context::addVisitedLink(const String& visitedURL)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
+ toImpl(m_context.get())->addVisitedLink(visitedURL);
+}
+
+void Ewk_Context::setCacheModel(Ewk_Cache_Model cacheModel)
+{
+ WKContextSetCacheModel(m_context.get(), static_cast<Ewk_Cache_Model>(cacheModel));
+}
+
+Ewk_Cache_Model Ewk_Context::cacheModel() const
+{
+ return static_cast<Ewk_Cache_Model>(WKContextGetCacheModel(m_context.get()));
+}
+
+Ewk_Context* ewk_context_ref(Ewk_Context* ewkContext)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
+
+ ewkContext->ref();
+
+ return ewkContext;
+}
+
+void ewk_context_unref(Ewk_Context* ewkContext)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ewkContext);
+
+ ewkContext->deref();
+}
+
+Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
+
+ return const_cast<Ewk_Context*>(ewkContext)->cookieManager();
+}
- return new Ewk_Context(contextRef);
+Ewk_Favicon_Database* ewk_context_favicon_database_get(const Ewk_Context* ewkContext)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
+
+ return const_cast<Ewk_Context*>(ewkContext)->faviconDatabase();
+}
+
+WKContextRef Ewk_Context::wkContext()
+{
+ return m_context.get();
}
/**
* @internal
* Registers that a new download has been requested.
*/
-void ewk_context_download_job_add(Ewk_Context* ewkContext, Ewk_Download_Job* ewkDownload)
+void Ewk_Context::addDownloadJob(Ewk_Download_Job* ewkDownload)
{
- EINA_SAFETY_ON_NULL_RETURN(ewkContext);
EINA_SAFETY_ON_NULL_RETURN(ewkDownload);
uint64_t downloadId = ewkDownload->id();
- if (ewkContext->downloadJobs.contains(downloadId))
+ if (m_downloadJobs.contains(downloadId))
return;
- ewkContext->downloadJobs.add(downloadId, ewkDownload);
+ m_downloadJobs.add(downloadId, ewkDownload);
}
/**
@@ -218,11 +270,9 @@ void ewk_context_download_job_add(Ewk_Context* ewkContext, Ewk_Download_Job* ewk
* Returns the #Ewk_Download_Job with the given @a downloadId, or
* @c 0 in case of failure.
*/
-Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context* ewkContext, uint64_t downloadId)
+Ewk_Download_Job* Ewk_Context::downloadJob(uint64_t downloadId)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
-
- return ewkContext->downloadJobs.get(downloadId).get();
+ return m_downloadJobs.get(downloadId).get();
}
/**
@@ -230,10 +280,9 @@ Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context* ewkContext, ui
* Removes the #Ewk_Download_Job with the given @a downloadId from the internal
* HashMap.
*/
-void ewk_context_download_job_remove(Ewk_Context* ewkContext, uint64_t downloadId)
+void Ewk_Context::removeDownloadJob(uint64_t downloadId)
{
- EINA_SAFETY_ON_NULL_RETURN(ewkContext);
- ewkContext->downloadJobs.remove(downloadId);
+ m_downloadJobs.remove(downloadId);
}
/**
@@ -241,9 +290,9 @@ void ewk_context_download_job_remove(Ewk_Context* ewkContext, uint64_t downloadI
*
* @param ewkContext a #Ewk_Context object.
*/
-WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context* ewkContext)
+WKSoupRequestManagerRef Ewk_Context::requestManager()
{
- return ewkContext->requestManager.get();
+ return m_requestManager.get();
}
/**
@@ -253,12 +302,11 @@ WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context* ewkCo
* @param ewkContext a #Ewk_Context object.
* @param schemeRequest a #Ewk_Url_Scheme_Request object.
*/
-void ewk_context_url_scheme_request_received(Ewk_Context* ewkContext, Ewk_Url_Scheme_Request* schemeRequest)
+void Ewk_Context::urlSchemeRequestReceived(Ewk_Url_Scheme_Request* schemeRequest)
{
- EINA_SAFETY_ON_NULL_RETURN(ewkContext);
EINA_SAFETY_ON_NULL_RETURN(schemeRequest);
- Ewk_Url_Scheme_Handler handler = ewkContext->urlSchemeHandlers.get(schemeRequest->scheme());
+ Ewk_Url_Scheme_Handler handler = m_urlSchemeHandlers.get(schemeRequest->scheme());
if (!handler.callback)
return;
@@ -267,38 +315,27 @@ void ewk_context_url_scheme_request_received(Ewk_Context* ewkContext, Ewk_Url_Sc
Ewk_Context* ewk_context_default_get()
{
- static Ewk_Context defaultContext(adoptWK(WKContextCreate()));
-
- return &defaultContext;
+ return Ewk_Context::defaultContext().get();
}
Ewk_Context* ewk_context_new()
{
- return new Ewk_Context(adoptWK(WKContextCreate()));
+ return Ewk_Context::create().leakRef();
}
Ewk_Context* ewk_context_new_with_injected_bundle_path(const char* path)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(path, 0);
- WKRetainPtr<WKStringRef> pathRef(AdoptWK, WKStringCreateWithUTF8CString(path));
- if (!fileExists(toImpl(pathRef.get())->string()))
- return 0;
-
- return new Ewk_Context(adoptWK(WKContextCreateWithInjectedBundlePath(pathRef.get())));
+ return Ewk_Context::create(String::fromUTF8(path)).leakRef();
}
Eina_Bool ewk_context_url_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(scheme, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
- ewkContext->urlSchemeHandlers.set(String::fromUTF8(scheme), Ewk_Url_Scheme_Handler(callback, userData));
- WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme));
- WKSoupRequestManagerRegisterURIScheme(ewkContext->requestManager.get(), wkScheme.get());
-
- return true;
+ return ewkContext->registerURLScheme(String::fromUTF8(scheme), callback, userData);
}
void ewk_context_vibration_client_callbacks_set(Ewk_Context* ewkContext, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void* data)
@@ -306,7 +343,7 @@ void ewk_context_vibration_client_callbacks_set(Ewk_Context* ewkContext, Ewk_Vib
EINA_SAFETY_ON_NULL_RETURN(ewkContext);
#if ENABLE(VIBRATION)
- ewkContext->vibrationProvider->setVibrationClientCallbacks(vibrate, cancel, data);
+ ewkContext->vibrationProvider()->setVibrationClientCallbacks(vibrate, cancel, data);
#endif
}
@@ -314,28 +351,22 @@ void ewk_context_history_callbacks_set(Ewk_Context* ewkContext, Ewk_History_Navi
{
EINA_SAFETY_ON_NULL_RETURN(ewkContext);
- ewkContext->historyClient.navigate_func = navigate;
- ewkContext->historyClient.client_redirect_func = clientRedirect;
- ewkContext->historyClient.server_redirect_func = serverRedirect;
- ewkContext->historyClient.title_update_func = titleUpdate;
- ewkContext->historyClient.populate_visited_links_func = populateVisitedLinks;
- ewkContext->historyClient.user_data = data;
+ Ewk_Context_History_Client& historyClient = ewkContext->historyClient();
+ historyClient.navigate_func = navigate;
+ historyClient.client_redirect_func = clientRedirect;
+ historyClient.server_redirect_func = serverRedirect;
+ historyClient.title_update_func = titleUpdate;
+ historyClient.populate_visited_links_func = populateVisitedLinks;
+ historyClient.user_data = data;
}
-const Ewk_Context_History_Client* ewk_context_history_client_get(const Ewk_Context* ewkContext)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
-
- return &ewkContext->historyClient;
-}
void ewk_context_visited_link_add(Ewk_Context* ewkContext, const char* visitedURL)
{
EINA_SAFETY_ON_NULL_RETURN(ewkContext);
EINA_SAFETY_ON_NULL_RETURN(visitedURL);
- WKRetainPtr<WKStringRef> wkVisitedURL(AdoptWK, WKStringCreateWithUTF8CString(visitedURL));
- WKContextAddVisitedLink(ewkContext->context.get(), wkVisitedURL.get());
+ ewkContext->addVisitedLink(visitedURL);
}
// Ewk_Cache_Model enum validation
@@ -346,14 +377,16 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_CACHE_MODEL_PRIMARY_WEBBROWSER, kWKCacheModelPr
Eina_Bool ewk_context_cache_model_set(Ewk_Context* ewkContext, Ewk_Cache_Model cacheModel)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
- WKContextSetCacheModel(ewk_context_WKContext_get(ewkContext), static_cast<Ewk_Cache_Model>(cacheModel));
+
+ ewkContext->setCacheModel(cacheModel);
+
return true;
}
Ewk_Cache_Model ewk_context_cache_model_get(const Ewk_Context* ewkContext)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, EWK_CACHE_MODEL_DOCUMENT_VIEWER);
- WKCacheModel cacheModel = WKContextGetCacheModel(ewk_context_WKContext_get(ewkContext));
- return static_cast<Ewk_Cache_Model>(cacheModel);
+
+ return ewkContext->cacheModel();
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp
index 11647b41e..2fa86e9a7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_download_client.cpp
@@ -50,7 +50,7 @@ static inline Ewk_Context* toEwkContext(const void* clientInfo)
static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* /*allowOverwrite*/, const void* clientInfo)
{
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID());
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID());
ASSERT(download);
download->setSuggestedFileName(toImpl(filename)->string().utf8().data());
@@ -67,14 +67,14 @@ static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownlo
static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo)
{
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID());
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID());
ASSERT(download);
download->setResponse(Ewk_Url_Response::create(wkResponse));
}
static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef /*path*/, const void* clientInfo)
{
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID());
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID());
ASSERT(download);
download->setState(EWK_DOWNLOAD_JOB_STATE_DOWNLOADING);
@@ -82,7 +82,7 @@ static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStrin
static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo)
{
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), toImpl(wkDownload)->downloadID());
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(toImpl(wkDownload)->downloadID());
ASSERT(download);
download->incrementReceivedData(length);
}
@@ -90,35 +90,35 @@ static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t leng
static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void* clientInfo)
{
uint64_t downloadId = toImpl(wkDownload)->downloadID();
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId);
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(downloadId);
ASSERT(download);
OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error);
download->setState(EWK_DOWNLOAD_JOB_STATE_FAILED);
ewk_view_download_job_failed(download->view(), download, ewkError.get());
- ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId);
+ toEwkContext(clientInfo)->removeDownloadJob(downloadId);
}
static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo)
{
uint64_t downloadId = toImpl(wkDownload)->downloadID();
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId);
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(downloadId);
ASSERT(download);
download->setState(EWK_DOWNLOAD_JOB_STATE_CANCELLED);
ewk_view_download_job_cancelled(download->view(), download);
- ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId);
+ toEwkContext(clientInfo)->removeDownloadJob(downloadId);
}
static void didFinish(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo)
{
uint64_t downloadId = toImpl(wkDownload)->downloadID();
- Ewk_Download_Job* download = ewk_context_download_job_get(toEwkContext(clientInfo), downloadId);
+ Ewk_Download_Job* download = toEwkContext(clientInfo)->downloadJob(downloadId);
ASSERT(download);
download->setState(EWK_DOWNLOAD_JOB_STATE_FINISHED);
ewk_view_download_job_finished(download->view(), download);
- ewk_context_download_job_remove(toEwkContext(clientInfo), downloadId);
+ toEwkContext(clientInfo)->removeDownloadJob(downloadId);
}
void ewk_context_download_client_attach(Ewk_Context* ewkContext)
@@ -136,7 +136,7 @@ void ewk_context_download_client_attach(Ewk_Context* ewkContext)
wkDownloadClient.didFail = didFail;
wkDownloadClient.didFinish = didFinish;
- WKContextSetDownloadClient(ewk_context_WKContext_get(ewkContext), &wkDownloadClient);
+ WKContextSetDownloadClient(ewkContext->wkContext(), &wkDownloadClient);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp
index 1038b4df5..4f793b9d0 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_history_client.cpp
@@ -41,75 +41,70 @@
using namespace WebKit;
-static inline const Ewk_Context_History_Client* getEwkHistoryDelegate(const void* clientInfo)
+static inline const Ewk_Context_History_Client& getEwkHistoryClient(const void* clientInfo)
{
ASSERT(clientInfo);
- return ewk_context_history_client_get(static_cast<const Ewk_Context*>(clientInfo));
+ return static_cast<const Ewk_Context*>(clientInfo)->historyClient();
}
static void didNavigateWithNavigationData(WKContextRef, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef, const void* clientInfo)
{
- const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo);
- ASSERT(historyDelegate);
+ const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo);
- if (!historyDelegate->navigate_func)
+ if (!historyClient.navigate_func)
return;
RefPtr<Ewk_Navigation_Data> navigationDataEwk = Ewk_Navigation_Data::create(navigationData);
- historyDelegate->navigate_func(ewk_view_from_page_get(toImpl(page)), navigationDataEwk.get(), historyDelegate->user_data);
+ historyClient.navigate_func(ewk_view_from_page_get(toImpl(page)), navigationDataEwk.get(), historyClient.user_data);
}
static void didPerformClientRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo)
{
- const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo);
- ASSERT(historyDelegate);
+ const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo);
- if (!historyDelegate->client_redirect_func)
+ if (!historyClient.client_redirect_func)
return;
WKEinaSharedString sourceURLString(sourceURL);
WKEinaSharedString destinationURLString(destinationURL);
- historyDelegate->client_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyDelegate->user_data);
+ historyClient.client_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyClient.user_data);
}
static void didPerformServerRedirect(WKContextRef, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void* clientInfo)
{
- const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo);
- ASSERT(historyDelegate);
+ const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo);
- if (!historyDelegate->server_redirect_func)
+ if (!historyClient.server_redirect_func)
return;
WKEinaSharedString sourceURLString(sourceURL);
WKEinaSharedString destinationURLString(destinationURL);
- historyDelegate->server_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyDelegate->user_data);
+ historyClient.server_redirect_func(ewk_view_from_page_get(toImpl(page)), sourceURLString, destinationURLString, historyClient.user_data);
}
static void didUpdateHistoryTitle(WKContextRef, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef, const void* clientInfo)
{
- const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo);
- ASSERT(historyDelegate);
+ const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo);
- if (!historyDelegate->title_update_func)
+ if (!historyClient.title_update_func)
return;
WKEinaSharedString titleString(title);
WKEinaSharedString stringURL(URL);
- historyDelegate->title_update_func(ewk_view_from_page_get(toImpl(page)), titleString, stringURL, historyDelegate->user_data);
+ historyClient.title_update_func(ewk_view_from_page_get(toImpl(page)), titleString, stringURL, historyClient.user_data);
}
static void populateVisitedLinks(WKContextRef, const void* clientInfo)
{
- const Ewk_Context_History_Client* historyDelegate = getEwkHistoryDelegate(clientInfo);
- ASSERT(historyDelegate);
+ const Ewk_Context_History_Client& historyClient = getEwkHistoryClient(clientInfo);
- if (!historyDelegate->populate_visited_links_func)
+ if (!historyClient.populate_visited_links_func)
return;
- historyDelegate->populate_visited_links_func(historyDelegate->user_data);
+ historyClient.populate_visited_links_func(historyClient.user_data);
}
void ewk_context_history_client_attach(Ewk_Context* ewkContext)
@@ -126,5 +121,5 @@ void ewk_context_history_client_attach(Ewk_Context* ewkContext)
wkHistoryClient.didUpdateHistoryTitle = didUpdateHistoryTitle;
wkHistoryClient.populateVisitedLinks = populateVisitedLinks;
- WKContextSetHistoryClient(ewk_context_WKContext_get(ewkContext), &wkHistoryClient);
+ WKContextSetHistoryClient(ewkContext->wkContext(), &wkHistoryClient);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h
index 705739a16..489f05189 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h
@@ -20,22 +20,87 @@
#ifndef ewk_context_private_h
#define ewk_context_private_h
-#include <WebKit2/WKBase.h>
+#include "WKAPICast.h"
+#include "WKRetainPtr.h"
+#include "ewk_context_history_client_private.h"
-typedef struct Ewk_Context Ewk_Context;
-typedef struct Ewk_Download_Job Ewk_Download_Job;
-typedef struct Ewk_Url_Scheme_Request Ewk_Url_Scheme_Request;
-typedef struct Ewk_Context_History_Client Ewk_Context_History_Client;
+class Ewk_Download_Job;
+class Ewk_Url_Scheme_Request;
+class Ewk_Cookie_Manager;
+class Ewk_Favicon_Database;
+#if ENABLE(BATTERY_STATUS)
+class BatteryProvider;
+#endif
+#if ENABLE(NETWORK_INFO)
+class NetworkInfoProvider;
+#endif
+#if ENABLE(VIBRATION)
+class VibrationProvider;
+#endif
-WKContextRef ewk_context_WKContext_get(const Ewk_Context*);
-Ewk_Context* ewk_context_new_from_WKContext(WKContextRef);
-WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context*);
-void ewk_context_url_scheme_request_received(Ewk_Context*, Ewk_Url_Scheme_Request*);
+class Ewk_Context : public RefCounted<Ewk_Context> {
+public:
+ static PassRefPtr<Ewk_Context> create(WKContextRef context);
+ static PassRefPtr<Ewk_Context> create();
+ static PassRefPtr<Ewk_Context> create(const String& injectedBundlePath);
-void ewk_context_download_job_add(Ewk_Context*, Ewk_Download_Job*);
-Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context*, uint64_t downloadId);
-void ewk_context_download_job_remove(Ewk_Context*, uint64_t downloadId);
+ static PassRefPtr<Ewk_Context> defaultContext();
-const Ewk_Context_History_Client* ewk_context_history_client_get(const Ewk_Context*);
+ ~Ewk_Context();
+
+ Ewk_Cookie_Manager* cookieManager();
+
+ Ewk_Favicon_Database* faviconDatabase();
+
+ bool registerURLScheme(const String& scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData);
+
+#if ENABLE(VIBRATION)
+ PassRefPtr<VibrationProvider> vibrationProvider();
+#endif
+
+ void addVisitedLink(const String& visitedURL);
+
+ void setCacheModel(Ewk_Cache_Model);
+
+ Ewk_Cache_Model cacheModel() const;
+
+ WKContextRef wkContext();
+
+ WKSoupRequestManagerRef requestManager();
+
+ void urlSchemeRequestReceived(Ewk_Url_Scheme_Request*);
+
+ void addDownloadJob(Ewk_Download_Job*);
+ Ewk_Download_Job* downloadJob(uint64_t downloadId);
+ void removeDownloadJob(uint64_t downloadId);
+
+ const Ewk_Context_History_Client& historyClient() const { return m_historyClient; }
+ Ewk_Context_History_Client& historyClient() { return m_historyClient; }
+
+private:
+ explicit Ewk_Context(WKContextRef);
+
+ WKRetainPtr<WKContextRef> m_context;
+
+ OwnPtr<Ewk_Cookie_Manager> m_cookieManager;
+ OwnPtr<Ewk_Favicon_Database> m_faviconDatabase;
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<BatteryProvider> m_batteryProvider;
+#endif
+#if ENABLE(NETWORK_INFO)
+ RefPtr<NetworkInfoProvider> m_networkInfoProvider;
+#endif
+#if ENABLE(VIBRATION)
+ RefPtr<VibrationProvider> m_vibrationProvider;
+#endif
+ HashMap<uint64_t, RefPtr<Ewk_Download_Job> > m_downloadJobs;
+
+ WKRetainPtr<WKSoupRequestManagerRef> m_requestManager;
+
+ typedef HashMap<String, class Ewk_Url_Scheme_Handler> URLSchemeHandlerMap;
+ URLSchemeHandlerMap m_urlSchemeHandlers;
+
+ Ewk_Context_History_Client m_historyClient;
+};
#endif // ewk_context_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp
index b2573ca8e..fe801ce6b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_request_manager_client.cpp
@@ -41,7 +41,7 @@ static inline Ewk_Context* toEwkContext(const void* clientInfo)
static void didReceiveURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef, uint64_t requestID, const void* clientInfo)
{
RefPtr<Ewk_Url_Scheme_Request> schemeRequest = Ewk_Url_Scheme_Request::create(soupRequestManagerRef, urlRef, requestID);
- ewk_context_url_scheme_request_received(toEwkContext(clientInfo), schemeRequest.get());
+ toEwkContext(clientInfo)->urlSchemeRequestReceived(schemeRequest.get());
}
void ewk_context_request_manager_client_attach(Ewk_Context* context)
@@ -53,5 +53,5 @@ void ewk_context_request_manager_client_attach(Ewk_Context* context)
wkRequestManagerClient.clientInfo = context;
wkRequestManagerClient.didReceiveURIRequest = didReceiveURIRequest;
- WKSoupRequestManagerSetClient(ewk_context_request_manager_get(context), &wkRequestManagerClient);
+ WKSoupRequestManagerSetClient(context->requestManager(), &wkRequestManagerClient);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index fc955ec82..e77751934 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -132,7 +132,7 @@ struct Ewk_View_Private_Data {
OwnPtr<Ewk_Settings> settings;
bool areMouseEventsEnabled;
WKRetainPtr<WKColorPickerResultListenerRef> colorPickerResultListener;
- Ewk_Context* context;
+ RefPtr<Ewk_Context> context;
#if ENABLE(TOUCH_EVENTS)
bool areTouchEventsEnabled;
#endif
@@ -152,7 +152,6 @@ struct Ewk_View_Private_Data {
Ewk_View_Private_Data()
: areMouseEventsEnabled(false)
- , context(0)
#if ENABLE(TOUCH_EVENTS)
, areTouchEventsEnabled(false)
#endif
@@ -171,7 +170,7 @@ struct Ewk_View_Private_Data {
~Ewk_View_Private_Data()
{
/* Unregister icon change callback */
- Ewk_Favicon_Database* iconDatabase = ewk_context_favicon_database_get(context);
+ Ewk_Favicon_Database* iconDatabase = context->faviconDatabase();
iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);
void* item;
@@ -477,7 +476,6 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData)
static void _ewk_view_priv_del(Ewk_View_Private_Data* priv)
{
- ewk_context_unref(priv->context);
delete priv;
}
@@ -795,7 +793,7 @@ static inline Evas_Smart* _ewk_view_smart_class_new(void)
return smart;
}
-static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKPageGroupRef pageGroupRef)
+static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
@@ -807,9 +805,9 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP
priv->pageClient = PageClientImpl::create(ewkView);
if (pageGroupRef)
- priv->pageProxy = toImpl(ewk_context_WKContext_get(context))->createWebPage(priv->pageClient.get(), toImpl(pageGroupRef));
+ priv->pageProxy = toImpl(context->wkContext())->createWebPage(priv->pageClient.get(), toImpl(pageGroupRef));
else
- priv->pageProxy = toImpl(ewk_context_WKContext_get(context))->createWebPage(priv->pageClient.get(), WebPageGroup::create().get());
+ priv->pageProxy = toImpl(context->wkContext())->createWebPage(priv->pageClient.get(), WebPageGroup::create().get());
addToPageViewMap(ewkView);
@@ -822,7 +820,7 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP
priv->backForwardList = Ewk_Back_Forward_List::create(toAPI(priv->pageProxy->backForwardList()));
priv->settings = adoptPtr(new Ewk_Settings(WKPageGroupGetPreferences(WKPageGetPageGroup(toAPI(priv->pageProxy.get())))));
- priv->context = ewk_context_ref(context);
+ priv->context = context;
#if USE(COORDINATED_GRAPHICS)
priv->pageViewportControllerClient = PageViewportControllerClientEfl::create(ewkView);
@@ -842,7 +840,7 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP
priv->resourceLoadClient = ResourceLoadClientEfl::create(ewkView);
/* Listen for favicon changes */
- Ewk_Favicon_Database* iconDatabase = ewk_context_favicon_database_get(priv->context);
+ Ewk_Favicon_Database* iconDatabase = priv->context->faviconDatabase();
iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView));
}
@@ -882,7 +880,7 @@ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGrou
if (!ewkView)
return 0;
- _ewk_view_initialize(ewkView, ewk_context_new_from_WKContext(contextRef), pageGroupRef);
+ _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef);
return ewkView;
}
@@ -904,6 +902,7 @@ Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* co
Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
}
@@ -917,7 +916,7 @@ Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
- return priv->context;
+ return priv->context.get();
}
/**
@@ -1544,7 +1543,7 @@ void ewk_view_update_icon(Evas_Object* ewkView)
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
- Ewk_Favicon_Database* iconDatabase = ewk_context_favicon_database_get(priv->context);
+ Ewk_Favicon_Database* iconDatabase = priv->context->faviconDatabase();
ASSERT(iconDatabase);
priv->faviconURL = ewk_favicon_database_icon_url_get(iconDatabase, priv->url);
diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp
index e010a6e52..88d52ba62 100644
--- a/Source/WebKit2/UIProcess/PageViewportController.cpp
+++ b/Source/WebKit2/UIProcess/PageViewportController.cpp
@@ -68,7 +68,6 @@ PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, Page
{
// Initializing Viewport Raw Attributes to avoid random negative or infinity scale factors
// if there is a race condition between the first layout and setting the viewport attributes for the first time.
- m_rawAttributes.devicePixelRatio = 1;
m_rawAttributes.initialScale = 1;
m_rawAttributes.minimumScale = 1;
m_rawAttributes.maximumScale = 1;
@@ -277,7 +276,7 @@ void PageViewportController::updateMinimumScaleToFit()
if (m_viewportSize.isEmpty())
return;
- float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize));
+ float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize), devicePixelRatio());
if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) {
m_minimumScaleToFit = minimumScale;
diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp
index cbc26e68b..bfb87abc3 100644
--- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp
@@ -493,7 +493,6 @@ void PageViewportControllerClientQt::didChangeVisibleContents()
void PageViewportControllerClientQt::didChangeViewportAttributes()
{
- emit m_viewportItem->experimental()->test()->devicePixelRatioChanged();
emit m_viewportItem->experimental()->test()->viewportChanged();
}
diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def
index 5db44471c..5fe9caf05 100644
--- a/Source/WebKit2/win/WebKit2.def
+++ b/Source/WebKit2/win/WebKit2.def
@@ -274,7 +274,7 @@ EXPORTS
?webkitWillExitFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z
?webkitDidExitFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z
?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z
- ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@@Z
+ ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@M@Z
?computeViewportAttributes@WebCore@@YA?AUViewportAttributes@1@UViewportArguments@1@HHHMVIntSize@1@@Z
?viewportArguments@Page@WebCore@@QBE?AUViewportArguments@2@XZ
?isPageBoxVisible@Document@WebCore@@QAE_NH@Z
diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def
index cada54a94..5a9d4bc77 100644
--- a/Source/WebKit2/win/WebKit2CFLite.def
+++ b/Source/WebKit2/win/WebKit2CFLite.def
@@ -263,7 +263,7 @@ EXPORTS
?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z
?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z
?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z
- ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@@Z
+ ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@M@Z
?computeViewportAttributes@WebCore@@YA?AUViewportAttributes@1@UViewportArguments@1@HHHMVIntSize@1@@Z
?viewportArguments@Page@WebCore@@QBE?AUViewportArguments@2@XZ
?isPageBoxVisible@Document@WebCore@@QAE_NH@Z
diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter
index e81a66a8e..8c5dab0d2 100644
--- a/Source/autotools/symbols.filter
+++ b/Source/autotools/symbols.filter
@@ -107,7 +107,7 @@ _ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageE
_ZN7WebCore28InspectorFrontendClientLocalD2Ev;
_ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELj0EEE;
_ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELm0EEE;
-_ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE;
+_ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf;
_ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_13DOMStringListE;
_ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_9DOMWindowE;
_ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE;
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 3397e46ae..6429e448d 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,12 @@
+2012-10-23 Simon Hausmann <simon.hausmann@digia.com>
+
+ Unreviewed trivial Qt build fix: Fix build without USE_3D_GRAPHICS
+
+ Disable USE_GRAPHICS_SURFACE if we don't have USE_3D_GRAPHICS because
+ GraphicsSurface.h needs GraphicsContext3D.
+
+ * qmake/mkspecs/features/features.prf:
+
2012-10-23 Simon Pena <spena@igalia.com>
Unreviewed. Adding myself as committer.
diff --git a/Tools/qmake/mkspecs/features/features.prf b/Tools/qmake/mkspecs/features/features.prf
index 4b6e95bd9..d7f0301d6 100644
--- a/Tools/qmake/mkspecs/features/features.prf
+++ b/Tools/qmake/mkspecs/features/features.prf
@@ -124,8 +124,11 @@ defineTest(detectFeatures) {
packagesExist(libudev): WEBKIT_CONFIG += gamepad
# Support for Graphics Surface
- mac: WEBKIT_CONFIG += use_graphics_surface
- linux-*:contains(WEBKIT_CONFIG, have_glx):contains(WEBKIT_CONFIG, have_xcomposite):contains(WEBKIT_CONFIG, have_xrender): WEBKIT_CONFIG += use_graphics_surface
+ # GraphicsSurface requires GraphicsContext3D and hence use_3d_graphics
+ use?(3d_graphics) {
+ mac: WEBKIT_CONFIG += use_graphics_surface
+ linux-*:contains(WEBKIT_CONFIG, have_glx):contains(WEBKIT_CONFIG, have_xcomposite):contains(WEBKIT_CONFIG, have_xrender): WEBKIT_CONFIG += use_graphics_surface
+ }
# Slider Touch is sensible to use when compiling WebKit2
enable?(touch_events): WEBKIT_CONFIG += touch_slider