Title: [118436] trunk/Source
Revision
118436
Author
[email protected]
Date
2012-05-24 15:33:13 -0700 (Thu, 24 May 2012)

Log Message

[BlackBerry] Implement select popup and remove old hook to air popup
https://bugs.webkit.org/show_bug.cgi?id=87419

Patch by Crystal Zhang <[email protected]> on 2012-05-24
Reviewed by Rob Buis.

Source/WebCore:

Add new files to make file, add css file for select popup.

* PlatformBlackBerry.cmake:
* Resources/blackberry/popupControlBlackBerry.css: Added.
(html):
(body):
(.bottombuttonOK):
(.bottombuttonCancel):
(.tablebutton):

Source/WebKit:

Add new files to make file.

* PlatformBlackBerry.cmake:

Source/WebKit/blackberry:

Introduce new html select popup client, remove the old hook to air popup.

* Api/WebPageClient.h:
* WebCoreSupport/SelectPopupClient.cpp: Added.
(WebCore):
(WebCore::SelectPopupClient::SelectPopupClient):
(WebCore::SelectPopupClient::~SelectPopupClient):
(WebCore::SelectPopupClient::update):
(WebCore::SelectPopupClient::generateHTML):
(WebCore::SelectPopupClient::closePopup):
(WebCore::SelectPopupClient::contentSize):
(WebCore::SelectPopupClient::htmlSource):
(WebCore::SelectPopupClient::setValueAndClosePopup):
(WebCore::SelectPopupClient::didClosePopup):
(WebCore::SelectPopupClient::writeDocument):
* WebCoreSupport/SelectPopupClient.h: Added.
(WebKit):
(WebCore):
(SelectPopupClient):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::openSelectPopup):
* WebKitSupport/InputHandler.h:
(WebCore):
(InputHandler):
* WebKitSupport/WebPopupType.h: Added.
(BlackBerry):
(WebKit):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118435 => 118436)


--- trunk/Source/WebCore/ChangeLog	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebCore/ChangeLog	2012-05-24 22:33:13 UTC (rev 118436)
@@ -1,3 +1,20 @@
+2012-05-24  Crystal Zhang  <[email protected]>
+
+        [BlackBerry] Implement select popup and remove old hook to air popup
+        https://bugs.webkit.org/show_bug.cgi?id=87419
+
+        Reviewed by Rob Buis.
+
+        Add new files to make file, add css file for select popup.
+
+        * PlatformBlackBerry.cmake:
+        * Resources/blackberry/popupControlBlackBerry.css: Added.
+        (html):
+        (body):
+        (.bottombuttonOK):
+        (.bottombuttonCancel):
+        (.tablebutton):
+
 2012-05-24  Levi Weintraub  <[email protected]>
 
         Avoid creating InlineBoxes for floating and positioned objects in isolates.

Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (118435 => 118436)


