Modified: trunk/Source/WebCore/ChangeLog (120266 => 120267)
--- trunk/Source/WebCore/ChangeLog 2012-06-14 02:27:21 UTC (rev 120266)
+++ trunk/Source/WebCore/ChangeLog 2012-06-14 02:36:35 UTC (rev 120267)
@@ -1,3 +1,16 @@
+2012-06-13 Crystal Zhang <[email protected]>
+
+ [BlackBerry] Apply New Style and JS for Select Popup
+ https://bugs.webkit.org/show_bug.cgi?id=89020
+
+ Reviewed by Rob Buis.
+
+ PR 162854
+
+ Use new python script for data generating, as the old one is too simple and problematic.
+
+ * PlatformBlackBerry.cmake:
+
2012-06-13 Dana Jansens <[email protected]>
[chromium] Assert if iterating an invalid RenderSurfaceLayerList, where a layer in the list has no RenderSurface
Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (120266 => 120267)
--- trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-06-14 02:27:21 UTC (rev 120266)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-06-14 02:36:35 UTC (rev 120267)
@@ -106,7 +106,6 @@
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
@@ -350,3 +349,18 @@
VERBATIM)
LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/WebDOM${_name}.cpp)
ENDFOREACH ()
+
+# Generate contents for PopupPicker.cpp
+SET(WebCore_POPUP_CSS_AND_JS
+ ${WEBCORE_DIR}/Resources/blackberry/popupControlBlackBerry.css
+ ${WEBCORE_DIR}/Resources/blackberry/selectControlBlackBerry.css
+ ${WEBCORE_DIR}/Resources/blackberry/selectControlBlackBerry.js
+)
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/PopupPicker.h ${DERIVED_SOURCES_WEBCORE_DIR}/PopupPicker.cpp
+ MAIN_DEPENDENCY ${WEBCORE_DIR}/make-file-arrays.py
+ DEPENDS ${WebCore_POPUP_CSS_AND_JS}
+ COMMAND ${PYTHON_EXECUTABLE} ${WEBCORE_DIR}/make-file-arrays.py --out-h=${DERIVED_SOURCES_WEBCORE_DIR}/PopupPicker.h --out-cpp=${DERIVED_SOURCES_WEBCORE_DIR}/PopupPicker.cpp ${WebCore_POPUP_CSS_AND_JS}
+)
+LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/PopupPicker.cpp)
Modified: trunk/Source/WebKit/blackberry/ChangeLog (120266 => 120267)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-06-14 02:27:21 UTC (rev 120266)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-06-14 02:36:35 UTC (rev 120267)
@@ -1,3 +1,19 @@
+2012-06-13 Crystal Zhang <[email protected]>
+
+ [BlackBerry] Apply New Style and JS for Select Popup
+ https://bugs.webkit.org/show_bug.cgi?id=89020
+
+ Reviewed by Rob Buis.
+
+ PR 162854
+
+ Use new styled CSS files for select popup, also remove most JS functions
+ to a separate JS file, only pass the parameters to JS, and use new python
+ script for data generating, as the old one is too simple and problematic.
+
+ * WebCoreSupport/SelectPopupClient.cpp:
+ (WebCore::SelectPopupClient::generateHTML):
+
2012-06-13 Amy Ousterhout <[email protected]>
Rename currentDeviceMotion to lastMotion in DeviceMotionClient
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp (120266 => 120267)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp 2012-06-14 02:27:21 UTC (rev 120266)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp 2012-06-14 02:36:35 UTC (rev 120267)
@@ -28,8 +28,8 @@
#include "HTMLSelectElement.h"
#include "Page.h"
#include "PagePopup.h"
+#include "PopupPicker.h"
#include "RenderObject.h"
-#include "UserAgentStyleSheets.h"
#include "WebPage_p.h"
#include <wtf/text/StringBuilder.h>
@@ -65,55 +65,63 @@
const int* itemType, bool* selecteds)
{
StringBuilder source;
- String fullPath(RESOURCE_PATH);
- String singleSelectImage("singleSelect.png");
- String multiSelectImage("multiSelect.png");
- source.append("<head><style>\n");
+ source.append("<html><head><style>\n");
// Include CSS file.
- source.append(popupControlBlackBerryUserAgentStyleSheet,
- sizeof(popupControlBlackBerryUserAgentStyleSheet));
+ source.append(popupControlBlackBerryCss,
+ sizeof(popupControlBlackBerryCss));
+ source.append("</style>\n<style>");
+ source.append(selectControlBlackBerryCss,
+ sizeof(selectControlBlackBerryCss));
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();}");
+ source.append("window.addEventListener('load', function () {");
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("window.select.show(true, ");
+ else
+ source.append("window.select.show(false, ");
+ // Add labels.
+ source.append("[");
+ for (int i = 0; i < size; i++) {
+ source.append("'" + String(labels[i].impl()) + "'");
+ // Don't append ',' to last element.
+ if (i != size - 1)
+ source.append(", ");
}
- 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\"> ");
+ source.append("], ");
+ // Add enables.
+ source.append("[");
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(enableds[i]? "true" : "false");
+ // Don't append ',' to last element.
+ if (i != size - 1)
+ source.append(", ");
}
- 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");
+ source.append("], ");
+ // Add itemType.
+ source.append("[");
+ for (int i = 0; i < size; i++) {
+ source.append(String::number(itemType[i]));
+ // Don't append ',' to last element.
+ if (i != size - 1)
+ source.append(", ");
+ }
+ source.append("], ");
+ // Add selecteds
+ source.append("[");
+ for (int i = 0; i < size; i++) {
+ source.append(selecteds[i]? "true" : "false");
+ // Don't append ',' to last element.
+ if (i != size - 1)
+ source.append(", ");
+ }
+ source.append("] ");
+ // If multi-select, add OK button for confirm.
+ if (m_multiple)
+ source.append(", 'OK'");
+ source.append("); \n }); \n");
+ source.append(selectControlBlackBerryJs, sizeof(selectControlBlackBerryJs));
+ source.append("</script>\n");
+ source.append("</body> </html>\n");
m_source = source.toString();
}
@@ -144,7 +152,7 @@
for (unsigned i = 0; i < m_size; i++)
selecteds[i] = stringValue[i] - '0';
- const WTF::Vector<HTMLElement*>& items = m_element->listItems();
+ const Vector<HTMLElement*>& items = m_element->listItems();
if (items.size() != static_cast<unsigned int>(m_size))
return;