Reviewed by John Louch.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2005 00:43:14 +0000 (00:43 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2005 00:43:14 +0000 (00:43 +0000)
        - fixed <rdar://problem/3958503> need screenX and screenY to use WebKit windowFrame delegate

        * khtml/ecma/kjs_window.cpp: (Window::get): Change screenX and screenY to use frameGeometry instead
        of using mapToGlobal and screen in a complicated way.
        * kwq/KWQKHTMLView.mm: Removed unused mapToGlobal function.
        * kwq/KWQWindowWidget.h: Ditto.
        * kwq/KWQWindowWidget.mm: Ditto.

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/kjs_window.cpp
WebCore/kwq/KWQKHTMLView.mm
WebCore/kwq/KWQWindowWidget.h
WebCore/kwq/KWQWindowWidget.mm

index 70a38db87d34db00ea61d034a61e1302b9586873..185a4a9e7dcea71bdbfc0d2047116e6fc85662aa 100644 (file)
@@ -1,3 +1,15 @@
+2005-01-17  Darin Adler  <darin@apple.com>
+
+        Reviewed by John Louch.
+
+        - fixed <rdar://problem/3958503> need screenX and screenY to use WebKit windowFrame delegate
+
+        * khtml/ecma/kjs_window.cpp: (Window::get): Change screenX and screenY to use frameGeometry instead
+        of using mapToGlobal and screen in a complicated way.
+        * kwq/KWQKHTMLView.mm: Removed unused mapToGlobal function.
+        * kwq/KWQWindowWidget.h: Ditto.
+        * kwq/KWQWindowWidget.mm: Ditto.
+
 2005-01-17  David Hyatt  <hyatt@apple.com>
 
        Fix a screwup in rightmost/lowets position computation.  3955207.  Make sure floats with layers are still checked.
index eb5220114048c6f9601f8408d69d963e97c50955..056181dc4adc0e6be44ff6c9c438bc77d9eb203e 100644 (file)
@@ -603,15 +603,28 @@ Value Window::get(ExecState *exec, const Identifier &p) const
     case ScreenX: {
       if (!m_part->view())
         return Undefined();
+#if APPLE_CHANGES
+      // We want to use frameGeometry here instead of mapToGlobal because it goes through
+      // the windowFrame method of the WebKit's UI delegate. Also we don't want to try
+      // to do anything relative to the screen the window is on, so the code below is no
+      // good of us anyway.
+      return Number(m_part->view()->topLevelWidget()->frameGeometry().x());
+#else
       QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(m_part->view()));
       return Number(m_part->view()->mapToGlobal(QPoint(0,0)).x() + sg.x());
+#endif
     }
     case ScreenTop:
     case ScreenY: {
       if (!m_part->view())
         return Undefined();
+#if APPLE_CHANGES
+      // See comment above in ScreenX.
+      return Number(m_part->view()->topLevelWidget()->frameGeometry().y());
+#else
       QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(m_part->view()));
       return Number(m_part->view()->mapToGlobal(QPoint(0,0)).y() + sg.y());
+#endif
     }
     case ScrollX: {
       if (!m_part->view())
index f5c8854580468e3e132775b5c73778337506d533..7155b8991f3225ebecc585138ee058244116b486 100644 (file)
@@ -38,14 +38,6 @@ QWidget *KHTMLView::topLevelWidget() const
     return KWQ(part())->topLevelWidget();
 }
 
-QPoint KHTMLView::mapToGlobal(const QPoint &p) const
-{
-    // This is only used by JavaScript to implement the getting
-    // the screenX and screen Y coordinates.
-
-    return static_cast<KWQWindowWidget *>(topLevelWidget())->mapToGlobal(p);
-}
-
 QPoint KHTMLView::viewportToGlobal(const QPoint &p) const
 {
     return static_cast<KWQWindowWidget *>(topLevelWidget())->viewportToGlobal(p);
index 6d3c753cfedccb93f0a118b6048c50efdd91ca1a..3f53a3131cc98b3b4a2efc420757b7307e684cd3 100644 (file)
@@ -48,7 +48,6 @@ class KWQWindowWidget : public QWidget
     virtual void setFrameGeometry(const QRect &);
 
     virtual QWidget *topLevelWidget() const;
-    virtual QPoint mapToGlobal(const QPoint &) const;
     virtual QPoint mapFromGlobal(const QPoint &) const;
     virtual QPoint viewportToGlobal(const QPoint &) const;
 
index 78029a464da1ea6ceb5be7357e508da33230bb23..1128a44ffabeefcb4569305eaf1aab9aab335d15 100644 (file)
@@ -68,17 +68,11 @@ QWidget *KWQWindowWidget::topLevelWidget() const
 }
 
 // Note these routines work on QT window coords - origin upper left
-QPoint KWQWindowWidget::mapToGlobal(const QPoint &p) const
-{
-    QPoint cocoaWindowPoint(p.x(), (int)([d->bridge windowFrame].size.height - p.y()));
-    return viewportToGlobal(cocoaWindowPoint);
-}
-
 QPoint KWQWindowWidget::mapFromGlobal(const QPoint &p) const
 {
     NSPoint screenPoint = NSMakePoint(p.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - p.y());
     NSPoint windowPoint = [[d->bridge window] convertScreenToBase:screenPoint];
-    return QPoint((int)windowPoint.x, (int)([[d->bridge window] frame].size.height - windowPoint.y));
+    return QPoint((int)windowPoint.x, (int)([d->bridge windowFrame].size.height - windowPoint.y));
 }
 
 // maps "viewport" (actually Cocoa window coords) to screen coords