--- trunk/Source/WebCore/PlatformBlackBerry.cmake	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake	2012-05-24 22:33:13 UTC (rev 118436)
@@ -106,6 +106,7 @@
 LIST(APPEND WebCore_USER_AGENT_STYLE_SHEETS
     ${WEBCORE_DIR}/css/mediaControlsBlackBerry.css
     ${WEBCORE_DIR}/css/themeBlackBerry.css
+    ${WEBCORE_DIR}/Resources/blackberry/popupControlBlackBerry.css
 )
 
 LIST(APPEND WebCore_INCLUDE_DIRECTORIES

Added: trunk/Source/WebCore/Resources/blackberry/popupControlBlackBerry.css (0 => 118436)


--- trunk/Source/WebCore/Resources/blackberry/popupControlBlackBerry.css	                        (rev 0)
+++ trunk/Source/WebCore/Resources/blackberry/popupControlBlackBerry.css	2012-05-24 22:33:13 UTC (rev 118436)
@@ -0,0 +1,66 @@
+html {
+    position: fixed;
+    left: 0;
+    top: 0;
+    bottom: 0;
+    right: 0;
+    overflow: hidden;
+}
+
+body {
+    padding: 0;
+    margin: 0;
+    font-family: "Myriad Pro", "Arial", "Helvetica", sans-serif;
+}
+
+.bottombuttonOK {
+    font-family: Arial, Helvetica, sans-serif;
+    font-size: 14px;
+    font-style: oblique;
+    color: rgba(16, 16, 16, 0.6);
+    background-color: rgba(6, 6, 6, 0.6);
+    text-align: center;
+    vertical-align: middle;
+    display: block;
+    height: 30px;
+    width: 70px;
+    border: 1px solid #000;
+    position: fixed;
+    bottom: auto;
+}
+
+.bottombuttonCancel {
+    font-family: Arial, Helvetica, sans-serif;
+    font-size: 14px;
+    font-style: oblique;
+    color: rgba(16, 16, 16, 0.6);
+    background-color: rgba(6, 6, 6, 0.6);
+    text-align: center;
+    vertical-align: middle;
+    display: block;
+    height: 30px;
+    width: 70px;
+    border: 1px solid #000;
+    position: fixed;
+    bottom: auto;
+    left: 80px;
+}
+
+.tablebutton {
+    font-family: Arial, Helvetica, sans-serif;
+    font-size: 16px;
+    font-weight: bold;
+    background-color: #E2E4E3;
+    height: 100%;
+    width: 100%;
+    border-top-style: none;
+    border-right-style: none;
+    border-left-style: none;
+    border-bottom-style: none;
+    margin: 0 auto;
+    position:relative;
+    top:0%;
+    left:0%;
+    bottom:0%;
+    right:0%;
+}

Modified: trunk/Source/WebKit/ChangeLog (118435 => 118436)


--- trunk/Source/WebKit/ChangeLog	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebKit/ChangeLog	2012-05-24 22:33:13 UTC (rev 118436)
@@ -1,3 +1,14 @@
+2012-05-24  Crystal Zhang  <[email protected]>
+
+        [BlackBerry] Implement select popup and remove old hook to air popup
+        https://bugs.webkit.org/show_bug.cgi?id=87419
+
+        Reviewed by Rob Buis.
+
+        Add new files to make file.
+
+        * PlatformBlackBerry.cmake:
+
 2012-05-24  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Unreviewed, unbreak `make install' after r117046.

Modified: trunk/Source/WebKit/PlatformBlackBerry.cmake (118435 => 118436)


--- trunk/Source/WebKit/PlatformBlackBerry.cmake	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebKit/PlatformBlackBerry.cmake	2012-05-24 22:33:13 UTC (rev 118436)
@@ -76,6 +76,7 @@
     blackberry/WebCoreSupport/NotificationPresenterImpl.cpp
     blackberry/WebCoreSupport/VibrationClientBlackBerry.cpp
     blackberry/WebCoreSupport/PagePopupBlackBerry.cpp
+    blackberry/WebCoreSupport/SelectPopupClient.cpp
     blackberry/WebKitSupport/BackingStoreCompositingSurface.cpp
     blackberry/WebKitSupport/BackingStoreTile.cpp
     blackberry/WebKitSupport/BackingStoreClient.cpp

Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (118435 => 118436)


--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-05-24 22:33:13 UTC (rev 118436)
@@ -162,7 +162,6 @@
 
     virtual void resetBackForwardList(unsigned listSize, unsigned currentIndex) = 0;
 
-    virtual void openPopupList(bool multiple, int size, const ScopeArray<WebString>& labels, bool* enableds, const int* itemType, bool* selecteds) = 0;
     virtual void openDateTimePopup(int type, const WebString& value, const WebString& min, const WebString& max, double step) = 0;
     virtual void openColorPopup(const WebString& value) = 0;
 

Modified: trunk/Source/WebKit/blackberry/ChangeLog (118435 => 118436)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-05-24 22:33:13 UTC (rev 118436)
@@ -1,3 +1,38 @@
+2012-05-24  Crystal Zhang  <[email protected]>
+
+        [BlackBerry] Implement select popup and remove old hook to air popup
+        https://bugs.webkit.org/show_bug.cgi?id=87419
+
+        Reviewed by Rob Buis.
+
+        Introduce new html select popup client, remove the old hook to air popup.
+
+        * Api/WebPageClient.h:
+        * WebCoreSupport/SelectPopupClient.cpp: Added.
+        (WebCore):
+        (WebCore::SelectPopupClient::SelectPopupClient):
+        (WebCore::SelectPopupClient::~SelectPopupClient):
+        (WebCore::SelectPopupClient::update):
+        (WebCore::SelectPopupClient::generateHTML):
+        (WebCore::SelectPopupClient::closePopup):
+        (WebCore::SelectPopupClient::contentSize):
+        (WebCore::SelectPopupClient::htmlSource):
+        (WebCore::SelectPopupClient::setValueAndClosePopup):
+        (WebCore::SelectPopupClient::didClosePopup):
+        (WebCore::SelectPopupClient::writeDocument):
+        * WebCoreSupport/SelectPopupClient.h: Added.
+        (WebKit):
+        (WebCore):
+        (SelectPopupClient):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::openSelectPopup):
+        * WebKitSupport/InputHandler.h:
+        (WebCore):
+        (InputHandler):
+        * WebKitSupport/WebPopupType.h: Added.
+        (BlackBerry):
+        (WebKit):
+
 2012-05-24  Antonio Gomes  <[email protected]>
 
         Possible missing layout in Iris browser after hiding VKB

Added: trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp (0 => 118436)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp	                        (rev 0)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp	2012-05-24 22:33:13 UTC (rev 118436)
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+
+#include "SelectPopupClient.h"
+
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "Document.h"
+#include "DocumentWriter.h"
+#include "HTMLOptionElement.h"
+#include "HTMLSelectElement.h"
+#include "Page.h"
+#include "PagePopup.h"
+#include "RenderObject.h"
+#include "UserAgentStyleSheets.h"
+#include "WebPage_p.h"
+
+#include <wtf/text/StringBuilder.h>
+
+#define CELL_HEIGHT 30
+
+namespace WebCore {
+
+SelectPopupClient::SelectPopupClient(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds,
+    const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLSelectElement* element)
+    : m_multiple(multiple)
+    , m_size(size)
+    , m_webPage(webPage)
+    , m_element(element)
+{
+    generateHTML(multiple, size, labels, enableds, itemType, selecteds);
+}
+
+SelectPopupClient::~SelectPopupClient()
+{
+}
+
+void SelectPopupClient::update(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds,
+    const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement* element)
+{
+    m_multiple = multiple;
+    m_size = size;
+    m_element = element;
+    generateHTML(multiple, size, labels, enableds, itemType, selecteds);
+}
+
+void SelectPopupClient::generateHTML(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds,
+    const int* itemType, bool* selecteds)
+{
+    StringBuilder source;
+    String fullPath(RESOURCE_PATH);
+    String singleSelectImage("singleSelect.png");
+    String multiSelectImage("multiSelect.png");
+    source.append("<head><style>\n");
+    // Include CSS file.
+    source.append(popupControlBlackBerryUserAgentStyleSheet,
+            sizeof(popupControlBlackBerryUserAgentStyleSheet));
+    source.append("</style></head><body>\n");
+    source.append("<script>\n");
+    source.append("var options=new Array(" + String::number(size) + ");");
+    source.append("for (var i = 0; i < " + String::number(size) + "; i++ )");
+    source.append("{ options[i] = false ;");
+    source.append("var imageid = document.getElementById(\"image\" + parseInt(i)); imageid.style.visibility = false; }");
+    source.append("function Ok() { var selecteds = \"\";");
+    source.append("for (var i = 0; i < " + String::number(size) + "; i++ )");
+    source.append("{  if (options[i]) selecteds += '1'; else selecteds += '0';}");
+    source.append("window.setValueAndClosePopup(selecteds, window.popUp); window.close();}");
+    source.append("function Cancel() { var selecteds = \"\";");
+    source.append("for (var i = 0; i < " + String::number(size) + "; i++ )");
+    source.append("selecteds += '0';");
+    source.append("window.setValueAndClosePopup(selecteds, window.popUp); window.close();}");
+    if (m_multiple)
+        source.append("function Select(i) { options[i] = !options[i]; var imageid = document.getElementById(\"image\" + parseInt(i)); imageid.style.visibility = options[i]; }");
+    else {
+        source.append("function Select(i) { for (var j = 0; j < " + String::number(size) + "; j++ )");
+        source.append("{ options[j] = false; ");
+        source.append("var imageid = document.getElementById(\"image\" + parseInt(j)); imageid.style.visibility = false; }");
+        source.append("options[i] = true; ");
+        source.append("var imageid = document.getElementById(\"image\" + parseInt(i)); imageid.style.visibility = true; }");
+    }
+    source.append("</script>\n");
+
+    int tableWidth = contentSize().width();
+    int tableHeight = CELL_HEIGHT * size;
+    source.append("<table width=\"" + String::number(tableWidth) + "\" height=\"" + String::number(tableHeight)
+        + "\" border=\"0\" frame=\"void\" rules=\"rows\"> ");
+    for (int i = 0; i < size; i++) {
+        source.append(" <tr> <td bgcolor=\"#E2E4E3\" width=\"80%\"><input class=\"tablebutton\" id=\"button" + String::number(i)
+            + "\" type=\"button\" value=\"" + String(labels[i].impl()) + "\" _onclick_=\"Select(" + String::number(i) + ");\" />");
+        source.append("</td>");
+        source.append("<td bgcolor=\"#E2E4E3\" width=\"20%\"><input type=\"image\" id=\"image" + String::number(i) + "\" src="" " + fullPath
+            + singleSelectImage + " \" /></td> </tr>");
+    }
+    source.append("</table>");
+    source.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td>");
+    source.append("<input class=\"bottombuttonOK\" name=\"btnOk\" type=\"button\" value=\"Ok\" ");
+    source.append("_onclick_=\"Ok();\" /></td> <td nowrap=\"nowrap\"> <input class=\"bottombuttonCancel\" type=\"button\" value=\"Cancel\" _onclick_=\"Cancel();\" />");
+    source.append("</td> </tr></table>");
+    source.append("</body>\n");
+    m_source = source.toString();
+}
+
+void SelectPopupClient::closePopup()
+{
+    ASSERT(m_webPage);
+    m_webPage->m_page->chrome()->client()->closePagePopup(0);
+}
+
+IntSize SelectPopupClient::contentSize()
+{
+    // Fixme: will generate content size dynamically
+    return IntSize(320, 256);
+}
+
+String SelectPopupClient::htmlSource()
+{
+    return m_source;
+}
+
+void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue)
+{
+
+    ASSERT(m_size == stringValue.length());
+
+    if (m_size > 0) {
+        bool selecteds[m_size];
+        for (unsigned i = 0; i < m_size; i++)
+            selecteds[i] = stringValue[i] - 32;
+
+        const WTF::Vector<HTMLElement*>& items = m_element->listItems();
+
+        if (items.size() != static_cast<unsigned int>(m_size))
+            return;
+
+        HTMLOptionElement* option;
+        for (unsigned i = 0; i < m_size; i++) {
+            if (items[i]->hasTagName(HTMLNames::optionTag)) {
+                option = static_cast<HTMLOptionElement*>(items[i]);
+                option->setSelectedState(selecteds[i]);
+            }
+        }
+    }
+    // Force repaint because we do not send mouse events to the select element
+    // and the element doesn't automatically repaint itself.
+    m_element->dispatchFormControlChangeEvent();
+    m_element->renderer()->repaint();
+    closePopup();
+}
+
+void SelectPopupClient::didClosePopup()
+{
+    m_webPage = 0;
+    m_element = 0;
+}
+
+void SelectPopupClient::writeDocument(DocumentWriter& writer)
+{
+    writer.setMIMEType("text/html");
+    writer.begin(KURL());
+    writer.addData(m_source.utf8().data(), m_source.utf8().length());
+    writer.end();
+}
+}
+

Added: trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h (0 => 118436)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h	                        (rev 0)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h	2012-05-24 22:33:13 UTC (rev 118436)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef SelectPopupClient_h
+#define SelectPopupClient_h
+
+#include "IntSize.h"
+#include "PagePopupClient.h"
+#include "ScopePointer.h"
+#include "WTFString.h"
+#include "WebString.h"
+
+namespace BlackBerry {
+namespace WebKit {
+class WebPagePrivate;
+}
+}
+
+namespace WebCore {
+class DocumentWriter;
+class HTMLSelectElement;
+class PagePopup;
+
+class SelectPopupClient : public PagePopupClient {
+public:
+    SelectPopupClient(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds, const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement*);
+    ~SelectPopupClient();
+
+    void update(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds, const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement*);
+
+    void generateHTML(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds, const int* itemType, bool* selecteds);
+
+    void writeDocument(DocumentWriter&);
+    virtual IntSize contentSize();
+    virtual String htmlSource();
+    virtual void setValueAndClosePopup(int, const String&);
+    virtual void didClosePopup();
+    void closePopup();
+
+    bool m_multiple;
+    unsigned m_size;
+    String m_source;
+    BlackBerry::WebKit::WebPagePrivate* m_webPage;
+    HTMLSelectElement* m_element;
+};
+} // namespace WebCore
+#endif

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (118435 => 118436)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-05-24 22:33:13 UTC (rev 118436)
@@ -49,6 +49,7 @@
 #include "RenderTextControl.h"
 #include "RenderWidget.h"
 #include "ScopePointer.h"
+#include "SelectPopupClient.h"
 #include "SelectionHandler.h"
 #include "TextIterator.h"
 #include "WebPageClient.h"
@@ -1122,51 +1123,61 @@
     if (!select || select->disabled())
         return false;
 
+    // If there's no view, do nothing and return.
+    if (!select->document()->view())
+        return false;
+
     if (isActiveTextEdit())
         clearCurrentFocusElement();
 
     m_currentFocusElement = select;
     m_currentFocusElementType = SelectPopup;
+
     const WTF::Vector<HTMLElement*>& listItems = select->listItems();
     int size = listItems.size();
-    if (!size) {
-        ScopeArray<WebString> labels;
-        bool* enableds = 0;
-        int* itemTypes = 0;
-        bool* selecteds = 0;
-        m_webPage->m_client->openPopupList(false, size, labels, enableds, itemTypes, selecteds);
-        return true;
-    }
 
     bool multiple = select->multiple();
-
     ScopeArray<WebString> labels;
     labels.reset(new WebString[size]);
-    bool* enableds = new bool[size];
-    int* itemTypes = new int[size];
-    bool* selecteds = new bool[size];
 
-    for (int i = 0; i < size; i++) {
-        if (listItems[i]->hasTagName(HTMLNames::optionTag)) {
-            HTMLOptionElement* option = static_cast<HTMLOptionElement*>(listItems[i]);
-            labels[i] = option->textIndentedToRespectGroupLabel();
-            enableds[i] = option->disabled() ? 0 : 1;
-            selecteds[i] = option->selected();
-            itemTypes[i] = TypeOption;
-        } else if (listItems[i]->hasTagName(HTMLNames::optgroupTag)) {
-            HTMLOptGroupElement* optGroup = static_cast<HTMLOptGroupElement*>(listItems[i]);
-            labels[i] = optGroup->groupLabelText();
-            enableds[i] = optGroup->disabled() ? 0 : 1;
-            selecteds[i] = false;
-            itemTypes[i] = TypeGroup;
-        } else if (listItems[i]->hasTagName(HTMLNames::hrTag)) {
-            enableds[i] = false;
-            selecteds[i] = false;
-            itemTypes[i] = TypeSeparator;
+    if (!size) {
+        if (!m_selectClient)
+            m_selectClient = new SelectPopupClient(multiple, size, labels, 0, 0, 0, m_webPage, select);
+        else
+            m_selectClient->update(multiple, size, labels, enableds, itemTypes, selecteds, m_webPage, select);
+    } else {
+        bool* enableds = new bool[size];
+        int* itemTypes = new int[size];
+        bool* selecteds = new bool[size];
+
+        for (int i = 0; i < size; i++) {
+            if (listItems[i]->hasTagName(HTMLNames::optionTag)) {
+                HTMLOptionElement* option = static_cast<HTMLOptionElement*>(listItems[i]);
+                labels[i] = option->textIndentedToRespectGroupLabel();
+                enableds[i] = option->disabled() ? 0 : 1;
+                selecteds[i] = option->selected();
+                itemTypes[i] = TypeOption;
+            } else if (listItems[i]->hasTagName(HTMLNames::optgroupTag)) {
+                HTMLOptGroupElement* optGroup = static_cast<HTMLOptGroupElement*>(listItems[i]);
+                labels[i] = optGroup->groupLabelText();
+                enableds[i] = optGroup->disabled() ? 0 : 1;
+                selecteds[i] = false;
+                itemTypes[i] = TypeGroup;
+            } else if (listItems[i]->hasTagName(HTMLNames::hrTag)) {
+                enableds[i] = false;
+                selecteds[i] = false;
+                itemTypes[i] = TypeSeparator;
+            }
         }
+
+        if (!m_selectClient)
+            m_selectClient = new SelectPopupClient(multiple, size, labels, enableds, itemTypes, selecteds, m_webPage, select);
+        else
+            m_selectClient->update(multiple, size, labels, enableds, itemTypes, selecteds, m_webPage, select);
     }
 
-    m_webPage->m_client->openPopupList(multiple, size, labels, enableds, itemTypes, selecteds);
+    WebCore::IntRect elementRectInRootView = select->document()->view()->contentsToRootView(select->getRect());
+    m_webPage->m_page->chrome()->client()->openPagePopup(m_selectClient, elementRectInRootView);
     return true;
 }
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (118435 => 118436)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-05-24 22:31:50 UTC (rev 118435)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-05-24 22:33:13 UTC (rev 118436)
@@ -37,6 +37,7 @@
 class HTMLSelectElement;
 class IntRect;
 class Node;
+class SelectPopupClient;
 }
 
 namespace BlackBerry {
@@ -192,6 +193,8 @@
 
     PendingKeyboardStateChange m_pendingKeyboardVisibilityChange;
     bool m_delayKeyboardVisibilityChange;
+
+    WebCore::SelectPopupClient* m_selectClient;
 };
 
 }

Added: trunk/Source/WebKit/blackberry/WebKitSupport/WebPopupType.h (0 => 118436)


--- trunk/Source/WebKit/blackberry/WebKitSupport/WebPopupType.h	                        (rev 0)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/WebPopupType.h	2012-05-24 22:33:13 UTC (rev 118436)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef WebPopupType_h
+#define WebPopupType_h
+
+namespace BlackBerry {
+
+namespace WebKit {
+
+enum WebPopupType {
+    WebPopupTypeNone, // Not a popup.
+    WebPopupTypeSelect, // Select Control
+    WebPopupTypeDate, // Date control
+};
+
+}
+}
+
+#endif // WebPopupType_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to