but instead just behave as a normal setter that takes ownership of the platform menu description (the qmenu).
Instead now QWebPage::contextMenuEvent() retrieves the QMenu after calling sendContextMenuEvent and calls exec()
on it.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27532
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-07 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ Changed ContextMenu::setPlatformDescription for the Qt port to not show the qmenu right away
+ but instead just behave as a normal setter that takes ownership of the platform menu description (the qmenu).
+ Instead now QWebPage::contextMenuEvent() retrieves the QMenu after calling sendContextMenuEvent and calls exec()
+ on it.
+
+ WARNING: NO TEST CASES ADDED OR CHANGED
+
+ * platform/qt/ContextMenuQt.cpp:
+
2007-11-07 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
{
#ifndef QT_NO_MENU
- //qDebug("Switch menu(%p) %p to %p", this, (QMenu*)m_menu, menu);
- if (menu == 0) {
- FrameView *v = m_hitTestResult.innerNode()->document()->frame()->view();
- m_menu->exec(v->containingWindow()->mapToGlobal(v->contentsToWindow(m_hitTestResult.point())));
- }
if (menu != m_menu) {
delete m_menu;
m_menu = menu;
#include "Frame.h"
#include "ChromeClientQt.h"
+#include "ContextMenu.h"
#include "ContextMenuClientQt.h"
#include "DragClientQt.h"
#include "DragController.h"
void QWebPage::contextMenuEvent(QContextMenuEvent *ev)
{
QWebFramePrivate *frame = d->currentFrame(ev->pos())->d;
- if (frame->eventHandler)
- frame->eventHandler->sendContextMenuEvent(PlatformMouseEvent(ev, 1));
+ if (!frame->eventHandler)
+ return;
+ d->page->contextMenuController()->clearContextMenu();
+ frame->eventHandler->sendContextMenuEvent(PlatformMouseEvent(ev, 1));
+ ContextMenu *menu = d->page->contextMenuController()->contextMenu();
+ QMenu *qmenu = menu->releasePlatformDescription();
+ if (qmenu) {
+ qmenu->exec(ev->globalPos());
+ delete qmenu;
+ }
}
void QWebPage::wheelEvent(QWheelEvent *ev)
+2007-11-07 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ Changed ContextMenu::setPlatformDescription for the Qt port to not show the qmenu right away
+ but instead just behave as a normal setter that takes ownership of the platform menu description (the qmenu).
+ Instead now QWebPage::contextMenuEvent() retrieves the QMenu after calling sendContextMenuEvent and calls exec()
+ on it.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::contextMenuEvent):
+ * WebCoreSupport/ContextMenuClientQt.cpp:
+ (WebCore::ContextMenuClientQt::getCustomMenuFromDefaultItems):
+
2007-11-07 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
#include "config.h"
#include "ContextMenuClientQt.h"
+#include "ContextMenu.h"
#include "HitTestResult.h"
#include "KURL.h"
#include "Shared.h"
notImplemented();
}
-PlatformMenuDescription ContextMenuClientQt::getCustomMenuFromDefaultItems(ContextMenu*)
+PlatformMenuDescription ContextMenuClientQt::getCustomMenuFromDefaultItems(ContextMenu* menu)
{
- notImplemented();
- return PlatformMenuDescription();
+ // warning: this transfers the ownership to the caller
+ return menu->releasePlatformDescription();
}
void ContextMenuClientQt::contextMenuItemSelected(ContextMenuItem*, const ContextMenu*)