summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry/Api/WebPage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-26 11:37:00 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-26 11:36:36 +0100
commitf474b2b60ec57205facd4eec2181ebe69b686772 (patch)
tree42a132541a82c97039ea8a98b40e5012187ede28 /Source/WebKit/blackberry/Api/WebPage.cpp
parent061d58bc0fa016cfeed744fd3e4663460635d69b (diff)
downloadqtwebkit-f474b2b60ec57205facd4eec2181ebe69b686772.tar.gz
Imported WebKit commit 76dac539db7ece7079963adfcfe878d8e2f7d861 (http://svn.webkit.org/repository/webkit/trunk@135696)
New snapshot that fixes build after QMacStyle removal Change-Id: Idea95c96c73b49158d52861db2a4b8d2c51766b0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit/blackberry/Api/WebPage.cpp')
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.cpp125
1 files changed, 58 insertions, 67 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp
index aece95429..8c24a51cd 100644
--- a/Source/WebKit/blackberry/Api/WebPage.cpp
+++ b/Source/WebKit/blackberry/Api/WebPage.cpp
@@ -1636,7 +1636,6 @@ void WebPagePrivate::zoomToInitialScaleOnLoad()
BBLOG(Platform::LogLevelInfo, "WebPagePrivate::zoomToInitialScaleOnLoad content is empty!");
#endif
requestLayoutIfNeeded();
- m_client->resetBitmapZoomScale(currentScale());
notifyTransformedContentsSizeChanged();
return;
}
@@ -1667,7 +1666,6 @@ void WebPagePrivate::zoomToInitialScaleOnLoad()
if (!performedZoom) {
// We only notify if we didn't perform zoom, because zoom will notify on
// its own...
- m_client->resetBitmapZoomScale(currentScale());
notifyTransformedContentsSizeChanged();
}
}
@@ -2959,7 +2957,6 @@ void WebPagePrivate::zoomBlock()
TransformationMatrix zoom;
zoom.scale(m_blockZoomFinalScale);
*m_transformationMatrix = zoom;
- m_client->resetBitmapZoomScale(m_blockZoomFinalScale);
// FIXME: Do we really need to suspend/resume both backingstore and screen here?
m_backingStore->d->suspendBackingStoreUpdates();
m_backingStore->d->suspendScreenUpdates();
@@ -3467,7 +3464,14 @@ void WebPagePrivate::dispatchViewportPropertiesDidChange(const ViewportArguments
Platform::IntSize virtualViewport = recomputeVirtualViewportFromViewportArguments();
m_webPage->setVirtualViewportSize(virtualViewport);
- if (loadState() == WebKit::WebPagePrivate::Committed)
+ // Reset m_userPerformedManualZoom and enable m_shouldZoomToInitialScaleAfterLoadFinished so that we can relayout
+ // the page and zoom it to fit the screen when we dynamically change the meta viewport after the load is finished.
+ bool isLoadFinished = loadState() == Finished;
+ if (isLoadFinished) {
+ m_userPerformedManualZoom = false;
+ setShouldZoomToInitialScaleAfterLoadFinished(true);
+ }
+ if (loadState() == Committed || isLoadFinished)
zoomToInitialScaleOnLoad();
}
@@ -4048,72 +4052,13 @@ void WebPage::setDocumentScrollOriginPoint(const Platform::IntPoint& documentScr
d->setScrollOriginPoint(documentScrollOrigin);
}
-bool WebPagePrivate::dispatchTouchEventToFullScreenPlugin(PluginView* plugin, const Platform::TouchEvent& event)
-{
- NPTouchEvent npTouchEvent;
-
- if (event.isDoubleTap())
- npTouchEvent.type = TOUCH_EVENT_DOUBLETAP;
- else if (event.isTouchHold())
- npTouchEvent.type = TOUCH_EVENT_TOUCHHOLD;
- else {
- switch (event.m_type) {
- case Platform::TouchEvent::TouchStart:
- npTouchEvent.type = TOUCH_EVENT_START;
- break;
- case Platform::TouchEvent::TouchEnd:
- npTouchEvent.type = TOUCH_EVENT_END;
- break;
- case Platform::TouchEvent::TouchMove:
- npTouchEvent.type = TOUCH_EVENT_MOVE;
- break;
- case Platform::TouchEvent::TouchCancel:
- npTouchEvent.type = TOUCH_EVENT_CANCEL;
- break;
- default:
- return false;
- }
- }
-
- npTouchEvent.points = 0;
- npTouchEvent.size = event.m_points.size();
- if (npTouchEvent.size) {
- npTouchEvent.points = new NPTouchPoint[npTouchEvent.size];
- for (int i = 0; i < npTouchEvent.size; i++) {
- npTouchEvent.points[i].touchId = event.m_points[i].m_id;
- npTouchEvent.points[i].clientX = event.m_points[i].m_screenPos.x();
- npTouchEvent.points[i].clientY = event.m_points[i].m_screenPos.y();
- npTouchEvent.points[i].screenX = event.m_points[i].m_screenPos.x();
- npTouchEvent.points[i].screenY = event.m_points[i].m_screenPos.y();
- npTouchEvent.points[i].pageX = event.m_points[i].m_pos.x();
- npTouchEvent.points[i].pageY = event.m_points[i].m_pos.y();
- }
- }
-
- NPEvent npEvent;
- npEvent.type = NP_TouchEvent;
- npEvent.data = &npTouchEvent;
-
- bool handled = plugin->dispatchFullScreenNPEvent(npEvent);
-
- if (npTouchEvent.type == TOUCH_EVENT_DOUBLETAP && !handled) {
- // Send Touch Up if double tap not consumed.
- npTouchEvent.type = TOUCH_EVENT_END;
- npEvent.data = &npTouchEvent;
- handled = plugin->dispatchFullScreenNPEvent(npEvent);
- }
- delete[] npTouchEvent.points;
- return handled;
-}
-
void WebPage::touchPointAsMouseEvent(const Platform::TouchPoint& point)
{
if (d->m_page->defersLoading())
return;
- PluginView* pluginView = d->m_fullScreenPluginView.get();
- if (pluginView)
- d->dispatchTouchPointAsMouseEventToFullScreenPlugin(pluginView, point);
+ if (d->m_fullScreenPluginView.get())
+ return;
d->m_lastUserEventTimestamp = currentTime();
@@ -4129,6 +4074,51 @@ void WebPage::playSoundIfAnchorIsTarget() const
d->m_touchEventHandler->playSoundIfAnchorIsTarget();
}
+bool WebPagePrivate::dispatchTouchEventToFullScreenPlugin(PluginView* plugin, const Platform::TouchEvent& event)
+{
+ // Always convert touch events to mouse events.
+ // Don't send actual touch events because no one has ever implemented them in flash.
+ if (!event.neverHadMultiTouch())
+ return false;
+
+ if (event.isDoubleTap() || event.isTouchHold() || event.m_type == Platform::TouchEvent::TouchCancel) {
+ NPTouchEvent npTouchEvent;
+
+ if (event.isDoubleTap())
+ npTouchEvent.type = TOUCH_EVENT_DOUBLETAP;
+ else if (event.isTouchHold())
+ npTouchEvent.type = TOUCH_EVENT_TOUCHHOLD;
+ else if (event.m_type == Platform::TouchEvent::TouchCancel)
+ npTouchEvent.type = TOUCH_EVENT_CANCEL;
+
+ npTouchEvent.points = 0;
+ npTouchEvent.size = event.m_points.size();
+ if (npTouchEvent.size) {
+ npTouchEvent.points = new NPTouchPoint[npTouchEvent.size];
+ for (int i = 0; i < npTouchEvent.size; i++) {
+ npTouchEvent.points[i].touchId = event.m_points[i].m_id;
+ npTouchEvent.points[i].clientX = event.m_points[i].m_screenPos.x();
+ npTouchEvent.points[i].clientY = event.m_points[i].m_screenPos.y();
+ npTouchEvent.points[i].screenX = event.m_points[i].m_screenPos.x();
+ npTouchEvent.points[i].screenY = event.m_points[i].m_screenPos.y();
+ npTouchEvent.points[i].pageX = event.m_points[i].m_pos.x();
+ npTouchEvent.points[i].pageY = event.m_points[i].m_pos.y();
+ }
+ }
+
+ NPEvent npEvent;
+ npEvent.type = NP_TouchEvent;
+ npEvent.data = &npTouchEvent;
+
+ plugin->dispatchFullScreenNPEvent(npEvent);
+ delete[] npTouchEvent.points;
+ return true;
+ }
+
+ dispatchTouchPointAsMouseEventToFullScreenPlugin(plugin, event.m_points[0]);
+ return true;
+}
+
bool WebPagePrivate::dispatchTouchPointAsMouseEventToFullScreenPlugin(PluginView* pluginView, const Platform::TouchPoint& point)
{
NPEvent npEvent;
@@ -4145,7 +4135,7 @@ bool WebPagePrivate::dispatchTouchPointAsMouseEventToFullScreenPlugin(PluginView
mouse.type = MOUSE_MOTION;
break;
case Platform::TouchPoint::TouchStationary:
- return false;
+ return true;
}
mouse.x = point.m_screenPos.x();
@@ -4155,7 +4145,8 @@ bool WebPagePrivate::dispatchTouchPointAsMouseEventToFullScreenPlugin(PluginView
npEvent.type = NP_MouseEvent;
npEvent.data = &mouse;
- return pluginView->dispatchFullScreenNPEvent(npEvent);
+ pluginView->dispatchFullScreenNPEvent(npEvent);
+ return true;
}
void WebPage::touchEventCancel()