Add setValue and closePopup methods to PagePopupController
authorkeishi@webkit.org <keishi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 13:36:51 +0000 (13:36 +0000)
committerkeishi@webkit.org <keishi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 13:36:51 +0000 (13:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109897

Reviewed by Kent Tamura.

.:

* ManualTests/forms/calendar-picker.html: Added mock setValue and closePopup implementation.
* ManualTests/forms/color-suggestion-picker.html: Ditto.

Source/WebCore:

The new calendar picker (Bug 109439) needs to set a value without
closing the popup. We can't do that with the existing
setValueAndClosePopup.

No new tests. Existing calendar picker and color suggestion picker tests
that closing and setting values work properly.

* Resources/pagepopups/pickerCommon.js:
(Picker.prototype.submitValue): Stop using setValueAndClosePopup.
(Picker.prototype.handleCancel): Ditto.
* page/PagePopupClient.h:
(PagePopupClient):
* page/PagePopupController.cpp:
(WebCore::PagePopupController::setValue): Sets value to element without closing popup.
(WebCore):
(WebCore::PagePopupController::closePopup): Just closes popup.
* page/PagePopupController.h:
(PagePopupController):
* page/PagePopupController.idl:

Source/WebKit/blackberry:

* WebCoreSupport/ColorPickerClient.cpp:
(WebCore::ColorPickerClient::setValue): Added empty implementation.
(WebCore):
* WebCoreSupport/ColorPickerClient.h:
(ColorPickerClient):
* WebCoreSupport/DatePickerClient.cpp:
(WebCore::DatePickerClient::setValue): Ditto.
(WebCore):
* WebCoreSupport/DatePickerClient.h:
(DatePickerClient):
* WebCoreSupport/SelectPopupClient.cpp:
(WebCore::SelectPopupClient::setValue): Ditto.
(WebCore):
* WebCoreSupport/SelectPopupClient.h:
(SelectPopupClient):

Source/WebKit/chromium:

* src/ColorChooserPopupUIController.cpp:
(WebKit::ColorChooserPopupUIController::setValue):
(WebKit):
* src/ColorChooserPopupUIController.h:
(ColorChooserPopupUIController):
* src/DateTimeChooserImpl.cpp:
(WebKit::DateTimeChooserImpl::setValueAndClosePopup): Use setValue and closePopup.
(WebKit):
(WebKit::DateTimeChooserImpl::setValue):
(WebKit::DateTimeChooserImpl::closePopup):
* src/DateTimeChooserImpl.h:
(DateTimeChooserImpl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142987 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
ChangeLog
ManualTests/forms/calendar-picker.html
ManualTests/forms/color-suggestion-picker.html
Source/WebCore/ChangeLog
Source/WebCore/Resources/pagepopups/pickerCommon.js
Source/WebCore/page/PagePopupClient.h
Source/WebCore/page/PagePopupController.cpp
Source/WebCore/page/PagePopupController.h
Source/WebCore/page/PagePopupController.idl
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ColorPickerClient.cpp
Source/WebKit/blackberry/WebCoreSupport/ColorPickerClient.h
Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp
Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h
Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp
Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ColorChooserPopupUIController.cpp
Source/WebKit/chromium/src/ColorChooserPopupUIController.h
Source/WebKit/chromium/src/DateTimeChooserImpl.cpp
Source/WebKit/chromium/src/DateTimeChooserImpl.h

index 7e045f1b1a3deeb03f8102a47fc949b40f7325e1..9a7ba0e163701cf2e9044dc9a56c302d329de78c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-02-15  Keishi Hattori  <keishi@webkit.org>
+
+        Add setValue and closePopup methods to PagePopupController
+        https://bugs.webkit.org/show_bug.cgi?id=109897
+
+        Reviewed by Kent Tamura.
+
+        * ManualTests/forms/calendar-picker.html: Added mock setValue and closePopup implementation.
+        * ManualTests/forms/color-suggestion-picker.html: Ditto.
+
 2013-02-15  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Simplify hitTestResultAtPoint and nodesFromRect APIs
index 20e14a81192e1e3a3e44628c91ed9269657989ff..2dd5f17749c183d722b033e63fdee5c5a437ed6b 100644 (file)
@@ -294,6 +294,12 @@ function openCalendar(args) {
             if (numValue == 0)
                 window.document.getElementById('date').value = stringValue;
         },
+        setValue: function(value) {
+            window.log('value="' + value + '"');
+            window.document.getElementById('date').value = value;
+        },
+        closePopup: function() {
+        },
         localizeNumberString: function(numString) {
             if (typeof numString == "number")
                 return numString.toLocaleString();
index ded4e7cb7cf8cd19b185aab3dda74cdfe135096a..8934ae111959b352e8038a87c0627c6cca4892dd 100644 (file)
@@ -56,7 +56,13 @@ function openColorPicker(args) {
             window.log('number=' + numValue + ', string="' + stringValue + '"');
             if (numValue === 0)
                 window.document.getElementById('color').value = stringValue;
-        }
+        },
+        setValue: function(value) {
+            window.log('value="' + value + '"');
+            window.document.getElementById('color').value = value;
+        },
+        closePopup: function() {
+        },
     }
 
     setTimeout(function() {
index d5e05b829926a9da2f5ddc69f13e55ddd17c3675..7088b77041d203e06a82a1a45032230b1aa58641 100644 (file)
@@ -1,3 +1,30 @@
+2013-02-15  Keishi Hattori  <keishi@webkit.org>
+
+        Add setValue and closePopup methods to PagePopupController
+        https://bugs.webkit.org/show_bug.cgi?id=109897
+
+        Reviewed by Kent Tamura.
+
+        The new calendar picker (Bug 109439) needs to set a value without
+        closing the popup. We can't do that with the existing
+        setValueAndClosePopup.
+
+        No new tests. Existing calendar picker and color suggestion picker tests
+        that closing and setting values work properly.
+
+        * Resources/pagepopups/pickerCommon.js:
+        (Picker.prototype.submitValue): Stop using setValueAndClosePopup.
+        (Picker.prototype.handleCancel): Ditto.
+        * page/PagePopupClient.h:
+        (PagePopupClient):
+        * page/PagePopupController.cpp:
+        (WebCore::PagePopupController::setValue): Sets value to element without closing popup.
+        (WebCore):
+        (WebCore::PagePopupController::closePopup): Just closes popup.
+        * page/PagePopupController.h:
+        (PagePopupController):
+        * page/PagePopupController.idl:
+
 2013-02-15  Mihnea Ovidenie  <mihnea@adobe.com>
 
         [CSS Regions] RenderRegion should inherit from RenderBlock
index 170ecb15b3d32563cd17ffa3edfc83e74c5646ca..7034329f830f75eee4a5ea3fd370993373e1f43c 100644 (file)
@@ -242,11 +242,12 @@ Picker.Actions = {
  * @param {!string} value
  */
 Picker.prototype.submitValue = function(value) {
-    window.pagePopupController.setValueAndClosePopup(Picker.Actions.SetValue, value);
+    window.pagePopupController.setValue(value);
+    window.pagePopupController.closePopup();
 }
 
 Picker.prototype.handleCancel = function() {
-    window.pagePopupController.setValueAndClosePopup(Picker.Actions.Cancel, "");
+    window.pagePopupController.closePopup();
 }
 
 Picker.prototype.chooseOtherColor = function() {
index 391c8f83e7cbaf528a050224726e8f3320419f69..b324cfbdbe9d27aa9e94eb421bedaf7a760b84ee 100644 (file)
@@ -60,6 +60,12 @@ public:
     // An implementation of this function should call ChromeClient::closePagePopup().
     virtual void setValueAndClosePopup(int numValue, const String& stringValue) = 0;
 
+    // This is called by the content HTML of a PagePopup.
+    virtual void setValue(const String&) = 0;
+
+    // This is called by the content HTML of a PagePopup.
+    virtual void closePopup() = 0;
+
     // This is called whenever a PagePopup was closed.
     virtual void didClosePopup() = 0;
 
index dbe75224b62a440bd7bd77c42ee58c2c10c84777..1cba6b1055e506284b2e0b2447b29eb84b28fcf9 100644 (file)
@@ -55,6 +55,18 @@ void PagePopupController::setValueAndClosePopup(int numValue, const String& stri
         m_popupClient->setValueAndClosePopup(numValue, stringValue);
 }
 
+void PagePopupController::setValue(const String& value)
+{
+    if (m_popupClient)
+        m_popupClient->setValue(value);
+}
+
+void PagePopupController::closePopup()
+{
+    if (m_popupClient)
+        m_popupClient->closePopup();
+}
+
 String PagePopupController::localizeNumberString(const String& numberString)
 {
     if (m_popupClient)
index 19de4804352d19f4cb2ca2dc4aea999415111db5..1507a4d53331646f2a539ead5567aa448c3d0ef4 100644 (file)
@@ -44,6 +44,8 @@ class PagePopupController : public RefCounted<PagePopupController> {
 public:
     static PassRefPtr<PagePopupController> create(PagePopupClient*);
     void setValueAndClosePopup(int numValue, const String& stringValue);
+    void setValue(const String&);
+    void closePopup();
     String localizeNumberString(const String&);
 #if ENABLE(CALENDAR_PICKER)
     String formatMonth(int year, int zeroBaseMonth);
index 03f47286b31beb18e57b3f973b4ce873ff85966a..0aa62d686a61c09d15e873f3656cf90bd9aec1fa 100644 (file)
@@ -33,6 +33,8 @@
     ImplementationLacksVTable
 ] interface PagePopupController {
     void setValueAndClosePopup(in long numberValue, in DOMString stringValue);
+    void setValue(DOMString value);
+    void closePopup();
     DOMString localizeNumberString(in DOMString numberString);
     [Conditional=CALENDAR_PICKER] DOMString formatMonth(in long year, in long zeroBaseMonth);
     void histogramEnumeration(DOMString name, long sample, long boundaryValue);
index 4909ebe52c59a058109552281891fee80cff3653..d537ff13633c13c105a4a9c1014b54b7f754ef5d 100644 (file)
@@ -1,3 +1,26 @@
+2013-02-15  Keishi Hattori  <keishi@webkit.org>
+
+        Add setValue and closePopup methods to PagePopupController
+        https://bugs.webkit.org/show_bug.cgi?id=109897
+
+        Reviewed by Kent Tamura.
+
+        * WebCoreSupport/ColorPickerClient.cpp:
+        (WebCore::ColorPickerClient::setValue): Added empty implementation.
+        (WebCore):
+        * WebCoreSupport/ColorPickerClient.h:
+        (ColorPickerClient):
+        * WebCoreSupport/DatePickerClient.cpp:
+        (WebCore::DatePickerClient::setValue): Ditto.
+        (WebCore):
+        * WebCoreSupport/DatePickerClient.h:
+        (DatePickerClient):
+        * WebCoreSupport/SelectPopupClient.cpp:
+        (WebCore::SelectPopupClient::setValue): Ditto.
+        (WebCore):
+        * WebCoreSupport/SelectPopupClient.h:
+        (SelectPopupClient):
+
 2013-02-15  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Simplify hitTestResultAtPoint and nodesFromRect APIs
index dfc893fd259333e3eb47a413fa00f517c5be3254..8be0664d5d7e1ccdcf61db187f9bf5efe72973d5 100644 (file)
@@ -24,6 +24,7 @@
 #include "Document.h"
 #include "DocumentWriter.h"
 #include "HTMLInputElement.h"
+#include "NotImplemented.h"
 #include "Page.h"
 #include "PagePopup.h"
 #include "PopupPicker.h"
@@ -98,6 +99,11 @@ void ColorPickerClient::setValueAndClosePopup(int, const String& value)
     closePopup();
 }
 
+void ColorPickerClient::setValue(const String&)
+{
+    notImplemented();
+}
+
 void ColorPickerClient::didClosePopup()
 {
     m_webPage = 0;
index 2e6fbbe77910be83625a150d6de7c918b3abb546..04f06870d87fa93aea3d4ef37da659c2b46d0d6b 100644 (file)
@@ -46,11 +46,11 @@ public:
     String htmlSource() const;
     virtual Localizer& localizer();
     void setValueAndClosePopup(int, const String&);
+    void setValue(const String&);
+    void closePopup();
     void didClosePopup();
 
 private:
-    void closePopup();
-
     String m_source;
     BlackBerry::WebKit::WebPagePrivate* m_webPage;
     RefPtr<HTMLInputElement> m_element;
index d73d84ee6eaa306c4762c73891e17794fc7b38fd..0b38df04655f0240bdd72d703ab476973ce70a10 100644 (file)
@@ -25,6 +25,7 @@
 #include "DocumentWriter.h"
 #include "Frame.h"
 #include "HTMLInputElement.h"
+#include "NotImplemented.h"
 #include "Page.h"
 #include "PagePopup.h"
 #include "PopupPicker.h"
@@ -137,6 +138,11 @@ void DatePickerClient::setValueAndClosePopup(int, const String& value)
     closePopup();
 }
 
+void DatePickerClient::setValue(int, const String& value)
+{
+    notImplemented();
+}
+
 void DatePickerClient::didClosePopup()
 {
     m_webPage = 0;
index 66b20c9c8be89a99d4eecce882fc75d2c01b1a79..0e215416740b0f17caa4432f0668e58a1abaf6f0 100644 (file)
@@ -48,6 +48,7 @@ public:
     virtual String htmlSource();
     virtual Localizer& localizer();
     void setValueAndClosePopup(int, const String&);
+    void setValue(const String&);
     void didClosePopup();
     void closePopup();
 
index b1af6fa638d3757dba536a77760ec2c40d4c54c3..3fd92f7fb8f72e0b5bd73f6bdc9f7b9daa440968 100644 (file)
@@ -26,6 +26,7 @@
 #include "DocumentWriter.h"
 #include "HTMLOptionElement.h"
 #include "HTMLSelectElement.h"
+#include "NotImplemented.h"
 #include "Page.h"
 #include "PagePopup.h"
 #include "PopupPicker.h"
@@ -195,6 +196,11 @@ void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue)
     m_notifyChangeTimer.startOneShot(0);
 }
 
+void SelectPopupClient::setValue(const String&)
+{
+    notImplemented();
+}
+
 void SelectPopupClient::didClosePopup()
 {
     m_webPage = 0;
index b139aeed3cd6d1564d3fbfc1eeee98565e25147b..f90f65354036ba05ceaa5bbf82e241a700f83a76 100644 (file)
@@ -55,8 +55,9 @@ public:
     virtual String htmlSource();
     virtual Localizer& localizer();
     virtual void setValueAndClosePopup(int, const String&);
+    virtual void setValue(const String&);
+    virtual void closePopup();
     virtual void didClosePopup();
-    void closePopup();
 
     bool m_multiple;
     unsigned m_size;
index ce52915570a1e5243cfb29c6374f63010a5c96ce..48f6475d98c7a55c844564a689fcb5dc80a214aa 100644 (file)
@@ -1,3 +1,23 @@
+2013-02-15  Keishi Hattori  <keishi@webkit.org>
+
+        Add setValue and closePopup methods to PagePopupController
+        https://bugs.webkit.org/show_bug.cgi?id=109897
+
+        Reviewed by Kent Tamura.
+
+        * src/ColorChooserPopupUIController.cpp:
+        (WebKit::ColorChooserPopupUIController::setValue):
+        (WebKit):
+        * src/ColorChooserPopupUIController.h:
+        (ColorChooserPopupUIController):
+        * src/DateTimeChooserImpl.cpp:
+        (WebKit::DateTimeChooserImpl::setValueAndClosePopup): Use setValue and closePopup.
+        (WebKit):
+        (WebKit::DateTimeChooserImpl::setValue):
+        (WebKit::DateTimeChooserImpl::closePopup):
+        * src/DateTimeChooserImpl.h:
+        (DateTimeChooserImpl):
+
 2013-02-15  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Simplify hitTestResultAtPoint and nodesFromRect APIs
index 6944eae69cc45cbc65e10b7b5df3d3753bd598cb..c49fb95ac920618f45ebb58a500cf91dbf786761 100644 (file)
@@ -122,6 +122,12 @@ void ColorChooserPopupUIController::setValueAndClosePopup(int numValue, const St
     closePopup();
 }
 
+void ColorChooserPopupUIController::setValue(const String& value)
+{
+    ASSERT(m_client);
+    m_client->didChooseColor(Color(value));
+}
+
 void ColorChooserPopupUIController::didClosePopup()
 {
     m_popup = 0;
index c4d5848c4b9108ceea22e7b7b81c7378909ca69d..4eaf8f96797441ea876b7e4d808497d87d5de3ab 100644 (file)
@@ -54,11 +54,12 @@ public:
     virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE;
     virtual WebCore::Locale& locale() OVERRIDE;
     virtual void setValueAndClosePopup(int, const String&) OVERRIDE;
+    virtual void setValue(const String&) OVERRIDE;
+    virtual void closePopup() OVERRIDE;
     virtual void didClosePopup() OVERRIDE;
 
 private:
     void openPopup();
-    void closePopup();
 
     ChromeClientImpl* m_chromeClient;
     WebCore::ColorChooserClient* m_client;
index 7ce5f0a8cf31b37d5bec63832d390fc55b652935..6e5aad21995a30fba67d65975d707f4e7fd18e1f 100644 (file)
@@ -169,7 +169,17 @@ void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stri
 {
     RefPtr<DateTimeChooserImpl> protector(this);
     if (numValue >= 0)
-        m_client->didChooseValue(stringValue);
+        setValue(stringValue);
+    endChooser();
+}
+
+void DateTimeChooserImpl::setValue(const String& value)
+{
+    m_client->didChooseValue(value);
+}
+
+void DateTimeChooserImpl::closePopup()
+{
     endChooser();
 }
 
index 224358623a8aaa5abe13d2c1c812f78af06d4e77..030789362578e77bd8b4126487660daae5cf253e 100644 (file)
@@ -59,6 +59,8 @@ private:
     virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE;
     virtual WebCore::Locale& locale() OVERRIDE;
     virtual void setValueAndClosePopup(int, const String&) OVERRIDE;
+    virtual void setValue(const String&) OVERRIDE;
+    virtual void closePopup() OVERRIDE;
     virtual void didClosePopup() OVERRIDE;
 
     ChromeClientImpl* m_chromeClient;