Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #24 from antseppa/noresize
[qtwebkit] Provide a way to turn off automatic content resizing when …
  • Loading branch information
Raine Mäkeläinen committed May 27, 2015
2 parents c3785a4 + 59f26c9 commit 335d2b2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
24 changes: 23 additions & 1 deletion qtwebkit/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Expand Up @@ -317,6 +317,7 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport)
, m_temporaryCookies(false)
, m_loadProgress(0)
, m_enableInputFieldAnimation(true)
, m_enableResizeContent(true)
{
viewport->setClip(true);
viewport->setPixelAligned(true);
Expand Down Expand Up @@ -1369,6 +1370,27 @@ void QQuickWebViewExperimental::setEnableInputFieldAnimation(bool enableInputFie
emit enableInputFieldAnimationChanged();
}

bool QQuickWebViewExperimental::enableResizeContent() const
{
Q_D(const QQuickWebView);
return d->m_enableResizeContent;
}

void QQuickWebViewExperimental::setEnableResizeContent(bool enableResizeContent)
{
Q_D(QQuickWebView);

if (d->m_enableResizeContent == enableResizeContent)
return;

d->m_enableResizeContent = enableResizeContent;
emit enableResizeContentChanged();

if (d->m_enableResizeContent) {
d->updateViewportSize();
}
}

void QQuickWebViewExperimental::animateInputFieldVisible()
{
Q_D(QQuickWebView);
Expand Down Expand Up @@ -2294,7 +2316,7 @@ void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& old
{
Q_D(QQuickWebView);
QQuickFlickable::geometryChanged(newGeometry, oldGeometry);
if (newGeometry.size() != oldGeometry.size())
if (newGeometry.size() != oldGeometry.size() && d->m_enableResizeContent)
d->updateViewportSize();
}

Expand Down
5 changes: 5 additions & 0 deletions qtwebkit/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Expand Up @@ -292,6 +292,7 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
Q_PROPERTY(QUrl userStyleSheet READ userStyleSheet WRITE setUserStyleSheet NOTIFY userStyleSheetChanged)
Q_PROPERTY(QUrl remoteInspectorUrl READ remoteInspectorUrl NOTIFY remoteInspectorUrlChanged FINAL)
Q_PROPERTY(bool enableInputFieldAnimation READ enableInputFieldAnimation WRITE setEnableInputFieldAnimation NOTIFY enableInputFieldAnimationChanged)
Q_PROPERTY(bool enableResizeContent READ enableResizeContent WRITE setEnableResizeContent NOTIFY enableResizeContentChanged)
Q_ENUMS(NavigationRequestActionExperimental)
Q_FLAGS(FindFlags)

Expand Down Expand Up @@ -347,6 +348,8 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
QUrl remoteInspectorUrl() const;
bool enableInputFieldAnimation() const;
void setEnableInputFieldAnimation(bool enableInputFieldAnimation);
bool enableResizeContent() const;
void setEnableResizeContent(bool enableResizeContent);

Q_INVOKABLE void animateInputFieldVisible();

Expand Down Expand Up @@ -438,6 +441,8 @@ public Q_SLOTS:
void overviewChanged();
void pinchingChanged();
void enableInputFieldAnimationChanged();
void enableResizeContentChanged();


void temporaryCookiesChanged();
void textFound(int matchCount);
Expand Down
Expand Up @@ -245,6 +245,7 @@ class QQuickWebViewPrivate {
QString m_currentUrl;
bool m_pinching;
bool m_enableInputFieldAnimation;
bool m_enableResizeContent;
};

class QQuickWebViewLegacyPrivate : public QQuickWebViewPrivate {
Expand Down

0 comments on commit 335d2b2

Please sign in to comment.