[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
trey
trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:48:20 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 45ab46540c161c5cc0a4cfec8648223b4e4b8199
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jun 24 20:20:44 2004 +0000
3679986 - screenX and screenY are flipped and relative to the bottom left of the WebView, rather than the screen
3699510 - synthesized click events have bogus screen coords
Reviewed by Darin.
* khtml/khtmlview.cpp:
(KHTMLView::dispatchDragEvent): Generate screen coords for drag events using new func.
(KHTMLView::dispatchMouseEvent): Ditto.
* khtml/khtmlview.h:
* khtml/xml/dom_nodeimpl.cpp:
(NodeImpl::dispatchMouseEvent): Comment tricky semantics.
Calc screen coords in apple-specific way.
* kwq/KWQKHTMLView.mm:
(KHTMLView::viewportToGlobal): Passthrough to window widget.
* kwq/KWQScrollView.mm:
* kwq/KWQWindowWidget.h:
* kwq/KWQWindowWidget.mm:
(KWQWindowWidget::mapToGlobal): Call former code factored to new method below.
(KWQWindowWidget::viewportToGlobal): New method to convert "viewport" (which for us
really means NSWindow coords) to screen coords.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6922 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5fc2ed9..d6495a6 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,28 @@
2004-06-24 Trey Matteson <trey at apple.com>
+ 3679986 - screenX and screenY are flipped and relative to the bottom left of the WebView, rather than the screen
+ 3699510 - synthesized click events have bogus screen coords
+
+ Reviewed by Darin.
+
+ * khtml/khtmlview.cpp:
+ (KHTMLView::dispatchDragEvent): Generate screen coords for drag events using new func.
+ (KHTMLView::dispatchMouseEvent): Ditto.
+ * khtml/khtmlview.h:
+ * khtml/xml/dom_nodeimpl.cpp:
+ (NodeImpl::dispatchMouseEvent): Comment tricky semantics.
+ Calc screen coords in apple-specific way.
+ * kwq/KWQKHTMLView.mm:
+ (KHTMLView::viewportToGlobal): Passthrough to window widget.
+ * kwq/KWQScrollView.mm:
+ * kwq/KWQWindowWidget.h:
+ * kwq/KWQWindowWidget.mm:
+ (KWQWindowWidget::mapToGlobal): Call former code factored to new method below.
+ (KWQWindowWidget::viewportToGlobal): New method to convert "viewport" (which for us
+ really means NSWindow coords) to screen coords.
+
+2004-06-24 Trey Matteson <trey at apple.com>
+
3693420 - onbeforecut and onbeforepaste need real implementaion
Reviewed by Chris.
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 393f9b0..6c3fccb 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -1161,10 +1161,15 @@ bool KHTMLView::dispatchDragEvent(int eventId, DOM::NodeImpl *dragTarget, const
{
int clientX, clientY;
viewportToContents(loc.x(), loc.y(), clientX, clientY);
- // Typically we'd use the mouse event's globalX/Y, but we have no mouse event to query, and in practice
- // the globalX/Y fields are the window level coords anyway.
+#if APPLE_CHANGES
+ QPoint screenLoc = viewportToGlobal(loc);
+ int screenX = screenLoc.x();
+ int screenY = screenLoc.y();
+#else
+#warning Need implementation of converting event location to screen location
int screenX = loc.x();
int screenY = loc.y();
+#endif
bool ctrlKey = 0; // FIXME - set up modifiers, grab from AK or CG
bool altKey = 0;
bool shiftKey = 0;
@@ -1728,8 +1733,14 @@ bool KHTMLView::dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode, bool
int exceptioncode = 0;
int clientX, clientY;
viewportToContents(_mouse->x(), _mouse->y(), clientX, clientY);
+#if APPLE_CHANGES
+ QPoint screenLoc = viewportToGlobal(_mouse->pos());
+ int screenX = screenLoc.x();
+ int screenY = screenLoc.y();
+#else
int screenX = _mouse->globalX();
int screenY = _mouse->globalY();
+#endif
int button = -1;
switch (_mouse->button()) {
case LeftButton:
diff --git a/WebCore/khtml/khtmlview.h b/WebCore/khtml/khtmlview.h
index 79107d4..2c2d900 100644
--- a/WebCore/khtml/khtmlview.h
+++ b/WebCore/khtml/khtmlview.h
@@ -218,6 +218,8 @@ public:
#if APPLE_CHANGES
QWidget *topLevelWidget() const;
QPoint mapToGlobal(const QPoint &) const;
+ // maps "viewport" (actually Cocoa window coords) to screen coords
+ QPoint viewportToGlobal(const QPoint &) const;
void adjustViewSize();
void initScrollBars();
#endif
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index a2b4ff7..5eac558 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -762,13 +762,37 @@ bool NodeImpl::dispatchMouseEvent(QMouseEvent *_mouse, int overrideId, int overr
int exceptioncode = 0;
+#if APPLE_CHANGES
+// Careful here - our viewportToContents() converts points from NSEvents, in NSWindow coord system to
+// our khtmlview's coord system. This works for QMouseEvents coming from Cocoa because those events
+// hold the location from the NSEvent. The QMouseEvent param here was made by other khtml code, so it
+// will be a "proper" QT event with coords in terms of this widget. So in WebCore it would never be
+// right to pass coords from _mouse to viewportToContents().
+#endif
// int clientX, clientY;
// viewportToContents(_mouse->x(), _mouse->y(), clientX, clientY);
int clientX = _mouse->x(); // ### adjust to be relative to view
int clientY = _mouse->y(); // ### adjust to be relative to view
+#if APPLE_CHANGES
+ int screenX;
+ int screenY;
+ KHTMLView *view = document->document()->view();
+ if (view) {
+ // This gets us as far as NSWindow coords
+ QPoint windowLoc = view->contentsToViewport(_mouse->pos());
+ // Then from NSWindow coords to screen coords
+ QPoint screenLoc = view->viewportToGlobal(windowLoc);
+ screenX = screenLoc.x();
+ screenY = screenLoc.y();
+ } else {
+ screenX = _mouse->x();
+ screenY = _mouse->y();
+ }
+#else
int screenX = _mouse->globalX();
int screenY = _mouse->globalY();
+#endif
int button = -1;
switch (_mouse->button()) {
diff --git a/WebCore/kwq/KWQKHTMLView.mm b/WebCore/kwq/KWQKHTMLView.mm
index 9c563ef..f5c8854 100644
--- a/WebCore/kwq/KWQKHTMLView.mm
+++ b/WebCore/kwq/KWQKHTMLView.mm
@@ -45,3 +45,8 @@ QPoint KHTMLView::mapToGlobal(const QPoint &p) const
return static_cast<KWQWindowWidget *>(topLevelWidget())->mapToGlobal(p);
}
+
+QPoint KHTMLView::viewportToGlobal(const QPoint &p) const
+{
+ return static_cast<KWQWindowWidget *>(topLevelWidget())->viewportToGlobal(p);
+}
diff --git a/WebCore/kwq/KWQScrollView.mm b/WebCore/kwq/KWQScrollView.mm
index 9a80c29..f076904 100644
--- a/WebCore/kwq/KWQScrollView.mm
+++ b/WebCore/kwq/KWQScrollView.mm
@@ -387,6 +387,8 @@ QPoint QScrollView::contentsToViewport(const QPoint &p)
return QPoint(vx, vy);
}
+// NB, for us "viewport" means the NSWindow's coord system, which is origin lower left
+
void QScrollView::contentsToViewport(int x, int y, int& vx, int& vy)
{
KWQ_BLOCK_EXCEPTIONS;
diff --git a/WebCore/kwq/KWQWindowWidget.h b/WebCore/kwq/KWQWindowWidget.h
index efb0f56..6d3c753 100644
--- a/WebCore/kwq/KWQWindowWidget.h
+++ b/WebCore/kwq/KWQWindowWidget.h
@@ -50,6 +50,7 @@ class KWQWindowWidget : public QWidget
virtual QWidget *topLevelWidget() const;
virtual QPoint mapToGlobal(const QPoint &) const;
virtual QPoint mapFromGlobal(const QPoint &) const;
+ virtual QPoint viewportToGlobal(const QPoint &) const;
private:
KWQWindowWidgetPrivate *d;
diff --git a/WebCore/kwq/KWQWindowWidget.mm b/WebCore/kwq/KWQWindowWidget.mm
index 76bb897..78029a4 100644
--- a/WebCore/kwq/KWQWindowWidget.mm
+++ b/WebCore/kwq/KWQWindowWidget.mm
@@ -67,11 +67,11 @@ QWidget *KWQWindowWidget::topLevelWidget() const
return (QWidget *)this;
}
+// Note these routines work on QT window coords - origin upper left
QPoint KWQWindowWidget::mapToGlobal(const QPoint &p) const
{
- NSPoint windowPoint = NSMakePoint(p.x(), [d->bridge windowFrame].size.height - p.y());
- NSPoint screenPoint = [[d->bridge window] convertBaseToScreen:windowPoint];
- return QPoint((int)screenPoint.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y));
+ QPoint cocoaWindowPoint(p.x(), (int)([d->bridge windowFrame].size.height - p.y()));
+ return viewportToGlobal(cocoaWindowPoint);
}
QPoint KWQWindowWidget::mapFromGlobal(const QPoint &p) const
@@ -81,6 +81,14 @@ QPoint KWQWindowWidget::mapFromGlobal(const QPoint &p) const
return QPoint((int)windowPoint.x, (int)([[d->bridge window] frame].size.height - windowPoint.y));
}
+// maps "viewport" (actually Cocoa window coords) to screen coords
+QPoint KWQWindowWidget::viewportToGlobal(const QPoint &p) const
+{
+ NSPoint windowPoint = NSMakePoint(p.x(), p.y());
+ NSPoint screenPoint = [[d->bridge window] convertBaseToScreen:windowPoint];
+ return QPoint((int)screenPoint.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y));
+}
+
void KWQWindowWidget::setFrameGeometry(const QRect &r)
{
// FIXME: Could do something to make it easy for the browser to avoid saving this change.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list