Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting devicePixelRatio #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,11 @@ void QWebPageAdapter::setDevicePixelRatio(float devicePixelRatio)
page->setDeviceScaleFactor(devicePixelRatio);
}

float QWebPageAdapter::devicePixelRatio()
{
return page->deviceScaleFactor();
}

bool QWebPageAdapter::handleKeyEvent(QKeyEvent *ev)
{
Frame* frame = page->focusController()->focusedOrMainFrame();
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ class WEBKIT_EXPORTDATA QWebPageAdapter {

ViewportAttributes viewportAttributesForSize(const QSize& availableSize, const QSize& deviceSize) const;
void setDevicePixelRatio(float devicePixelRatio);
float devicePixelRatio();

QWebSettings *settings;

Expand Down
11 changes: 11 additions & 0 deletions Source/WebKit/qt/WidgetApi/qwebpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
#endif
, linkPolicy(QWebPage::DontDelegateLinks)
, m_viewportSize(QSize(0, 0))
, m_devicePixelRatio(qreal(0))
, useFixedLayout(false)
, window(0)
, inspectorFrontend(0)
Expand Down Expand Up @@ -2046,6 +2047,16 @@ void QWebPagePrivate::_q_updateScreen(QScreen* screen)
setDevicePixelRatio(screen->devicePixelRatio());
}

void QWebPage::setDevicePixelRatio(qreal ratio)
{
d->setDevicePixelRatio(ratio);
}

qreal QWebPage::devicePixelRatio() const
{
return d->devicePixelRatio();
}

static int getintenv(const char* variable)
{
bool ok;
Expand Down
2 changes: 2 additions & 0 deletions Source/WebKit/qt/WidgetApi/qwebpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ class QWEBKITWIDGETS_EXPORT QWebPage : public QObject {
virtual void triggerAction(WebAction action, bool checked = false);

QSize viewportSize() const;
void setDevicePixelRatio(qreal ratio);
qreal devicePixelRatio() const;
void setViewportSize(const QSize &size) const;
ViewportAttributes viewportAttributesForSize(const QSize& availableSize) const;

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/qt/WidgetApi/qwebpage_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class QWebPagePrivate : public QWebPageAdapter {
QWebPage::LinkDelegationPolicy linkPolicy;

QSize m_viewportSize;
qreal m_devicePixelRatio;
QSize fixedLayoutSize;

QWebHitTestResult hitTestResult;
Expand Down