<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[52151] trunk/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/52151">52151</a></dd>
<dt>Author</dt> <dd>eric@webkit.org</dd>
<dt>Date</dt> <dd>2009-12-15 08:13:51 -0800 (Tue, 15 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>2009-12-15  Luiz Agostini  &lt;luiz.agostini@openbossa.org&gt;

        Reviewed by Kenneth Rohde Christiansen.

        Moving list populate methods from PopupMenuQt to QWebPopup.

        In preparation to future implementation of a delegation API for the combobox.

        * platform/PopupMenu.h:
        * platform/qt/PopupMenuQt.cpp:
        (WebCore::PopupMenu::show):
        (WebCore::PopupMenu::hide):
        * platform/qt/QWebPopup.cpp:
        (WebCore::QWebPopup::show):
        (WebCore::QWebPopup::populate):
        * platform/qt/QWebPopup.h:
        (WebCore::QWebPopup::hide):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreplatformPopupMenuh">trunk/WebCore/platform/PopupMenu.h</a></li>
<li><a href="#trunkWebCoreplatformqtPopupMenuQtcpp">trunk/WebCore/platform/qt/PopupMenuQt.cpp</a></li>
<li><a href="#trunkWebCoreplatformqtQWebPopupcpp">trunk/WebCore/platform/qt/QWebPopup.cpp</a></li>
<li><a href="#trunkWebCoreplatformqtQWebPopuph">trunk/WebCore/platform/qt/QWebPopup.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (52150 => 52151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-12-15 14:18:47 UTC (rev 52150)
+++ trunk/WebCore/ChangeLog        2009-12-15 16:13:51 UTC (rev 52151)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2009-12-15  Luiz Agostini  &lt;luiz.agostini@openbossa.org&gt;
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Moving list populate methods from PopupMenuQt to QWebPopup.
+        
+        In preparation to future implementation of a delegation API for the combobox.
+
+        * platform/PopupMenu.h:
+        * platform/qt/PopupMenuQt.cpp:
+        (WebCore::PopupMenu::show):
+        (WebCore::PopupMenu::hide):
+        * platform/qt/QWebPopup.cpp:
+        (WebCore::QWebPopup::show):
+        (WebCore::QWebPopup::populate):
+        * platform/qt/QWebPopup.h:
+        (WebCore::QWebPopup::hide):
+
</ins><span class="cx"> 2009-12-15  Alexander Pavlov  &lt;apavlov@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Pavel Feldman.
</span></span></pre></div>
<a id="trunkWebCoreplatformPopupMenuh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/PopupMenu.h (52150 => 52151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/PopupMenu.h        2009-12-15 14:18:47 UTC (rev 52150)
+++ trunk/WebCore/platform/PopupMenu.h        2009-12-15 16:13:51 UTC (rev 52151)
</span><span class="lines">@@ -144,8 +144,6 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSPopUpButtonCell&gt; m_popup;
</span><span class="cx"> #elif PLATFORM(QT)
</span><del>-    void clear();
-    void populate(const IntRect&amp;);
</del><span class="cx">     QWebPopup* m_popup;
</span><span class="cx"> #elif PLATFORM(WIN)
</span><span class="cx">     // ScrollBarClient
</span></span></pre></div>
<a id="trunkWebCoreplatformqtPopupMenuQtcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/qt/PopupMenuQt.cpp (52150 => 52151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/qt/PopupMenuQt.cpp        2009-12-15 14:18:47 UTC (rev 52150)
+++ trunk/WebCore/platform/qt/PopupMenuQt.cpp        2009-12-15 16:13:51 UTC (rev 52151)
</span><span class="lines">@@ -26,22 +26,10 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;PopupMenu.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Frame.h&quot;
</del><span class="cx"> #include &quot;FrameView.h&quot;
</span><del>-#include &quot;HostWindow.h&quot;
</del><span class="cx"> #include &quot;PopupMenuClient.h&quot;
</span><del>-#include &quot;QWebPageClient.h&quot;
</del><span class="cx"> #include &quot;QWebPopup.h&quot;
</span><span class="cx"> 
</span><del>-#include &lt;QAction&gt;
-#include &lt;QDebug&gt;
-#include &lt;QListWidget&gt;
-#include &lt;QListWidgetItem&gt;
-#include &lt;QMenu&gt;
-#include &lt;QPoint&gt;
-#include &lt;QStandardItemModel&gt;
-#include &lt;QWidgetAction&gt;
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> PopupMenu::PopupMenu(PopupMenuClient* client)
</span><span class="lines">@@ -55,52 +43,16 @@
</span><span class="cx">     delete m_popup;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PopupMenu::clear()
-{
-    m_popup-&gt;clear();
-}
-
-void PopupMenu::populate(const IntRect&amp;)
-{
-    clear();
-    Q_ASSERT(client());
-
-    QStandardItemModel* model = qobject_cast&lt;QStandardItemModel*&gt;(m_popup-&gt;model());
-    Q_ASSERT(model);
-
-    int size = client()-&gt;listSize();
-    for (int i = 0; i &lt; size; i++) {
-        if (client()-&gt;itemIsSeparator(i))
-            m_popup-&gt;insertSeparator(i);
-        else {
-            m_popup-&gt;insertItem(i, client()-&gt;itemText(i));
-
-            if (model &amp;&amp; !client()-&gt;itemIsEnabled(i))
-                model-&gt;item(i)-&gt;setEnabled(false);
-
-            if (client()-&gt;itemIsSelected(i))
-                m_popup-&gt;setCurrentIndex(i);
-        }
-    }
-}
-
</del><span class="cx"> void PopupMenu::show(const IntRect&amp; r, FrameView* v, int index)
</span><span class="cx"> {
</span><del>-    QWebPageClient* client = v-&gt;hostWindow()-&gt;platformPageClient();
-    populate(r);
</del><span class="cx">     QRect rect = r;
</span><span class="cx">     rect.moveTopLeft(v-&gt;contentsToWindow(r.topLeft()));
</span><del>-    rect.setHeight(m_popup-&gt;sizeHint().height());
-
-    m_popup-&gt;setParent(client-&gt;ownerWidget());
-    m_popup-&gt;setGeometry(rect);
-    m_popup-&gt;setCurrentIndex(index);
-    m_popup-&gt;exec();
</del><ins>+    m_popup-&gt;show(rect, index);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PopupMenu::hide()
</span><span class="cx"> {
</span><del>-    m_popup-&gt;hidePopup();
</del><ins>+    m_popup-&gt;hide();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PopupMenu::updateFromElement()
</span></span></pre></div>
<a id="trunkWebCoreplatformqtQWebPopupcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/qt/QWebPopup.cpp (52150 => 52151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/qt/QWebPopup.cpp        2009-12-15 14:18:47 UTC (rev 52150)
+++ trunk/WebCore/platform/qt/QWebPopup.cpp        2009-12-15 16:13:51 UTC (rev 52151)
</span><span class="lines">@@ -20,12 +20,15 @@
</span><span class="cx">  */
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;QWebPopup.h&quot;
</span><ins>+#include &quot;HostWindow.h&quot;
</ins><span class="cx"> #include &quot;PopupMenuStyle.h&quot;
</span><ins>+#include &quot;QWebPageClient.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;QAbstractItemView&gt;
</span><span class="cx"> #include &lt;QApplication&gt;
</span><span class="cx"> #include &lt;QInputContext&gt;
</span><span class="cx"> #include &lt;QMouseEvent&gt;
</span><ins>+#include &lt;QStandardItemModel&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -41,13 +44,44 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-void QWebPopup::exec()
</del><ins>+void QWebPopup::show(const QRect&amp; geometry, int selectedIndex)
</ins><span class="cx"> {
</span><ins>+    populate();
+    setCurrentIndex(selectedIndex);
+
+    QWidget* parent = 0;
+    if (m_client-&gt;hostWindow() &amp;&amp; m_client-&gt;hostWindow()-&gt;platformPageClient())
+       parent = m_client-&gt;hostWindow()-&gt;platformPageClient()-&gt;ownerWidget();
+
+    setParent(parent);
+    setGeometry(QRect(geometry.left(), geometry.top(), geometry.width(), sizeHint().height()));
+
</ins><span class="cx">     QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
</span><span class="cx">                       Qt::LeftButton, Qt::NoModifier);
</span><span class="cx">     QCoreApplication::sendEvent(this, &amp;event);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void QWebPopup::populate()
+{
+    clear();
+    Q_ASSERT(m_client);
+
+    QStandardItemModel* model = qobject_cast&lt;QStandardItemModel*&gt;(QComboBox::model());
+    Q_ASSERT(model);
+
+    int size = m_client-&gt;listSize();
+    for (int i = 0; i &lt; size; i++) {
+        if (m_client-&gt;itemIsSeparator(i))
+            insertSeparator(i);
+        else {
+            insertItem(i, m_client-&gt;itemText(i));
+
+            if (model &amp;&amp; !m_client-&gt;itemIsEnabled(i))
+                model-&gt;item(i)-&gt;setEnabled(false);
+        }
+    }
+}
+
</ins><span class="cx"> void QWebPopup::showPopup()
</span><span class="cx"> {
</span><span class="cx">     QComboBox::showPopup();
</span></span></pre></div>
<a id="trunkWebCoreplatformqtQWebPopuph"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/qt/QWebPopup.h (52150 => 52151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/qt/QWebPopup.h        2009-12-15 14:18:47 UTC (rev 52150)
+++ trunk/WebCore/platform/qt/QWebPopup.h        2009-12-15 16:13:51 UTC (rev 52151)
</span><span class="lines">@@ -27,21 +27,25 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class QWebPopup : public QComboBox {
</del><ins>+class QWebPopup : private QComboBox {
</ins><span class="cx">     Q_OBJECT
</span><span class="cx"> public:
</span><span class="cx">     QWebPopup(PopupMenuClient* client);
</span><span class="cx"> 
</span><del>-    void exec();
</del><ins>+    void show(const QRect&amp; geometry, int selectedIndex);
+    void hide() { hidePopup(); }
</ins><span class="cx"> 
</span><del>-    virtual void showPopup();
-    virtual void hidePopup();
-
</del><span class="cx"> private slots:
</span><span class="cx">     void activeChanged(int);
</span><ins>+
</ins><span class="cx"> private:
</span><span class="cx">     PopupMenuClient* m_client;
</span><span class="cx">     bool m_popupVisible;
</span><ins>+
+    void populate();
+
+    virtual void showPopup();
+    virtual void hidePopup();
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>