Changeset 124643 in webkit


Ignore:
Timestamp:
Aug 3, 2012 12:58:17 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] FrameLoaderClient::restoreViewState() shouldn't trigger painting
https://bugs.webkit.org/show_bug.cgi?id=93141

Patch by Yong Li <yoli@rim.com> on 2012-08-03
Reviewed by Rob Buis.

PR# 172041.
It is not always safe to render the page at this point. So we post a message
instead.

  • Api/WebPage.cpp:

(WebKit):
(BlackBerry::WebKit::WebPagePrivate::restoreHistoryViewState):

  • Api/WebPage_p.h:

(WebPagePrivate):

  • WebCoreSupport/FrameLoaderClientBlackBerry.cpp:

(WebCore::FrameLoaderClientBlackBerry::restoreViewState):

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

Legend:

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

    r124639 r124643  
    64626462    m_mainFrame->setTextZoomFactor(textZoomFactor);
    64636463}
    6464 }
    6465 }
     6464
     6465void WebPagePrivate::restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock)
     6466{
     6467    if (!m_mainFrame)
     6468        return;
     6469
     6470    m_backingStore->d->suspendScreenAndBackingStoreUpdates(); // don't flash checkerboard for the setScrollPosition call
     6471    m_mainFrame->view()->setContentsSizeFromHistory(contentsSize);
     6472
     6473    // Here we need to set scroll position what we asked for.
     6474    // So we use ScrollView::constrainsScrollingToContentEdge(false).
     6475    bool oldConstrainsScrollingToContentEdge = m_mainFrame->view()->constrainsScrollingToContentEdge();
     6476    m_mainFrame->view()->setConstrainsScrollingToContentEdge(false);
     6477    setScrollPosition(scrollPosition);
     6478    m_mainFrame->view()->setConstrainsScrollingToContentEdge(oldConstrainsScrollingToContentEdge);
     6479
     6480    m_shouldReflowBlock = shouldReflowBlock;
     6481
     6482    bool didZoom = zoomAboutPoint(scale, m_mainFrame->view()->scrollPosition(), true /* enforceScaleClamping */, true /*forceRendering*/, true /*isRestoringZoomLevel*/);
     6483    // If we're already at that scale, then we should still force rendering
     6484    // since our scroll position changed.
     6485    m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
     6486
     6487    if (!didZoom) {
     6488        // We need to notify the client of the scroll position and content size change(s) above even if we didn't scale.
     6489        notifyTransformedContentsSizeChanged();
     6490        notifyTransformedScrollChanged();
     6491    }
     6492}
     6493
     6494}
     6495}
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r124639 r124643  
    136136    void setTextReflowAnchorPoint(const Platform::IntPoint& focalPoint);
    137137
    138     void schedulePinchZoomAboutPoint(double scale, const WebCore::IntPoint& anchor);
     138    void restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock);
    139139
    140140    // Perform actual zoom for block zoom.
  • trunk/Source/WebKit/blackberry/ChangeLog

    r124639 r124643  
     12012-08-03  Yong Li  <yoli@rim.com>
     2
     3        [BlackBerry] FrameLoaderClient::restoreViewState() shouldn't trigger painting
     4        https://bugs.webkit.org/show_bug.cgi?id=93141
     5
     6        Reviewed by Rob Buis.
     7
     8        PR# 172041.
     9        It is not always safe to render the page at this point. So we post a message
     10        instead.
     11
     12        * Api/WebPage.cpp:
     13        (WebKit):
     14        (BlackBerry::WebKit::WebPagePrivate::restoreHistoryViewState):
     15        * Api/WebPage_p.h:
     16        (WebPagePrivate):
     17        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     18        (WebCore::FrameLoaderClientBlackBerry::restoreViewState):
     19
    1202012-08-03  Konrad Piascik  <kpiascik@rim.com>
    221
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r124403 r124643  
    6969#include "WebPageClient.h"
    7070
     71#include <BlackBerryPlatformExecutableMessage.h>
    7172#include <BlackBerryPlatformLog.h>
    7273#include <BlackBerryPlatformMediaDocument.h>
     74#include <BlackBerryPlatformMessageClient.h>
    7375#include <BlackBerryPlatformScreen.h>
    7476#include <JavaScriptCore/APICast.h>
     
    10861088    if (orientationChanged && viewState.isZoomToFitScale)
    10871089        scale = BlackBerry::Platform::Graphics::Screen::primaryScreen()->width() * scale / static_cast<double>(BlackBerry::Platform::Graphics::Screen::primaryScreen()->height());
    1088     m_webPagePrivate->m_backingStore->d->suspendScreenAndBackingStoreUpdates(); // don't flash checkerboard for the setScrollPosition call
    1089     m_frame->view()->setContentsSizeFromHistory(contentsSize);
    1090 
    1091     // Here we need to set scroll position what we asked for.
    1092     // So we use ScrollView::setCanOverscroll(true).
    1093     bool oldCanOverscroll = m_frame->view()->canOverScroll();
    1094     m_frame->view()->setCanOverscroll(true);
    1095     m_webPagePrivate->setScrollPosition(scrollPosition);
    1096     m_frame->view()->setCanOverscroll(oldCanOverscroll);
    1097 
    1098     m_webPagePrivate->m_shouldReflowBlock = viewState.shouldReflowBlock;
    1099 
    1100     bool didZoom = m_webPagePrivate->zoomAboutPoint(scale, m_frame->view()->scrollPosition(), true /* enforceScaleClamping */, true /*forceRendering*/, true /*isRestoringZoomLevel*/);
    1101     // If we're already at that scale, then we should still force rendering
    1102     // since our scroll position changed.
    1103     m_webPagePrivate->m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
    1104 
    1105     if (!didZoom) {
    1106         // We need to notify the client of the scroll position and content size change(s) above even if we didn't scale.
    1107         m_webPagePrivate->notifyTransformedContentsSizeChanged();
    1108         m_webPagePrivate->notifyTransformedScrollChanged();
    1109     }
     1090
     1091    // It is not safe to render the page at this point. So we post a message instead. Messages have higher priority than timers.
     1092    BlackBerry::Platform::webKitThreadMessageClient()->dispatchMessage(BlackBerry::Platform::createMethodCallMessage(
     1093        &WebPagePrivate::restoreHistoryViewState, m_webPagePrivate, contentsSize, scrollPosition, scale, viewState.shouldReflowBlock));
    11101094}
    11111095
Note: See TracChangeset for help on using the changeset viewer.