https://bugs.webkit.org/show_bug.cgi?id=72463
Patch by Alexandre Elias <aelias@google.com> on 2011-11-16
Reviewed by Darin Fisher.
We need a way to read back the computed min/max page scale factor in
order to support the software path, and for some application logic
such as zooming in/out when tapping form fields.
I also added a few clamp calls that are needed in some corner cases.
* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setPageScaleFactor):
(WebKit::WebViewImpl::setPageScaleFactorLimits):
(WebKit::WebViewImpl::minimumPageScaleFactor):
(WebKit::WebViewImpl::maximumPageScaleFactor):
* src/WebViewImpl.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100474
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-11-16 Alexandre Elias <aelias@google.com>
+
+ [chromium] Add minimum/maximumPageScaleFactor API and clamp fixes
+ https://bugs.webkit.org/show_bug.cgi?id=72463
+
+ Reviewed by Darin Fisher.
+
+ We need a way to read back the computed min/max page scale factor in
+ order to support the software path, and for some application logic
+ such as zooming in/out when tapping form fields.
+
+ I also added a few clamp calls that are needed in some corner cases.
+
+ * public/WebView.h:
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setPageScaleFactor):
+ (WebKit::WebViewImpl::setPageScaleFactorLimits):
+ (WebKit::WebViewImpl::minimumPageScaleFactor):
+ (WebKit::WebViewImpl::maximumPageScaleFactor):
+ * src/WebViewImpl.h:
+
2011-11-16 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Application cache status should be updated after swapCache().
// again).
virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale) = 0;
+ virtual float minimumPageScaleFactor() const = 0;
+ virtual float maximumPageScaleFactor() const = 0;
+
// The ratio of the current device's screen DPI to the target device's screen DPI.
virtual float deviceScaleFactor() const = 0;
scaleFactor = 1;
scaleFactor = computePageScaleFactorWithinLimits(scaleFactor);
- page()->setPageScaleFactor(scaleFactor, origin);
+ WebPoint clampedOrigin = clampOffsetAtScale(origin, scaleFactor);
+ page()->setPageScaleFactor(scaleFactor, clampedOrigin);
}
float WebViewImpl::deviceScaleFactor() const
if (m_layerTreeHost)
m_layerTreeHost->setPageScaleFactorLimits(m_minimumPageScaleFactor, m_maximumPageScaleFactor);
#endif
+
+ float clampedScale = computePageScaleFactorWithinLimits(pageScaleFactor());
+ if (clampedScale != pageScaleFactor())
+ setPageScaleFactorPreservingScrollOffset(clampedScale);
+}
+
+float WebViewImpl::minimumPageScaleFactor() const
+{
+ return m_minimumPageScaleFactor;
+}
+
+float WebViewImpl::maximumPageScaleFactor() const
+{
+ return m_maximumPageScaleFactor;
}
WebSize WebViewImpl::fixedLayoutSize() const
virtual void setPageScaleFactorPreservingScrollOffset(float);
virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin);
virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale);
+ virtual float minimumPageScaleFactor() const;
+ virtual float maximumPageScaleFactor() const;
+
virtual float deviceScaleFactor() const;
virtual void setDeviceScaleFactor(float);
virtual bool isFixedLayoutModeEnabled() const;