Changeset 100474 in webkit


Ignore:
Timestamp:
Nov 16, 2011, 11:13:25 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Add minimum/maximumPageScaleFactor API and clamp fixes
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:
Location:
trunk/Source/WebKit/chromium
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r100454 r100474  
     12011-11-16  Alexandre Elias  <aelias@google.com>
     2
     3        [chromium] Add minimum/maximumPageScaleFactor API and clamp fixes
     4        https://bugs.webkit.org/show_bug.cgi?id=72463
     5
     6        Reviewed by Darin Fisher.
     7
     8        We need a way to read back the computed min/max page scale factor in
     9        order to support the software path, and for some application logic
     10        such as zooming in/out when tapping form fields.
     11
     12        I also added a few clamp calls that are needed in some corner cases.
     13
     14        * public/WebView.h:
     15        * src/WebViewImpl.cpp:
     16        (WebKit::WebViewImpl::setPageScaleFactor):
     17        (WebKit::WebViewImpl::setPageScaleFactorLimits):
     18        (WebKit::WebViewImpl::minimumPageScaleFactor):
     19        (WebKit::WebViewImpl::maximumPageScaleFactor):
     20        * src/WebViewImpl.h:
     21
    1222011-11-16  Vsevolod Vlasov  <vsevik@chromium.org>
    223
  • trunk/Source/WebKit/chromium/public/WebView.h

    r100196 r100474  
    228228    virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale) = 0;
    229229
     230    virtual float minimumPageScaleFactor() const = 0;
     231    virtual float maximumPageScaleFactor() const = 0;
     232
    230233    // The ratio of the current device's screen DPI to the target device's screen DPI.
    231234    virtual float deviceScaleFactor() const = 0;
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r100438 r100474  
    19041904
    19051905    scaleFactor = computePageScaleFactorWithinLimits(scaleFactor);
    1906     page()->setPageScaleFactor(scaleFactor, origin);
     1906    WebPoint clampedOrigin = clampOffsetAtScale(origin, scaleFactor);
     1907    page()->setPageScaleFactor(scaleFactor, clampedOrigin);
    19071908}
    19081909
     
    19691970        m_layerTreeHost->setPageScaleFactorLimits(m_minimumPageScaleFactor, m_maximumPageScaleFactor);
    19701971#endif
     1972
     1973    float clampedScale = computePageScaleFactorWithinLimits(pageScaleFactor());
     1974    if (clampedScale != pageScaleFactor())
     1975        setPageScaleFactorPreservingScrollOffset(clampedScale);
     1976}
     1977
     1978float WebViewImpl::minimumPageScaleFactor() const
     1979{
     1980    return m_minimumPageScaleFactor;
     1981}
     1982
     1983float WebViewImpl::maximumPageScaleFactor() const
     1984{
     1985    return m_maximumPageScaleFactor;
    19711986}
    19721987
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r100199 r100474  
    162162    virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin);
    163163    virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale);
     164    virtual float minimumPageScaleFactor() const;
     165    virtual float maximumPageScaleFactor() const;
     166
    164167    virtual float deviceScaleFactor() const;
    165168    virtual void setDeviceScaleFactor(float);
Note: See TracChangeset for help on using the changeset viewer.