Title: [122589] trunk/Source/WebKit/blackberry
- Revision
- 122589
- Author
- [email protected]
- Date
- 2012-07-13 09:11:13 -0700 (Fri, 13 Jul 2012)
Log 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 <[email protected]>
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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (122588 => 122589)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-07-13 16:00:40 UTC (rev 122588)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-07-13 16:11:13 UTC (rev 122589)
@@ -337,6 +337,7 @@
, m_visible(false)
, m_activationState(ActivationActive)
, m_shouldResetTilesWhenShown(false)
+ , m_shouldZoomToInitialScaleAfterLoadFinished(false)
, m_userScalable(true)
, m_userPerformedManualZoom(false)
, m_userPerformedManualScroll(false)
@@ -1054,6 +1055,7 @@
m_backingStore->d->resetRenderQueue();
m_backingStore->d->resetTiles(true /* resetBackground */);
m_backingStore->d->setScrollingOrZooming(false, false /* shouldBlit */);
+ m_shouldZoomToInitialScaleAfterLoadFinished = false;
m_userPerformedManualZoom = false;
m_userPerformedManualScroll = false;
m_shouldUseFixedDesktopMode = false;
@@ -1699,9 +1701,10 @@
m_nestedLayoutFinishedCount++;
- if (shouldZoomToInitialScaleOnLoad())
+ if (shouldZoomToInitialScaleOnLoad()) {
zoomToInitialScaleOnLoad();
- else if (loadState() != None)
+ m_shouldZoomToInitialScaleAfterLoadFinished = false;
+ } else if (loadState() != None)
notifyTransformedContentsSizeChanged();
m_nestedLayoutFinishedCount--;
@@ -1736,19 +1739,6 @@
}
}
-bool WebPagePrivate::shouldZoomToInitialScaleOnLoad() const
-{
- // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call dispatchDidFirstVisuallyNonEmptyLayout()
- // 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,
- // otherwise the scale of the web page can be incorrect.
- FrameLoadType frameLoadType = FrameLoadTypeStandard;
- if (m_mainFrame && m_mainFrame->loader())
- frameLoadType = m_mainFrame->loader()->loadType();
- if (m_loadState == Committed || (m_loadState == Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard)))
- return true;
- return false;
-}
-
void WebPagePrivate::zoomToInitialScaleOnLoad()
{
#if DEBUG_WEBPAGE_LOAD
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (122588 => 122589)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-07-13 16:00:40 UTC (rev 122588)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-07-13 16:11:13 UTC (rev 122589)
@@ -207,7 +207,12 @@
void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&);
void notifyDismissAutofillDialog();
- bool shouldZoomToInitialScaleOnLoad() const;
+ bool shouldZoomToInitialScaleOnLoad() const { return loadState() == Committed || m_shouldZoomToInitialScaleAfterLoadFinished; }
+ void setShouldZoomToInitialScaleAfterLoadFinished(bool shouldZoomToInitialScaleAfterLoadFinished)
+ {
+ m_shouldZoomToInitialScaleAfterLoadFinished = shouldZoomToInitialScaleAfterLoadFinished;
+ }
+
// Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport.
void zoomToInitialScaleOnLoad();
@@ -460,6 +465,7 @@
bool m_visible;
ActivationStateType m_activationState;
bool m_shouldResetTilesWhenShown;
+ bool m_shouldZoomToInitialScaleAfterLoadFinished;
bool m_userScalable;
bool m_userPerformedManualZoom;
bool m_userPerformedManualScroll;
Modified: trunk/Source/WebKit/blackberry/ChangeLog (122588 => 122589)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-07-13 16:00:40 UTC (rev 122588)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-07-13 16:11:13 UTC (rev 122589)
@@ -1,3 +1,38 @@
+2012-07-13 Jacky Jiang <[email protected]>
+
+ [BlackBerry] resetBitmapZoomScale called while zooming preventing pinch zoom
+ https://bugs.webkit.org/show_bug.cgi?id=91247
+
+ Reviewed by Antonio Gomes.
+
+ 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):
+
2012-07-13 Jakob Petsovits <[email protected]>
[BlackBerry] Use fillBuffer() instead of a user-defined background image.
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (122588 => 122589)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-07-13 16:00:40 UTC (rev 122588)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp 2012-07-13 16:11:13 UTC (rev 122589)
@@ -825,6 +825,14 @@
readyToRender(true);
+ // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call
+ // dispatchDidFirstVisuallyNonEmptyLayout() 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, otherwise the scale of
+ // the web page can be incorrect.
+ FrameLoadType frameLoadType = m_frame->loader()->loadType();
+ if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))
+ m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true);
+
if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) {
m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first.
m_webPagePrivate->m_backingStore->d->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes