Title: [98449] trunk/Source/WebKit2
Revision
98449
Author
hausm...@webkit.org
Date
2011-10-26 01:29:16 -0700 (Wed, 26 Oct 2011)

Log Message

 2011-10-20  Zeno Albisser  <zeno.albis...@nokia.com>

[Qt][WK2] Disable Context Menus until we have a proper QML implementation
https://bugs.webkit.org/show_bug.cgi?id=70537

This is just a temporary fix to avoid crashes in QtGui based
MiniBrowser that does not link to QtWidgets.

Patch by Jocelyn Turcotte <jocelyn.turco...@nokia.com>,
         Zeno Albisser <zeno.albis...@nokia.com>

Reviewed by Simon Hausmann.

* UIProcess/qt/WebContextMenuProxyQt.cpp:
(WebKit::WebContextMenuProxyQt::showContextMenu):
(WebKit::WebContextMenuProxyQt::createContextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98448 => 98449)


--- trunk/Source/WebKit2/ChangeLog	2011-10-26 08:29:00 UTC (rev 98448)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-26 08:29:16 UTC (rev 98449)
@@ -1,3 +1,20 @@
+ 2011-10-20  Zeno Albisser  <zeno.albis...@nokia.com>
+
+        [Qt][WK2] Disable Context Menus until we have a proper QML implementation
+        https://bugs.webkit.org/show_bug.cgi?id=70537
+
+        This is just a temporary fix to avoid crashes in QtGui based
+        MiniBrowser that does not link to QtWidgets.
+
+        Patch by Jocelyn Turcotte <jocelyn.turco...@nokia.com>,
+                 Zeno Albisser <zeno.albis...@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        * UIProcess/qt/WebContextMenuProxyQt.cpp:
+        (WebKit::WebContextMenuProxyQt::showContextMenu):
+        (WebKit::WebContextMenuProxyQt::createContextMenu):
+
 2011-10-25  Zeno Albisser  <zeno.albis...@nokia.com>
 
         [Qt][WK2] Remove QAction from MiniBrowser

Modified: trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp (98448 => 98449)


--- trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp	2011-10-26 08:29:00 UTC (rev 98448)
+++ trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp	2011-10-26 08:29:16 UTC (rev 98449)
@@ -69,18 +69,7 @@
 
 void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items)
 {
-    if (items.isEmpty())
-        return;
-
-    OwnPtr<QMenu> menu = createContextMenu(items);
-
-    // We call showContextMenu(), even with no items, because the client should be able to show custom items
-    // if WebKit has nothing to show.
-    if (!menu)
-        menu = adoptPtr(new QMenu);
-
-    menu->move(position);
-    m_viewInterface->showContextMenu(QSharedPointer<QMenu>(menu.leakPtr()));
+    // FIXME: Make this a QML compatible context menu.
 }
 
 void WebContextMenuProxyQt::hideContextMenu()
@@ -90,51 +79,8 @@
 
 PassOwnPtr<QMenu> WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) const
 {
-    OwnPtr<QMenu> menu = adoptPtr(new QMenu);
-    for (int i = 0; i < items.size(); ++i) {
-        const WebContextMenuItemData& item = items.at(i);
-        switch (item.type()) {
-        case WebCore::CheckableActionType: /* fall through */
-        case WebCore::ActionType: {
-            QAction* qtAction = new QAction(menu.get());
-            qtAction->setData(QVariant::fromValue(item));
-            qtAction->setText(item.title());
-            qtAction->setEnabled(item.enabled());
-            qtAction->setChecked(item.checked());
-            qtAction->setCheckable(item.type() == WebCore::CheckableActionType);
-            connect(qtAction, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool)), Qt::DirectConnection);
-
-            menu->addAction(qtAction);
-            break;
-        }
-        case WebCore::SeparatorType:
-            menu->addSeparator();
-            break;
-        case WebCore::SubmenuType:
-            if (OwnPtr<QMenu> subMenu = createContextMenu(item.submenu())) {
-                subMenu->setParent(menu.get());
-                subMenu->setTitle(item.title());
-                QMenu* const subMenuPtr = subMenu.leakPtr();
-                menu->addMenu(subMenuPtr);
-            }
-            break;
-        }
-    }
-
-    // Do not show sub-menus with just disabled actions.
-    if (menu->isEmpty())
-        return nullptr;
-
-    bool isAnyActionEnabled = false;
-    QList<QAction *> actions = menu->actions();
-    for (int i = 0; i < actions.count(); ++i) {
-        if (actions.at(i)->isVisible())
-            isAnyActionEnabled |= actions.at(i)->isEnabled();
-    }
-    if (!isAnyActionEnabled)
-        return nullptr;
-
-    return menu.release();
+    // FIXME: Make this a QML compatible context menu.
+    return nullptr;
 }
 
 #include "moc_WebContextMenuProxyQt.cpp"
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to