Tor Arne Vestbø <tavestbo@trolltech.com>
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2008 14:29:57 +0000 (14:29 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2008 14:29:57 +0000 (14:29 +0000)
Prevent middle-click from triggering open URL from clipboard when the event has already been accepted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/qt/PlatformScrollBarQt.cpp
WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog

index 182eabb..20aec85 100644 (file)
@@ -2,6 +2,15 @@
 
         Reviewed by Simon.
 
+        Prevent middle-click from triggering open URL from clipboard when the event has already been accepted.
+
+        * platform/qt/PlatformScrollBarQt.cpp:
+        (WebCore::PlatformScrollbar::handleMousePressEvent):
+
+2008-04-28  Tor Arne Vestbø  <tavestbo@trolltech.com>
+
+        Reviewed by Simon.
+
         Fix scrollbar behavior in QtWebKit to match QScrollBar.
 
         Right click context menu is now supported, along with
index 87b8294..66063eb 100644 (file)
@@ -313,7 +313,7 @@ bool PlatformScrollbar::handleMousePressEvent(const PlatformMouseEvent& evt)
         setValue(pixelPosToRangeValue((m_orientation == HorizontalScrollbar ?
                                         pos.x() : pos.y()) - thumbLength() / 2));
 
-    } else { // Left button
+    } else { // Left button, or if middle click centering is not supported
         const QPoint topLeft = m_opt.rect.topLeft();
         m_opt.rect.moveTo(QPoint(0, 0));
         QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
index 943d27f..5dd844c 100644 (file)
@@ -373,7 +373,8 @@ void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev)
     if (!frame->view())
         return;
 
-    frame->eventHandler()->mouseMoved(PlatformMouseEvent(ev, 0));
+    bool accepted = frame->eventHandler()->mouseMoved(PlatformMouseEvent(ev, 0));
+    ev->setAccepted(accepted);
 }
 
 void QWebPagePrivate::mousePressEvent(QMouseEvent *ev)
@@ -382,13 +383,15 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev)
     if (!frame->view())
         return;
 
-    if (tripleClickTimer.isActive() && (ev->pos() - tripleClick).manhattanLength() <
-         QApplication::startDragDistance()) {
+    if (tripleClickTimer.isActive()
+            && (ev->pos() - tripleClick).manhattanLength()
+                < QApplication::startDragDistance()) {
         mouseTripleClickEvent(ev);
         return;
     }
 
-    frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 1));
+    bool accepted = frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 1));
+    ev->setAccepted(accepted);
 }
 
 void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev)
@@ -397,7 +400,8 @@ void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev)
     if (!frame->view())
         return;
 
-    frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 2));
+    bool accepted = frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 2));
+    ev->setAccepted(accepted);
 
     tripleClickTimer.start(QApplication::doubleClickInterval(), q);
     tripleClick = ev->pos();
@@ -409,7 +413,8 @@ void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev)
     if (!frame->view())
         return;
 
-    frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 3));
+    bool accepted = frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(ev, 3));
+    ev->setAccepted(accepted);
 }
 
 void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
@@ -418,7 +423,8 @@ void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
     if (!frame->view())
         return;
 
-    frame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(ev, 0));
+    bool accepted = frame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(ev, 0));
+    ev->setAccepted(accepted);
 
 #ifndef QT_NO_CLIPBOARD
     if (QApplication::clipboard()->supportsSelection()) {
index 4cad6a9..efecf61 100644 (file)
@@ -2,6 +2,20 @@
 
         Reviewed by Simon.
 
+        Prevent middle-click from triggering open URL from clipboard when the event has already been accepted.
+        
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::mouseMoveEvent):
+        (QWebPagePrivate::mousePressEvent):
+        (QWebPagePrivate::mouseDoubleClickEvent):
+        (QWebPagePrivate::mouseTripleClickEvent):
+        (QWebPagePrivate::mouseReleaseEvent):
+
+2008-04-28  Tor Arne Vestbø  <tavestbo@trolltech.com>
+
+        Reviewed by Simon.
+
         Fix scrollbar behavior in QtWebKit to match QScrollBar.
         
         Right click context menu is now supported, along with