Title: [125803] trunk/Source/WebKit/blackberry
- Revision
- 125803
- Author
- [email protected]
- Date
- 2012-08-16 12:55:52 -0700 (Thu, 16 Aug 2012)
Log Message
[BlackBerry] Reload valid page from Error Page keeps history ViewState and zoom.
https://bugs.webkit.org/show_bug.cgi?id=94123
Reviewed by Antonio Gomes.
Reviewed internally by Leo Yang, Jacky Jiang.
PR 178305
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setLoadState):Reset the scales and
the user scalable flag if we're reloading from an error page.
(BlackBerry::WebKit::WebPagePrivate::updateViewportSize): Don't update the
viewport size if we're still in the WebPagePrivate::init method.
(BlackBerry::WebKit::WebPagePrivate::zoomToInitialScaleOnLoad):
Properly set the shouldZoom flag if we're not going to restore the
view state.
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::FrameLoaderClientBlackBerry):
(WebCore::FrameLoaderClientBlackBerry::dispatchDidCommitLoad): Set the
ViewState's shouldSaveViewState flag if we're coming from an error page.
(WebCore::FrameLoaderClientBlackBerry::saveViewStateToItem): Set the
new member variable m_shouldRestoreViewState based on the ViewState's
shouldSaveViewState flag.
(WebCore::FrameLoaderClientBlackBerry::restoreViewState): Added early
return if m_shouldRestoreViewState is false.
* WebCoreSupport/FrameLoaderClientBlackBerry.h: Add new method to have
the client track whether we should restore the view state.
(WebCore::FrameLoaderClientBlackBerry::shouldRestoreViewState):
(FrameLoaderClientBlackBerry):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (125802 => 125803)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-16 19:54:00 UTC (rev 125802)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-16 19:55:52 UTC (rev 125803)
@@ -1074,7 +1074,9 @@
documentHasViewportArguments = true;
if (m_mainFrame && m_mainFrame->loader())
frameLoadType = m_mainFrame->loader()->loadType();
- if (!((m_didRestoreFromPageCache && documentHasViewportArguments) || (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin))) {
+ FrameLoaderClientBlackBerry* frameLoaderClient = static_cast<FrameLoaderClientBlackBerry*>(m_mainFrame->loader()->client());
+ if (!((m_didRestoreFromPageCache && documentHasViewportArguments)
+ || ((frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin) && frameLoaderClient->shouldRestoreViewState()))) {
m_viewportArguments = ViewportArguments();
m_userScalable = m_webSettings->isUserScalable();
resetScales();
@@ -1576,6 +1578,10 @@
void WebPagePrivate::updateViewportSize(bool setFixedReportedSize, bool sendResizeEvent)
{
+ // This checks to make sure we're not calling updateViewportSize
+ // during WebPagePrivate::init().
+ if (!m_backingStore)
+ return;
ASSERT(m_mainFrame->view());
if (setFixedReportedSize)
m_mainFrame->view()->setFixedReportedSize(actualVisibleSize());
@@ -1755,7 +1761,9 @@
// If this load should restore view state, don't zoom to initial scale
// but instead let the HistoryItem's saved viewport reign supreme.
- if (m_mainFrame && m_mainFrame->loader() && m_mainFrame->loader()->shouldRestoreScrollPositionAndViewState())
+ FrameLoaderClientBlackBerry* frameLoaderClient = static_cast<FrameLoaderClientBlackBerry*>(m_mainFrame->loader()->client());
+ if (m_mainFrame && m_mainFrame->loader() && m_mainFrame->loader()->shouldRestoreScrollPositionAndViewState()
+ && frameLoaderClient && frameLoaderClient->shouldRestoreViewState())
shouldZoom = false;
if (shouldZoom && shouldZoomToInitialScaleOnLoad()) {
Modified: trunk/Source/WebKit/blackberry/ChangeLog (125802 => 125803)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-16 19:54:00 UTC (rev 125802)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-16 19:55:52 UTC (rev 125803)
@@ -1,3 +1,35 @@
+2012-08-16 Konrad Piascik <[email protected]>
+
+ [BlackBerry] Reload valid page from Error Page keeps history ViewState and zoom.
+ https://bugs.webkit.org/show_bug.cgi?id=94123
+
+ Reviewed by Antonio Gomes.
+
+ Reviewed internally by Leo Yang, Jacky Jiang.
+ PR 178305
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::setLoadState):Reset the scales and
+ the user scalable flag if we're reloading from an error page.
+ (BlackBerry::WebKit::WebPagePrivate::updateViewportSize): Don't update the
+ viewport size if we're still in the WebPagePrivate::init method.
+ (BlackBerry::WebKit::WebPagePrivate::zoomToInitialScaleOnLoad):
+ Properly set the shouldZoom flag if we're not going to restore the
+ view state.
+ * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+ (WebCore::FrameLoaderClientBlackBerry::FrameLoaderClientBlackBerry):
+ (WebCore::FrameLoaderClientBlackBerry::dispatchDidCommitLoad): Set the
+ ViewState's shouldSaveViewState flag if we're coming from an error page.
+ (WebCore::FrameLoaderClientBlackBerry::saveViewStateToItem): Set the
+ new member variable m_shouldRestoreViewState based on the ViewState's
+ shouldSaveViewState flag.
+ (WebCore::FrameLoaderClientBlackBerry::restoreViewState): Added early
+ return if m_shouldRestoreViewState is false.
+ * WebCoreSupport/FrameLoaderClientBlackBerry.h: Add new method to have
+ the client track whether we should restore the view state.
+ (WebCore::FrameLoaderClientBlackBerry::shouldRestoreViewState):
+ (FrameLoaderClientBlackBerry):
+
2012-08-16 Leo Yang <[email protected]>
[BlackBerry] Remove Mobile mode from WebPage.cpp and WebPage_p.h
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (125802 => 125803)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-08-16 19:54:00 UTC (rev 125802)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-08-16 19:55:52 UTC (rev 125803)
@@ -109,6 +109,7 @@
, m_hasSentResponseToPlugin(false)
, m_cancelLoadOnNextData(false)
, m_wasProvisionalLoadTriggeredByUserGesture(true) // To avoid affecting the first load.
+ , m_shouldRestoreViewState(true)
{
}
@@ -550,6 +551,8 @@
// SubstituteData in dispatchDidFailProvisionalLoad).
if (m_loadingErrorPage) {
m_loadingErrorPage = false;
+ if (HistoryItem* item = m_frame->loader()->history()->currentItem())
+ item->viewState().shouldSaveViewState = false;
m_webPagePrivate->m_client->notifyLoadFailedBeforeCommit(
originalUrl.characters(), originalUrl.length(),
url.characters(), url.length(), token.characters(), token.length());
@@ -1025,7 +1028,8 @@
ASSERT(item);
HistoryItemViewState& viewState = item->viewState();
- if (viewState.shouldSaveViewState) {
+ m_shouldRestoreViewState = viewState.shouldSaveViewState;
+ if (m_shouldRestoreViewState) {
viewState.orientation = m_webPagePrivate->mainFrame()->orientation();
viewState.isZoomToFitScale = m_webPagePrivate->currentScale() == m_webPagePrivate->zoomToFitScale();
viewState.scale = m_webPagePrivate->currentScale();
@@ -1038,6 +1042,8 @@
void FrameLoaderClientBlackBerry::restoreViewState()
{
+ if (!m_shouldRestoreViewState)
+ return;
if (!isMainFrame())
return;
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h (125802 => 125803)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h 2012-08-16 19:54:00 UTC (rev 125802)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h 2012-08-16 19:55:52 UTC (rev 125803)
@@ -182,6 +182,8 @@
void suppressChildFrameCreation() { m_childFrameCreationSuppressed = true; }
+ bool shouldRestoreViewState() const { return m_shouldRestoreViewState; }
+
private:
void receivedData(const char*, int, const String&);
void didFinishOrFailLoading(const ResourceError&);
@@ -219,6 +221,8 @@
bool m_cancelLoadOnNextData;
bool m_wasProvisionalLoadTriggeredByUserGesture;
+
+ bool m_shouldRestoreViewState;
};
} // WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes