Title: [103054] trunk/Source/WebKit2
Revision
103054
Author
commit-qu...@webkit.org
Date
2011-12-16 03:27:36 -0800 (Fri, 16 Dec 2011)

Log Message

[qt][wk2] Viewport info panel shows wrong current scale
https://bugs.webkit.org/show_bug.cgi?id=74613

Patch by Michael Bruning <michael.brun...@nokia.com> on 2011-12-16
Reviewed by Kenneth Rohde Christiansen.

* UIProcess/API/qt/qwebviewportinfo.cpp:
(QWebViewportInfo::currentScale): Added division by devicePixelRatio. Also
added emission of currenScaleUpdated signal when the viewport constraints
have been updated.
(QWebViewportInfo::didUpdateViewportConstraints):
* UIProcess/API/qt/qwebviewportinfo_p.h: Changed return type of
currentScale to QVariant as it depends on the viewport interaction engine
now.
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::ensureContentWithinViewportBoundary): Changed
to use currentCSSScale for getting the current css scale.
(WebKit::QtViewportInteractionEngine::currentCSSScale): Added.
* UIProcess/qt/QtViewportInteractionEngine.h: Added method currentCSSScale.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (103053 => 103054)


--- trunk/Source/WebKit2/ChangeLog	2011-12-16 11:10:24 UTC (rev 103053)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-16 11:27:36 UTC (rev 103054)
@@ -1,3 +1,24 @@
+2011-12-16  Michael Bruning  <michael.brun...@nokia.com>
+
+        [qt][wk2] Viewport info panel shows wrong current scale
+        https://bugs.webkit.org/show_bug.cgi?id=74613
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * UIProcess/API/qt/qwebviewportinfo.cpp:
+        (QWebViewportInfo::currentScale): Added division by devicePixelRatio. Also
+        added emission of currenScaleUpdated signal when the viewport constraints
+        have been updated.
+        (QWebViewportInfo::didUpdateViewportConstraints):
+        * UIProcess/API/qt/qwebviewportinfo_p.h: Changed return type of
+        currentScale to QVariant as it depends on the viewport interaction engine
+        now.
+        * UIProcess/qt/QtViewportInteractionEngine.cpp:
+        (WebKit::QtViewportInteractionEngine::ensureContentWithinViewportBoundary): Changed
+        to use currentCSSScale for getting the current css scale.
+        (WebKit::QtViewportInteractionEngine::currentCSSScale): Added.
+        * UIProcess/qt/QtViewportInteractionEngine.h: Added method currentCSSScale.
+
 2011-12-15  Martin Robinson  <mrobin...@igalia.com>
 
         Fix 'make dist' in preparation for the GTK+ release.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp (103053 => 103054)


--- trunk/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp	2011-12-16 11:10:24 UTC (rev 103053)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp	2011-12-16 11:27:36 UTC (rev 103054)
@@ -41,9 +41,12 @@
     return QSize(m_webViewPrivate->pageView->width(), m_webViewPrivate->pageView->height());
 }
 
-qreal QWebViewportInfo::currentScale() const
+QVariant QWebViewportInfo::currentScale() const
 {
-    return m_webViewPrivate->pageView->scale();
+    if (!m_webViewPrivate->interactionEngine)
+        return QVariant();
+
+    return m_webViewPrivate->interactionEngine->currentCSSScale();
 }
 
 QVariant QWebViewportInfo::devicePixelRatio() const
@@ -107,4 +110,5 @@
 void QWebViewportInfo::didUpdateViewportConstraints()
 {
     emit viewportConstraintsUpdated();
+    emit currentScaleUpdated();
 }

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h (103053 => 103054)


--- trunk/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h	2011-12-16 11:10:24 UTC (rev 103053)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h	2011-12-16 11:27:36 UTC (rev 103054)
@@ -37,7 +37,7 @@
 class QWEBKIT_EXPORT QWebViewportInfo : public QObject {
     Q_OBJECT
     Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeUpdated)
-    Q_PROPERTY(qreal currentScale READ currentScale NOTIFY currentScaleUpdated)
+    Q_PROPERTY(QVariant currentScale READ currentScale NOTIFY currentScaleUpdated)
     Q_PROPERTY(QVariant devicePixelRatio READ devicePixelRatio NOTIFY viewportConstraintsUpdated)
     Q_PROPERTY(QVariant initialScale READ initialScale NOTIFY viewportConstraintsUpdated)
     Q_PROPERTY(QVariant isScalable READ isScalable NOTIFY viewportConstraintsUpdated)
@@ -55,7 +55,7 @@
     virtual ~QWebViewportInfo();
 
     QSize contentsSize() const;
-    qreal currentScale() const;
+    QVariant currentScale() const;
     QVariant devicePixelRatio() const;
     QVariant initialScale() const;
     QVariant isScalable() const;

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (103053 => 103054)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2011-12-16 11:10:24 UTC (rev 103053)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2011-12-16 11:27:36 UTC (rev 103054)
@@ -401,10 +401,8 @@
     if (scrollAnimationActive() || scaleAnimationActive())
         return false;
 
-    qreal currentCSSScale = cssScaleFromItem(m_content->scale());
+    qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(currentCSSScale()));
 
-    qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(currentCSSScale));
-
     const QRectF viewportRect = m_viewport->boundingRect();
     QPointF viewportHotspot = viewportRect.center();
 
@@ -451,6 +449,11 @@
     ensureContentWithinViewportBoundary(/* immediate */ true);
 }
 
+qreal QtViewportInteractionEngine::currentCSSScale()
+{
+    return cssScaleFromItem(m_content->scale());
+}
+
 bool QtViewportInteractionEngine::scrollAnimationActive() const
 {
     QScroller* scroller = const_cast<QtViewportInteractionEngine*>(this)->scroller();

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h (103053 => 103054)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h	2011-12-16 11:10:24 UTC (rev 103053)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h	2011-12-16 11:27:36 UTC (rev 103054)
@@ -97,6 +97,8 @@
     void focusEditableArea(const QRectF& caretArea, const QRectF& targetArea);
 
     const Constraints& constraints() const { return m_constraints; }
+    qreal currentCSSScale();
+
 Q_SIGNALS:
     void contentSuspendRequested();
     void contentResumeRequested();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to