Title: [125565] trunk/Source/WebKit/blackberry
Revision
125565
Author
charles....@torchmobile.com.cn
Date
2012-08-14 08:09:08 -0700 (Tue, 14 Aug 2012)

Log Message

[BlackBerry] Some callback of Select onchange doesn't work
https://bugs.webkit.org/show_bug.cgi?id=93944

Reviewed by George Staikos.

The Selection element is implemented with PagePopup, an HTML-based WebView with
some _javascript_s to make the UI of the select and option lists; The selection
change is initiated from the _javascript_ code in the Select Webview, and back to
the native code of SelectPopupClient, which now in turn dispatches
FormControlChangeEvent to the select element directly, and that causes the
_javascript_ callback been invoked in the same cycle as the _javascript_ in the
Popup View, and causes some _javascript_ Context problem.

The solution is to send the FormControlChangeEvent asynchronously by a timer,
when the _javascript_ in the Popup view finishes execution, we then send the
FormControlChangeEvent to the select element in the content page, that avoids
the concurrent _javascript_ context issue.

* WebCoreSupport/SelectPopupClient.cpp:
(WebCore::SelectPopupClient::SelectPopupClient):
(WebCore::SelectPopupClient::setValueAndClosePopup):
(WebCore):
(WebCore::SelectPopupClient::notifySelectionChange):
* WebCoreSupport/SelectPopupClient.h:
(SelectPopupClient):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (125564 => 125565)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-08-14 14:52:25 UTC (rev 125564)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-08-14 15:09:08 UTC (rev 125565)
@@ -1,3 +1,31 @@
+2012-08-14  Charles Wei  <charles....@torchmobile.com.cn>
+
+        [BlackBerry] Some callback of Select onchange doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=93944
+
+        Reviewed by George Staikos.
+
+        The Selection element is implemented with PagePopup, an HTML-based WebView with
+        some _javascript_s to make the UI of the select and option lists; The selection
+        change is initiated from the _javascript_ code in the Select Webview, and back to
+        the native code of SelectPopupClient, which now in turn dispatches
+        FormControlChangeEvent to the select element directly, and that causes the
+        _javascript_ callback been invoked in the same cycle as the _javascript_ in the
+        Popup View, and causes some _javascript_ Context problem.
+
+        The solution is to send the FormControlChangeEvent asynchronously by a timer, 
+        when the _javascript_ in the Popup view finishes execution, we then send the
+        FormControlChangeEvent to the select element in the content page, that avoids
+        the concurrent _javascript_ context issue.
+
+        * WebCoreSupport/SelectPopupClient.cpp:
+        (WebCore::SelectPopupClient::SelectPopupClient):
+        (WebCore::SelectPopupClient::setValueAndClosePopup):
+        (WebCore):
+        (WebCore::SelectPopupClient::notifySelectionChange):
+        * WebCoreSupport/SelectPopupClient.h:
+        (SelectPopupClient):
+
 2012-08-14  Arvid Nilsson  <anils...@rim.com>
 
         [BlackBerry] Get rid of glCopyTexImage2D in Canvas and WebGL code paths

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp (125564 => 125565)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp	2012-08-14 14:52:25 UTC (rev 125564)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp	2012-08-14 15:09:08 UTC (rev 125565)
@@ -44,6 +44,7 @@
     , m_size(size)
     , m_webPage(webPage)
     , m_element(element)
+    , m_notifyChangeTimer(this, &SelectPopupClient::notifySelectionChange)
 {
     generateHTML(multiple, size, labels, enableds, itemType, selecteds);
 }
@@ -173,10 +174,10 @@
     }
     // Force repaint because we do not send mouse events to the select element
     // and the element doesn't automatically repaint itself.
-    m_element->dispatchFormControlChangeEvent();
     if (m_element->renderer())
         m_element->renderer()->repaint();
-    closePopup();
+
+    m_notifyChangeTimer.startOneShot(0);
 }
 
 void SelectPopupClient::didClosePopup()
@@ -192,5 +193,13 @@
     writer.addData(m_source.utf8().data(), m_source.utf8().length());
     writer.end();
 }
+
+void SelectPopupClient::notifySelectionChange(WebCore::Timer<SelectPopupClient>*)
+{
+    if (m_element)
+        m_element->dispatchFormControlChangeEvent();
+    closePopup();
 }
 
+}
+

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h (125564 => 125565)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h	2012-08-14 14:52:25 UTC (rev 125564)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h	2012-08-14 15:09:08 UTC (rev 125565)
@@ -22,6 +22,7 @@
 #include "IntSize.h"
 #include "PagePopupClient.h"
 #include "ScopePointer.h"
+#include "Timer.h"
 #include "WTFString.h"
 #include "WebString.h"
 
@@ -44,6 +45,7 @@
     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 notifySelectionChange(WebCore::Timer<SelectPopupClient> *);
 
     void writeDocument(DocumentWriter&);
     virtual IntSize contentSize();
@@ -57,6 +59,7 @@
     String m_source;
     BlackBerry::WebKit::WebPagePrivate* m_webPage;
     HTMLSelectElement* m_element;
+    WebCore::Timer<SelectPopupClient> m_notifyChangeTimer;
 };
 } // namespace WebCore
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to