Diff
Modified: trunk/Source/WebKit2/ChangeLog (92679 => 92680)
--- trunk/Source/WebKit2/ChangeLog 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-09 14:10:57 UTC (rev 92680)
@@ -1,3 +1,28 @@
+2011-08-09 Kenneth Rohde Christiansen <[email protected]>
+
+ [Qt] Vastly improve the algorithm for finding a zoomable area when doing double-tap
+ https://bugs.webkit.org/show_bug.cgi?id=65907
+
+ Reviewed by Andreas Kling.
+
+ This is upstreaming of the algorithm we are currently using on the N9 browser
+ and this also fixes a bug with not considering the frame positions when finding
+ a zoomable area.
+
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didFindZoomableArea):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/qt/qdesktopwebpageproxy.cpp:
+ (QDesktopWebPageProxy::didFindZoomableArea):
+ * UIProcess/qt/qdesktopwebpageproxy.h:
+ * UIProcess/qt/qtouchwebpageproxy.cpp:
+ (QTouchWebPageProxy::didFindZoomableArea):
+ * UIProcess/qt/qtouchwebpageproxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::findZoomableAreaForPoint):
+
2011-08-08 Chris Marrin <[email protected]>
Logic to compute visible display rect in GraphicsLayerCA::syncCompositingState
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2011-08-09 14:10:57 UTC (rev 92680)
@@ -104,7 +104,7 @@
#endif
#if PLATFORM(QT)
virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
- virtual void didFindZoomableArea(const WebCore::IntRect&) = 0;
+ virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-08-09 14:10:57 UTC (rev 92680)
@@ -2202,9 +2202,9 @@
m_pageClient->didChangeContentsSize(size);
}
-void WebPageProxy::didFindZoomableArea(const IntRect& area)
+void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
{
- m_pageClient->didFindZoomableArea(area);
+ m_pageClient->didFindZoomableArea(target, area);
}
void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-08-09 14:10:57 UTC (rev 92680)
@@ -661,7 +661,7 @@
#if PLATFORM(QT)
void didChangeContentsSize(const WebCore::IntSize&);
- void didFindZoomableArea(const WebCore::IntRect&);
+ void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
#endif
#if ENABLE(TOUCH_EVENTS)
void needTouchEvents(bool);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2011-08-09 14:10:57 UTC (rev 92680)
@@ -72,7 +72,7 @@
#endif
#if PLATFORM(QT)
DidChangeContentsSize(WebCore::IntSize newSize)
- DidFindZoomableArea(WebCore::IntRect area)
+ DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
#endif
#if ENABLE(TOUCH_EVENTS)
NeedTouchEvents(bool needTouchEvents)
Modified: trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp 2011-08-09 14:10:57 UTC (rev 92680)
@@ -226,7 +226,7 @@
QObject::timerEvent(ev);
}
-void QDesktopWebPageProxy::didFindZoomableArea(const IntRect&)
+void QDesktopWebPageProxy::didFindZoomableArea(const IntPoint&, const IntRect&)
{
// This feature is only used by QTouchWebView.
}
Modified: trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h 2011-08-09 14:10:57 UTC (rev 92680)
@@ -46,7 +46,7 @@
#if ENABLE(TOUCH_EVENTS)
virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
#endif
- virtual void didFindZoomableArea(const WebCore::IntRect&);
+ virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
virtual void timerEvent(QTimerEvent*);
Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp 2011-08-09 14:10:57 UTC (rev 92680)
@@ -121,7 +121,7 @@
drawingArea()->setContentsScale(scale);
}
-void QTouchWebPageProxy::didFindZoomableArea(const IntRect& area)
+void QTouchWebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
{
emit zoomableAreaFound(QRect(area));
}
Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h (92679 => 92680)
--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h 2011-08-09 14:10:57 UTC (rev 92680)
@@ -54,7 +54,7 @@
#if ENABLE(TOUCH_EVENTS)
virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
#endif
- virtual void didFindZoomableArea(const WebCore::IntRect&);
+ virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
TouchViewInterface* touchViewInterface() const { return static_cast<TouchViewInterface*>(m_viewInterface); }
TiledDrawingAreaProxy* drawingArea() const { return static_cast<WebKit::TiledDrawingAreaProxy*>(m_webPageProxy->drawingArea()); }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (92679 => 92680)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-08-09 13:32:29 UTC (rev 92679)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-08-09 14:10:57 UTC (rev 92680)
@@ -2087,19 +2087,39 @@
#if PLATFORM(QT)
void WebPage::findZoomableAreaForPoint(const WebCore::IntPoint& point)
{
- const int minimumZoomTargetWidth = 100;
-
Frame* mainframe = m_mainFrame->coreFrame();
HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), /*allowShadowContent*/ false, /*ignoreClipping*/ true);
Node* node = result.innerNode();
- while (node && node->getRect().width() < minimumZoomTargetWidth)
+
+ if (!node)
+ return;
+
+ IntRect zoomableArea = node->getRect();
+
+ while (true) {
+ bool found = !node->isTextNode() && !node->isShadowRoot();
+
+ // No candidate found, bail out.
+ if (!found && !node->parentNode())
+ return;
+
+ // Candidate found, and it is a better candidate than its parent.
+ // NB: A parent is considered a better candidate iff the node is
+ // contained by it and it is the only child.
+ if (found && (!node->parentNode() || node->parentNode()->childNodeCount() != 1))
+ break;
+
node = node->parentNode();
+ zoomableArea.unite(node->getRect());
+ }
- IntRect zoomableArea;
- if (node)
- zoomableArea = node->getRect();
- send(Messages::WebPageProxy::DidFindZoomableArea(zoomableArea));
+ if (node->document() && node->document()->frame() && node->document()->frame()->view()) {
+ const ScrollView* view = node->document()->frame()->view();
+ zoomableArea = view->contentsToWindow(zoomableArea);
+ }
+
+ send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea));
}
#endif