Changeset 122589 in webkit


Ignore:
Timestamp:
Jul 13, 2012 9:11:13 AM (12 years ago)
Author:
zhajiang@rim.com
Message:

[BlackBerry] resetBitmapZoomScale called while zooming preventing pinch zoom
https://bugs.webkit.org/show_bug.cgi?id=91247

Reviewed by Antonio Gomes.
Patch by Jacky Jiang <zhajiang@rim.com>

PR: 175432
On yahoo.com, the web page stopped zooming while trying to pinch as
WebPageClient::resetBitmapZoomScale(double) was being called by
WebPagePrivate::zoomToInitialScaleOnLoad() after load finished.
And also yahoo.com was keeping updating layout, which made it really
bad that zoomToInitialScaleOnLoad() was called many times when load
finished and the load type was FrameLoadTypeStandard or FrameLoadTypeSame.
As we only care about the situation that dispatchDidFirstVisuallyNonEmptyLayout()
happens after load finished, we can move the code to that method and
set a flag for WebPage layoutFinished() and zoomToInitialScaleOnLoad()
instead. In this way, we can ensure that the flag is only enabled when
dispatchDidFirstVisuallyNonEmptyLayout() is called after load finished
and get rid of calling zoomToInitialScaleOnLoad() lots of times when
keeping updating layout in such kind of situation.

Internally reviewed by Arvid Nilsson

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
(BlackBerry::WebKit::WebPagePrivate::setLoadState):
(BlackBerry::WebKit::WebPagePrivate::layoutFinished):

  • Api/WebPage_p.h:

(BlackBerry::WebKit::WebPagePrivate::shouldZoomToInitialScaleOnLoad):
(BlackBerry::WebKit::WebPagePrivate::setShouldZoomToInitialScaleAfterLoadFinished):
(WebPagePrivate):

  • WebCoreSupport/FrameLoaderClientBlackBerry.cpp:

(WebCore::FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout):

Location:
trunk/Source/WebKit/blackberry
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r122476 r122589  
    338338    , m_activationState(ActivationActive)
    339339    , m_shouldResetTilesWhenShown(false)
     340    , m_shouldZoomToInitialScaleAfterLoadFinished(false)
    340341    , m_userScalable(true)
    341342    , m_userPerformedManualZoom(false)
     
    10551056            m_backingStore->d->resetTiles(true /* resetBackground */);
    10561057            m_backingStore->d->setScrollingOrZooming(false, false /* shouldBlit */);
     1058            m_shouldZoomToInitialScaleAfterLoadFinished = false;
    10571059            m_userPerformedManualZoom = false;
    10581060            m_userPerformedManualScroll = false;
     
    17001702    m_nestedLayoutFinishedCount++;
    17011703
    1702     if (shouldZoomToInitialScaleOnLoad())
     1704    if (shouldZoomToInitialScaleOnLoad()) {
    17031705        zoomToInitialScaleOnLoad();
    1704     else if (loadState() != None)
     1706        m_shouldZoomToInitialScaleAfterLoadFinished = false;
     1707    } else if (loadState() != None)
    17051708        notifyTransformedContentsSizeChanged();
    17061709
     
    17351738        }
    17361739    }
    1737 }
    1738 
    1739 bool WebPagePrivate::shouldZoomToInitialScaleOnLoad() const
    1740 {
    1741     // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call dispatchDidFirstVisuallyNonEmptyLayout()
    1742     // after the load Finished state, in which case the web page will have no chance to zoom to initial scale. So we should give it a chance,
    1743     // otherwise the scale of the web page can be incorrect.
    1744     FrameLoadType frameLoadType = FrameLoadTypeStandard;
    1745     if (m_mainFrame && m_mainFrame->loader())
    1746         frameLoadType = m_mainFrame->loader()->loadType();
    1747     if (m_loadState == Committed || (m_loadState == Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard)))
    1748         return true;
    1749     return false;
    17501740}
    17511741
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r122444 r122589  
    208208    void notifyDismissAutofillDialog();
    209209
    210     bool shouldZoomToInitialScaleOnLoad() const;
     210    bool shouldZoomToInitialScaleOnLoad() const { return loadState() == Committed || m_shouldZoomToInitialScaleAfterLoadFinished; }
     211    void setShouldZoomToInitialScaleAfterLoadFinished(bool shouldZoomToInitialScaleAfterLoadFinished)
     212    {
     213        m_shouldZoomToInitialScaleAfterLoadFinished = shouldZoomToInitialScaleAfterLoadFinished;
     214    }
     215
    211216    // Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport.
    212217    void zoomToInitialScaleOnLoad();
     
    461466    ActivationStateType m_activationState;
    462467    bool m_shouldResetTilesWhenShown;
     468    bool m_shouldZoomToInitialScaleAfterLoadFinished;
    463469    bool m_userScalable;
    464470    bool m_userPerformedManualZoom;
  • trunk/Source/WebKit/blackberry/ChangeLog

    r122587 r122589  
     12012-07-13  Jacky Jiang  <zhajiang@rim.com>
     2
     3        [BlackBerry] resetBitmapZoomScale called while zooming preventing pinch zoom
     4        https://bugs.webkit.org/show_bug.cgi?id=91247
     5
     6        Reviewed by Antonio Gomes.
     7
     8        PR: 175432
     9        On yahoo.com, the web page stopped zooming while trying to pinch as
     10        WebPageClient::resetBitmapZoomScale(double) was being called by
     11        WebPagePrivate::zoomToInitialScaleOnLoad() after load finished.
     12        And also yahoo.com was keeping updating layout, which made it really
     13        bad that zoomToInitialScaleOnLoad() was called many times when load
     14        finished and the load type was FrameLoadTypeStandard or FrameLoadTypeSame.
     15        As we only care about the situation that dispatchDidFirstVisuallyNonEmptyLayout()
     16        happens after load finished, we can move the code to that method and
     17        set a flag for WebPage layoutFinished() and zoomToInitialScaleOnLoad()
     18        instead. In this way, we can ensure that the flag is only enabled when
     19        dispatchDidFirstVisuallyNonEmptyLayout() is called after load finished
     20        and get rid of calling zoomToInitialScaleOnLoad() lots of times when
     21        keeping updating layout in such kind of situation.
     22
     23        Internally reviewed by Arvid Nilsson
     24
     25        * Api/WebPage.cpp:
     26        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
     27        (BlackBerry::WebKit::WebPagePrivate::setLoadState):
     28        (BlackBerry::WebKit::WebPagePrivate::layoutFinished):
     29        * Api/WebPage_p.h:
     30        (BlackBerry::WebKit::WebPagePrivate::shouldZoomToInitialScaleOnLoad):
     31        (BlackBerry::WebKit::WebPagePrivate::setShouldZoomToInitialScaleAfterLoadFinished):
     32        (WebPagePrivate):
     33        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     34        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout):
     35
    1362012-07-13  Jakob Petsovits  <jpetsovits@rim.com>
    237
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r120694 r122589  
    826826    readyToRender(true);
    827827
     828    // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call
     829    // dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page
     830    // will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of
     831    // the web page can be incorrect.
     832    FrameLoadType frameLoadType = m_frame->loader()->loadType();
     833    if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))
     834        m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true);
     835
    828836    if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) {
    829837        m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first.
Note: See TracChangeset for help on using the changeset viewer.