Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (128602 => 128603)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-09-14 13:19:36 UTC (rev 128602)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-09-14 13:27:18 UTC (rev 128603)
@@ -208,8 +208,6 @@
const double manualScrollInterval = 0.1; // The time interval during which we associate user action with scrolling.
-const double delayedZoomInterval = 0;
-
const IntSize minimumLayoutSize(10, 10); // Needs to be a small size, greater than 0, that we can grow the layout from.
const double minimumExpandingRatio = 0.15;
@@ -402,7 +400,6 @@
, m_currentBlockZoomNode(0)
, m_currentBlockZoomAdjustedNode(0)
, m_shouldReflowBlock(false)
- , m_delayedZoomTimer(adoptPtr(new Timer<WebPagePrivate>(this, &WebPagePrivate::zoomAboutPointTimerFired)))
, m_lastUserEventTimestamp(0.0)
, m_pluginMouseButtonPressed(false)
, m_pluginMayOpenNewTab(false)
@@ -1042,8 +1039,6 @@
break;
case Committed:
{
- unscheduleZoomAboutPoint();
-
#if ENABLE(ACCELERATED_2D_CANVAS)
if (m_page->settings()->canvasUsesAcceleratedDrawing()) {
// Free GPU resources as we're on a new page.
@@ -1299,71 +1294,6 @@
max(0, static_cast<int>(roundf(reflowedRect.y() + offsetY - anchorOffset.y() / inverseScale))));
}
-bool WebPagePrivate::scheduleZoomAboutPoint(double unclampedScale, const FloatPoint& anchor, bool enforceScaleClamping, bool forceRendering)
-{
- double scale;
- if (!shouldZoomAboutPoint(unclampedScale, anchor, enforceScaleClamping, &scale)) {
- // We could be back to the right zoom level before the timer has
- // timed out, because of wiggling back and forth. Stop the timer.
- unscheduleZoomAboutPoint();
- return false;
- }
-
- // For some reason, the bitmap zoom wants an anchor in backingstore coordinates!
- // this is different from zoomAboutPoint, which wants content coordinates.
- // See RIM Bug #641.
-
- FloatPoint transformedAnchor = mapToTransformedFloatPoint(anchor);
- FloatPoint transformedScrollPosition = mapToTransformedFloatPoint(scrollPosition());
-
- // Prohibit backingstore from updating the window overtop of the bitmap.
- m_backingStore->d->suspendScreenAndBackingStoreUpdates();
-
- // Need to invert the previous transform to anchor the viewport.
- double zoomFraction = scale / transformationMatrix()->m11();
-
- // Anchor offset from scroll position in float.
- FloatPoint anchorOffset(transformedAnchor.x() - transformedScrollPosition.x(),
- transformedAnchor.y() - transformedScrollPosition.y());
-
- IntPoint srcPoint(
- static_cast<int>(roundf(transformedAnchor.x() - anchorOffset.x() / zoomFraction)),
- static_cast<int>(roundf(transformedAnchor.y() - anchorOffset.y() / zoomFraction)));
-
- const IntRect viewportRect = IntRect(IntPoint::zero(), transformedViewportSize());
- const IntRect dstRect = viewportRect;
-
- // This is the rect to pass as the actual source rect in the backingstore
- // for the transform given by zoom.
- IntRect srcRect(srcPoint.x(),
- srcPoint.y(),
- viewportRect.width() / zoomFraction,
- viewportRect.height() / zoomFraction);
- m_backingStore->d->blitContents(dstRect, srcRect);
-
- m_delayedZoomArguments.scale = scale;
- m_delayedZoomArguments.anchor = anchor;
- m_delayedZoomArguments.enforceScaleClamping = enforceScaleClamping;
- m_delayedZoomArguments.forceRendering = forceRendering;
- m_delayedZoomTimer->startOneShot(delayedZoomInterval);
-
- return true;
-}
-
-void WebPagePrivate::unscheduleZoomAboutPoint()
-{
- if (m_delayedZoomTimer->isActive())
- m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::None);
-
- m_delayedZoomTimer->stop();
-}
-
-void WebPagePrivate::zoomAboutPointTimerFired(Timer<WebPagePrivate>*)
-{
- zoomAboutPoint(m_delayedZoomArguments.scale, m_delayedZoomArguments.anchor, m_delayedZoomArguments.enforceScaleClamping, m_delayedZoomArguments.forceRendering);
- m_backingStore->d->resumeScreenAndBackingStoreUpdates(m_delayedZoomArguments.forceRendering ? BackingStore::RenderAndBlit : BackingStore::None);
-}
-
void WebPagePrivate::setNeedsLayout()
{
FrameView* view = m_mainFrame->view();
@@ -3881,12 +3811,56 @@
if (atLeft)
anchor.setX(0);
+ double clampedScale;
+
// Try and zoom here with clamping on.
if (m_backingStore->d->shouldDirectRenderingToWindow()) {
bool success = zoomAboutPoint(scale, anchor, false /* enforceScaleClamping */, true /* forceRendering */);
if (!success && ensureFocusElementVisible)
ensureContentVisible(!newVisibleRectContainsOldVisibleRect);
- } else if (!scheduleZoomAboutPoint(scale, anchor, false /* enforceScaleClamping */, true /* forceRendering */)) {
+
+ } else if (shouldZoomAboutPoint(scale, anchor, false /* enforceScaleClamping */, &clampedScale)) {
+
+ // For some reason, the bitmap zoom wants an anchor in backingstore coordinates!
+ // this is different from zoomAboutPoint, which wants content coordinates.
+ // See RIM Bug #641.
+
+ FloatPoint transformedAnchor = mapToTransformedFloatPoint(anchor);
+ FloatPoint transformedScrollPosition = mapToTransformedFloatPoint(scrollPosition());
+
+ // Prohibit backingstore from updating the window overtop of the bitmap.
+ m_backingStore->d->suspendScreenAndBackingStoreUpdates();
+
+ // Need to invert the previous transform to anchor the viewport.
+ double zoomFraction = clampedScale / transformationMatrix()->m11();
+
+ // Anchor offset from scroll position in float.
+ FloatPoint anchorOffset(transformedAnchor.x() - transformedScrollPosition.x(),
+ transformedAnchor.y() - transformedScrollPosition.y());
+
+ IntPoint srcPoint(
+ static_cast<int>(roundf(transformedAnchor.x() - anchorOffset.x() / zoomFraction)),
+ static_cast<int>(roundf(transformedAnchor.y() - anchorOffset.y() / zoomFraction)));
+
+ const IntRect viewportRect = IntRect(IntPoint::zero(), transformedViewportSize());
+ const IntRect dstRect = viewportRect;
+
+ // This is the rect to pass as the actual source rect in the backingstore
+ // for the transform given by zoom.
+ IntRect srcRect(srcPoint.x(),
+ srcPoint.y(),
+ viewportRect.width() / zoomFraction,
+ viewportRect.height() / zoomFraction);
+ m_backingStore->d->blitContents(dstRect, srcRect);
+
+ zoomAboutPoint(clampedScale, anchor, false /*enforceScaleClamping*/, true /*forceRendering*/);
+
+ m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
+
+ if (ensureFocusElementVisible)
+ ensureContentVisible(!newVisibleRectContainsOldVisibleRect);
+ } else {
+
// Suspend all screen updates to the backingstore.
m_backingStore->d->suspendScreenAndBackingStoreUpdates();
@@ -3917,8 +3891,7 @@
// If we need layout then render and blit, otherwise just blit as our viewport has changed.
m_backingStore->d->resumeScreenAndBackingStoreUpdates(needsLayout ? BackingStore::RenderAndBlit : BackingStore::Blit);
- } else if (ensureFocusElementVisible)
- ensureContentVisible(!newVisibleRectContainsOldVisibleRect);
+ }
}
void WebPage::setViewportSize(const Platform::IntSize& viewportSize, bool ensureFocusElementVisible)
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (128602 => 128603)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-09-14 13:19:36 UTC (rev 128602)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-09-14 13:27:18 UTC (rev 128603)
@@ -134,8 +134,6 @@
// Scale the page to the given scale and anchor about the point which is specified in untransformed content coordinates.
bool zoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforceScaleClamping = true, bool forceRendering = false, bool isRestoringZoomLevel = false);
- bool scheduleZoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforceScaleClamping = true, bool forceRendering = false);
- void unscheduleZoomAboutPoint();
WebCore::IntPoint calculateReflowedScrollPosition(const WebCore::FloatPoint& anchorOffset, double inverseScale);
void setTextReflowAnchorPoint(const Platform::IntPoint& focalPoint);
@@ -547,15 +545,6 @@
RefPtr<WebCore::Node> m_currentBlockZoomAdjustedNode;
bool m_shouldReflowBlock;
- // Delayed zoomAboutPoint.
- OwnPtr<WebCore::Timer<WebPagePrivate> > m_delayedZoomTimer;
- struct {
- double scale;
- WebCore::FloatPoint anchor;
- bool enforceScaleClamping;
- bool forceRendering;
- } m_delayedZoomArguments;
-
double m_lastUserEventTimestamp; // Used to detect user scrolling.
WebCore::PlatformMouseEvent m_lastMouseEvent;
Modified: trunk/Source/WebKit/blackberry/ChangeLog (128602 => 128603)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-09-14 13:19:36 UTC (rev 128602)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-09-14 13:27:18 UTC (rev 128603)
@@ -1,3 +1,35 @@
+2012-09-13 Antonio Gomes <[email protected]>
+
+ [BlackBerry] Remove the ability to schedule a zoom about point call.
+ https://bugs.webkit.org/show_bug.cgi?id=96696
+
+ [FullScreen] entering/leaving fullscreen results in temporary glitches on the screen (Part I)
+ PR #180866
+
+ Reviewed by Rob Buis.
+
+ Internally reviewed by Jacky Jiang and Arvid Nilsson.
+
+ Patch replaces the async call to zoomAboutPoint (via scheduling it with a one-shot-0-timer).
+ Instead, at its single call site, we inline most of the previous scheduleZoomAboutPoint code,
+ and in the end call zoomAboutPoint directly.
+
+ Change was estimulated by Arvid's comment on PRzilla: "There is no longer any reason to have
+ zoom about point be async.. That was a hack I did for BB6, back when we were doing everything on the WK
+ thread and needed manual time slicing betwren rendering and user interaction."
+
+ The bigger goal though is to be able to remove screen glitches while entering/leaving
+ fullscreen mode: since we could accurately use the count-based suspend/resume backing
+ store mechanism to prevent it.
+
+ * Api/WebPage.cpp:
+ (WebKit):
+ (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+ (BlackBerry::WebKit::WebPagePrivate::setLoadState):
+ (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+
2012-09-14 Arvid Nilsson <[email protected]>
[BlackBerry] Add renderTreeAsText API to WebPage