Changeset 53005 in webkit
- Timestamp:
- Jan 8, 2010 1:48:02 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53004 r53005 1 2010-01-08 Luiz Agostini <luiz.agostini@openbossa.org> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Delegation client 6 https://bugs.webkit.org/show_bug.cgi?id=32826 7 8 Factory related code removed from QtAbstractWebPopup. Popups are now created 9 by ChromeClientQt. 10 Popup content information struct added to class QtAbstractWebPopup. 11 PopupMenuClient is now hidden from higher layers. 12 QtAbstractWebPopup now receives content information and font as parameters 13 of method populate. 14 QtFallbackWebPopup moved to WebKit/qt/WebCoreSupport. 15 16 * WebCore.pro: 17 * platform/qt/PopupMenuQt.cpp: 18 (WebCore::PopupMenu::PopupMenu): 19 (WebCore::getItems): 20 (WebCore::PopupMenu::show): 21 * platform/qt/QtAbstractWebPopup.cpp: 22 (WebCore::QtAbstractWebPopup::QtAbstractWebPopup): 23 (WebCore::QtAbstractWebPopup::popupDidHide): 24 (WebCore::QtAbstractWebPopup::valueChanged): 25 * platform/qt/QtAbstractWebPopup.h: 26 (WebCore::QtAbstractWebPopup::Item::): 27 * platform/qt/QtFallbackWebPopup.cpp: Removed. 28 * platform/qt/QtFallbackWebPopup.h: Removed. 29 1 30 2010-01-08 Yuzo Fujishima <yuzo@google.com> 2 31 -
trunk/WebCore/WebCore.pro
r52972 r53005 1984 1984 platform/qt/QWebPageClient.h \ 1985 1985 platform/qt/QtAbstractWebPopup.h \ 1986 platform/qt/QtFallbackWebPopup.h \1987 1986 platform/qt/RenderThemeQt.h \ 1988 1987 platform/qt/ScrollbarThemeQt.h \ … … 2386 2385 xml/XSLTUnicodeSort.h \ 2387 2386 $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ 2387 $$PWD/../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \ 2388 2388 $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ 2389 2389 $$PWD/platform/network/qt/DnsPrefetchHelper.h … … 2447 2447 platform/qt/PopupMenuQt.cpp \ 2448 2448 platform/qt/QtAbstractWebPopup.cpp \ 2449 platform/qt/QtFallbackWebPopup.cpp \2450 2449 platform/qt/RenderThemeQt.cpp \ 2451 2450 platform/qt/ScrollbarQt.cpp \ … … 2464 2463 platform/qt/WidgetQt.cpp \ 2465 2464 plugins/qt/PluginDataQt.cpp \ 2465 ../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp \ 2466 2466 ../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp \ 2467 2467 ../WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp \ -
trunk/WebCore/platform/qt/PopupMenuQt.cpp
r52223 r53005 2 2 * This file is part of the popup menu implementation for <select> elements in WebCore. 3 3 * 4 * Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies)4 * Copyright (C) 2008, 2009, 2010 Nokia Corporation and/or its subsidiary(-ies) 5 5 * Copyright (C) 2006 Apple Computer, Inc. 6 6 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com … … 27 27 #include "PopupMenu.h" 28 28 29 #include "Chrome.h" 30 #include "ChromeClientQt.h" 29 31 #include "FrameView.h" 30 32 #include "PopupMenuClient.h" 33 #include "QWebPageClient.h" 31 34 #include "QtAbstractWebPopup.h" 32 #include "QtFallbackWebPopup.h"33 35 34 36 namespace WebCore { … … 36 38 PopupMenu::PopupMenu(PopupMenuClient* client) 37 39 : m_popupClient(client) 40 , m_popup(0) 38 41 { 39 m_popup = QtAbstractWebPopup::create(client);40 42 } 41 43 … … 45 47 } 46 48 47 void PopupMenu::show(const IntRect& r, FrameView* v, int index)49 static QList<QtAbstractWebPopup::Item> getItems(PopupMenuClient* client) 48 50 { 49 QRect rect = r; 50 rect.moveTopLeft(v->contentsToWindow(r.topLeft())); 51 m_popup->show(rect, index); 51 QList<QtAbstractWebPopup::Item> result; 52 53 int size = client->listSize(); 54 for (int i = 0; i < size; ++i) { 55 QtAbstractWebPopup::Item item; 56 57 if (client->itemIsSeparator(i)) 58 item.type = QtAbstractWebPopup::Item::Separator; 59 else if (client->itemIsLabel(i)) 60 item.type = QtAbstractWebPopup::Item::Group; 61 else 62 item.type = QtAbstractWebPopup::Item::Option; 63 64 item.text = client->itemText(i); 65 item.toolTip = client->itemToolTip(i); 66 item.enabled = client->itemIsEnabled(i); 67 result.append(item); 68 } 69 return result; 70 } 71 72 void PopupMenu::show(const IntRect& rect, FrameView* view, int index) 73 { 74 ChromeClientQt* chromeClient = static_cast<ChromeClientQt*>( 75 view->frame()->page()->chrome()->client()); 76 ASSERT(chromeClient); 77 78 if (!m_popup) { 79 m_popup = chromeClient->createPopup(); 80 m_popup->m_client = m_popupClient; 81 } 82 83 m_popup->setParent(chromeClient->platformPageClient()->ownerWidget()); 84 m_popup->populate(m_popupClient->menuStyle().font().font(), 85 getItems(m_popupClient)); 86 87 QRect bounds = rect; 88 bounds.moveTopLeft(view->contentsToWindow(rect.topLeft())); 89 m_popup->show(bounds, index); 52 90 } 53 91 -
trunk/WebCore/platform/qt/QtAbstractWebPopup.cpp
r52223 r53005 22 22 23 23 #include "PopupMenuClient.h" 24 #include "QtFallbackWebPopup.h"25 24 26 25 27 26 namespace WebCore { 28 27 29 QtAbstractWebPopupFactory* QtAbstractWebPopup::m_factory = 0; 30 31 QtAbstractWebPopup::QtAbstractWebPopup(PopupMenuClient* client) 32 : m_client(client) 28 QtAbstractWebPopup::QtAbstractWebPopup() 29 : m_client(0) 33 30 { 34 Q_ASSERT(m_client);35 31 } 36 32 … … 39 35 } 40 36 41 PopupMenuClient* QtAbstractWebPopup::client()37 void QtAbstractWebPopup::popupDidHide(bool acceptSuggestions) 42 38 { 43 return m_client; 39 Q_ASSERT(m_client); 40 m_client->popupDidHide(acceptSuggestions); 44 41 } 45 42 46 void QtAbstractWebPopup:: setFactory(QtAbstractWebPopupFactory* factory)43 void QtAbstractWebPopup::valueChanged(int index) 47 44 { 48 m_factory = factory; 49 } 50 51 QtAbstractWebPopup* QtAbstractWebPopup::create(PopupMenuClient* client) 52 { 53 return m_factory ? m_factory->create(client) : new QtFallbackWebPopup(client); 45 Q_ASSERT(m_client); 46 m_client->valueChanged(index); 54 47 } 55 48 -
trunk/WebCore/platform/qt/QtAbstractWebPopup.h
r52223 r53005 21 21 #define QtAbstractWebPopup_h 22 22 23 #include <QFont> 24 #include <QList> 23 25 #include <QRect> 24 26 25 27 namespace WebCore { 26 28 27 class QtAbstractWebPopup;28 29 class PopupMenuClient; 29 30 class QtAbstractWebPopupFactory {31 public:32 virtual QtAbstractWebPopup* create(PopupMenuClient* client) = 0;33 };34 30 35 31 class QtAbstractWebPopup { 36 32 public: 37 QtAbstractWebPopup(PopupMenuClient* client); 33 struct Item { 34 enum { Option, Group, Separator } type; 35 QString text; 36 QString toolTip; 37 bool enabled; 38 }; 39 40 QtAbstractWebPopup(); 38 41 virtual ~QtAbstractWebPopup(); 39 42 40 43 virtual void show(const QRect& geometry, int selectedIndex) = 0; 41 44 virtual void hide() = 0; 42 43 static void setFactory(QtAbstractWebPopupFactory* factory); 44 static QtAbstractWebPopup* create(PopupMenuClient* client); 45 virtual void populate(const QFont& font, const QList<Item>& items) = 0; 46 virtual void setParent(QWidget* parent) = 0; 45 47 46 48 protected: 47 PopupMenuClient* client(); 49 void popupDidHide(bool acceptSuggestions); 50 void valueChanged(int index); 48 51 49 52 private: 53 friend class PopupMenu; 50 54 PopupMenuClient* m_client; 51 static QtAbstractWebPopupFactory* m_factory;52 55 }; 53 56 -
trunk/WebKit/qt/ChangeLog
r52928 r53005 1 2010-01-08 Luiz Agostini <luiz.agostini@openbossa.org> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Delegation client 6 https://bugs.webkit.org/show_bug.cgi?id=32826 7 8 Added method createPopup to ChromeClientQt used to create popups. 9 QtFallbackWebPopup moved from WebCore/platform/qt to 10 WebKit/qt/WebCoreSupport. 11 12 * WebCoreSupport/ChromeClientQt.cpp: 13 (WebCore::ChromeClientQt::createPopup): 14 * WebCoreSupport/ChromeClientQt.h: 15 * WebCoreSupport/QtFallbackWebPopup.cpp: Added. 16 (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): 17 (WebCore::QtFallbackWebPopup::show): 18 (WebCore::QtFallbackWebPopup::populate): 19 (WebCore::QtFallbackWebPopup::showPopup): 20 (WebCore::QtFallbackWebPopup::hidePopup): 21 (WebCore::QtFallbackWebPopup::activeChanged): 22 (WebCore::QtFallbackWebPopup::setParent): 23 * WebCoreSupport/QtFallbackWebPopup.h: Added. 24 (WebCore::QtFallbackWebPopup::hide): 25 1 26 2010-01-07 Yael Aharon <yael.aharon@nokia.com> 2 27 -
trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
r52152 r53005 39 39 #include "WindowFeatures.h" 40 40 #include "DatabaseTracker.h" 41 #include "QtFallbackWebPopup.h" 42 #include "QWebPageClient.h" 41 43 #include "SecurityOrigin.h" 42 #include "QWebPageClient.h"43 44 44 45 #include "qwebpage.h" … … 466 467 } 467 468 468 } 469 QtAbstractWebPopup* ChromeClientQt::createPopup() 470 { 471 return new QtFallbackWebPopup; 472 } 473 474 } -
trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h
r50351 r53005 43 43 class Page; 44 44 struct FrameLoadRequest; 45 class QtAbstractWebPopup; 45 46 46 47 class ChromeClientQt : public ChromeClient … … 135 136 virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); 136 137 138 QtAbstractWebPopup* createPopup(); 139 137 140 QWebPage* m_webPage; 138 141 WebCore::KURL lastHoverURL; -
trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
r53004 r53005 34 34 // QtFallbackWebPopup 35 35 36 QtFallbackWebPopup::QtFallbackWebPopup( PopupMenuClient* client)37 : QtAbstractWebPopup( client)36 QtFallbackWebPopup::QtFallbackWebPopup() 37 : QtAbstractWebPopup() 38 38 , m_popupVisible(false) 39 39 { 40 setFont(QtAbstractWebPopup::client()->menuStyle().font().font());41 40 connect(this, SIGNAL(activated(int)), 42 41 SLOT(activeChanged(int)), Qt::QueuedConnection); … … 46 45 void QtFallbackWebPopup::show(const QRect& geometry, int selectedIndex) 47 46 { 48 populate();49 47 setCurrentIndex(selectedIndex); 50 48 49 /* 51 50 QWidget* parent = 0; 52 51 if (client()->hostWindow() && client()->hostWindow()->platformPageClient()) … … 54 53 55 54 setParent(parent); 55 */ 56 56 57 setGeometry(QRect(geometry.left(), geometry.top(), geometry.width(), sizeHint().height())); 57 58 … … 61 62 } 62 63 63 void QtFallbackWebPopup::populate( )64 void QtFallbackWebPopup::populate(const QFont& font, const QList<Item>& items) 64 65 { 65 66 clear(); … … 68 69 Q_ASSERT(model); 69 70 70 int size = client()->listSize(); 71 for (int i = 0; i < size; i++) { 72 if (client()->itemIsSeparator(i)) 71 setFont(font); 72 for (int i = 0; i < items.size(); ++i) { 73 switch (items[i].type) { 74 case QtAbstractWebPopup::Item::Separator: 73 75 insertSeparator(i); 74 else { 75 insertItem(i, client()->itemText(i)); 76 77 if (model && !client()->itemIsEnabled(i)) 78 model->item(i)->setEnabled(false); 76 break; 77 case QtAbstractWebPopup::Item::Group: 78 insertItem(i, items[i].text); 79 model->item(i)->setEnabled(false); 80 break; 81 case QtAbstractWebPopup::Item::Option: 82 insertItem(i, items[i].text); 83 model->item(i)->setEnabled(items[i].enabled); 84 break; 79 85 } 80 86 } … … 104 110 105 111 m_popupVisible = false; 106 client()->popupDidHide(true);112 popupDidHide(true); 107 113 } 108 114 … … 112 118 return; 113 119 114 client()->valueChanged(index); 120 valueChanged(index); 121 } 122 123 void QtFallbackWebPopup::setParent(QWidget* parent) 124 { 125 QComboBox::setParent(parent); 115 126 } 116 127 -
trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
r53004 r53005 29 29 Q_OBJECT 30 30 public: 31 QtFallbackWebPopup( PopupMenuClient* client);31 QtFallbackWebPopup(); 32 32 33 33 virtual void show(const QRect& geometry, int selectedIndex); 34 34 virtual void hide() { hidePopup(); } 35 virtual void populate(const QFont& font, const QList<Item>& items); 36 virtual void setParent(QWidget* parent); 35 37 36 38 private slots: … … 40 42 bool m_popupVisible; 41 43 42 void populate();43 44 44 45 virtual void showPopup();
Note: See TracChangeset
for help on using the changeset viewer.