Changeset 52199 in webkit
- Timestamp:
- Dec 16, 2009 9:27:09 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
- 2 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52193 r52199 1 2009-12-16 Luiz Agostini <luiz.agostini@openbossa.org> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Implement combobox delegate for Qt 6 https://bugs.webkit.org/show_bug.cgi?id=32550 7 8 Refactoring of class QWebPopup. 9 10 Class QWebPopup has been split in QtAbstractWebPopup and QtFallbackWebPopup. 11 Both new classes are now in corresponding files and files QWebPopup.* have been removed. 12 13 Custom combo popup classes will inherit from QtAbstractWebPopup. It is not the public API as it is 14 in WebCore and will not be visible by users of QtWebKit. It will be used in implementation of 15 public QtWebKit combobox popup delegation API. 16 17 Class QtFallbackWebPopup inherits from QtAbstractWebPopup and implements the currently used combobox popup. 18 It needs to be improved to provide standard features that are missing like style or indentation. 19 20 No behavior changes. 21 22 * WebCore.pro: 23 * platform/PopupMenu.h: 24 * platform/qt/PopupMenuQt.cpp: 25 (WebCore::PopupMenu::PopupMenu): 26 * platform/qt/QWebPopup.cpp: Removed. 27 * platform/qt/QWebPopup.h: Removed. 28 * platform/qt/QtAbstractWebPopup.cpp: Added. 29 (WebCore::QtAbstractWebPopup::QtAbstractWebPopup): 30 (WebCore::QtAbstractWebPopup::~QtAbstractWebPopup): 31 (WebCore::QtAbstractWebPopup::client): 32 * platform/qt/QtAbstractWebPopup.h: Added. 33 * platform/qt/QtFallbackWebPopup.cpp: Added. 34 (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): 35 (WebCore::QtFallbackWebPopup::show): 36 (WebCore::QtFallbackWebPopup::populate): 37 (WebCore::QtFallbackWebPopup::showPopup): 38 (WebCore::QtFallbackWebPopup::hidePopup): 39 (WebCore::QtFallbackWebPopup::activeChanged): 40 * platform/qt/QtFallbackWebPopup.h: Added. 41 (WebCore::QtFallbackWebPopup::hide): 42 1 43 2009-12-15 Pavel Feldman <pfeldman@chromium.org> 2 44 -
trunk/WebCore/WebCore.pro
r52103 r52199 1967 1967 platform/qt/ClipboardQt.h \ 1968 1968 platform/qt/QWebPageClient.h \ 1969 platform/qt/QWebPopup.h \ 1969 platform/qt/QtAbstractWebPopup.h \ 1970 platform/qt/QtFallbackWebPopup.h \ 1970 1971 platform/qt/RenderThemeQt.h \ 1971 1972 platform/qt/ScrollbarThemeQt.h \ … … 2426 2427 platform/qt/PlatformTouchPointQt.cpp \ 2427 2428 platform/qt/PopupMenuQt.cpp \ 2428 platform/qt/QWebPopup.cpp \ 2429 platform/qt/QtAbstractWebPopup.cpp \ 2430 platform/qt/QtFallbackWebPopup.cpp \ 2429 2431 platform/qt/RenderThemeQt.cpp \ 2430 2432 platform/qt/ScrollbarQt.cpp \ -
trunk/WebCore/platform/PopupMenu.h
r52151 r52199 43 43 #elif PLATFORM(QT) 44 44 namespace WebCore { 45 class QWebPopup;45 class QtAbstractWebPopup; 46 46 } 47 47 #elif PLATFORM(GTK) … … 145 145 RetainPtr<NSPopUpButtonCell> m_popup; 146 146 #elif PLATFORM(QT) 147 Q WebPopup* m_popup;147 QtAbstractWebPopup* m_popup; 148 148 #elif PLATFORM(WIN) 149 149 // ScrollBarClient -
trunk/WebCore/platform/qt/PopupMenuQt.cpp
r52151 r52199 2 2 * This file is part of the popup menu implementation for <select> elements in WebCore. 3 3 * 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)4 * Copyright (C) 2008, 2009 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 … … 29 29 #include "FrameView.h" 30 30 #include "PopupMenuClient.h" 31 #include "QWebPopup.h" 31 #include "QtAbstractWebPopup.h" 32 #include "QtFallbackWebPopup.h" 32 33 33 34 namespace WebCore { … … 36 37 : m_popupClient(client) 37 38 { 38 m_popup = new Q WebPopup(client);39 m_popup = new QtFallbackWebPopup(client); 39 40 } 40 41 -
trunk/WebCore/platform/qt/QtAbstractWebPopup.cpp
r52198 r52199 1 1 /* 2 * 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 4 3 * 5 4 * This library is free software; you can redistribute it and/or … … 19 18 * 20 19 */ 21 #i fndef QWebPopup_h22 # define QWebPopup_h20 #include "config.h" 21 #include "QtAbstractWebPopup.h" 23 22 24 #include <QComboBox>23 #include "PopupMenuStyle.h" 25 24 26 #include "PopupMenuClient.h"27 25 28 26 namespace WebCore { 29 27 30 class QWebPopup : private QComboBox { 31 Q_OBJECT 32 public: 33 QWebPopup(PopupMenuClient* client); 28 // QAbstractWebPopup 34 29 35 void show(const QRect& geometry, int selectedIndex); 36 void hide() { hidePopup(); } 37 38 private slots: 39 void activeChanged(int); 40 41 private: 42 PopupMenuClient* m_client; 43 bool m_popupVisible; 44 45 void populate(); 46 47 virtual void showPopup(); 48 virtual void hidePopup(); 49 }; 50 30 QtAbstractWebPopup::QtAbstractWebPopup(PopupMenuClient* client) 31 : m_client(client) 32 { 33 Q_ASSERT(m_client); 51 34 } 52 35 53 #endif 36 QtAbstractWebPopup::~QtAbstractWebPopup() 37 { 38 } 39 40 PopupMenuClient* QtAbstractWebPopup::client() 41 { 42 return m_client; 43 } 44 45 } // namespace WebCore -
trunk/WebCore/platform/qt/QtAbstractWebPopup.h
r52198 r52199 1 1 /* 2 * 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 4 3 * 5 4 * This library is free software; you can redistribute it and/or … … 19 18 * 20 19 */ 21 #ifndef QWebPopup_h 22 #define QWebPopup_h 23 24 #include <QComboBox> 20 #ifndef QtAbstractWebPopup_h 21 #define QtAbstractWebPopup_h 25 22 26 23 #include "PopupMenuClient.h" 24 #include <QComboBox> 27 25 28 26 namespace WebCore { 29 27 30 class QWebPopup : private QComboBox { 31 Q_OBJECT 28 class QtAbstractWebPopup { 32 29 public: 33 QWebPopup(PopupMenuClient* client); 30 QtAbstractWebPopup(PopupMenuClient* client); 31 virtual ~QtAbstractWebPopup(); 34 32 35 v oid show(const QRect& geometry, int selectedIndex);36 v oid hide() { hidePopup(); }33 virtual void show(const QRect& geometry, int selectedIndex) = 0; 34 virtual void hide() = 0; 37 35 38 pr ivate slots:39 void activeChanged(int);36 protected: 37 PopupMenuClient* client(); 40 38 41 39 private: 42 40 PopupMenuClient* m_client; 43 bool m_popupVisible;44 45 void populate();46 47 virtual void showPopup();48 virtual void hidePopup();49 41 }; 50 42 51 43 } 52 44 53 #endif 45 #endif // QtAbstractWebPopup_h -
trunk/WebCore/platform/qt/QtFallbackWebPopup.cpp
r52198 r52199 1 1 /* 2 * 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 4 3 * 5 4 * This library is free software; you can redistribute it and/or … … 20 19 */ 21 20 #include "config.h" 22 #include "QWebPopup.h" 21 #include "QtFallbackWebPopup.h" 22 23 23 #include "HostWindow.h" 24 #include "PopupMenuStyle.h"25 24 #include "QWebPageClient.h" 26 27 25 #include <QAbstractItemView> 28 26 #include <QApplication> … … 33 31 namespace WebCore { 34 32 35 QWebPopup::QWebPopup(PopupMenuClient* client) 36 : m_client(client) 33 // QtFallbackWebPopup 34 35 QtFallbackWebPopup::QtFallbackWebPopup(PopupMenuClient* client) 36 : QtAbstractWebPopup(client) 37 37 , m_popupVisible(false) 38 38 { 39 Q_ASSERT(m_client); 40 41 setFont(m_client->menuStyle().font().font()); 39 setFont(QtAbstractWebPopup::client()->menuStyle().font().font()); 42 40 connect(this, SIGNAL(activated(int)), 43 41 SLOT(activeChanged(int)), Qt::QueuedConnection); … … 45 43 46 44 47 void Q WebPopup::show(const QRect& geometry, int selectedIndex)45 void QtFallbackWebPopup::show(const QRect& geometry, int selectedIndex) 48 46 { 49 47 populate(); … … 51 49 52 50 QWidget* parent = 0; 53 if ( m_client->hostWindow() && m_client->hostWindow()->platformPageClient())54 parent = m_client->hostWindow()->platformPageClient()->ownerWidget();51 if (client()->hostWindow() && client()->hostWindow()->platformPageClient()) 52 parent = client()->hostWindow()->platformPageClient()->ownerWidget(); 55 53 56 54 setParent(parent); … … 62 60 } 63 61 64 void Q WebPopup::populate()62 void QtFallbackWebPopup::populate() 65 63 { 66 64 clear(); 67 Q_ASSERT(m_client);68 65 69 66 QStandardItemModel* model = qobject_cast<QStandardItemModel*>(QComboBox::model()); 70 67 Q_ASSERT(model); 71 68 72 int size = m_client->listSize();69 int size = client()->listSize(); 73 70 for (int i = 0; i < size; i++) { 74 if ( m_client->itemIsSeparator(i))71 if (client()->itemIsSeparator(i)) 75 72 insertSeparator(i); 76 73 else { 77 insertItem(i, m_client->itemText(i));74 insertItem(i, client()->itemText(i)); 78 75 79 if (model && ! m_client->itemIsEnabled(i))76 if (model && !client()->itemIsEnabled(i)) 80 77 model->item(i)->setEnabled(false); 81 78 } … … 83 80 } 84 81 85 void Q WebPopup::showPopup()82 void QtFallbackWebPopup::showPopup() 86 83 { 87 84 QComboBox::showPopup(); … … 89 86 } 90 87 91 void Q WebPopup::hidePopup()88 void QtFallbackWebPopup::hidePopup() 92 89 { 93 90 QWidget* activeFocus = QApplication::focusWidget(); … … 106 103 107 104 m_popupVisible = false; 108 m_client->popupDidHide();105 client()->popupDidHide(); 109 106 } 110 107 111 void Q WebPopup::activeChanged(int index)108 void QtFallbackWebPopup::activeChanged(int index) 112 109 { 113 110 if (index < 0) 114 111 return; 115 112 116 m_client->valueChanged(index);113 client()->valueChanged(index); 117 114 } 118 115 119 } // namespace WebCore 120 121 #include "moc_QWebPopup.cpp" 116 } -
trunk/WebCore/platform/qt/QtFallbackWebPopup.h
r52198 r52199 1 1 /* 2 * 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 4 3 * 5 4 * This library is free software; you can redistribute it and/or … … 19 18 * 20 19 */ 21 #ifndef Q WebPopup_h22 #define Q WebPopup_h20 #ifndef QtFallbackWebPopup_h 21 #define QtFallbackWebPopup_h 23 22 23 #include "QtAbstractWebPopup.h" 24 24 #include <QComboBox> 25 26 #include "PopupMenuClient.h"27 25 28 26 namespace WebCore { 29 27 30 class Q WebPopup : private QComboBox{28 class QtFallbackWebPopup : private QComboBox, public QtAbstractWebPopup { 31 29 Q_OBJECT 32 30 public: 33 Q WebPopup(PopupMenuClient* client);31 QtFallbackWebPopup(PopupMenuClient* client); 34 32 35 v oid show(const QRect& geometry, int selectedIndex);36 v oid hide() { hidePopup(); }33 virtual void show(const QRect& geometry, int selectedIndex); 34 virtual void hide() { hidePopup(); } 37 35 38 36 private slots: … … 40 38 41 39 private: 42 PopupMenuClient* m_client;43 40 bool m_popupVisible; 44 41 … … 51 48 } 52 49 53 #endif 50 #endif // QtFallbackWebPopup_h
Note: See TracChangeset
for help on using the changeset viewer.