Title: [124643] trunk/Source/WebKit/blackberry
- Revision
- 124643
- Author
- [email protected]
- Date
- 2012-08-03 12:58:17 -0700 (Fri, 03 Aug 2012)
Log Message
[BlackBerry] FrameLoaderClient::restoreViewState() shouldn't trigger painting
https://bugs.webkit.org/show_bug.cgi?id=93141
Patch by Yong Li <[email protected]> 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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (124642 => 124643)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-03 19:49:38 UTC (rev 124642)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-03 19:58:17 UTC (rev 124643)
@@ -6461,5 +6461,35 @@
m_mainFrame->setTextZoomFactor(textZoomFactor);
}
+
+void WebPagePrivate::restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock)
+{
+ if (!m_mainFrame)
+ return;
+
+ m_backingStore->d->suspendScreenAndBackingStoreUpdates(); // don't flash checkerboard for the setScrollPosition call
+ m_mainFrame->view()->setContentsSizeFromHistory(contentsSize);
+
+ // Here we need to set scroll position what we asked for.
+ // So we use ScrollView::constrainsScrollingToContentEdge(false).
+ bool oldConstrainsScrollingToContentEdge = m_mainFrame->view()->constrainsScrollingToContentEdge();
+ m_mainFrame->view()->setConstrainsScrollingToContentEdge(false);
+ setScrollPosition(scrollPosition);
+ m_mainFrame->view()->setConstrainsScrollingToContentEdge(oldConstrainsScrollingToContentEdge);
+
+ m_shouldReflowBlock = shouldReflowBlock;
+
+ bool didZoom = zoomAboutPoint(scale, m_mainFrame->view()->scrollPosition(), true /* enforceScaleClamping */, true /*forceRendering*/, true /*isRestoringZoomLevel*/);
+ // If we're already at that scale, then we should still force rendering
+ // since our scroll position changed.
+ m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
+
+ if (!didZoom) {
+ // We need to notify the client of the scroll position and content size change(s) above even if we didn't scale.
+ notifyTransformedContentsSizeChanged();
+ notifyTransformedScrollChanged();
+ }
}
+
}
+}
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (124642 => 124643)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-08-03 19:49:38 UTC (rev 124642)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-08-03 19:58:17 UTC (rev 124643)
@@ -135,7 +135,7 @@
WebCore::IntPoint calculateReflowedScrollPosition(const WebCore::FloatPoint& anchorOffset, double inverseScale);
void setTextReflowAnchorPoint(const Platform::IntPoint& focalPoint);
- void schedulePinchZoomAboutPoint(double scale, const WebCore::IntPoint& anchor);
+ void restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock);
// Perform actual zoom for block zoom.
void zoomBlock();
Modified: trunk/Source/WebKit/blackberry/ChangeLog (124642 => 124643)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-03 19:49:38 UTC (rev 124642)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-03 19:58:17 UTC (rev 124643)
@@ -1,3 +1,22 @@
+2012-08-03 Yong Li <[email protected]>
+
+ [BlackBerry] FrameLoaderClient::restoreViewState() shouldn't trigger painting
+ https://bugs.webkit.org/show_bug.cgi?id=93141
+
+ 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):
+
2012-08-03 Konrad Piascik <[email protected]>
[BlackBerry] InspectorOverlay class duplicated in WebCore
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (124642 => 124643)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-08-03 19:49:38 UTC (rev 124642)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-08-03 19:58:17 UTC (rev 124643)
@@ -68,8 +68,10 @@
#endif
#include "WebPageClient.h"
+#include <BlackBerryPlatformExecutableMessage.h>
#include <BlackBerryPlatformLog.h>
#include <BlackBerryPlatformMediaDocument.h>
+#include <BlackBerryPlatformMessageClient.h>
#include <BlackBerryPlatformScreen.h>
#include <_javascript_Core/APICast.h>
#include <network/FilterStream.h>
@@ -1085,28 +1087,10 @@
// When rotate happens, only zoom when previous page was zoomToFitScale, otherwise keep old scale.
if (orientationChanged && viewState.isZoomToFitScale)
scale = BlackBerry::Platform::Graphics::Screen::primaryScreen()->width() * scale / static_cast<double>(BlackBerry::Platform::Graphics::Screen::primaryScreen()->height());
- m_webPagePrivate->m_backingStore->d->suspendScreenAndBackingStoreUpdates(); // don't flash checkerboard for the setScrollPosition call
- m_frame->view()->setContentsSizeFromHistory(contentsSize);
- // Here we need to set scroll position what we asked for.
- // So we use ScrollView::setCanOverscroll(true).
- bool oldCanOverscroll = m_frame->view()->canOverScroll();
- m_frame->view()->setCanOverscroll(true);
- m_webPagePrivate->setScrollPosition(scrollPosition);
- m_frame->view()->setCanOverscroll(oldCanOverscroll);
-
- m_webPagePrivate->m_shouldReflowBlock = viewState.shouldReflowBlock;
-
- bool didZoom = m_webPagePrivate->zoomAboutPoint(scale, m_frame->view()->scrollPosition(), true /* enforceScaleClamping */, true /*forceRendering*/, true /*isRestoringZoomLevel*/);
- // If we're already at that scale, then we should still force rendering
- // since our scroll position changed.
- m_webPagePrivate->m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
-
- if (!didZoom) {
- // We need to notify the client of the scroll position and content size change(s) above even if we didn't scale.
- m_webPagePrivate->notifyTransformedContentsSizeChanged();
- m_webPagePrivate->notifyTransformedScrollChanged();
- }
+ // It is not safe to render the page at this point. So we post a message instead. Messages have higher priority than timers.
+ BlackBerry::Platform::webKitThreadMessageClient()->dispatchMessage(BlackBerry::Platform::createMethodCallMessage(
+ &WebPagePrivate::restoreHistoryViewState, m_webPagePrivate, contentsSize, scrollPosition, scale, viewState.shouldReflowBlock));
}
PolicyAction FrameLoaderClientBlackBerry::decidePolicyForExternalLoad(const ResourceRequest& request, bool isFragmentScroll)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes