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 7e045f1..9a7ba0e 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 20e14a8..2dd5f17 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 ded4e7c..8934ae1 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 d5e05b8..7088b77 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 170ecb1..7034329 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 391c8f8..b324cfb 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 dbe7522..1cba6b1 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 19de480..1507a4d 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 03f4728..0aa62d6 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 4909ebe..d537ff1 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 dfc893f..8be0664 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 2e6fbbe..04f0687 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 d73d84e..0b38df0 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 66b20c9..0e21541 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 b1af6fa..3fd92f7 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 b139aee..f90f653 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 ce52915..48f6475 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 6944eae..c49fb95 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 c4d5848..4eaf8f9 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 7ce5f0a..6e5aad2 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 2243586..0307893 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;