summaryrefslogtreecommitdiffstats
path: root/WebKit/qt/Api
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/qt/Api')
-rw-r--r--WebKit/qt/Api/DerivedSources.pro2
-rw-r--r--WebKit/qt/Api/qwebelement.cpp47
-rw-r--r--WebKit/qt/Api/qwebelement.h18
-rw-r--r--WebKit/qt/Api/qwebframe.cpp78
-rw-r--r--WebKit/qt/Api/qwebframe_p.h6
-rw-r--r--WebKit/qt/Api/qwebkitplatformplugin.h5
-rw-r--r--WebKit/qt/Api/qwebpage.cpp98
-rw-r--r--WebKit/qt/Api/qwebpage.h22
-rw-r--r--WebKit/qt/Api/qwebpage_p.h6
-rw-r--r--WebKit/qt/Api/qwebscriptworld.cpp2
-rw-r--r--WebKit/qt/Api/qwebsettings.cpp4
11 files changed, 192 insertions, 96 deletions
diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro
index 86d5dac..6fb52f2 100644
--- a/WebKit/qt/Api/DerivedSources.pro
+++ b/WebKit/qt/Api/DerivedSources.pro
@@ -10,7 +10,7 @@ DESTDIR = ../../../include/QtWebKit
QUOTE = ""
DOUBLE_ESCAPED_QUOTE = ""
ESCAPE = ""
-contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH) {
+win32-msvc* | (contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH)) {
# MinGW's make will run makefile commands using sh, even if make
# was run from the Windows shell, if it finds sh in the path.
ESCAPE = "^"
diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp
index f7b1188..261631c 100644
--- a/WebKit/qt/Api/qwebelement.cpp
+++ b/WebKit/qt/Api/qwebelement.cpp
@@ -31,23 +31,33 @@
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLElement.h"
+#if USE(JSC)
#include "JSGlobalObject.h"
#include "JSHTMLElement.h"
#include "JSObject.h"
-#include "NodeList.h"
#include "PropertyNameArray.h"
+#include <parser/SourceCode.h>
+#include "qt_runtime.h"
+#elif USE(V8)
+#include "V8DOMWindow.h"
+#include "V8Binding.h"
+#include "NotImplemented.h"
+#endif
+#include "NodeList.h"
#include "RenderImage.h"
#include "StaticNodeList.h"
-#include "qt_runtime.h"
#include "qwebframe.h"
#include "qwebframe_p.h"
#include "runtime_root.h"
-#include <parser/SourceCode.h>
#include <wtf/Vector.h>
#include <wtf/text/CString.h>
#include <QPainter>
+#if USE(V8)
+using namespace V8::Bindings;
+#endif
+
using namespace WebCore;
class QWebElementPrivate {
@@ -694,6 +704,7 @@ QWebFrame *QWebElement::webFrame() const
return QWebFramePrivate::kit(frame);
}
+#if USE(JSC)
static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValue, ScriptState*& state, ScriptController*& scriptController)
{
if (!element)
@@ -721,6 +732,26 @@ static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValu
return true;
}
+#elif USE(V8)
+static bool setupScriptContext(WebCore::Element* element, v8::Handle<v8::Value>& thisValue, ScriptState*& state, ScriptController*& scriptController)
+{
+ if (!element)
+ return false;
+
+ Document* document = element->document();
+ if (!document)
+ return false;
+
+ Frame* frame = document->frame();
+ if (!frame)
+ return false;
+
+ state = mainWorldScriptState(frame);
+ // Get V8 wrapper for DOM element
+ thisValue = toV8(frame->domWindow());
+ return true;
+}
+#endif
/*!
@@ -732,12 +763,16 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource)
return QVariant();
ScriptState* state = 0;
+#if USE(JSC)
JSC::JSValue thisValue;
+#elif USE(V8)
+ v8::Handle<v8::Value> thisValue;
+#endif
ScriptController* scriptController = 0;
if (!setupScriptContext(m_element, thisValue, state, scriptController))
return QVariant();
-
+#if USE(JSC)
JSC::ScopeChain& scopeChain = state->dynamicGlobalObject()->globalScopeChain();
JSC::UString script(reinterpret_cast_ptr<const UChar*>(scriptSource.data()), scriptSource.length());
JSC::Completion completion = JSC::evaluate(state, scopeChain, JSC::makeSource(script), thisValue);
@@ -750,6 +785,10 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource)
int distance = 0;
return JSC::Bindings::convertValueToQVariant(state, result, QMetaType::Void, &distance);
+#elif USE(V8)
+ notImplemented();
+ return QVariant();
+#endif
}
/*!
diff --git a/WebKit/qt/Api/qwebelement.h b/WebKit/qt/Api/qwebelement.h
index c488d12..b94c372 100644
--- a/WebKit/qt/Api/qwebelement.h
+++ b/WebKit/qt/Api/qwebelement.h
@@ -32,11 +32,20 @@ namespace WebCore {
class Node;
}
-namespace JSC {
-namespace Bindings {
+
+#if defined(WTF_USE_V8) && WTF_USE_V8
+namespace V8 {
+ namespace Bindings {
class QtWebElementRuntime;
+ }
}
+#else
+namespace JSC {
+ namespace Bindings {
+ class QtWebElementRuntime;
+ }
}
+#endif
QT_BEGIN_NAMESPACE
class QPainter;
@@ -160,7 +169,12 @@ private:
friend class QWebHitTestResult;
friend class QWebHitTestResultPrivate;
friend class QWebPage;
+
+#if defined(WTF_USE_V8) && WTF_USE_V8
+ friend class V8::Bindings::QtWebElementRuntime;
+#else
friend class JSC::Bindings::QtWebElementRuntime;
+#endif
QWebElementPrivate* d;
WebCore::Element* m_element;
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index 464b4a0..46580bb 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -21,8 +21,12 @@
#include "config.h"
#include "qwebframe.h"
+#if USE(JSC)
#include "Bridge.h"
#include "CallFrame.h"
+#elif USE(V8)
+#include "V8Binding.h"
+#endif
#include "Document.h"
#include "DocumentLoader.h"
#include "DragData.h"
@@ -32,23 +36,35 @@
#include "FrameLoaderClientQt.h"
#include "FrameTree.h"
#include "FrameView.h"
+#if USE(JSC)
#include "GCController.h"
+#elif USE(V8)
+#include "V8GCController.h"
+#endif
#include "GraphicsContext.h"
#include "HTMLMetaElement.h"
#include "HitTestResult.h"
#include "HTTPParsers.h"
#include "IconDatabase.h"
#include "InspectorController.h"
+#if USE(JSC)
#include "JSDOMBinding.h"
#include "JSDOMWindowBase.h"
#include "JSLock.h"
#include "JSObject.h"
+#elif USE(V8)
+#include "V8DOMWrapper.h"
+#include "V8DOMWindowShell.h"
+#endif
+#include "NetworkingContext.h"
#include "NodeList.h"
#include "Page.h"
#include "PlatformMouseEvent.h"
#include "PlatformWheelEvent.h"
#include "PrintContext.h"
+#if USE(JSC)
#include "PutPropertySlot.h"
+#endif
#include "RenderLayer.h"
#include "RenderTreeAsText.h"
#include "RenderView.h"
@@ -64,8 +80,10 @@
#include "TiledBackingStore.h"
#include "htmlediting.h"
#include "markup.h"
+#if USE(JSC)
#include "qt_instance.h"
#include "qt_runtime.h"
+#endif
#include "qwebelement.h"
#include "qwebframe_p.h"
#include "qwebpage.h"
@@ -74,8 +92,10 @@
#include "qwebsecurityorigin_p.h"
#include "qwebscriptworld.h"
#include "qwebscriptworld_p.h"
+#if USE(JSC)
#include "runtime_object.h"
#include "runtime_root.h"
+#endif
#include "wtf/HashMap.h"
#include <QMultiMap>
#include <qdebug.h>
@@ -476,7 +496,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object
{
if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled))
return;
-
+#if USE(JSC)
JSC::JSLock lock(JSC::SilenceAssertionsOnly);
JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld());
JSC::Bindings::RootObject* root;
@@ -497,6 +517,13 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object
JSC::PutPropertySlot slot;
window->put(exec, JSC::Identifier(exec, reinterpret_cast_ptr<const UChar*>(name.constData()), name.length()), runtimeObject, slot);
+#elif USE(V8)
+ QScriptEngine* engine = d->frame->script()->qtScriptEngine();
+ if (!engine)
+ return;
+ QScriptValue v = engine->newQObject(object, ownership);
+ engine->globalObject().property("window").setProperty(name, v);
+#endif
}
/*!
@@ -868,9 +895,9 @@ QList<QWebFrame*> QWebFrame::childFrames() const
FrameTree *tree = d->frame->tree();
for (Frame *child = tree->firstChild(); child; child = child->tree()->nextSibling()) {
FrameLoader *loader = child->loader();
- FrameLoaderClientQt *client = static_cast<FrameLoaderClientQt*>(loader->client());
- if (client)
- rc.append(client->webFrame());
+ QWebFrame* webFrame = qobject_cast<QWebFrame*>(loader->networkingContext()->originatingObject());
+ if (webFrame)
+ rc.append(webFrame);
}
}
@@ -1105,11 +1132,9 @@ void QWebFrame::render(QPainter* painter)
*/
void QWebFrame::setTextSizeMultiplier(qreal factor)
{
- FrameView* view = d->frame->view();
- if (!view)
- return;
+ page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, true);
- view->setZoomFactor(factor, ZoomTextOnly);
+ d->frame->setPageAndTextZoomFactors(1, factor);
}
/*!
@@ -1117,11 +1142,7 @@ void QWebFrame::setTextSizeMultiplier(qreal factor)
*/
qreal QWebFrame::textSizeMultiplier() const
{
- FrameView* view = d->frame->view();
- if (!view)
- return 1;
-
- return view->zoomFactor();
+ return d->zoomTextOnly ? d->frame->textZoomFactor() : d->frame->pageZoomFactor();
}
/*!
@@ -1132,24 +1153,15 @@ qreal QWebFrame::textSizeMultiplier() const
void QWebFrame::setZoomFactor(qreal factor)
{
- Page* page = d->frame->page();
- if (!page)
- return;
-
- FrameView* view = d->frame->view();
- if (!view)
- return;
-
- view->setZoomFactor(factor, page->settings()->zoomMode());
+ if (d->zoomTextOnly)
+ d->frame->setTextZoomFactor(factor);
+ else
+ d->frame->setPageZoomFactor(factor);
}
qreal QWebFrame::zoomFactor() const
{
- FrameView* view = d->frame->view();
- if (!view)
- return 1;
-
- return view->zoomFactor();
+ return d->zoomTextOnly ? d->frame->textZoomFactor() : d->frame->pageZoomFactor();
}
/*!
@@ -1388,9 +1400,17 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource)
ScriptController *proxy = d->frame->script();
QVariant rc;
if (proxy) {
- JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
+#if USE(JSC)
int distance = 0;
+ JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
+
rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject(mainThreadNormalWorld())->globalExec(), v, QMetaType::Void, &distance);
+#elif USE(V8)
+ QScriptEngine* engine = d->frame->script()->qtScriptEngine();
+ if (!engine)
+ return rc;
+ rc = engine->evaluate(scriptSource).toVariant();
+#endif
}
return rc;
}
@@ -1414,7 +1434,7 @@ WebCore::Frame* QWebFramePrivate::core(const QWebFrame* webFrame)
QWebFrame* QWebFramePrivate::kit(const WebCore::Frame* coreFrame)
{
- return static_cast<FrameLoaderClientQt*>(coreFrame->loader()->client())->webFrame();
+ return qobject_cast<QWebFrame*>(coreFrame->loader()->networkingContext()->originatingObject());
}
diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h
index b5dda62..6d6eca1 100644
--- a/WebKit/qt/Api/qwebframe_p.h
+++ b/WebKit/qt/Api/qwebframe_p.h
@@ -31,6 +31,7 @@
#include "qwebelement.h"
#include "wtf/RefPtr.h"
#include "Frame.h"
+#include "ViewportArguments.h"
namespace WebCore {
class FrameLoaderClientQt;
@@ -71,7 +72,7 @@ public:
, allowsScrolling(true)
, marginWidth(-1)
, marginHeight(-1)
- , initialLayoutComplete(false)
+ , zoomTextOnly(false)
{}
void init(QWebFrame* qframe, QWebFrameData* frameData);
void setPage(QWebPage*);
@@ -99,7 +100,8 @@ public:
bool allowsScrolling;
int marginWidth;
int marginHeight;
- bool initialLayoutComplete;
+ bool zoomTextOnly;
+ WebCore::ViewportArguments viewportArguments;
};
class QWebHitTestResultPrivate {
diff --git a/WebKit/qt/Api/qwebkitplatformplugin.h b/WebKit/qt/Api/qwebkitplatformplugin.h
index 3c56c98..76496c5 100644
--- a/WebKit/qt/Api/qwebkitplatformplugin.h
+++ b/WebKit/qt/Api/qwebkitplatformplugin.h
@@ -27,6 +27,7 @@
*/
#include <QObject>
+#include <QUrl>
class QWebSelectData
{
@@ -66,6 +67,7 @@ public:
virtual const QString title() const = 0;
virtual const QString message() const = 0;
virtual const QByteArray iconData() const = 0;
+ virtual const QUrl openerPageUrl() const = 0;
};
class QWebNotificationPresenter : public QObject
@@ -79,6 +81,7 @@ public:
Q_SIGNALS:
void notificationClosed();
+ void notificationClicked();
};
class QWebHapticFeedbackPlayer
@@ -113,6 +116,6 @@ public:
};
-Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.3");
+Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.4");
#endif // QWEBKITPLATFORMPLUGIN_H
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 8bf9208..181b3a6 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -64,6 +64,7 @@
#include "FocusController.h"
#include "Editor.h"
#include "Scrollbar.h"
+#include "NetworkingContext.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformWheelEvent.h"
#include "PluginDatabase.h"
@@ -77,6 +78,7 @@
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "WindowFeatures.h"
+#include "WebPlatformStrategies.h"
#include "LocalizedStrings.h"
#include "Cache.h"
#include "runtime/InitializeThreading.h"
@@ -263,13 +265,15 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
, inspectorIsInternalOnly(false)
{
WebCore::InitializeLoggingChannelsIfNecessary();
- JSC::initializeThreading();
+ ScriptController::initializeThreading();
WTF::initializeMainThread();
WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData);
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
WebCore::Font::setCodePath(WebCore::Font::Complex);
#endif
+ WebPlatformStrategies::initialize(qq);
+
Page::PageClients pageClients;
pageClients.chromeClient = new ChromeClientQt(q);
pageClients.contextMenuClient = new ContextMenuClientQt();
@@ -1201,7 +1205,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
(selection.length < 0) ? selection.start : selection.start + selection.length);
} else
#endif
- editor->setComposition(preedit, underlines, preedit.length(), 0);
+ if (!preedit.isEmpty())
+ editor->setComposition(preedit, underlines, preedit.length(), 0);
}
ev->accept();
@@ -1697,15 +1702,15 @@ InspectorController* QWebPagePrivate::inspectorController()
/*!
- \class QWebPage::ViewportHints
+ \class QWebPage::ViewportConfiguration
\since 4.7
- \brief The QWebPage::ViewportHints class describes hints that can be applied to a viewport.
+ \brief The QWebPage::ViewportConfiguration class describes hints that can be applied to a viewport.
- QWebPage::ViewportHints provides a description of a viewport, such as viewport geometry,
+ QWebPage::ViewportConfiguration provides a description of a viewport, such as viewport geometry,
initial scale factor with limits, plus information about whether a user should be able
to scale the contents in the viewport or not, ie. by zooming.
- ViewportHints can be set by a web author using the viewport meta tag extension, documented
+ ViewportConfiguration can be set by a web author using the viewport meta tag extension, documented
at \l{http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}.
All values might not be set, as such when dealing with the hints, the developer needs to
@@ -1715,13 +1720,14 @@ InspectorController* QWebPagePrivate::inspectorController()
*/
/*!
- Constructs an empty QWebPage::ViewportHints.
+ Constructs an empty QWebPage::ViewportConfiguration.
*/
-QWebPage::ViewportHints::ViewportHints()
+QWebPage::ViewportConfiguration::ViewportConfiguration()
: d(0)
, m_initialScaleFactor(-1.0)
, m_minimumScaleFactor(-1.0)
, m_maximumScaleFactor(-1.0)
+ , m_devicePixelRatio(-1.0)
, m_isUserScalable(true)
, m_isValid(false)
{
@@ -1729,13 +1735,14 @@ QWebPage::ViewportHints::ViewportHints()
}
/*!
- Constructs a QWebPage::ViewportHints which is a copy from \a other .
+ Constructs a QWebPage::ViewportConfiguration which is a copy from \a other .
*/
-QWebPage::ViewportHints::ViewportHints(const QWebPage::ViewportHints& other)
+QWebPage::ViewportConfiguration::ViewportConfiguration(const QWebPage::ViewportConfiguration& other)
: d(other.d)
, m_initialScaleFactor(other.m_initialScaleFactor)
, m_minimumScaleFactor(other.m_minimumScaleFactor)
, m_maximumScaleFactor(other.m_maximumScaleFactor)
+ , m_devicePixelRatio(other.m_devicePixelRatio)
, m_isUserScalable(other.m_isUserScalable)
, m_isValid(other.m_isValid)
, m_size(other.m_size)
@@ -1744,18 +1751,18 @@ QWebPage::ViewportHints::ViewportHints(const QWebPage::ViewportHints& other)
}
/*!
- Destroys the QWebPage::ViewportHints.
+ Destroys the QWebPage::ViewportConfiguration.
*/
-QWebPage::ViewportHints::~ViewportHints()
+QWebPage::ViewportConfiguration::~ViewportConfiguration()
{
}
/*!
- Assigns the given QWebPage::ViewportHints to this viewport hints and returns a
+ Assigns the given QWebPage::ViewportConfiguration to this viewport hints and returns a
reference to this.
*/
-QWebPage::ViewportHints& QWebPage::ViewportHints::operator=(const QWebPage::ViewportHints& other)
+QWebPage::ViewportConfiguration& QWebPage::ViewportConfiguration::operator=(const QWebPage::ViewportConfiguration& other)
{
if (this != &other) {
d = other.d;
@@ -1770,30 +1777,30 @@ QWebPage::ViewportHints& QWebPage::ViewportHints::operator=(const QWebPage::View
return *this;
}
-/*! \fn inline bool QWebPage::ViewportHints::isValid() const
- Returns whether this is a valid ViewportHints or not.
+/*! \fn inline bool QWebPage::ViewportConfiguration::isValid() const
+ Returns whether this is a valid ViewportConfiguration or not.
- An invalid ViewportHints will have an empty QSize, negative values for scale factors and
+ An invalid ViewportConfiguration will have an empty QSize, negative values for scale factors and
true for the boolean isUserScalable.
*/
-/*! \fn inline QSize QWebPage::ViewportHints::size() const
+/*! \fn inline QSize QWebPage::ViewportConfiguration::size() const
Returns the size of the viewport.
*/
-/*! \fn inline qreal QWebPage::ViewportHints::initialScaleFactor() const
+/*! \fn inline qreal QWebPage::ViewportConfiguration::initialScaleFactor() const
Returns the initial scale of the viewport as a multiplier.
*/
-/*! \fn inline qreal QWebPage::ViewportHints::minimumScaleFactor() const
+/*! \fn inline qreal QWebPage::ViewportConfiguration::minimumScaleFactor() const
Returns the minimum scale value of the viewport as a multiplier.
*/
-/*! \fn inline qreal QWebPage::ViewportHints::maximumScaleFactor() const
+/*! \fn inline qreal QWebPage::ViewportConfiguration::maximumScaleFactor() const
Returns the maximum scale value of the viewport as a multiplier.
*/
-/*! \fn inline bool QWebPage::ViewportHints::isUserScalable() const
+/*! \fn inline bool QWebPage::ViewportConfiguration::isUserScalable() const
Determines whether or not the scale can be modified by the user.
*/
@@ -1913,7 +1920,8 @@ QWebFrame *QWebPage::mainFrame() const
QWebFrame *QWebPage::currentFrame() const
{
d->createMainFrame();
- return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame();
+ WebCore::Frame *frame = d->page->focusController()->focusedOrMainFrame();
+ return qobject_cast<QWebFrame*>(frame->loader()->networkingContext()->originatingObject());
}
@@ -2317,6 +2325,30 @@ void QWebPage::setViewportSize(const QSize &size) const
}
}
+QWebPage::ViewportConfiguration QWebPage::viewportConfigurationForSize(QSize availableSize) const
+{
+ static int desktopWidth = 980;
+ static int deviceDPI = 160;
+
+ FloatRect rect = d->page->chrome()->windowRect();
+
+ int deviceWidth = rect.width();
+ int deviceHeight = rect.height();
+
+ WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);
+
+ ViewportConfiguration result;
+
+ result.m_isValid = true;
+ result.m_size = conf.layoutViewport;
+ result.m_initialScaleFactor = conf.initialScale;
+ result.m_minimumScaleFactor = conf.minimumScale;
+ result.m_maximumScaleFactor = conf.maximumScale;
+ result.m_devicePixelRatio = conf.devicePixelRatio;
+
+ return result;
+}
+
QSize QWebPage::preferredContentsSize() const
{
QWebFrame* frame = d->mainFrame;
@@ -2366,8 +2398,7 @@ void QWebPage::setPreferredContentsSize(const QSize& size) const
} else if (view->useFixedLayout())
view->setUseFixedLayout(false);
- if (frame->d->initialLayoutComplete)
- view->layout();
+ view->layout();
}
/*!
@@ -3699,25 +3730,12 @@ quint64 QWebPage::bytesReceived() const
/*!
\since 4.7
- \fn void QWebPage::viewportChangeRequested(const QWebPage::ViewportHints& hints)
-
- This signal is emitted before any layout of the contents, giving you the viewport \a arguments
- the web page would like you to use when laying out its contents, including elements fixed to the
- viewport. This viewport might be larger that your actual viewport, meaning that a initialScaleFactor
- should be applied. When no scale is given, it is assumed that the contents should be scaled
- such that the width of the scaled contents fits within the actual viewport.
-
- The minimum and maximum allowed scale represents the min and max values that the page
- allows for scaling, and thus, affects the ability to zoom in on the page.
-
- Invalid values are supplied for the values not explicitly set by the web author; thus an
- invalid viewport size, and negative values for scale factor and limits. The boolean
- ViewportHints::isUserScalable is set to true.
+ \fn void QWebPage::viewportChangeRequested()
Page authors can provide the supplied values by using the viewport meta tag. More information
about this can be found at \l{http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}.
- \sa QWebPage::ViewportHints, setPreferredContentsSize(), QGraphicsWebView::setScale()
+ \sa QWebPage::ViewportConfiguration, setPreferredContentsSize(), QGraphicsWebView::setScale()
*/
/*!
diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h
index dda4a6a..b1441ff 100644
--- a/WebKit/qt/Api/qwebpage.h
+++ b/WebKit/qt/Api/qwebpage.h
@@ -48,7 +48,7 @@ class QWebHitTestResult;
class QWebNetworkInterface;
class QWebPagePrivate;
class QWebPluginFactory;
-class QtViewportHintsPrivate;
+class QtViewportConfigurationPrivate;
namespace WebCore {
class ChromeClientQt;
@@ -207,34 +207,35 @@ public:
GeolocationPermissionDomain
};
- class ViewportHints {
+ class ViewportConfiguration {
public:
- ViewportHints();
- ViewportHints(const QWebPage::ViewportHints& other);
+ ViewportConfiguration();
+ ViewportConfiguration(const QWebPage::ViewportConfiguration& other);
- ~ViewportHints();
+ ~ViewportConfiguration();
- QWebPage::ViewportHints& operator=(const QWebPage::ViewportHints& other);
+ QWebPage::ViewportConfiguration& operator=(const QWebPage::ViewportConfiguration& other);
inline qreal initialScaleFactor() const { return m_initialScaleFactor; };
inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; };
inline qreal maximumScaleFactor() const { return m_maximumScaleFactor; };
- inline int targetDensityDpi() const { return m_targetDensityDpi; };
+ inline qreal devicePixelRatio() const { return m_devicePixelRatio; };
inline bool isUserScalable() const { return m_isUserScalable; };
inline bool isValid() const { return m_isValid; };
inline QSize size() const { return m_size; };
private:
- QSharedDataPointer<QtViewportHintsPrivate> d;
+ QSharedDataPointer<QtViewportConfigurationPrivate> d;
qreal m_initialScaleFactor;
qreal m_minimumScaleFactor;
qreal m_maximumScaleFactor;
- int m_targetDensityDpi;
+ qreal m_devicePixelRatio;
bool m_isUserScalable;
bool m_isValid;
QSize m_size;
friend class WebCore::ChromeClientQt;
+ friend class QWebPage;
};
@@ -274,6 +275,7 @@ public:
QSize viewportSize() const;
void setViewportSize(const QSize &size) const;
+ ViewportConfiguration viewportConfigurationForSize(QSize availableSize) const;
QSize preferredContentsSize() const;
void setPreferredContentsSize(const QSize &size) const;
@@ -384,7 +386,7 @@ Q_SIGNALS:
void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item);
void restoreFrameStateRequested(QWebFrame* frame);
- void viewportChangeRequested(const QWebPage::ViewportHints& hints);
+ void viewportChangeRequested();
void requestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain);
void checkPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);
diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h
index 6310eaf..82f5365 100644
--- a/WebKit/qt/Api/qwebpage_p.h
+++ b/WebKit/qt/Api/qwebpage_p.h
@@ -58,13 +58,13 @@ QT_END_NAMESPACE
class QWebInspector;
class QWebPageClient;
-class QtViewportHintsPrivate : public QSharedData {
+class QtViewportConfigurationPrivate : public QSharedData {
public:
- QtViewportHintsPrivate(QWebPage::ViewportHints* qq)
+ QtViewportConfigurationPrivate(QWebPage::ViewportConfiguration* qq)
: q(qq)
{ }
- QWebPage::ViewportHints* q;
+ QWebPage::ViewportConfiguration* q;
};
class QWebPagePrivate {
diff --git a/WebKit/qt/Api/qwebscriptworld.cpp b/WebKit/qt/Api/qwebscriptworld.cpp
index 84b678d..74ab651 100644
--- a/WebKit/qt/Api/qwebscriptworld.cpp
+++ b/WebKit/qt/Api/qwebscriptworld.cpp
@@ -32,7 +32,9 @@ using namespace WebCore;
*/
QWebScriptWorld::QWebScriptWorld()
{
+#if USE(JSC)
d = new QWebScriptWorldPrivate(ScriptController::createWorld());
+#endif
}
QWebScriptWorld::QWebScriptWorld(const QWebScriptWorld& other)
diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp
index d88b0da..b71de25 100644
--- a/WebKit/qt/Api/qwebsettings.cpp
+++ b/WebKit/qt/Api/qwebsettings.cpp
@@ -217,10 +217,6 @@ void QWebSettingsPrivate::apply()
QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
settings->setLocalStorageDatabasePath(storagePath);
- value = attributes.value(QWebSettings::ZoomTextOnly,
- global->attributes.value(QWebSettings::ZoomTextOnly));
- settings->setZoomMode(value ? WebCore::ZoomTextOnly : WebCore::ZoomPage);
-
value = attributes.value(QWebSettings::PrintElementBackgrounds,
global->attributes.value(QWebSettings::PrintElementBackgrounds));
settings->setShouldPrintBackgrounds(value);