Title: [144494] trunk/Source/WebKit/blackberry
- Revision
- 144494
- Author
- [email protected]
- Date
- 2013-03-01 13:31:34 -0800 (Fri, 01 Mar 2013)
Log Message
[BlackBerry] Screen went black while navigating back/forward on the reddit.com page
https://bugs.webkit.org/show_bug.cgi?id=111192
Patch by Jacky Jiang <[email protected]>.
Reviewed by Rob Buis.
Internally reviewed by Jakob Petsovits.
PR: 299783
When going back to the previous reddit.com page, the actual contents
size was much less than the history contents size. However, we expanded
the actual contents size to history contents size which caused a huge
black area below the actual contents.
To fix that, don't restore the contents size from history contents size
and scroll back to the valid contents area if we are about to overscroll.
* Api/WebPage.cpp:
(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 (144493 => 144494)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-03-01 21:26:51 UTC (rev 144493)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-03-01 21:31:34 UTC (rev 144494)
@@ -6176,7 +6176,7 @@
m_mainFrame->setTextZoomFactor(textZoomFactor);
}
-void WebPagePrivate::restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock)
+void WebPagePrivate::restoreHistoryViewState(const WebCore::IntPoint& scrollPosition, double scale, bool shouldReflowBlock)
{
if (!m_mainFrame) {
// FIXME: Do we really need to suspend/resume both backingstore and screen here?
@@ -6185,13 +6185,20 @@
return;
}
- m_mainFrame->view()->setContentsSizeFromHistory(contentsSize);
+ // If we are about to overscroll, scroll back to the valid contents area.
+ WebCore::IntPoint adjustedScrollPosition = scrollPosition;
+ WebCore::IntSize validContentsSize = contentsSize();
+ WebCore::IntSize viewportSize = actualVisibleSize();
+ if (adjustedScrollPosition.x() + viewportSize.width() > validContentsSize.width())
+ adjustedScrollPosition.setX(validContentsSize.width() - viewportSize.width());
+ if (adjustedScrollPosition.y() + viewportSize.height() > validContentsSize.height())
+ adjustedScrollPosition.setY(validContentsSize.height() - viewportSize.height());
// 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);
+ setScrollPosition(adjustedScrollPosition);
m_mainFrame->view()->setConstrainsScrollingToContentEdge(oldConstrainsScrollingToContentEdge);
m_shouldReflowBlock = shouldReflowBlock;
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (144493 => 144494)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2013-03-01 21:26:51 UTC (rev 144493)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2013-03-01 21:31:34 UTC (rev 144494)
@@ -142,7 +142,7 @@
WebCore::IntPoint calculateReflowedScrollPosition(const WebCore::FloatPoint& anchorOffset, double inverseScale);
void setTextReflowAnchorPoint(const Platform::IntPoint& focalPoint);
- void restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock);
+ void restoreHistoryViewState(const WebCore::IntPoint& scrollPosition, double scale, bool shouldReflowBlock);
// Perform actual zoom for block zoom.
void zoomBlock();
Modified: trunk/Source/WebKit/blackberry/ChangeLog (144493 => 144494)
--- trunk/Source/WebKit/blackberry/ChangeLog 2013-03-01 21:26:51 UTC (rev 144493)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2013-03-01 21:31:34 UTC (rev 144494)
@@ -1,3 +1,26 @@
+2013-03-01 Jacky Jiang <[email protected]>
+
+ [BlackBerry] Screen went black while navigating back/forward on the reddit.com page
+ https://bugs.webkit.org/show_bug.cgi?id=111192
+
+ Reviewed by Rob Buis.
+ Internally reviewed by Jakob Petsovits.
+
+ PR: 299783
+ When going back to the previous reddit.com page, the actual contents
+ size was much less than the history contents size. However, we expanded
+ the actual contents size to history contents size which caused a huge
+ black area below the actual contents.
+ To fix that, don't restore the contents size from history contents size
+ and scroll back to the valid contents area if we are about to overscroll.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::restoreHistoryViewState):
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+ * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+ (WebCore::FrameLoaderClientBlackBerry::restoreViewState):
+
2013-03-01 Mike Fenton <[email protected]>
[BlackBerry] Improve input bounds clipping for search fields.
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (144493 => 144494)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2013-03-01 21:26:51 UTC (rev 144493)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2013-03-01 21:31:34 UTC (rev 144494)
@@ -1120,7 +1120,6 @@
// that, and the worst thing that could happen is that
// HistoryController::restoreScrollPositionAndViewState calls
// setScrollPosition with the the same point, which is a NOOP.
- IntSize contentsSize = currentItem->contentsSize();
IntPoint scrollPosition = currentItem->scrollPoint();
if (m_webPagePrivate->m_userPerformedManualScroll)
scrollPosition = m_webPagePrivate->scrollPosition();
@@ -1164,7 +1163,7 @@
// 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));
+ &WebPagePrivate::restoreHistoryViewState, m_webPagePrivate, scrollPosition, scale, viewState.shouldReflowBlock));
}
PolicyAction FrameLoaderClientBlackBerry::decidePolicyForExternalLoad(const ResourceRequest& request, bool isFragmentScroll)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes