* Change the coordinate transformation in the PlatformMouseEvent handlers
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 09:36:57 +0000 (09:36 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 09:36:57 +0000 (09:36 +0000)
* We want to convert from coordinates of the containing window to our local
  position on the scrollbar.

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

WebCore/ChangeLog
WebCore/platform/qt/PlatformScrollBarQt.cpp

index 336b21fb9d25ba16ceda45cf0df15a8e888f0de8..0c6ca336e06794980396e7a19eb2635c910ae1ce 100644 (file)
@@ -1,3 +1,15 @@
+2008-01-18  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
+        * Change the coordinate transformation in the PlatformMouseEvent handlers
+        * We want to convert from coordinates of the containing window to our local
+        position on the scrollbar.
+
+        * platform/qt/PlatformScrollBarQt.cpp:
+        (WebCore::PlatformScrollbar::handleMouseMoveEvent):
+        (WebCore::PlatformScrollbar::handleMousePressEvent):
+
 2008-01-18  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Simon.
index 8d9f8588e45c33f77ea9adfc9da0719f713d839e..6439edf7fbdf9b9bcd1e279c0529c2d406978e5b 100644 (file)
@@ -197,14 +197,11 @@ int PlatformScrollbar::trackLength() const
 
 bool PlatformScrollbar::handleMouseMoveEvent(const PlatformMouseEvent& evt)
 {
-    const QPoint pos = parent()->convertFromContainingWindow(evt.pos());
+    const QPoint pos = convertFromContainingWindow(evt.pos());
     //qDebug() << "PlatformScrollbar::handleMouseMoveEvent" << m_opt.rect << pos << evt.pos();
 
     m_opt.state |= QStyle::State_MouseOver;
-    const QPoint ctlPt = m_opt.rect.topLeft();
-    m_opt.rect.moveTo(0, 0);
-    QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, QPoint(pos) - ctlPt, 0);
-    m_opt.rect.moveTo(ctlPt);
+    QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
 
     if (sc == m_pressedPart) {
         m_opt.state |= QStyle::State_Sunken;
@@ -274,13 +271,10 @@ bool PlatformScrollbar::handleMouseOutEvent(const PlatformMouseEvent& evt)
 
 bool PlatformScrollbar::handleMousePressEvent(const PlatformMouseEvent& evt)
 {
-    const QPoint pos = parent()->convertFromContainingWindow(evt.pos());
+    const QPoint pos = convertFromContainingWindow(evt.pos());
     //qDebug() << "PlatformScrollbar::handleMousePressEvent" << m_opt.rect << pos << evt.pos();
 
-    const QPoint ctlPt = m_opt.rect.topLeft();
-    m_opt.rect.moveTo(0, 0);
-    QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, QPoint(pos) - ctlPt, 0);
-    m_opt.rect.moveTo(ctlPt);
+    QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
     switch (sc) {
         case QStyle::SC_ScrollBarAddLine:
         case QStyle::SC_ScrollBarSubLine: