- 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
+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.
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())
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);
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;
}
// 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