Diff
Modified: trunk/LayoutTests/ChangeLog (266062 => 266063)
--- trunk/LayoutTests/ChangeLog 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/LayoutTests/ChangeLog 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1,3 +1,21 @@
+2020-08-24 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Show picker for date and datetime-local input types
+ https://bugs.webkit.org/show_bug.cgi?id=214946
+
+ Reviewed by Darin Adler and Wenson Hsieh.
+
+ Added tests to verify that the picker is correctly shown and hidden for date and
+ datetime-local input types.
+
+ * fast/forms/date/date-show-hide-picker-expected.txt: Added.
+ * fast/forms/date/date-show-hide-picker.html: Added.
+ * fast/forms/datetimelocal/datetimelocal-show-hide-picker-expected.txt: Added.
+ * fast/forms/datetimelocal/datetimelocal-show-hide-picker.html: Added.
+ * platform/ios/TestExpectations:
+ * resources/ui-helper.js:
+ (window.UIHelper.isShowingDateTimePicker):
+
2020-08-24 Hector Lopez <hector_i_lo...@apple.com>
WebGL conformance: Failures and Timeouts in suite 2.0.0/conformance2
Added: trunk/LayoutTests/fast/forms/date/date-show-hide-picker-expected.txt (0 => 266063)
--- trunk/LayoutTests/fast/forms/date/date-show-hide-picker-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/date/date-show-hide-picker-expected.txt 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,5 @@
+
+1. Is showing date picker? true
+2. Is showing date picker? false
+
+This test verifies that a date picker is presented when clicking on a date input.
Added: trunk/LayoutTests/fast/forms/date/date-show-hide-picker.html (0 => 266063)
--- trunk/LayoutTests/fast/forms/date/date-show-hide-picker.html (rev 0)
+++ trunk/LayoutTests/fast/forms/date/date-show-hide-picker.html 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+<script src=""
+<style>
+input {
+ width: 300px;
+ height: 50px;
+}
+
+body {
+ margin: 0;
+}
+</style>
+<head>
+<body _onload_="runTest()">
+<input id="input" type="date"/>
+<pre>1. Is showing date picker? <span id="before"></span></pre>
+<pre>2. Is showing date picker? <span id="after"></span></pre>
+<br>
+<div>This test verifies that a date picker is presented when clicking on a date input.</div>
+</body>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+async function runTest() {
+ await UIHelper.activateAndWaitForInputSessionAt(150, 25);
+
+ before.textContent = await UIHelper.isShowingDateTimePicker();
+ input.blur();
+ after.textContent = await UIHelper.isShowingDateTimePicker();
+
+ testRunner.notifyDone();
+}
+</script>
+</html>
Added: trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-show-hide-picker-expected.txt (0 => 266063)
--- trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-show-hide-picker-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-show-hide-picker-expected.txt 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,5 @@
+
+1. Is showing date picker? true
+2. Is showing date picker? false
+
+This test verifies that a date picker is presented when clicking on a datetime-local input.
Added: trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-show-hide-picker.html (0 => 266063)
--- trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-show-hide-picker.html (rev 0)
+++ trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-show-hide-picker.html 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+<script src=""
+<style>
+input {
+ width: 300px;
+ height: 50px;
+}
+
+body {
+ margin: 0;
+}
+</style>
+<head>
+<body _onload_="runTest()">
+<input id="input" type="datetime-local"/>
+<pre>1. Is showing date picker? <span id="before"></span></pre>
+<pre>2. Is showing date picker? <span id="after"></span></pre>
+<br>
+<div>This test verifies that a date picker is presented when clicking on a datetime-local input.</div>
+</body>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+async function runTest() {
+ await UIHelper.activateAndWaitForInputSessionAt(150, 25);
+
+ before.textContent = await UIHelper.isShowingDateTimePicker();
+ input.blur();
+ after.textContent = await UIHelper.isShowingDateTimePicker();
+
+ testRunner.notifyDone();
+}
+</script>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (266062 => 266063)
--- trunk/LayoutTests/platform/ios/TestExpectations 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2020-08-24 16:25:10 UTC (rev 266063)
@@ -3472,6 +3472,10 @@
fast/text/selection-is-prevent-defaulted.html [ Failure ]
+# FIXME: These tests require UIScriptControllerIOS additions to know when a date/time picker is presented
+fast/forms/date/date-show-hide-picker.html [ Skip ]
+fast/forms/datetimelocal/datetimelocal-show-hide-picker.html [ Skip ]
+
# <rdar://problem/59636115> REGRESSION: [ iOS & macOS ] two imported/w3c/web-platform-tests/WebCryptoAPI are failing
imported/w3c/web-platform-tests/WebCryptoAPI/import_export/rsa_importKey.https.worker.html [ Failure ]
imported/w3c/web-platform-tests/WebCryptoAPI/import_export/test_rsa_importKey.https.html [ Failure ]
Modified: trunk/LayoutTests/resources/ui-helper.js (266062 => 266063)
--- trunk/LayoutTests/resources/ui-helper.js 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/LayoutTests/resources/ui-helper.js 2020-08-24 16:25:10 UTC (rev 266063)
@@ -847,6 +847,15 @@
});
}
+ static isShowingDateTimePicker()
+ {
+ return new Promise(resolve => {
+ testRunner.runUIScript(`(() => {
+ uiController.uiScriptComplete(uiController.isShowingDateTimePicker);
+ })()`, result => resolve(result === "true"));
+ });
+ }
+
static zoomScale()
{
return new Promise(resolve => {
Modified: trunk/Source/WebCore/ChangeLog (266062 => 266063)
--- trunk/Source/WebCore/ChangeLog 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/ChangeLog 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1,3 +1,54 @@
+2020-08-24 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Show picker for date and datetime-local input types
+ https://bugs.webkit.org/show_bug.cgi?id=214946
+
+ Reviewed by Darin Adler and Wenson Hsieh.
+
+ Date and datetime-local input types require a calendar picker to be presented when activated.
+ Consequently, BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent was modified to
+ create a DateTimeChooser and display a calendar upon activation. This object is destroyed
+ when the element is blurred, hiding the calendar.
+
+ There is currently no picker UI for month, week, and time input types. As a result,
+ handleDOMActivateEvent is a no-op on those input types.
+
+ Wrote an encoder and decoder for DateTimeChooserParameters, so that the picker can be
+ created with the correct values.
+
+ Tests: fast/forms/date/date-show-hide-picker.html
+ fast/forms/datetimelocal/datetimelocal-show-hide-picker.html
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/BaseChooserOnlyDateAndTimeInputType.cpp:
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::elementDidBlur):
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::isPresentingAttachedView const):
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
+ * html/BaseChooserOnlyDateAndTimeInputType.h:
+ * html/HTMLInputElement.cpp:
+ * html/MonthInputType.cpp:
+ (WebCore::MonthInputType::handleDOMActivateEvent):
+ * html/MonthInputType.h:
+ * html/TimeInputType.cpp:
+ (WebCore::TimeInputType::handleDOMActivateEvent):
+ * html/TimeInputType.h:
+ * html/WeekInputType.cpp:
+ (WebCore::WeekInputType::handleDOMActivateEvent):
+ * html/WeekInputType.h:
+ * loader/EmptyClients.cpp:
+ (WebCore::EmptyChromeClient::createDateTimeChooser):
+ * loader/EmptyClients.h:
+ * page/Chrome.cpp:
+ (WebCore::Chrome::createDateTimeChooser):
+ * page/Chrome.h:
+ * page/ChromeClient.h:
+ * platform/DateTimeChooser.h:
+ * platform/DateTimeChooserClient.h:
+ * platform/DateTimeChooserParameters.h: Added.
+ (WebCore::DateTimeChooserParameters::encode const):
+ (WebCore::DateTimeChooserParameters::decode):
+
2020-08-24 Zalan Bujtas <za...@apple.com>
[LFC][IFC] Rename LineBox::baseline to alignment baseline
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (266062 => 266063)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1000,8 +1000,8 @@
37C738EB1EDBD384003F2B0B /* PerformanceMeasure.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738EA1EDBD381003F2B0B /* PerformanceMeasure.h */; };
37C738ED1EDBD5BC003F2B0B /* SVGUnknownElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738EC1EDBD5B7003F2B0B /* SVGUnknownElement.h */; };
37C738EF1EDBD71B003F2B0B /* MathMLUnknownElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738EE1EDBD718003F2B0B /* MathMLUnknownElement.h */; };
- 37C738F31EDBDE8A003F2B0B /* DateTimeChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */; };
- 37C738F41EDBDE8D003F2B0B /* DateTimeChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738F21EDBDE87003F2B0B /* DateTimeChooserClient.h */; };
+ 37C738F31EDBDE8A003F2B0B /* DateTimeChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 37C738F41EDBDE8D003F2B0B /* DateTimeChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C738F21EDBDE87003F2B0B /* DateTimeChooserClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
37D456FD1A9A50D8003330A1 /* LocalizableStrings.pm in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */; };
37E3524D12450C6600BAF5D9 /* InputType.h in Headers */ = {isa = PBXBuildFile; fileRef = 37E3524C12450C6600BAF5D9 /* InputType.h */; settings = {ATTRIBUTES = (Private, ); }; };
37F567CE165358F400DDE92B /* PopupOpeningObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3772B09516535856000A49CA /* PopupOpeningObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5080,6 +5080,7 @@
E58B45BA20AD07DD00991025 /* DataListButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E58B45B820AD07DD00991025 /* DataListButtonElement.h */; };
E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = E59DD4B721098285003C8B47 /* ListButtonArrow.png */; };
E5BA7D63151437CA00FE1E3F /* LengthFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E5C59A9A24D0E1AA003B86E1 /* DateTimeChooserParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = E5C59A9924D0E1AA003B86E1 /* DateTimeChooserParameters.h */; settings = {ATTRIBUTES = (Private, ); }; };
E71467B324ABAEF200FB2F50 /* AudioNodeOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B124ABAEF100FB2F50 /* AudioNodeOptions.h */; };
E71467B624ABAF1D00FB2F50 /* PannerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B524ABAF1D00FB2F50 /* PannerOptions.h */; };
E755E89224C7434B009F7C23 /* PeriodicWaveConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = E755E88F24C7434B009F7C23 /* PeriodicWaveConstraints.h */; };
@@ -15924,6 +15925,7 @@
E58B45B820AD07DD00991025 /* DataListButtonElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataListButtonElement.h; sourceTree = "<group>"; };
E59DD4B721098285003C8B47 /* ListButtonArrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ListButtonArrow.png; sourceTree = "<group>"; };
E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthFunctions.h; sourceTree = "<group>"; };
+ E5C59A9924D0E1AA003B86E1 /* DateTimeChooserParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeChooserParameters.h; sourceTree = "<group>"; };
E71467B124ABAEF100FB2F50 /* AudioNodeOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioNodeOptions.h; sourceTree = "<group>"; };
E71467B424ABAF0B00FB2F50 /* AudioNodeOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AudioNodeOptions.idl; sourceTree = "<group>"; };
E71467B524ABAF1D00FB2F50 /* PannerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PannerOptions.h; sourceTree = "<group>"; };
@@ -26690,6 +26692,7 @@
A5732B09136A161D005C8D7C /* DateComponents.h */,
37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */,
37C738F21EDBDE87003F2B0B /* DateTimeChooserClient.h */,
+ E5C59A9924D0E1AA003B86E1 /* DateTimeChooserParameters.h */,
45FEA5CD156DDE8C00654101 /* Decimal.cpp */,
45FEA5CE156DDE8C00654101 /* Decimal.h */,
CD83D35A211110820076E11C /* DeferrableTask.h */,
@@ -30749,6 +30752,7 @@
F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */,
37C738F31EDBDE8A003F2B0B /* DateTimeChooser.h in Headers */,
37C738F41EDBDE8D003F2B0B /* DateTimeChooserClient.h in Headers */,
+ E5C59A9A24D0E1AA003B86E1 /* DateTimeChooserParameters.h in Headers */,
453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */,
F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */,
0F6A12BE1A00923700C6DE72 /* DebugPageOverlays.h in Headers */,
Modified: trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp (266062 => 266063)
--- trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -29,6 +29,8 @@
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+#include "Chrome.h"
+#include "DateTimeChooserParameters.h"
#include "HTMLDivElement.h"
#include "HTMLInputElement.h"
#include "Page.h"
@@ -57,8 +59,24 @@
DateTimeChooserParameters parameters;
if (!element()->setupDateTimeChooserParameters(parameters))
return;
+
+ if (auto chrome = this->chrome()) {
+ m_dateTimeChooser = chrome->createDateTimeChooser(*this);
+ if (m_dateTimeChooser)
+ m_dateTimeChooser->showChooser(parameters);
+ }
}
+void BaseChooserOnlyDateAndTimeInputType::elementDidBlur()
+{
+ closeDateTimeChooser();
+}
+
+bool BaseChooserOnlyDateAndTimeInputType::isPresentingAttachedView() const
+{
+ return !!m_dateTimeChooser;
+}
+
void BaseChooserOnlyDateAndTimeInputType::createShadowSubtree()
{
static MainThreadNeverDestroyed<const AtomString> valueContainerPseudo("-webkit-date-and-time-value", AtomString::ConstructFromLiteral);
@@ -96,10 +114,10 @@
closeDateTimeChooser();
}
-void BaseChooserOnlyDateAndTimeInputType::didChooseValue(const String& value)
+void BaseChooserOnlyDateAndTimeInputType::didChooseValue(StringView value)
{
ASSERT(element());
- element()->setValue(value, DispatchInputAndChangeEvent);
+ element()->setValue(value.toString(), DispatchInputAndChangeEvent);
}
void BaseChooserOnlyDateAndTimeInputType::didEndChooser()
Modified: trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h (266062 => 266063)
--- trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -49,18 +49,20 @@
void detach() override;
void setValue(const String&, bool valueChanged, TextFieldEventBehavior) override;
void handleDOMActivateEvent(Event&) override;
+ void elementDidBlur() final;
ShouldCallBaseEventHandler handleKeydownEvent(KeyboardEvent&) override;
void handleKeypressEvent(KeyboardEvent&) override;
void handleKeyupEvent(KeyboardEvent&) override;
bool accessKeyAction(bool sendMouseEvents) override;
bool isMouseFocusable() const override;
+ bool isPresentingAttachedView() const final;
void attributeChanged(const QualifiedName&) override;
// DateTimeChooserClient functions:
- void didChooseValue(const String&) final;
+ void didChooseValue(StringView) final;
void didEndChooser() final;
- RefPtr<DateTimeChooser> m_dateTimeChooser;
+ std::unique_ptr<DateTimeChooser> m_dateTimeChooser;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (266062 => 266063)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -37,6 +37,7 @@
#include "Chrome.h"
#include "ChromeClient.h"
#include "DateTimeChooser.h"
+#include "DateTimeChooserParameters.h"
#include "Document.h"
#include "Editor.h"
#include "EventNames.h"
Modified: trunk/Source/WebCore/html/MonthInputType.cpp (266062 => 266063)
--- trunk/Source/WebCore/html/MonthInputType.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/MonthInputType.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -129,6 +129,10 @@
return true;
}
+void MonthInputType::handleDOMActivateEvent(Event&)
+{
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/html/MonthInputType.h (266062 => 266063)
--- trunk/Source/WebCore/html/MonthInputType.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/MonthInputType.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -51,6 +51,7 @@
Optional<DateComponents> parseToDateComponents(const StringView&) const override;
Optional<DateComponents> setMillisecondToDateComponents(double) const override;
bool isMonthField() const override;
+ void handleDOMActivateEvent(Event&) override;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/TimeInputType.cpp (266062 => 266063)
--- trunk/Source/WebCore/html/TimeInputType.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/TimeInputType.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -104,6 +104,10 @@
return true;
}
+void TimeInputType::handleDOMActivateEvent(Event&)
+{
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/html/TimeInputType.h (266062 => 266063)
--- trunk/Source/WebCore/html/TimeInputType.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/TimeInputType.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -48,6 +48,7 @@
Optional<DateComponents> parseToDateComponents(const StringView&) const override;
Optional<DateComponents> setMillisecondToDateComponents(double) const override;
bool isTimeField() const override;
+ void handleDOMActivateEvent(Event&) override;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/WeekInputType.cpp (266062 => 266063)
--- trunk/Source/WebCore/html/WeekInputType.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/WeekInputType.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -82,6 +82,10 @@
return true;
}
+void WeekInputType::handleDOMActivateEvent(Event&)
+{
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/html/WeekInputType.h (266062 => 266063)
--- trunk/Source/WebCore/html/WeekInputType.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/html/WeekInputType.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -47,6 +47,7 @@
Optional<DateComponents> parseToDateComponents(const StringView&) const override;
Optional<DateComponents> setMillisecondToDateComponents(double) const override;
bool isWeekField() const override;
+ void handleDOMActivateEvent(Event&) override;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (266062 => 266063)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -491,6 +491,15 @@
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+std::unique_ptr<DateTimeChooser> EmptyChromeClient::createDateTimeChooser(DateTimeChooserClient&)
+{
+ return nullptr;
+}
+
+#endif
+
void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&)
{
}
Modified: trunk/Source/WebCore/loader/EmptyClients.h (266062 => 266063)
--- trunk/Source/WebCore/loader/EmptyClients.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -136,6 +136,10 @@
bool canShowDataListSuggestionLabels() const final { return false; }
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ std::unique_ptr<DateTimeChooser> createDateTimeChooser(DateTimeChooserClient&) final;
+#endif
+
void runOpenPanel(Frame&, FileChooser&) final;
void showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) final;
void loadIconForFiles(const Vector<String>&, FileIconLoader&) final { }
Modified: trunk/Source/WebCore/page/Chrome.cpp (266062 => 266063)
--- trunk/Source/WebCore/page/Chrome.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/page/Chrome.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -61,6 +61,10 @@
#include "DataListSuggestionPicker.h"
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+#include "DateTimeChooser.h"
+#endif
+
#if PLATFORM(MAC) && ENABLE(GRAPHICS_CONTEXT_GL)
#include "GraphicsContextGLOpenGLManager.h"
#endif
@@ -442,6 +446,21 @@
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+std::unique_ptr<DateTimeChooser> Chrome::createDateTimeChooser(DateTimeChooserClient& client)
+{
+#if PLATFORM(IOS_FAMILY)
+ UNUSED_PARAM(client);
+ return nullptr;
+#else
+ notifyPopupOpeningObservers();
+ return m_client.createDateTimeChooser(client);
+#endif
+}
+
+#endif
+
void Chrome::runOpenPanel(Frame& frame, FileChooser& fileChooser)
{
notifyPopupOpeningObservers();
Modified: trunk/Source/WebCore/page/Chrome.h (266062 => 266063)
--- trunk/Source/WebCore/page/Chrome.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/page/Chrome.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -157,6 +157,10 @@
std::unique_ptr<DataListSuggestionPicker> createDataListSuggestionPicker(DataListSuggestionsClient&);
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ std::unique_ptr<DateTimeChooser> createDateTimeChooser(DateTimeChooserClient&);
+#endif
+
void runOpenPanel(Frame&, FileChooser&);
void showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&);
void loadIconForFiles(const Vector<String>&, FileIconLoader&);
Modified: trunk/Source/WebCore/page/ChromeClient.h (266062 => 266063)
--- trunk/Source/WebCore/page/ChromeClient.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/page/ChromeClient.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -289,6 +289,10 @@
virtual bool canShowDataListSuggestionLabels() const = 0;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ virtual std::unique_ptr<DateTimeChooser> createDateTimeChooser(DateTimeChooserClient&) = 0;
+#endif
+
virtual void runOpenPanel(Frame&, FileChooser&) = 0;
virtual void showShareSheet(ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback) { callback(false); }
Modified: trunk/Source/WebCore/platform/DateTimeChooser.h (266062 => 266063)
--- trunk/Source/WebCore/platform/DateTimeChooser.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/platform/DateTimeChooser.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -28,43 +28,23 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DateTimeChooser_h
-#define DateTimeChooser_h
+#pragma once
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
-#include "IntRect.h"
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include <wtf/WeakPtr.h>
namespace WebCore {
-struct DateTimeChooserParameters {
- AtomString type;
- IntRect anchorRectInRootView;
- // Locale name for which the chooser should be localized. This
- // might be an invalid name because it comes from HTML lang
- // attributes.
- AtomString locale;
- String currentValue;
- Vector<String> suggestionValues;
- Vector<String> localizedSuggestionValues;
- Vector<String> suggestionLabels;
- double minimum;
- double maximum;
- double step;
- double stepBase;
- bool required;
- bool isAnchorElementRTL;
-};
+struct DateTimeChooserParameters;
-// For pickers like color pickers and date pickers.
-class DateTimeChooser : public RefCounted<DateTimeChooser> {
+class DateTimeChooser : public CanMakeWeakPtr<DateTimeChooser> {
+ WTF_MAKE_FAST_ALLOCATED;
public:
virtual ~DateTimeChooser() = default;
virtual void endChooser() = 0;
+ virtual void showChooser(const DateTimeChooserParameters&) = 0;
};
} // namespace WebCore
#endif
-#endif // DateTimeChooser_h
Modified: trunk/Source/WebCore/platform/DateTimeChooserClient.h (266062 => 266063)
--- trunk/Source/WebCore/platform/DateTimeChooserClient.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebCore/platform/DateTimeChooserClient.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -28,10 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DateTimeChooserClient_h
-#define DateTimeChooserClient_h
+#pragma once
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
namespace WebCore {
class DateTimeChooserClient {
@@ -39,11 +39,11 @@
virtual ~DateTimeChooserClient() = default;
// Called when user picked a value.
- virtual void didChooseValue(const String&) = 0;
+ virtual void didChooseValue(StringView) = 0;
// Called when chooser has ended.
virtual void didEndChooser() = 0;
};
} // namespace WebCore
-#endif
-#endif // DateTimeChooserClient_h
+
+#endif // ENABLE(DATE_AND_TIME_INPUT_TYPES)
Added: trunk/Source/WebCore/platform/DateTimeChooserParameters.h (0 => 266063)
--- trunk/Source/WebCore/platform/DateTimeChooserParameters.h (rev 0)
+++ trunk/Source/WebCore/platform/DateTimeChooserParameters.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+#include "IntRect.h"
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct DateTimeChooserParameters {
+ AtomString type;
+ IntRect anchorRectInRootView;
+ // Locale name for which the chooser should be localized.
+ // This might be an invalid name because it comes from HTML lang attributes.
+ AtomString locale;
+ String currentValue;
+ Vector<String> suggestionValues;
+ Vector<String> localizedSuggestionValues;
+ Vector<String> suggestionLabels;
+ double minimum;
+ double maximum;
+ double step;
+ double stepBase;
+ bool required;
+ bool isAnchorElementRTL;
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<DateTimeChooserParameters> decode(Decoder&);
+};
+
+template<class Encoder>
+void DateTimeChooserParameters::encode(Encoder& encoder) const
+{
+ encoder << type;
+ encoder << anchorRectInRootView;
+ encoder << locale;
+ encoder << currentValue;
+ encoder << suggestionValues;
+ encoder << localizedSuggestionValues;
+ encoder << suggestionLabels;
+ encoder << minimum;
+ encoder << maximum;
+ encoder << step;
+ encoder << stepBase;
+ encoder << required;
+ encoder << isAnchorElementRTL;
+}
+
+template<class Decoder>
+Optional<DateTimeChooserParameters> DateTimeChooserParameters::decode(Decoder& decoder)
+{
+ AtomString type;
+ if (!decoder.decode(type))
+ return WTF::nullopt;
+
+ IntRect anchorRectInRootView;
+ if (!decoder.decode(anchorRectInRootView))
+ return WTF::nullopt;
+
+ AtomString locale;
+ if (!decoder.decode(locale))
+ return WTF::nullopt;
+
+ String currentValue;
+ if (!decoder.decode(currentValue))
+ return WTF::nullopt;
+
+ Vector<String> suggestionValues;
+ if (!decoder.decode(suggestionValues))
+ return WTF::nullopt;
+
+ Vector<String> localizedSuggestionValues;
+ if (!decoder.decode(localizedSuggestionValues))
+ return WTF::nullopt;
+
+ Vector<String> suggestionLabels;
+ if (!decoder.decode(suggestionLabels))
+ return WTF::nullopt;
+
+ double minimum;
+ if (!decoder.decode(minimum))
+ return WTF::nullopt;
+
+ double maximum;
+ if (!decoder.decode(maximum))
+ return WTF::nullopt;
+
+ double step;
+ if (!decoder.decode(step))
+ return WTF::nullopt;
+
+ double stepBase;
+ if (!decoder.decode(stepBase))
+ return WTF::nullopt;
+
+ bool required;
+ if (!decoder.decode(required))
+ return WTF::nullopt;
+
+ bool isAnchorElementRTL;
+ if (!decoder.decode(isAnchorElementRTL))
+ return WTF::nullopt;
+
+ return {{ WTFMove(type), anchorRectInRootView, WTFMove(locale), WTFMove(currentValue), WTFMove(suggestionValues), WTFMove(localizedSuggestionValues), WTFMove(suggestionLabels), minimum, maximum, step, stepBase, required, isAnchorElementRTL }};
+}
+
+} // namespace WebCore
+
+#endif
Modified: trunk/Source/WebKit/ChangeLog (266062 => 266063)
--- trunk/Source/WebKit/ChangeLog 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/ChangeLog 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1,3 +1,77 @@
+2020-08-24 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Show picker for date and datetime-local input types
+ https://bugs.webkit.org/show_bug.cgi?id=214946
+
+ Reviewed by Darin Adler and Wenson Hsieh.
+
+ Created WKDateTimePicker as a wrapper around NSDatePicker. The picker is
+ displayed in its own NSWindow, ensuring the view is always above the page.
+ WebPageProxy and WKDateTimePicker communicate through WebDateTimePickerMac,
+ in order for the picker to be initialized with the correct initial, minimum,
+ and maximum date, and so that the chosen date can be sent back to the
+ WebProcess.
+
+ Added IPC messages to enable communication between the UIProcess and the
+ WebProcess necessary for showing and hiding the picker.
+
+ * Sources.txt:
+ * SourcesCocoa.txt:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebDateTimePicker.cpp: Added.
+ (WebKit::WebDateTimePicker::WebDateTimePicker):
+ (WebKit::WebDateTimePicker::~WebDateTimePicker):
+ (WebKit::WebDateTimePicker::endPicker):
+ * UIProcess/WebDateTimePicker.h: Added.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::showDateTimePicker):
+ (WebKit::WebPageProxy::endDateTimePicker):
+ (WebKit::WebPageProxy::didChooseDate):
+ (WebKit::WebPageProxy::didEndDateTimePicker):
+ (WebKit::WebPageProxy::closeOverlayedViews):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::createDateTimePicker):
+ * UIProcess/mac/PageClientImplMac.h:
+ * UIProcess/mac/PageClientImplMac.mm:
+ (WebKit::PageClientImpl::createDateTimePicker):
+ * UIProcess/mac/WebDateTimePickerMac.h: Added.
+ * UIProcess/mac/WebDateTimePickerMac.mm: Added.
+ (WebKit::WebDateTimePickerMac::create):
+ (WebKit::WebDateTimePickerMac::~WebDateTimePickerMac):
+ (WebKit::WebDateTimePickerMac::WebDateTimePickerMac):
+ (WebKit::WebDateTimePickerMac::endPicker):
+ (WebKit::WebDateTimePickerMac::showDateTimePicker):
+ (WebKit::WebDateTimePickerMac::didChooseDate):
+ (-[WKDateTimePickerWindow initWithContentRect:styleMask:backing:defer:]):
+ (-[WKDateTimePickerWindow canBecomeKeyWindow]):
+ (-[WKDateTimePickerWindow hasKeyAppearance]):
+ (-[WKDateTimePickerWindow shadowOptions]):
+ (-[WKDateTimePicker initWithParams:inView:]):
+ (-[WKDateTimePicker showPicker:]):
+ (-[WKDateTimePicker invalidate]):
+ (-[WKDateTimePicker didChooseDate:]):
+ (-[WKDateTimePicker dateFormatStringForType:]):
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::createDateTimeChooser):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebCoreSupport/WebDateTimeChooser.cpp: Added.
+ (WebKit::WebDateTimeChooser::WebDateTimeChooser):
+ (WebKit::WebDateTimeChooser::didChooseDate):
+ (WebKit::WebDateTimeChooser::didEndChooser):
+ (WebKit::WebDateTimeChooser::endChooser):
+ (WebKit::WebDateTimeChooser::showChooser):
+ * WebProcess/WebCoreSupport/WebDateTimeChooser.h: Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setActiveDateTimeChooser):
+ (WebKit::WebPage::didChooseDate):
+ (WebKit::WebPage::didEndDateTimePicker):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2020-08-24 Adrian Perez de Castro <ape...@igalia.com>
Non-unified build fixes, late August 2020 edition
Modified: trunk/Source/WebKit/Sources.txt (266062 => 266063)
--- trunk/Source/WebKit/Sources.txt 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/Sources.txt 2020-08-24 16:25:10 UTC (rev 266063)
@@ -307,6 +307,7 @@
UIProcess/WebCookieManagerProxy.cpp
UIProcess/WebCookieManagerProxyClient.cpp
UIProcess/WebDataListSuggestionsDropdown.cpp
+UIProcess/WebDateTimePicker.cpp
UIProcess/WebEditCommandProxy.cpp
UIProcess/WebFormClient.cpp
UIProcess/WebFormSubmissionListenerProxy.cpp
@@ -632,6 +633,7 @@
WebProcess/WebCoreSupport/WebColorChooser.cpp
WebProcess/WebCoreSupport/WebContextMenuClient.cpp
WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp
+WebProcess/WebCoreSupport/WebDateTimeChooser.cpp
WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp
WebProcess/WebCoreSupport/WebDragClient.cpp
WebProcess/WebCoreSupport/WebEditorClient.cpp
Modified: trunk/Source/WebKit/SourcesCocoa.txt (266062 => 266063)
--- trunk/Source/WebKit/SourcesCocoa.txt 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2020-08-24 16:25:10 UTC (rev 266063)
@@ -495,6 +495,7 @@
UIProcess/mac/WebContextMenuProxyMac.mm
UIProcess/mac/WebCookieManagerProxyMac.mm
UIProcess/mac/WebDataListSuggestionsDropdownMac.mm
+UIProcess/mac/WebDateTimePickerMac.mm
UIProcess/mac/WebPageProxyMac.mm
UIProcess/mac/WebPopupMenuProxyMac.mm
UIProcess/mac/WebProcessProxyMac.mm
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -30,6 +30,7 @@
#include "ShareableBitmap.h"
#include "WebColorPicker.h"
#include "WebDataListSuggestionsDropdown.h"
+#include "WebDateTimePicker.h"
#include "WebPopupMenuProxy.h"
#include <WebCore/ActivityState.h>
#include <WebCore/AlternativeTextClient.h>
@@ -158,6 +159,10 @@
class WebDataListSuggestionsDropdown;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+class WebDateTimePicker;
+#endif
+
#if ENABLE(FULLSCREEN_API)
class WebFullScreenManagerProxyClient;
#endif
@@ -338,6 +343,10 @@
virtual RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) = 0;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ virtual RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) = 0;
+#endif
+
#if PLATFORM(COCOA)
virtual Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) = 0;
#endif
Added: trunk/Source/WebKit/UIProcess/WebDateTimePicker.cpp (0 => 266063)
--- trunk/Source/WebKit/UIProcess/WebDateTimePicker.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebDateTimePicker.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebDateTimePicker.h"
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+#include "WebPageProxy.h"
+
+namespace WebKit {
+
+WebDateTimePicker::WebDateTimePicker(WebPageProxy& page)
+ : m_page(makeWeakPtr(page))
+{
+}
+
+WebDateTimePicker::~WebDateTimePicker()
+{
+}
+
+void WebDateTimePicker::endPicker()
+{
+ if (auto page = std::exchange(m_page, nullptr))
+ page->didEndDateTimePicker();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DATE_AND_TIME_INPUT_TYPES)
Added: trunk/Source/WebKit/UIProcess/WebDateTimePicker.h (0 => 266063)
--- trunk/Source/WebKit/UIProcess/WebDateTimePicker.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebDateTimePicker.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+#include <wtf/RefCounted.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+struct DateTimeChooserParameters;
+}
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebDateTimePicker : public RefCounted<WebDateTimePicker>, public CanMakeWeakPtr<WebDateTimePicker> {
+public:
+ virtual ~WebDateTimePicker();
+
+ virtual void endPicker();
+ virtual void showDateTimePicker(WebCore::DateTimeChooserParameters&&) = 0;
+
+protected:
+ explicit WebDateTimePicker(WebPageProxy&);
+
+ WeakPtr<WebPageProxy> m_page;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DATE_AND_TIME_INPUT_TYPES)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -294,6 +294,10 @@
#include "DefaultWebBrowserChecks.h"
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+#include "WebDateTimePicker.h"
+#endif
+
// This controls what strategy we use for mouse wheel coalescing.
#define MERGE_WHEEL_EVENTS 1
@@ -6175,6 +6179,43 @@
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+void WebPageProxy::showDateTimePicker(WebCore::DateTimeChooserParameters&& params)
+{
+ if (!m_dateTimePicker)
+ m_dateTimePicker = pageClient().createDateTimePicker(*this);
+
+ m_dateTimePicker->showDateTimePicker(WTFMove(params));
+}
+
+void WebPageProxy::endDateTimePicker()
+{
+ if (!m_dateTimePicker)
+ return;
+
+ m_dateTimePicker->endPicker();
+}
+
+void WebPageProxy::didChooseDate(StringView date)
+{
+ if (!hasRunningProcess())
+ return;
+
+ send(Messages::WebPage::DidChooseDate(date.toString()));
+}
+
+void WebPageProxy::didEndDateTimePicker()
+{
+ m_dateTimePicker = nullptr;
+ if (!hasRunningProcess())
+ return;
+
+ send(Messages::WebPage::DidEndDateTimePicker());
+}
+
+#endif
+
WebInspectorProxy* WebPageProxy::inspector() const
{
if (isClosed())
@@ -9361,6 +9402,10 @@
#if ENABLE(INPUT_TYPE_COLOR)
endColorPicker();
#endif
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ endDateTimePicker();
+#endif
}
#if ENABLE(POINTER_LOCK)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -250,6 +250,7 @@
struct CompositionHighlight;
struct ContentRuleListResults;
struct DataListSuggestionInformation;
+struct DateTimeChooserParameters;
struct DictionaryPopupInfo;
struct DragItem;
struct ElementContext;
@@ -418,6 +419,10 @@
typedef GenericCallback<bool, bool, String, double, double, uint64_t> NowPlayingInfoCallback;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+class WebDateTimePicker;
+#endif
+
using SpellDocumentTag = int64_t;
class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
@@ -1647,6 +1652,11 @@
void didCloseSuggestions();
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ void didChooseDate(StringView);
+ void didEndDateTimePicker();
+#endif
+
void updateCurrentModifierState();
#if HAVE(PENCILKIT)
@@ -2001,6 +2011,11 @@
void endDataListSuggestions();
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ void showDateTimePicker(WebCore::DateTimeChooserParameters&&);
+ void endDateTimePicker();
+#endif
+
void closeOverlayedViews();
void compositionWasCanceled();
@@ -2601,6 +2616,9 @@
#if ENABLE(DATALIST_ELEMENT)
RefPtr<WebDataListSuggestionsDropdown> m_dataListSuggestionsDropdown;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ RefPtr<WebDateTimePicker> m_dateTimePicker;
+#endif
#if PLATFORM(COCOA)
RefPtr<WebCore::ValidationBubble> m_validationBubble;
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-08-24 16:25:10 UTC (rev 266063)
@@ -98,6 +98,11 @@
EndDataListSuggestions();
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ ShowDateTimePicker(struct WebCore::DateTimeChooserParameters params);
+ EndDateTimePicker();
+#endif
+
# Policy messages
DecidePolicyForResponse(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::PolicyCheckIdentifier policyCheckIdentifier, uint64_t navigationID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, String downloadAttribute, uint64_t listenerID, WebKit::UserData userData)
DecidePolicyForNavigationActionAsync(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::PolicyCheckIdentifier policyCheckIdentifier, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, Optional<WebKit::WebPageProxyIdentifier> originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, IPC::FormDataReference requestBody, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData, uint64_t listenerID)
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -124,6 +124,10 @@
RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) final;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) final;
+#endif
+
void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;
void setTextIndicatorAnimationProgress(float) override;
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2020-08-24 16:25:10 UTC (rev 266063)
@@ -849,6 +849,13 @@
}
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+RefPtr<WebDateTimePicker> PageClientImpl::createDateTimePicker(WebPageProxy&)
+{
+ return nullptr;
+}
+#endif
+
#if ENABLE(DRAG_SUPPORT)
void PageClientImpl::didPerformDragOperation(bool handled)
{
Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -143,6 +143,10 @@
RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) override;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) override;
+#endif
+
Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (266062 => 266063)
--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm 2020-08-24 16:25:10 UTC (rev 266063)
@@ -52,6 +52,7 @@
#import "WebColorPickerMac.h"
#import "WebContextMenuProxyMac.h"
#import "WebDataListSuggestionsDropdownMac.h"
+#import "WebDateTimePickerMac.h"
#import "WebEditCommandProxy.h"
#import "WebPageProxy.h"
#import "WebPopupMenuProxyMac.h"
@@ -476,6 +477,13 @@
}
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+RefPtr<WebDateTimePicker> PageClientImpl::createDateTimePicker(WebPageProxy& page)
+{
+ return WebDateTimePickerMac::create(page, m_view);
+}
+#endif
+
Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message, const ValidationBubble::Settings& settings)
{
return ValidationBubble::create(m_view, message, settings);
Added: trunk/Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h (0 => 266063)
--- trunk/Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES) && USE(APPKIT)
+
+#import "WebDateTimePicker.h"
+#import <WebCore/DateTimeChooserParameters.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/WeakObjCPtr.h>
+#import <wtf/text/StringView.h>
+
+@class WKDateTimePicker;
+
+namespace WebKit {
+
+class WebDateTimePickerMac final : public WebDateTimePicker {
+public:
+ static Ref<WebDateTimePickerMac> create(WebPageProxy&, NSView *);
+ ~WebDateTimePickerMac();
+
+ void didChooseDate(StringView);
+
+private:
+ WebDateTimePickerMac(WebPageProxy&, NSView *);
+
+ void endPicker() final;
+ void showDateTimePicker(WebCore::DateTimeChooserParameters&&) final;
+
+ WeakObjCPtr<NSView> m_view;
+ RetainPtr<WKDateTimePicker> m_picker;
+ WebCore::DateTimeChooserParameters m_params;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DATE_AND_TIME_INPUT_TYPES) && USE(APPKIT)
Added: trunk/Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm (0 => 266063)
--- trunk/Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,233 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebDateTimePickerMac.h"
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES) && USE(APPKIT)
+
+#import "AppKitSPI.h"
+#import "WebPageProxy.h"
+
+constexpr CGFloat kCalendarWidth = 139;
+constexpr CGFloat kCalendarHeight = 148;
+constexpr NSString * kDateFormatString = @"yyyy-MM-dd";
+constexpr NSString * kDateTimeFormatString = @"yyyy-MM-dd'T'HH:mm";
+constexpr NSString * kDefaultLocaleIdentifier = @"en_US_POSIX";
+
+@interface WKDateTimePicker : NSObject
+
+- (id)initWithParams:(WebCore::DateTimeChooserParameters&&)params inView:(NSView *)view;
+- (void)showPicker:(WebKit::WebDateTimePickerMac&)picker;
+- (void)invalidate;
+
+@end
+
+@interface WKDateTimePickerWindow : NSWindow
+@end
+
+namespace WebKit {
+
+Ref<WebDateTimePickerMac> WebDateTimePickerMac::create(WebPageProxy& page, NSView *view)
+{
+ return adoptRef(*new WebDateTimePickerMac(page, view));
+}
+
+WebDateTimePickerMac::~WebDateTimePickerMac()
+{
+ [m_picker invalidate];
+}
+
+WebDateTimePickerMac::WebDateTimePickerMac(WebPageProxy& page, NSView *view)
+ : WebDateTimePicker(page)
+ , m_view(view)
+{
+}
+
+void WebDateTimePickerMac::endPicker()
+{
+ [m_picker invalidate];
+ m_picker = nil;
+ WebDateTimePicker::endPicker();
+}
+
+void WebDateTimePickerMac::showDateTimePicker(WebCore::DateTimeChooserParameters&& params)
+{
+ if (m_picker)
+ return;
+
+ m_picker = adoptNS([[WKDateTimePicker alloc] initWithParams:WTFMove(params) inView:m_view.get().get()]);
+ [m_picker showPicker:*this];
+}
+
+void WebDateTimePickerMac::didChooseDate(StringView date)
+{
+ if (!m_page)
+ return;
+
+ m_page->didChooseDate(date);
+ endPicker();
+}
+
+} // namespace WebKit
+
+// FIXME: Share this implementation with WKDataListSuggestionWindow.
+@implementation WKDateTimePickerWindow {
+ RetainPtr<NSVisualEffectView> _backdropView;
+}
+
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingStoreType defer:(BOOL)defer
+{
+ self = [super initWithContentRect:contentRect styleMask:styleMask backing:backingStoreType defer:defer];
+ if (!self)
+ return nil;
+
+ self.hasShadow = YES;
+ self.releasedWhenClosed = NO;
+ self.titleVisibility = NSWindowTitleHidden;
+ self.titlebarAppearsTransparent = YES;
+ self.movable = NO;
+ self.backgroundColor = [NSColor clearColor];
+ self.opaque = NO;
+
+ _backdropView = adoptNS([[NSVisualEffectView alloc] initWithFrame:contentRect]);
+ [_backdropView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ [_backdropView setMaterial:NSVisualEffectMaterialMenu];
+ [_backdropView setState:NSVisualEffectStateActive];
+ [_backdropView setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
+
+ [self setContentView:_backdropView.get()];
+
+ return self;
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return NO;
+}
+
+- (BOOL)hasKeyAppearance
+{
+ return YES;
+}
+
+- (NSWindowShadowOptions)shadowOptions
+{
+ return NSWindowShadowSecondaryWindow;
+}
+
+@end
+
+@implementation WKDateTimePicker {
+ WeakPtr<WebKit::WebDateTimePickerMac> _picker;
+ WebCore::DateTimeChooserParameters _params;
+ WeakObjCPtr<NSView> _presentingView;
+
+ RetainPtr<WKDateTimePickerWindow> _enclosingWindow;
+ RetainPtr<NSDatePicker> _datePicker;
+ RetainPtr<NSDateFormatter> _dateFormatter;
+}
+
+- (id)initWithParams:(WebCore::DateTimeChooserParameters&&)params inView:(NSView *)view
+{
+ if (!(self = [super init]))
+ return self;
+
+ _presentingView = view;
+ _params = WTFMove(params);
+
+ NSRect windowRect = [[_presentingView window] convertRectToScreen:[_presentingView convertRect:_params.anchorRectInRootView toView:nil]];
+ windowRect.origin.y = NSMinY(windowRect) - kCalendarHeight;
+ windowRect.size.width = kCalendarWidth;
+ windowRect.size.height = kCalendarHeight;
+
+ _enclosingWindow = adoptNS([[WKDateTimePickerWindow alloc] initWithContentRect:NSZeroRect styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView) backing:NSBackingStoreBuffered defer:NO]);
+ [_enclosingWindow setFrame:windowRect display:YES];
+
+ _datePicker = adoptNS([[NSDatePicker alloc] initWithFrame:[_enclosingWindow contentView].bounds]);
+ [_datePicker setDatePickerStyle:NSDatePickerStyleClockAndCalendar];
+ [_datePicker setDatePickerElements:NSDatePickerElementFlagYearMonthDay];
+ [_datePicker setTarget:self];
+ [_datePicker setAction:@selector(didChooseDate:)];
+
+ auto englishLocale = adoptNS([[NSLocale alloc] initWithLocaleIdentifier:kDefaultLocaleIdentifier]);
+ _dateFormatter = adoptNS([[NSDateFormatter alloc] init]);
+ [_dateFormatter setDateFormat:[self dateFormatStringForType:_params.type]];
+ [_dateFormatter setLocale:englishLocale.get()];
+
+ NSString *currentDateValueString = _params.currentValue;
+ if (![currentDateValueString length])
+ [_datePicker setDateValue:[NSDate date]];
+ else
+ [_datePicker setDateValue:[_dateFormatter dateFromString:currentDateValueString]];
+
+ [_datePicker setMinDate:[NSDate dateWithTimeIntervalSince1970:_params.minimum / 1000.0]];
+ [_datePicker setMaxDate:[NSDate dateWithTimeIntervalSince1970:_params.maximum / 1000.0]];
+
+ return self;
+}
+
+- (void)showPicker:(WebKit::WebDateTimePickerMac&)picker
+{
+ _picker = makeWeakPtr(picker);
+
+ [[_enclosingWindow contentView] addSubview:_datePicker.get()];
+ [[_presentingView window] addChildWindow:_enclosingWindow.get() ordered:NSWindowAbove];
+}
+
+- (void)invalidate
+{
+ [_datePicker removeFromSuperviewWithoutNeedingDisplay];
+ [_datePicker setTarget:nil];
+ [_datePicker setAction:nil];
+ _datePicker = nil;
+
+ _dateFormatter = nil;
+
+ [[_presentingView window] removeChildWindow:_enclosingWindow.get()];
+ [_enclosingWindow close];
+ _enclosingWindow = nil;
+}
+
+- (void)didChooseDate:(id)sender
+{
+ if (sender != _datePicker)
+ return;
+
+ String dateString = [_dateFormatter stringFromDate:[_datePicker dateValue]];
+ _picker->didChooseDate(StringView(dateString));
+}
+
+- (NSString *)dateFormatStringForType:(NSString *)type
+{
+ if ([type isEqualToString:@"datetime-local"])
+ return kDateTimeFormatString;
+
+ return kDateFormatString;
+}
+
+@end
+
+#endif // ENABLE(DATE_AND_TIME_INPUT_TYPES) && USE(APPKIT)
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (266062 => 266063)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1835,6 +1835,9 @@
E4E864931B16750700C82F40 /* VersionChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E8648E1B1673FB00C82F40 /* VersionChecks.h */; };
E52CF55220A35C3A00DADA27 /* WebDataListSuggestionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */; };
E548EBD121015F0E00BE3C32 /* WKFormColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */; };
+ E55CD1F524CF747D0042DB9C /* WebDateTimeChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */; };
+ E55CD20024D08D8F0042DB9C /* WebDateTimePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD1FC24D0880B0042DB9C /* WebDateTimePicker.h */; };
+ E55CD20324D09F1F0042DB9C /* WebDateTimePickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */; };
E568B91F20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */; };
E568B92220A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */; };
E5BEF6822130C48000F31111 /* WebDataListSuggestionsDropdownIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E5BEF6802130C47F00F31111 /* WebDataListSuggestionsDropdownIOS.h */; };
@@ -5365,6 +5368,12 @@
E548EBCF21015F0E00BE3C32 /* WKFormColorPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFormColorPicker.h; path = ios/forms/WKFormColorPicker.h; sourceTree = "<group>"; };
E548EBD021015F0E00BE3C32 /* WKFormColorPicker.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormColorPicker.mm; path = ios/forms/WKFormColorPicker.mm; sourceTree = "<group>"; };
E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDataListSuggestionsDropdown.cpp; sourceTree = "<group>"; };
+ E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDateTimeChooser.h; sourceTree = "<group>"; };
+ E55CD1F424CF747D0042DB9C /* WebDateTimeChooser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDateTimeChooser.cpp; sourceTree = "<group>"; };
+ E55CD1FC24D0880B0042DB9C /* WebDateTimePicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDateTimePicker.h; sourceTree = "<group>"; };
+ E55CD1FD24D0880B0042DB9C /* WebDateTimePicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebDateTimePicker.cpp; sourceTree = "<group>"; };
+ E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDateTimePickerMac.h; sourceTree = "<group>"; };
+ E55CD20224D09F1F0042DB9C /* WebDateTimePickerMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDateTimePickerMac.mm; sourceTree = "<group>"; };
E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdown.h; sourceTree = "<group>"; };
E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebDataListSuggestionsDropdownMac.h; sourceTree = "<group>"; };
E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = WebDataListSuggestionsDropdownMac.mm; sourceTree = "<group>"; };
@@ -8836,6 +8845,8 @@
BC032D6210F4378D0058C15A /* WebContextMenuClient.h */,
E52CF55120A35C3A00DADA27 /* WebDataListSuggestionPicker.cpp */,
E52CF55020A35C3A00DADA27 /* WebDataListSuggestionPicker.h */,
+ E55CD1F424CF747D0042DB9C /* WebDateTimeChooser.cpp */,
+ E55CD1F324CF747D0042DB9C /* WebDateTimeChooser.h */,
CD19A2691A13E820008D650E /* WebDiagnosticLoggingClient.cpp */,
CD19A26A1A13E821008D650E /* WebDiagnosticLoggingClient.h */,
BC111A56112F4FBB00337BAB /* WebDragClient.cpp */,
@@ -9052,6 +9063,8 @@
33AA1065131F060000D4A575 /* WebCookieManagerProxyClient.h */,
E54A14CE20FCFB7B007E13D8 /* WebDataListSuggestionsDropdown.cpp */,
E568B91E20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h */,
+ E55CD1FD24D0880B0042DB9C /* WebDateTimePicker.cpp */,
+ E55CD1FC24D0880B0042DB9C /* WebDateTimePicker.h */,
BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */,
BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */,
BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */,
@@ -9846,6 +9859,8 @@
F6D632BA133D181B00743D77 /* WebCookieManagerProxyMac.mm */,
E568B92020A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h */,
E568B92120A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.mm */,
+ E55CD20124D09F1F0042DB9C /* WebDateTimePickerMac.h */,
+ E55CD20224D09F1F0042DB9C /* WebDateTimePickerMac.mm */,
BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */,
BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */,
BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */,
@@ -11281,6 +11296,9 @@
E568B91F20A3AB2F00E3C856 /* WebDataListSuggestionsDropdown.h in Headers */,
E5BEF6822130C48000F31111 /* WebDataListSuggestionsDropdownIOS.h in Headers */,
E568B92220A3AC6A00E3C856 /* WebDataListSuggestionsDropdownMac.h in Headers */,
+ E55CD1F524CF747D0042DB9C /* WebDateTimeChooser.h in Headers */,
+ E55CD20024D08D8F0042DB9C /* WebDateTimePicker.h in Headers */,
+ E55CD20324D09F1F0042DB9C /* WebDateTimePickerMac.h in Headers */,
46B0524722668D8500265B97 /* WebDeviceOrientationAndMotionAccessController.h in Headers */,
E39628DD23960CC600658ECD /* WebDeviceOrientationUpdateProvider.h in Headers */,
E3866B0A2399A2D900F88FE9 /* WebDeviceOrientationUpdateProviderMessages.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (266062 => 266063)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -44,6 +44,7 @@
#include "WebColorChooser.h"
#include "WebCoreArgumentCoders.h"
#include "WebDataListSuggestionPicker.h"
+#include "WebDateTimeChooser.h"
#include "WebFrame.h"
#include "WebFrameLoaderClient.h"
#include "WebFullScreenManager.h"
@@ -775,6 +776,15 @@
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+std::unique_ptr<DateTimeChooser> WebChromeClient::createDateTimeChooser(DateTimeChooserClient& client)
+{
+ return makeUnique<WebDateTimeChooser>(m_page, client);
+}
+
+#endif
+
void WebChromeClient::runOpenPanel(Frame& frame, FileChooser& fileChooser)
{
if (m_page.activeOpenPanelResultListener())
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (266062 => 266063)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -152,6 +152,10 @@
bool canShowDataListSuggestionLabels() const final;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ std::unique_ptr<WebCore::DateTimeChooser> createDateTimeChooser(WebCore::DateTimeChooserClient&) final;
+#endif
+
#if ENABLE(IOS_TOUCH_EVENTS)
void didPreventDefaultForEvent() final;
#endif
Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.cpp (0 => 266063)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebDateTimeChooser.h"
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
+#include <WebCore/DateTimeChooserClient.h>
+#include <WebCore/DateTimeChooserParameters.h>
+
+namespace WebKit {
+
+WebDateTimeChooser::WebDateTimeChooser(WebPage& page, WebCore::DateTimeChooserClient& client)
+ : m_client(client)
+ , m_page(page)
+{
+}
+
+void WebDateTimeChooser::didChooseDate(StringView date)
+{
+ m_client.didChooseValue(date);
+}
+
+void WebDateTimeChooser::didEndChooser()
+{
+ m_client.didEndChooser();
+}
+
+void WebDateTimeChooser::endChooser()
+{
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::EndDateTimePicker(), m_page.identifier());
+}
+
+void WebDateTimeChooser::showChooser(const WebCore::DateTimeChooserParameters& params)
+{
+ m_page.setActiveDateTimeChooser(*this);
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowDateTimePicker(params), m_page.identifier());
+}
+
+} // namespace WebKit
+
+#endif
Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.h (0 => 266063)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+#include <WebCore/DateTimeChooser.h>
+
+namespace WebCore {
+class DateTimeChooserClient;
+struct DateTimeChooserParameters;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class WebDateTimeChooser final : public WebCore::DateTimeChooser {
+public:
+ WebDateTimeChooser(WebPage&, WebCore::DateTimeChooserClient&);
+
+ void didChooseDate(StringView);
+ void didEndChooser();
+
+private:
+ void endChooser() final;
+ void showChooser(const WebCore::DateTimeChooserParameters&) final;
+
+ WebCore::DateTimeChooserClient& m_client;
+ WebPage& m_page;
+};
+
+} // namespace WebKit
+
+#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (266062 => 266063)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-08-24 16:25:10 UTC (rev 266063)
@@ -80,6 +80,7 @@
#include "WebCoreArgumentCoders.h"
#include "WebDataListSuggestionPicker.h"
#include "WebDatabaseProvider.h"
+#include "WebDateTimeChooser.h"
#include "WebDiagnosticLoggingClient.h"
#include "WebDocumentLoader.h"
#include "WebDragClient.h"
@@ -4208,6 +4209,27 @@
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+
+void WebPage::setActiveDateTimeChooser(WebDateTimeChooser& dateTimeChooser)
+{
+ m_activeDateTimeChooser = makeWeakPtr(&dateTimeChooser);
+}
+
+void WebPage::didChooseDate(const String& date)
+{
+ if (m_activeDateTimeChooser)
+ m_activeDateTimeChooser->didChooseDate(date);
+}
+
+void WebPage::didEndDateTimePicker()
+{
+ if (auto chooser = std::exchange(m_activeDateTimeChooser, nullptr))
+ chooser->didEndChooser();
+}
+
+#endif
+
void WebPage::setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&& openPanelResultListener)
{
m_activeOpenPanelResultListener = WTFMove(openPanelResultListener);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (266062 => 266063)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -249,6 +249,7 @@
class WebContextMenu;
class WebContextMenuItemData;
class WebDataListSuggestionPicker;
+class WebDateTimeChooser;
class WebDocumentLoader;
class WebEvent;
class PlaybackSessionManager;
@@ -438,6 +439,12 @@
void didCloseSuggestions();
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ void setActiveDateTimeChooser(WebDateTimeChooser&);
+ void didChooseDate(const String&);
+ void didEndDateTimePicker();
+#endif
+
WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&);
@@ -1910,6 +1917,10 @@
WeakPtr<WebDataListSuggestionPicker> m_activeDataListSuggestionPicker;
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ WeakPtr<WebDateTimeChooser> m_activeDateTimeChooser;
+#endif
+
RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (266062 => 266063)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-08-24 16:25:10 UTC (rev 266063)
@@ -159,6 +159,11 @@
DidCloseSuggestions();
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ DidChooseDate(String date);
+ DidEndDateTimePicker();
+#endif
+
#if ENABLE(CONTEXT_MENUS)
ContextMenuHidden()
ContextMenuForKeyEvent()
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (266062 => 266063)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1,3 +1,14 @@
+2020-08-24 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Show picker for date and datetime-local input types
+ https://bugs.webkit.org/show_bug.cgi?id=214946
+
+ Reviewed by Darin Adler and Wenson Hsieh.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::createDateTimeChooser):
+
2020-08-19 Darin Adler <da...@apple.com>
Move node geometry functions from Range to RenderObject
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (266062 => 266063)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -147,6 +147,10 @@
bool canShowDataListSuggestionLabels() const final { return false; }
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+ std::unique_ptr<WebCore::DateTimeChooser> createDateTimeChooser(WebCore::DateTimeChooserClient&) final;
+#endif
+
#if ENABLE(POINTER_LOCK)
bool requestPointerLock() final;
void requestPointerUnlock() final;
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (266062 => 266063)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm 2020-08-24 16:25:10 UTC (rev 266063)
@@ -732,6 +732,14 @@
}
#endif
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
+std::unique_ptr<DateTimeChooser> WebChromeClient::createDateTimeChooser(DateTimeChooserClient&)
+{
+ ASSERT_NOT_REACHED();
+ return nullptr;
+}
+#endif
+
#if ENABLE(POINTER_LOCK)
bool WebChromeClient::requestPointerLock()
{
Modified: trunk/Tools/ChangeLog (266062 => 266063)
--- trunk/Tools/ChangeLog 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Tools/ChangeLog 2020-08-24 16:25:10 UTC (rev 266063)
@@ -1,3 +1,20 @@
+2020-08-24 Aditya Keerthi <akeer...@apple.com>
+
+ [macOS] Show picker for date and datetime-local input types
+ https://bugs.webkit.org/show_bug.cgi?id=214946
+
+ Reviewed by Darin Adler and Wenson Hsieh.
+
+ Added isShowingDateTimePicker testing hook in order to enable testing of the visibility of
+ the picker.
+
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ (WTR::UIScriptController::isShowingDateTimePicker const):
+ * WebKitTestRunner/mac/UIScriptControllerMac.h:
+ * WebKitTestRunner/mac/UIScriptControllerMac.mm:
+ (WTR::UIScriptControllerMac::isShowingDateTimePicker const):
+
2020-08-24 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Fix GTK4 build
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (266062 => 266063)
--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2020-08-24 16:25:10 UTC (rev 266063)
@@ -223,6 +223,8 @@
readonly attribute double timePickerValueHour;
readonly attribute double timePickerValueMinute;
+ readonly attribute boolean isShowingDateTimePicker;
+
// <datalist>
readonly attribute boolean isShowingDataListSuggestions;
void activateDataListSuggestion(unsigned long index, object callback);
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (266062 => 266063)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -216,6 +216,7 @@
virtual void setTimePickerValue(long hour, long minute) { notImplemented(); }
virtual double timePickerValueHour() const { notImplemented(); return -1; }
virtual double timePickerValueMinute() const { notImplemented(); return -1; }
+ virtual bool isShowingDateTimePicker() const { notImplemented(); return false; }
virtual bool isShowingDataListSuggestions() const { notImplemented(); return false; }
virtual JSObjectRef calendarType() const { notImplemented(); return nullptr; }
virtual void setDefaultCalendarType(JSStringRef calendarIdentifier, JSStringRef localeIdentifier) { notImplemented(); }
Modified: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.h (266062 => 266063)
--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.h 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.h 2020-08-24 16:25:10 UTC (rev 266063)
@@ -42,6 +42,7 @@
void zoomToScale(double, JSValueRef) override;
double zoomScale() const override;
void simulateAccessibilitySettingsChangeNotification(JSValueRef) override;
+ bool isShowingDateTimePicker() const override;
bool isShowingDataListSuggestions() const override;
void activateDataListSuggestion(unsigned index, JSValueRef callback) override;
void beginBackSwipe(JSValueRef) override;
Modified: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm (266062 => 266063)
--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm 2020-08-24 16:22:06 UTC (rev 266062)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm 2020-08-24 16:25:10 UTC (rev 266063)
@@ -97,6 +97,15 @@
}).get()];
}
+bool UIScriptControllerMac::isShowingDateTimePicker() const
+{
+ for (NSWindow *childWindow in webView().window.childWindows) {
+ if ([childWindow isKindOfClass:NSClassFromString(@"WKDateTimePickerWindow")])
+ return true;
+ }
+ return false;
+}
+
bool UIScriptControllerMac::isShowingDataListSuggestions() const
{
return dataListSuggestionsTableView();