From ceb51cd64c8bbcfc5a461e5043746722925f6322 Mon Sep 17 00:00:00 2001 From: "ayush.k123" Date: Thu, 19 Jan 2023 09:06:35 +0530 Subject: [PATCH] [M108 Migration] Bringup Native DateTime InputPicker Add the missed implementations for Native Date Time Input Picker. Add support for datetime input type. (Datetime input type is deprecated.) Add changes get/setenv to vconf_get_str/vconf_set_str for security issue in input picker It also fixes error of InputPicker. Reference: https://review.tizen.org/gerrit/274427/ Change-Id: I9c3f0b76521cdfa972e3a0bb4a42e97f196f3997 Signed-off-by: Ayush Kumar --- content/browser/browser_interface_binders.cc | 19 +- content/browser/web_contents/web_contents_impl.cc | 7 + content/child/runtime_features.cc | 5 + third_party/blink/public/blink_resources.grd | 1 + .../public/mojom/choosers/date_time_chooser.mojom | 2 +- .../blink/public/platform/web_runtime_features.h | 3 + third_party/blink/renderer/core/BUILD.gn | 12 ++ .../core/html/forms/date_time_local_input_type.cc | 69 +++++-- .../core/html/forms/date_time_local_input_type.h | 12 ++ .../core/html/forms/external_date_time_chooser.cc | 20 ++ .../core/html/forms/external_date_time_chooser.h | 8 + .../blink/renderer/core/html/forms/input_type.cc | 6 + third_party/blink/renderer/core/layout/build.gni | 2 +- .../blink/renderer/core/style/computed_style.h | 6 + .../platform/exported/web_runtime_features.cc | 6 + .../renderer/platform/text/date_components.cc | 177 ++++++++++++++++ .../blink/renderer/platform/text/date_components.h | 14 ++ .../renderer/platform/text/platform_locale.cc | 3 + .../chromium_impl/content/browser/browser_efl.gni | 2 + .../content/browser/date_time_chooser_efl.cc | 59 ++++++ .../content/browser/date_time_chooser_efl.h | 52 +++++ .../public/browser/web_contents_efl_delegate.h | 6 + .../core/rendering/RenderThemeChromiumTizen.cpp | 34 ---- .../core/rendering/RenderThemeChromiumTizen.h | 32 --- .../third_party/blink/renderer/core/core_efl.gni | 21 ++ .../renderer/core/css}/themeChromiumTizen.css | 0 .../core/layout/layout_theme_chromium_tizen.cc | 67 ++++++ .../core/layout/layout_theme_chromium_tizen.h | 25 +++ .../browser/input_picker/color_chooser_efl.h | 2 +- .../browser/input_picker/input_picker.cc | 225 ++++++++++++--------- .../browser/input_picker/input_picker.h | 53 ++--- tizen_src/ewk/efl_integration/eweb_view.cc | 9 +- tizen_src/ewk/efl_integration/eweb_view.h | 11 +- .../web_contents_efl_delegate_ewk.cc | 7 + .../web_contents_efl_delegate_ewk.h | 4 + 35 files changed, 773 insertions(+), 208 deletions(-) create mode 100644 tizen_src/chromium_impl/content/browser/date_time_chooser_efl.cc create mode 100644 tizen_src/chromium_impl/content/browser/date_time_chooser_efl.h delete mode 100644 tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.cpp delete mode 100644 tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.h create mode 100644 tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni rename tizen_src/chromium_impl/third_party/{WebKit/Source/core/rendering => blink/renderer/core/css}/themeChromiumTizen.css (100%) create mode 100644 tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.cc create mode 100644 tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.h diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index ba1ffe3..adac0a4 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc @@ -206,6 +206,10 @@ #include "media/fuchsia/mojom/fuchsia_media_resource_provider.mojom.h" #endif +#if BUILDFLAG(IS_EFL) +#include "content/browser/date_time_chooser_efl.h" +#endif + namespace blink { class StorageKey; } // namespace blink @@ -299,6 +303,16 @@ void BindSharedWorkerConnector( SharedWorkerConnectorImpl::Create(host->GetGlobalId(), std::move(receiver)); } +#if BUILDFLAG(IS_EFL) +void BindDateTimeChooserForFrame( + content::RenderFrameHost* host, + mojo::PendingReceiver receiver) { + auto* date_time_chooser = DateTimeChooserEfl::FromWebContents( + WebContents::FromRenderFrameHost(host)); + date_time_chooser->OnDateTimeChooserReceiver(std::move(receiver)); +} +#endif + #if BUILDFLAG(IS_ANDROID) void BindDateTimeChooserForFrame( RenderFrameHost* host, @@ -1065,7 +1079,10 @@ void PopulateBinderMapWithContext( map->Add(base::BindRepeating( &EmptyBinderForFrame)); #endif // BUILDFLAG(IS_ANDROID) - +#if BUILDFLAG(IS_EFL) + map->Add( + base::BindRepeating(&BindDateTimeChooserForFrame)); +#endif map->Add( base::BindRepeating(&ClipboardHostImpl::Create)); map->Add( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 2fc5272..0f16da0 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -187,6 +187,10 @@ #include "ui/gfx/geometry/dip_util.h" #endif +#if BUILDFLAG(IS_EFL) +#include "content/browser/date_time_chooser_efl.h" +#endif + #if BUILDFLAG(IS_ANDROID) #include "content/browser/android/date_time_chooser_android.h" #include "content/browser/android/java_interfaces_impl.h" @@ -3129,6 +3133,9 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, #if BUILDFLAG(IS_ANDROID) DateTimeChooserAndroid::CreateForWebContents(this); #endif +#if BUILDFLAG(IS_EFL) + DateTimeChooserEfl::CreateForWebContents(this); +#endif // BrowserPluginGuest::Init needs to be called after this WebContents has // a RenderWidgetHostViewChildFrame. That is, |view_->CreateView| above. diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 49473c7..208ace0 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc @@ -118,6 +118,11 @@ void SetRuntimeFeatureDefaultsForPlatform( WebRuntimeFeatures::EnableMediaControlsExpandGesture( base::FeatureList::IsEnabled(media::kMediaControlsExpandGesture)); #endif + +#if BUILDFLAG(IS_EFL) + // No plan to support complex UI for date/time INPUT types. + WebRuntimeFeatures::EnableInputMultipleFieldsUI(false); +#endif } enum RuntimeFeatureEnableOptions { diff --git a/third_party/blink/public/blink_resources.grd b/third_party/blink/public/blink_resources.grd index a06d71e..44f8953 100644 --- a/third_party/blink/public/blink_resources.grd +++ b/third_party/blink/public/blink_resources.grd @@ -16,6 +16,7 @@ + diff --git a/third_party/blink/public/mojom/choosers/date_time_chooser.mojom b/third_party/blink/public/mojom/choosers/date_time_chooser.mojom index 75c80e2..9867a51 100644 --- a/third_party/blink/public/mojom/choosers/date_time_chooser.mojom +++ b/third_party/blink/public/mojom/choosers/date_time_chooser.mojom @@ -32,7 +32,7 @@ interface DateTimeChooser { // Requires for opening a date/time dialog, and then |dialog_value| is // returned to replace a date/time input field. OpenDateTimeDialog(DateTimeDialogValue value) => - (bool success, double dialog_value); + (bool success, string dialog_value); // Dismiss the date/time dialog. CloseDateTimeDialog(); diff --git a/third_party/blink/public/platform/web_runtime_features.h b/third_party/blink/public/platform/web_runtime_features.h index e282c6e..5897b64b 100644 --- a/third_party/blink/public/platform/web_runtime_features.h +++ b/third_party/blink/public/platform/web_runtime_features.h @@ -67,6 +67,9 @@ class BLINK_PLATFORM_EXPORT WebRuntimeFeatures : public WebRuntimeFeaturesBase { static void EnableOverlayScrollbars(bool); static void EnableFluentScrollbars(bool); +#if BUILDFLAG(IS_EFL) + static void EnableInputMultipleFieldsUI(bool); +#endif WebRuntimeFeatures() = delete; }; diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index f6dff62..afb80e2 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn @@ -2,6 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +if (use_efl) { + import( + "//tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni") +} + import("//build/config/chromecast_build.gni") import("//build/config/compiler/compiler.gni") import("//build/config/dcheck_always_on.gni") @@ -342,6 +347,13 @@ component("core") { "//ui/gfx/geometry:geometry_skia", ] + if (use_efl) { + sources -= + rebase_path(external_exclude_webkit_core_layout_sources, "", "layout") + sources += external_webkit_core_layout_sources + deps += external_webkit_core_generated_deps + } + if (is_mac) { deps += [ "//ui/base/mojom" ] } diff --git a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc index 3e0a3c2..44f141f 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc @@ -47,12 +47,23 @@ static const int kDateTimeLocalDefaultStep = 60; static const int kDateTimeLocalDefaultStepBase = 0; static const int kDateTimeLocalStepScaleFactor = 1000; +#if BUILDFLAG(IS_EFL) +InputType* DateTimeLocalInputType::CreateDateTime(HTMLInputElement& element) { + return MakeGarbageCollected(element, true); +} +#endif + void DateTimeLocalInputType::CountUsage() { CountUsageIfVisible(WebFeature::kInputTypeDateTimeLocal); } const AtomicString& DateTimeLocalInputType::FormControlType() const { +#if BUILDFLAG(IS_EFL) + return is_date_time_ ? input_type_names::kDatetime + : input_type_names::kDatetimeLocal; +#else return input_type_names::kDatetimeLocal; +#endif } double DateTimeLocalInputType::ValueAsDate() const { @@ -87,6 +98,10 @@ bool DateTimeLocalInputType::ParseToDateComponentsInternal( DateComponents* out) const { DCHECK(out); unsigned end; +#if BUILDFLAG(IS_EFL) + if (is_date_time_) + return out->ParseDateTime(string, 0, end) && end == string.length(); +#endif return out->ParseDateTimeLocal(string, 0, end) && end == string.length(); } @@ -104,6 +119,9 @@ String DateTimeLocalInputType::LocalizeValue( return proposed_value; Locale::FormatType format_type = ShouldHaveSecondField(date) +#if BUILDFLAG(IS_EFL) + || is_date_time_ +#endif ? Locale::kFormatTypeMedium : Locale::kFormatTypeShort; String localized = GetElement().GetLocale().FormatDateTime(date, format_type); @@ -127,6 +145,12 @@ String DateTimeLocalInputType::FormatDateTimeFieldsState( !date_time_fields_state.HasMinute() || !date_time_fields_state.HasAMPM()) return g_empty_string; +#if BUILDFLAG(IS_EFL) + String additional_format = is_date_time_ ? "Z" : ""; +#else + String additional_format = ""; +#endif + if (date_time_fields_state.HasMillisecond() && date_time_fields_state.Millisecond()) { // According to WPTs and other browsers, we should remove trailing zeros @@ -138,39 +162,54 @@ String DateTimeLocalInputType::FormatDateTimeFieldsState( milliseconds.Truncate(milliseconds.length() - 1); } return String::Format( - "%04u-%02u-%02uT%02u:%02u:%02u.%s", date_time_fields_state.Year(), - date_time_fields_state.Month(), date_time_fields_state.DayOfMonth(), - date_time_fields_state.Hour24(), date_time_fields_state.Minute(), - date_time_fields_state.HasSecond() ? date_time_fields_state.Second() - : 0, - milliseconds.Ascii().c_str()); + "%04u-%02u-%02uT%02u:%02u:%02u.%s", + date_time_fields_state.Year(), date_time_fields_state.Month(), + date_time_fields_state.DayOfMonth(), + date_time_fields_state.Hour24(), date_time_fields_state.Minute(), + date_time_fields_state.HasSecond() + ? date_time_fields_state.Second() + : 0, + milliseconds.Ascii().c_str()) + + additional_format; } if (date_time_fields_state.HasSecond() && date_time_fields_state.Second()) { return String::Format( - "%04u-%02u-%02uT%02u:%02u:%02u", date_time_fields_state.Year(), - date_time_fields_state.Month(), date_time_fields_state.DayOfMonth(), - date_time_fields_state.Hour24(), date_time_fields_state.Minute(), - date_time_fields_state.Second()); + "%04u-%02u-%02uT%02u:%02u:%02u", date_time_fields_state.Year(), + date_time_fields_state.Month(), + date_time_fields_state.DayOfMonth(), + date_time_fields_state.Hour24(), date_time_fields_state.Minute(), + date_time_fields_state.Second()) + + additional_format; } return String::Format( - "%04u-%02u-%02uT%02u:%02u", date_time_fields_state.Year(), - date_time_fields_state.Month(), date_time_fields_state.DayOfMonth(), - date_time_fields_state.Hour24(), date_time_fields_state.Minute()); + "%04u-%02u-%02uT%02u:%02u", date_time_fields_state.Year(), + date_time_fields_state.Month(), + date_time_fields_state.DayOfMonth(), + date_time_fields_state.Hour24(), date_time_fields_state.Minute()) + + additional_format; } void DateTimeLocalInputType::SetupLayoutParameters( DateTimeEditElement::LayoutParameters& layout_parameters, const DateComponents& date) const { +#if BUILDFLAG(IS_EFL) + String additional_format = is_date_time_ ? "'Z'" : ""; +#else + String additional_format = ""; +#endif + if (ShouldHaveSecondField(date)) { layout_parameters.date_time_format = layout_parameters.locale.DateTimeFormatWithSeconds(); - layout_parameters.fallback_date_time_format = "yyyy-MM-dd'T'HH:mm:ss"; + layout_parameters.fallback_date_time_format = + "yyyy-MM-dd'T'HH:mm:ss" + additional_format; } else { layout_parameters.date_time_format = layout_parameters.locale.DateTimeFormatWithoutSeconds(); - layout_parameters.fallback_date_time_format = "yyyy-MM-dd'T'HH:mm"; + layout_parameters.fallback_date_time_format = + "yyyy-MM-dd'T'HH:mm" + additional_format; } if (!ParseToDateComponents( GetElement().FastGetAttribute(html_names::kMinAttr), diff --git a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h index b0aa26a..1736146 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h +++ b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h @@ -39,8 +39,16 @@ class ExceptionState; class DateTimeLocalInputType final : public BaseTemporalInputType { public: +#if BUILDFLAG(IS_EFL) + explicit DateTimeLocalInputType(HTMLInputElement& element, + bool is_date_time = false) + : BaseTemporalInputType(Type::kDateTimeLocal, element), + is_date_time_(is_date_time) {} + static InputType* CreateDateTime(HTMLInputElement&); +#else explicit DateTimeLocalInputType(HTMLInputElement& element) : BaseTemporalInputType(Type::kDateTimeLocal, element) {} +#endif private: void CountUsage() override; @@ -70,6 +78,10 @@ class DateTimeLocalInputType final : public BaseTemporalInputType { bool has_minute, bool has_second) const override; String AriaLabelForPickerIndicator() const override; + +#if BUILDFLAG(IS_EFL) + bool is_date_time_; +#endif }; template <> diff --git a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc index f87fccd..8a22ed5 100644 --- a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc +++ b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc @@ -45,7 +45,11 @@ static ui::TextInputType ToTextInputType(const AtomicString& source) { if (source == input_type_names::kDate) return ui::TextInputType::TEXT_INPUT_TYPE_DATE; if (source == input_type_names::kDatetime) +#if BUILDFLAG(IS_EFL) + return ui::TextInputType::TEXT_INPUT_TYPE_DATE_TIME; +#else return ui::TextInputType::TEXT_INPUT_TYPE_TIME; +#endif if (source == input_type_names::kDatetimeLocal) return ui::TextInputType::TEXT_INPUT_TYPE_DATE_TIME_LOCAL; if (source == input_type_names::kMonth) @@ -92,7 +96,11 @@ void ExternalDateTimeChooser::OpenDateTimeChooser( } void ExternalDateTimeChooser::ResponseHandler(bool success, +#if BUILDFLAG(IS_EFL) + const String& dialog_value) { +#else double dialog_value) { +#endif if (success) DidChooseValue(dialog_value); else @@ -118,6 +126,17 @@ mojom::blink::DateTimeChooser& ExternalDateTimeChooser::GetDateTimeChooser( return *date_time_chooser_.get(); } +#if BUILDFLAG(IS_EFL) +void ExternalDateTimeChooser::DidChooseValue(const String& value) { + if (client_) + client_->DidChooseValue(value); + // didChooseValue might run JavaScript code, and endChooser() might be + // called. However DateTimeChooserCompletionImpl still has one reference to + // this object. + if (client_) + client_->DidEndChooser(); +} +#else void ExternalDateTimeChooser::DidChooseValue(double value) { // Cache the owner element first, because DidChooseValue might run // JavaScript code and destroy |client|. @@ -138,6 +157,7 @@ void ExternalDateTimeChooser::DidChooseValue(double value) { if (client_) client_->DidEndChooser(); } +#endif void ExternalDateTimeChooser::DidCancelChooser() { if (client_) diff --git a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h index a071089..57961f8 100644 --- a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h +++ b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h @@ -45,12 +45,20 @@ class CORE_EXPORT ExternalDateTimeChooser final : public DateTimeChooser { // |frame| must not be null. void OpenDateTimeChooser(LocalFrame* frame, const DateTimeChooserParameters&); +#if BUILDFLAG(IS_EFL) + void ResponseHandler(bool success, const String& dialog_value); +#else void ResponseHandler(bool success, double dialog_value); +#endif bool IsShowingDateTimeChooserUI() const; private: +#if BUILDFLAG(IS_EFL) + void DidChooseValue(const String& value); +#else void DidChooseValue(double); +#endif void DidCancelChooser(); // DateTimeChooser function: diff --git a/third_party/blink/renderer/core/html/forms/input_type.cc b/third_party/blink/renderer/core/html/forms/input_type.cc index c8fd38b..a22687c 100644 --- a/third_party/blink/renderer/core/html/forms/input_type.cc +++ b/third_party/blink/renderer/core/html/forms/input_type.cc @@ -86,6 +86,7 @@ namespace blink { INPUT_TYPE(kCheckbox, CheckboxInputType) \ INPUT_TYPE(kColor, ColorInputType) \ INPUT_TYPE(kDate, DateInputType) \ + INPUT_TYPE(kDatetime, DateTimeLocalInputType) \ INPUT_TYPE(kDatetimeLocal, DateTimeLocalInputType) \ INPUT_TYPE(kEmail, EmailInputType) \ INPUT_TYPE(kFile, FileInputType) \ @@ -109,6 +110,11 @@ InputType* InputType::Create(HTMLInputElement& element, if (type_name.empty()) return MakeGarbageCollected(element); +#if BUILDFLAG(IS_EFL) + if (type_name == input_type_names::kDatetime) + return MakeGarbageCollected(element, true); +#endif + #define INPUT_TYPE_FACTORY(input_type, class_name) \ if (type_name == input_type_names::input_type) \ return MakeGarbageCollected(element); diff --git a/third_party/blink/renderer/core/layout/build.gni b/third_party/blink/renderer/core/layout/build.gni index 8c806e3..2780062 100644 --- a/third_party/blink/renderer/core/layout/build.gni +++ b/third_party/blink/renderer/core/layout/build.gni @@ -819,7 +819,7 @@ if (is_win) { blink_core_sources_layout += [ "layout_theme_font_provider_default.cc" ] } -if (is_linux || is_chromeos || is_tizen) { +if (is_linux || is_chromeos) { blink_core_sources_layout += [ "layout_theme_linux.cc", "layout_theme_linux.h", diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 90f5a5b..d9e8aae 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h @@ -100,6 +100,9 @@ class StyleInitialData; class StyleResolver; class StyleSelfAlignmentData; class TransformationMatrix; +#if BUILDFLAG(IS_EFL) +class LayoutThemeChromiumTizen; +#endif namespace css_longhand { @@ -289,6 +292,9 @@ class ComputedStyle : public ComputedStyleBase, friend class StyleResolver; // Access to UserModify(). friend class MatchedPropertiesCache; +#if BUILDFLAG(IS_EFL) + friend class LayoutThemeChromiumTizen; +#endif protected: mutable std::unique_ptr cached_data_; diff --git a/third_party/blink/renderer/platform/exported/web_runtime_features.cc b/third_party/blink/renderer/platform/exported/web_runtime_features.cc index 424852d..5dd2b16 100644 --- a/third_party/blink/renderer/platform/exported/web_runtime_features.cc +++ b/third_party/blink/renderer/platform/exported/web_runtime_features.cc @@ -65,4 +65,10 @@ void WebRuntimeFeatures::EnableFluentScrollbars(bool enable) { ScrollbarThemeSettings::SetFluentScrollbarsEnabled(enable); } +#if BUILDFLAG(IS_EFL) +void WebRuntimeFeatures::EnableInputMultipleFieldsUI(bool enable) { + RuntimeEnabledFeatures::SetInputMultipleFieldsUIEnabled(enable); +} +#endif + } // namespace blink diff --git a/third_party/blink/renderer/platform/text/date_components.cc b/third_party/blink/renderer/platform/text/date_components.cc index 54950b2..1d267b7 100644 --- a/third_party/blink/renderer/platform/text/date_components.cc +++ b/third_party/blink/renderer/platform/text/date_components.cc @@ -337,6 +337,183 @@ bool DateComponents::ParseDateTimeLocal(const String& src, return true; } +#if BUILDFLAG(IS_EFL) +bool DateComponents::AddDay(int day_diff) { + DCHECK(month_day_); + + int day = month_day_ + day_diff; + if (day > MaxDayOfMonth(year_, month_)) { + day = month_day_; + int year = year_; + int month = month_; + int max_day = MaxDayOfMonth(year, month); + for (; day_diff > 0; --day_diff) { + ++day; + if (day > max_day) { + day = 1; + ++month; + if (month >= 12) { // month is 0-origin. + month = 0; + ++year; + } + max_day = MaxDayOfMonth(year, month); + } + } + if (!WithinHTMLDateLimits(year, month, day)) + return false; + year_ = year; + month_ = month; + } else if (day < 1) { + int month = month_; + int year = year_; + day = month_day_; + for (; day_diff < 0; ++day_diff) { + --day; + if (day < 1) { + --month; + if (month < 0) { + month = 11; + --year; + } + day = MaxDayOfMonth(year, month); + } + } + if (!WithinHTMLDateLimits(year, month, day)) + return false; + year_ = year; + month_ = month; + } else { + if (!WithinHTMLDateLimits(year_, month_, day)) + return false; + } + month_day_ = day; + return true; +} + +bool DateComponents::AddMinute(int minute) { + // This function is used to adjust timezone offset. So year_, month_, + // month_day_ have values between the lower and higher limits. + DCHECK(WithinHTMLDateLimits(year_, month_, month_day_)); + + int carry; + // minute can be negative or greater than 59. + minute += minute_; + if (minute > 59) { + carry = minute / 60; + minute = minute % 60; + } else if (minute < 0) { + carry = (59 - minute) / 60; + minute += carry * 60; + carry = -carry; + DCHECK_GE(minute, 0); + DCHECK_LE(minute, 59); + } else { + if (!WithinHTMLDateLimits(year_, month_, month_day_, hour_, minute, second_, + millisecond_)) + return false; + minute_ = minute; + return true; + } + + int hour = hour_ + carry; + if (hour > 23) { + carry = hour / 24; + hour = hour % 24; + } else if (hour < 0) { + carry = (23 - hour) / 24; + hour += carry * 24; + carry = -carry; + DCHECK_GE(hour, 0); + DCHECK_LE(hour, 23); + } else { + if (!WithinHTMLDateLimits(year_, month_, month_day_, hour, minute, second_, + millisecond_)) + return false; + minute_ = minute; + hour_ = hour; + return true; + } + if (!AddDay(carry)) + return false; + if (!WithinHTMLDateLimits(year_, month_, month_day_, hour, minute, second_, + millisecond_)) + return false; + minute_ = minute; + hour_ = hour; + return true; +} + +// Parses a timezone part, and adjust year_, month_, month_day_, hour_, minute_, +// second_, and millisecond_. +bool DateComponents::ParseTimeZone(const String& src, + unsigned start, + unsigned& end) { + if (start >= src.length()) + return false; + unsigned index = start; + if (src[index] == 'Z') { + end = index + 1; + return true; + } + + bool minus; + if (src[index] == '+') + minus = false; + else if (src[index] == '-') + minus = true; + else + return false; + ++index; + + int hour; + int minute; + if (!ToInt(src, index, 2, hour) || hour < 0 || hour > 23) + return false; + index += 2; + + if (index >= src.length() || src[index] != ':') + return false; + ++index; + + if (!ToInt(src, index, 2, minute) || minute < 0 || minute > 59) + return false; + index += 2; + + if (minus) { + hour = -hour; + minute = -minute; + } + + // Subtract the timezone offset. + if (!AddMinute(-(hour * 60 + minute))) + return false; + end = index; + return true; +} + +bool DateComponents::ParseDateTime(const String& src, + unsigned start, + unsigned& end) { + unsigned index; + if (!ParseDate(src, start, index)) + return false; + if (index >= src.length()) + return false; + if (src[index] != 'T') + return false; + ++index; + if (!ParseTime(src, index, index)) + return false; + if (!ParseTimeZone(src, index, end)) + return false; + if (!WithinHTMLDateLimits(year_, month_, month_day_, hour_, minute_, second_, + millisecond_)) + return false; + type_ = kDateTime; + return true; +} +#endif + static inline double PositiveFmod(double value, double divider) { double remainder = fmod(value, divider); return remainder < 0 ? remainder + divider : remainder; diff --git a/third_party/blink/renderer/platform/text/date_components.h b/third_party/blink/renderer/platform/text/date_components.h index 90ceadd..e0eeef2 100644 --- a/third_party/blink/renderer/platform/text/date_components.h +++ b/third_party/blink/renderer/platform/text/date_components.h @@ -64,6 +64,9 @@ class PLATFORM_EXPORT DateComponents { enum Type { kInvalid, kDate, +#if BUILDFLAG(IS_EFL) + kDateTime, +#endif kDateTimeLocal, kMonth, kTime, @@ -113,6 +116,17 @@ class PLATFORM_EXPORT DateComponents { bool ParseTime(const String& src, unsigned start, unsigned& end); // Sets FullYear, Month, MonthDay, Hour, Minute, Second and Millisecond. bool ParseDateTimeLocal(const String&, unsigned start, unsigned& end); +#if BUILDFLAG(IS_EFL) + // Sets year, month, monthDay, hour, minute, second and millisecond, and + // adjusts timezone. + // For kDateTime type. Updates FullYear, Month, MonthDay, Hour, Minute, + // Second and Millisecond. + bool ParseDateTime(const String&, unsigned start, unsigned& end); + bool SetMillisecondsSinceEpochForDateTime(double ms); + bool ParseTimeZone(const String&, unsigned start, unsigned& end); + bool AddDay(int); + bool AddMinute(int); +#endif // The following SetMillisecondsSinceEpochFor*() functions take // the number of milliseconds since 1970-01-01 00:00:00.000 UTC as diff --git a/third_party/blink/renderer/platform/text/platform_locale.cc b/third_party/blink/renderer/platform/text/platform_locale.cc index 9bac9f2..351da70 100644 --- a/third_party/blink/renderer/platform/text/platform_locale.cc +++ b/third_party/blink/renderer/platform/text/platform_locale.cc @@ -572,6 +572,9 @@ String Locale::FormatDateTime(const DateComponents& date, case DateComponents::kWeek: builder.Build(WeekFormatInLDML()); break; +#if BUILDFLAG(IS_EFL) + case DateComponents::kDateTime: +#endif case DateComponents::kDateTimeLocal: builder.Build(format_type == kFormatTypeShort ? DateTimeFormatWithoutSeconds() diff --git a/tizen_src/chromium_impl/content/browser/browser_efl.gni b/tizen_src/chromium_impl/content/browser/browser_efl.gni index 4a1548a..b6a1022 100644 --- a/tizen_src/chromium_impl/content/browser/browser_efl.gni +++ b/tizen_src/chromium_impl/content/browser/browser_efl.gni @@ -66,6 +66,8 @@ external_content_browser_efl_deps = [ # Source ############################################################################## external_content_browser_efl_sources = [ + "//tizen_src/chromium_impl/content/browser/date_time_chooser_efl.cc", + "//tizen_src/chromium_impl/content/browser/date_time_chooser_efl.h", "//tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.cc", "//tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.h", "//tizen_src/chromium_impl/content/browser/public/browser/web_contents_efl_delegate.h", diff --git a/tizen_src/chromium_impl/content/browser/date_time_chooser_efl.cc b/tizen_src/chromium_impl/content/browser/date_time_chooser_efl.cc new file mode 100644 index 0000000..372ca2b --- /dev/null +++ b/tizen_src/chromium_impl/content/browser/date_time_chooser_efl.cc @@ -0,0 +1,59 @@ +// Copyright 2020 Samsung Electronics. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/date_time_chooser_efl.h" +#include "chromium_impl/content/browser/web_contents/web_contents_impl_efl.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "ewk/efl_integration/web_contents_efl_delegate_ewk.h" + +namespace content { + +// DateTimeChooserEfl implementation +DateTimeChooserEfl::DateTimeChooserEfl(WebContents* web_contents) + : web_contents_(web_contents), + date_time_chooser_receiver_(this), + WebContentsUserData(*web_contents) {} + +void DateTimeChooserEfl::OnDateTimeChooserReceiver( + mojo::PendingReceiver receiver) { + // Disconnect the previous picker first. + date_time_chooser_receiver_.reset(); + date_time_chooser_receiver_.Bind(std::move(receiver)); +} + +DateTimeChooserEfl::~DateTimeChooserEfl() {} + +void DateTimeChooserEfl::OpenDateTimeDialog( + blink::mojom::DateTimeDialogValuePtr value, + OpenDateTimeDialogCallback callback) { + if (open_date_time_response_callback_) { + date_time_chooser_receiver_.ReportBadMessage( + "DateTimeChooserAndroid: Previous picker's binding isn't closed."); + return; + } + open_date_time_response_callback_ = std::move(callback); + + WebContentsImplEfl* wcie = static_cast(web_contents_); + if (wcie->GetEflDelegate()) + wcie->GetEflDelegate()->OpenDateTimeDialog(value->dialog_type, + value->dialog_value, this); + else + std::move(open_date_time_response_callback_).Run(false, ""); +} + +void DateTimeChooserEfl::CloseDateTimeDialog() {} + +void DateTimeChooserEfl::ReplaceDateTime(const std::string& value) { + if (open_date_time_response_callback_) + std::move(open_date_time_response_callback_).Run(true, value); +} + +void DateTimeChooserEfl::CancelDialog() { + if (open_date_time_response_callback_) + std::move(open_date_time_response_callback_).Run(false, ""); +} + +WEB_CONTENTS_USER_DATA_KEY_IMPL(DateTimeChooserEfl); + +} // namespace content diff --git a/tizen_src/chromium_impl/content/browser/date_time_chooser_efl.h b/tizen_src/chromium_impl/content/browser/date_time_chooser_efl.h new file mode 100644 index 0000000..f6abda5 --- /dev/null +++ b/tizen_src/chromium_impl/content/browser/date_time_chooser_efl.h @@ -0,0 +1,52 @@ +// Copyright 2020 Samsung Electronics. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef CONTENT_BROWSER_EFL_DATE_TIME_CHOOSER_EFL_H_ +#define CONTENT_BROWSER_EFL_DATE_TIME_CHOOSER_EFL_H_ + +#include "content/public/browser/web_contents_observer.h" +#include "content/public/browser/web_contents_user_data.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "third_party/blink/public/mojom/choosers/date_time_chooser.mojom.h" + +#include "ui/base/ime/text_input_type.h" +#include "ui/gfx/native_widget_types.h" + +namespace content { + +class WebContents; +// Efl implementation for DateTimeChooser dialogs. +class DateTimeChooserEfl : public blink::mojom::DateTimeChooser, + public WebContentsUserData { + public: + explicit DateTimeChooserEfl(WebContents* web_contents); + ~DateTimeChooserEfl() override; + + DateTimeChooserEfl(const DateTimeChooserEfl&) = delete; + DateTimeChooserEfl& operator=(const DateTimeChooserEfl&) = delete; + + void OnDateTimeChooserReceiver( + mojo::PendingReceiver receiver); + + // blink::mojom::DateTimeChooser implementation: + // Shows the dialog. |value| is the date/time value converted to a + // number as defined in HTML. (See blink::InputType::parseToNumber()) + void OpenDateTimeDialog(blink::mojom::DateTimeDialogValuePtr value, + OpenDateTimeDialogCallback callback) override; + void CloseDateTimeDialog() override; + + void ReplaceDateTime(const std::string& value); + void CancelDialog(); + + private: + friend class WebContentsUserData; + WebContents* web_contents_; + + mojo::Receiver date_time_chooser_receiver_; + + OpenDateTimeDialogCallback open_date_time_response_callback_; + WEB_CONTENTS_USER_DATA_KEY_DECL(); +}; + +} // namespace content +#endif // CONTENT_BROWSER_EFL_DATE_TIME_CHOOSER_EFL_H_ diff --git a/tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h b/tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h index 75d3cc5..dcbe9d2 100644 --- a/tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h +++ b/tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h @@ -8,12 +8,14 @@ #include #include "base/callback.h" +#include "content/browser/date_time_chooser_efl.h" #include "content/common/content_export.h" #include "content/public/browser/context_menu_params.h" #include "services/device/public/mojom/screen_orientation_lock_types.mojom.h" #include "third_party/blink/public/common/context_menu_data/menu_item_info.h" #include "third_party/blink/public/common/input/web_gesture_event.h" #include "third_party/blink/public/common/input/web_input_event.h" +#include "ui/base/ime/text_input_type.h" #include "ui/gfx/geometry/rect.h" class GURL; @@ -69,6 +71,10 @@ class CONTENT_EXPORT WebContentsEflDelegate { virtual void OrientationLock(device::mojom::ScreenOrientationLockType) = 0; virtual void OrientationUnlock() = 0; + virtual void OpenDateTimeDialog( + ui::TextInputType dialog_type, + double dialog_value, + content::DateTimeChooserEfl* date_chooser) = 0; }; } // namespace content diff --git a/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.cpp b/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.cpp deleted file mode 100644 index 834c387..0000000 --- a/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "RenderThemeChromiumTizen.h" - -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup -// FIXME: EWK_BRINGUP definition should be removed. -#include "TizenUserAgentStyleSheets.h" -#endif - -namespace blink { - -scoped_refptr RenderThemeChromiumTizen::Create() { - return base::AdoptRef(new RenderThemeChromiumTizen()); -} - -LayoutTheme& LayoutTheme::NativeTheme() { - DEFINE_STATIC_REF(LayoutTheme, layout_theme, - (RenderThemeChromiumTizen::Create())); - return *layout_theme; -} - -RenderThemeChromiumTizen::~RenderThemeChromiumTizen() {} - -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup -// FIXME: EWK_BRINGUP definition should be removed. -String RenderThemeChromiumTizen::ExtraDefaultStyleSheet() { - return LayoutThemeDefault::extraDefaultStyleSheet() + - String(themeChromiumTizenCss, sizeof(themeChromiumTizenCss)); -} -#endif - -} // namespace blink diff --git a/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.h b/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.h deleted file mode 100644 index 25339c4..0000000 --- a/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/RenderThemeChromiumTizen.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef RenderThemeChromiumTizen_h -#define RenderThemeChromiumTizen_h - -#include "third_party/blink/renderer/core/layout/layout_theme_default.h" - -namespace blink { - -class RenderThemeChromiumTizen final : public LayoutThemeDefault { - public: - static scoped_refptr Create(); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - String ExtraDefaultStyleSheet() override; -#endif - bool DelegatesMenuListRendering() const override { return true; } - - Color PlatformTapHighlightColor() const override { - return RenderThemeChromiumTizen::defaultTapHighlightColor; - } - - private: - ~RenderThemeChromiumTizen() override; - static const RGBA32 defaultTapHighlightColor = 0x2eee6e1a; // light orange. -}; - -} // namespace blink - -#endif // RenderThemeChromiumTizen_h diff --git a/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni b/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni new file mode 100644 index 0000000..bacbb9c --- /dev/null +++ b/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni @@ -0,0 +1,21 @@ +# Copyright (c) 2015 Samsung Electronics. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +external_exclude_webkit_core_layout_sources = [] + +if (!is_tizen) { + external_exclude_webkit_core_layout_sources += [ + "layout_theme_linux.cc", + "layout_theme_linux.h", + ] +} + +external_webkit_core_layout_sources = [ + "//tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.cc", + "//tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.h", +] + +# For //third_party/blink/renderer/core:core_generated target +external_webkit_core_generated_deps = + [ "//tizen_src/chromium_impl/tizen:system-info" ] diff --git a/tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/themeChromiumTizen.css b/tizen_src/chromium_impl/third_party/blink/renderer/core/css/themeChromiumTizen.css similarity index 100% rename from tizen_src/chromium_impl/third_party/WebKit/Source/core/rendering/themeChromiumTizen.css rename to tizen_src/chromium_impl/third_party/blink/renderer/core/css/themeChromiumTizen.css diff --git a/tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.cc b/tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.cc new file mode 100644 index 0000000..bd7edce --- /dev/null +++ b/tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.cc @@ -0,0 +1,67 @@ +// Copyright 2014, 2016 Samsung Electronics. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "layout_theme_chromium_tizen.h" + +#include "core/style/computed_style.h" +#include "platform/web_test_support.h" +#include "third_party/blink/public/platform/platform.h" +#include "third_party/blink/public/platform/web_theme_engine.h" +#include "third_party/blink/public/resources/grit/blink_resources.h" +#include "third_party/blink/renderer/platform/data_resource_helper.h" +#include "tizen/system_info.h" + +namespace blink { + +static const RGBA32 kDefaultTapHighlightColorTizen = + 0x2eee6e1a; // Light orange +static const RGBA32 kDefaultFocusOutlineColorTizen = + 0xff00dae5; // (255,0,218,229) +static const RGBA32 kFocusOutlineColorTizenTv = 0xff0077f6; // (255,0,119,246) + +scoped_refptr LayoutThemeChromiumTizen::Create() { + return base::AdoptRef(new LayoutThemeChromiumTizen()); +} + +LayoutTheme& LayoutTheme::NativeTheme() { + DEFINE_STATIC_REF(LayoutTheme, layout_theme, + LayoutThemeChromiumTizen::Create()); + return *layout_theme; +} + +String LayoutThemeChromiumTizen::ExtraDefaultStyleSheet() { + return LayoutThemeDefault::ExtraDefaultStyleSheet() + + UncompressResourceAsASCIIString(IDR_UASTYLE_THEME_CHROMIUM_TIZEN_CSS); +} + +bool LayoutThemeChromiumTizen::DelegatesMenuListRendering() const { + return IsTvProfile() ? false : true; +} + +Color LayoutThemeChromiumTizen::PlatformTapHighlightColor() const { + return ColorFromPremultipliedARGB(kDefaultTapHighlightColorTizen); +} + +Color LayoutThemeChromiumTizen::PlatformFocusRingColor() const { + return IsTvProfile() + ? ColorFromPremultipliedARGB(kFocusOutlineColorTizenTv) + : ColorFromPremultipliedARGB(kDefaultFocusOutlineColorTizen); +} + +void LayoutThemeChromiumTizen::AdjustInnerSpinButtonStyle( + ComputedStyle& style) const { + if (!IsMobileProfile()) { + LayoutThemeDefault::AdjustInnerSpinButtonStyle(style); + return; + } + if (WebTestSupport::IsRunningWebTest()) { + gfx::Size size = Platform::Current()->ThemeEngine()->GetSize( + WebThemeEngine::kPartInnerSpinButton); + + style.SetWidth(Length::Fixed(size.width())); + style.SetMinWidth(Length::Fixed(size.width())); + } +} + +} // namespace blink diff --git a/tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.h b/tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.h new file mode 100644 index 0000000..8098069 --- /dev/null +++ b/tizen_src/chromium_impl/third_party/blink/renderer/core/layout/layout_theme_chromium_tizen.h @@ -0,0 +1,25 @@ +// Copyright 2014, 2016 Samsung Electronics. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef LayoutThemeChromiumTizen_h +#define LayoutThemeChromiumTizen_h + +#include "core/layout/layout_theme_default.h" + +namespace blink { + +class LayoutThemeChromiumTizen final : public LayoutThemeDefault { + public: + static scoped_refptr Create(); + + String ExtraDefaultStyleSheet() override; + bool DelegatesMenuListRendering() const override; + Color PlatformTapHighlightColor() const override; + Color PlatformFocusRingColor() const override; + void AdjustInnerSpinButtonStyle(ComputedStyle&) const override; +}; + +} // namespace blink + +#endif // LayoutThemeChromiumTizen_h diff --git a/tizen_src/ewk/efl_integration/browser/input_picker/color_chooser_efl.h b/tizen_src/ewk/efl_integration/browser/input_picker/color_chooser_efl.h index 9091a33..a383af1 100644 --- a/tizen_src/ewk/efl_integration/browser/input_picker/color_chooser_efl.h +++ b/tizen_src/ewk/efl_integration/browser/input_picker/color_chooser_efl.h @@ -18,7 +18,7 @@ class WebContents; class ColorChooserEfl : public ColorChooser { public: ColorChooserEfl(WebContents& web_contents); - ~ColorChooserEfl(); + ~ColorChooserEfl() override; ColorChooserEfl(const ColorChooserEfl&) = delete; ColorChooserEfl& operator=(const ColorChooserEfl&) = delete; diff --git a/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.cc b/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.cc index af7b8ff..ed4fa9d 100644 --- a/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.cc +++ b/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.cc @@ -16,11 +16,8 @@ #include "common/web_contents_utils.h" #include "content/common/paths_efl.h" #include "content/public/browser/web_contents.h" -#include "eweb_view.h" -#include "tizen/system_info.h" #if BUILDFLAG(IS_TIZEN) -#include #include #endif @@ -29,7 +26,6 @@ namespace content { static const char* kDefaultDatetimeFormat = "%Y/%m/%d %H:%M"; InputPicker::Layout::Layout(InputPicker* parent) : parent_(parent) { - CHECK(parent_); evas_object_focus_set(parent_->web_view_->evas_object(), false); // FIXME: Workaround. OSP requirement. OSP want to block own touch event // while webkit internal picker is running. @@ -57,17 +53,19 @@ InputPicker::Layout::~Layout() { } // static -std::unique_ptr -InputPicker::Layout::CreateAndShowColorPickerLayout(InputPicker* parent, - int r, - int g, - int b) { +InputPicker::Layout* InputPicker::Layout::CreateAndShowColorPickerLayout( + InputPicker* parent, + int r, + int g, + int b) { std::unique_ptr picker_layout(new Layout(parent)); picker_layout->is_color_picker_ = true; - if (!picker_layout->AddBaseLayout("Select color", - "colorselector_popup_layout")) + if (!picker_layout->AddBaseLayout( + dgettext("WebKit", "IDS_WEBVIEW_HEADER_SELECT_COLOUR"), + "colorselector_popup_layout")) { return nullptr; + } picker_layout->color_rect_ = evas_object_rectangle_add(evas_object_evas_get(picker_layout->layout_)); @@ -84,33 +82,32 @@ InputPicker::Layout::CreateAndShowColorPickerLayout(InputPicker* parent, if (!picker_layout->AddColorSelector(r, g, b)) return nullptr; - if (!picker_layout->AddOKButton()) + if (!picker_layout->AddButtons()) return nullptr; - evas_object_show(picker_layout->layout_); - elm_object_content_set(picker_layout->popup_, picker_layout->layout_); - evas_object_show(picker_layout->popup_); - picker_layout->red_ = r; picker_layout->green_ = g; picker_layout->blue_ = b; picker_layout->AddColorPickerCallbacks(); - - return picker_layout; + evas_object_show(picker_layout->popup_); + return picker_layout.release(); } static char* GetDateTimeFormat() { #if BUILDFLAG(IS_TIZEN) - char* language = getenv("LANGUAGE"); - setenv("LANGUAGE", "en_US", 1); + char* language = vconf_get_str(VCONFKEY_LANGSET); + if (!vconf_set_str(VCONFKEY_LANGSET, "en_US")) + LOG(ERROR) << "vconf_set_str failed "; char* region_format = vconf_get_str(VCONFKEY_REGIONFORMAT); if (!region_format) return nullptr; int time_value = 0; - char buf[256] = {0}; + char buf[256] = { + 0, + }; vconf_get_int(VCONFKEY_REGIONFORMAT_TIME1224, &time_value); if (time_value == VCONFKEY_TIME_FORMAT_24) snprintf(buf, sizeof(buf), "%s_DTFMT_24HR", region_format); @@ -142,17 +139,16 @@ static char* GetDateTimeFormat() { } } - if (!language || !strcmp(language, "")) - unsetenv("LANGUAGE"); - else - setenv("LANGUAGE", language, 1); - char* date_time_format = dgettext("dt_fmt", buf); + if (language && !vconf_set_str(VCONFKEY_LANGSET, language)) + LOG(ERROR) << "vconf_set_str failed "; + // FIXME: Workaround fix for not supported dt_fmt. // Use default format if dt_fmt string is not exist. if (strlen(date_time_format) == strlen(buf) && - !strncmp(date_time_format, buf, strlen(buf))) + !strncmp(date_time_format, buf, strlen(buf))) { return nullptr; + } return strdup(date_time_format); #else @@ -161,10 +157,10 @@ static char* GetDateTimeFormat() { } // static -std::unique_ptr -InputPicker::Layout::CreateAndShowDateLayout(InputPicker* parent, - struct tm* current_time, - ui::TextInputType type) { +InputPicker::Layout* InputPicker::Layout::CreateAndShowDateLayout( + InputPicker* parent, + struct tm* current_time, + ui::TextInputType type) { std::unique_ptr picker_layout(new Layout(parent)); picker_layout->input_type_ = type; @@ -189,8 +185,9 @@ InputPicker::Layout::CreateAndShowDateLayout(InputPicker* parent, } if (!picker_layout->AddBaseLayout(dgettext("WebKit", title.c_str()), - "date_popup")) + "date_popup")) { return nullptr; + } picker_layout->date_picker_ = elm_datetime_add(picker_layout->layout_); if (!picker_layout->date_picker_) @@ -210,7 +207,7 @@ InputPicker::Layout::CreateAndShowDateLayout(InputPicker* parent, elm_datetime_value_set(picker_layout->date_picker_, current_time); - if (!picker_layout->AddOKButton()) + if (!picker_layout->AddButtons()) return nullptr; if (type == ui::TEXT_INPUT_TYPE_MONTH) { @@ -224,17 +221,16 @@ InputPicker::Layout::CreateAndShowDateLayout(InputPicker* parent, picker_layout->AddDatePickerCallbacks(); - elm_object_content_set(picker_layout->popup_, picker_layout->layout_); evas_object_show(picker_layout->popup_); - return picker_layout; + return picker_layout.release(); } // static -std::unique_ptr -InputPicker::Layout::CreateAndShowDateTimeLayout(InputPicker* parent, - struct tm* current_time, - ui::TextInputType type) { +InputPicker::Layout* InputPicker::Layout::CreateAndShowDateTimeLayout( + InputPicker* parent, + struct tm* current_time, + ui::TextInputType type) { std::unique_ptr picker_layout(new Layout(parent)); picker_layout->input_type_ = type; @@ -242,8 +238,9 @@ InputPicker::Layout::CreateAndShowDateTimeLayout(InputPicker* parent, elm_object_scale_set(picker_layout->popup_, 0.7); if (!picker_layout->AddBaseLayout( dgettext("WebKit", "IDS_WEBVIEW_HEADER_SET_DATE_AND_TIME"), - "datetime_popup")) + "datetime_popup")) { return nullptr; + } picker_layout->time_picker_ = elm_datetime_add(picker_layout->layout_); picker_layout->date_picker_ = elm_datetime_add(picker_layout->layout_); @@ -270,38 +267,38 @@ InputPicker::Layout::CreateAndShowDateTimeLayout(InputPicker* parent, elm_datetime_value_set(picker_layout->date_picker_, current_time); elm_datetime_value_set(picker_layout->time_picker_, current_time); - - if (!picker_layout->AddOKButton()) + if (!picker_layout->AddButtons()) return nullptr; picker_layout->AddDatePickerCallbacks(); - - elm_object_content_set(picker_layout->popup_, picker_layout->layout_); evas_object_show(picker_layout->popup_); - return picker_layout; + return picker_layout.release(); +} + +bool InputPicker::Layout::SetDatetimePicker(Evas_Object* picker, + const char* style) { + return false; } // static -std::unique_ptr -InputPicker::Layout::CreateAndShowTimeLayout(InputPicker* parent, - struct tm* current_time) { +InputPicker::Layout* InputPicker::Layout::CreateAndShowTimeLayout( + InputPicker* parent, + struct tm* current_time) { std::unique_ptr picker_layout(new Layout(parent)); picker_layout->input_type_ = ui::TEXT_INPUT_TYPE_TIME; if (!picker_layout->AddBaseLayout( - dgettext("WebKit", "IDS_WEBVIEW_HEADER_SET_TIME"), "date_popup")) + dgettext("WebKit", "IDS_WEBVIEW_HEADER_SET_TIME"), "date_popup")) { return nullptr; + } picker_layout->time_picker_ = elm_datetime_add(picker_layout->layout_); if (!picker_layout->time_picker_) return nullptr; - elm_object_part_content_set(picker_layout->layout_, "elm.swallow.datetime", - picker_layout->time_picker_); elm_object_style_set(picker_layout->time_picker_, "time_layout"); - elm_object_part_content_set(picker_layout->layout_, "elm.swallow.datetime", picker_layout->time_picker_); @@ -316,7 +313,7 @@ InputPicker::Layout::CreateAndShowTimeLayout(InputPicker* parent, elm_datetime_value_set(picker_layout->time_picker_, current_time); - if (!picker_layout->AddOKButton()) + if (!picker_layout->AddButtons()) return nullptr; elm_datetime_field_visible_set(picker_layout->time_picker_, ELM_DATETIME_YEAR, @@ -328,18 +325,14 @@ InputPicker::Layout::CreateAndShowTimeLayout(InputPicker* parent, picker_layout->AddDatePickerCallbacks(); - elm_object_content_set(picker_layout->popup_, picker_layout->layout_); evas_object_show(picker_layout->popup_); - return picker_layout; + return picker_layout.release(); } bool InputPicker::Layout::AddBaseLayout(const char* title, const char* layout_group) { - Evas_Object* top_widget = elm_object_top_widget_get( - elm_object_parent_widget_get(parent_->web_view_->evas_object())); - if (!top_widget) - return false; + Evas_Object* top_widget = parent_->web_view_->GetElmWindow(); conformant_ = elm_conformant_add(top_widget); if (!conformant_) @@ -364,6 +357,7 @@ bool InputPicker::Layout::AddBaseLayout(const char* title, return false; elm_popup_align_set(popup_, ELM_NOTIFY_ALIGN_FILL, 1.0); + elm_object_part_text_set(popup_, "title,text", title); evas_object_size_hint_weight_set(popup_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -371,28 +365,38 @@ bool InputPicker::Layout::AddBaseLayout(const char* title, if (!layout_) return false; + elm_object_content_set(popup_, layout_); base::FilePath edj_dir; - base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir); base::FilePath control_path; + base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir); control_path = edj_dir.Append(FILE_PATH_LITERAL("control.edj")); elm_layout_file_set(layout_, control_path.AsUTF8Unsafe().c_str(), layout_group); - - evas_object_size_hint_weight_set(layout_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(layout_, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(layout_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); return true; } -bool InputPicker::Layout::AddOKButton() { - ok_button_ = elm_button_add(popup_); - if (!ok_button_) +bool InputPicker::Layout::AddButtons() { + set_button_ = elm_button_add(popup_); + cancel_button_ = elm_button_add(popup_); + if (!cancel_button_) + return false; + elm_object_domain_translatable_part_text_set( + cancel_button_, NULL, "WebKit", "IDS_WEBVIEW_BUTTON_CANCEL_ABB4"); + + if (!set_button_) return false; - elm_object_style_set(ok_button_, "popup"); - elm_object_text_set(ok_button_, "OK"); - elm_object_part_content_set(popup_, "button1", ok_button_); - evas_object_focus_set(ok_button_, true); + elm_object_domain_translatable_part_text_set(set_button_, NULL, "WebKit", + "IDS_WEBVIEW_BUTTON_SET_ABB2"); + elm_object_style_set(set_button_, "popup"); + elm_object_style_set(cancel_button_, "popup"); + elm_object_part_content_set(popup_, "button2", set_button_); + elm_object_part_content_set(popup_, "button1", cancel_button_); + evas_object_focus_set(cancel_button_, true); + evas_object_focus_set(set_button_, true); return true; } @@ -415,7 +419,10 @@ bool InputPicker::Layout::AddColorSelector(int r, int g, int b) { Eina_List* list = nullptr; Elm_Object_Item* it = nullptr; void* item = nullptr; - int red = 0, green = 0, blue = 0, alpha = 0; + int red = 0; + int green = 0; + int blue = 0; + int alpha = 0; EINA_LIST_FOREACH(color_list, list, item) { if (item) { @@ -443,11 +450,10 @@ bool InputPicker::Layout::AddColorSelector(int r, int g, int b) { void InputPicker::Layout::AddColorPickerCallbacks() { evas_object_smart_callback_add(color_picker_, "color,item,selected", ColorPickerItemSelectedCallback, color_rect_); - - evas_object_smart_callback_add(ok_button_, "clicked", + evas_object_smart_callback_add(set_button_, "clicked", ColorPickerSelectFinishedCallback, this); #if BUILDFLAG(IS_TIZEN) - eext_object_event_callback_add(popup_, EEXT_CALLBACK_BACK, + eext_object_event_callback_add(layout_, EEXT_CALLBACK_BACK, ColorPickerBackKeyCallback, this); #endif } @@ -458,22 +464,28 @@ void InputPicker::Layout::DeleteColorPickerCallbacks() { ColorPickerItemSelectedCallback); } - if (ok_button_) { - evas_object_smart_callback_del(ok_button_, "clicked", + if (set_button_) { + evas_object_smart_callback_del(set_button_, "clicked", ColorPickerSelectFinishedCallback); } + if (cancel_button_) { + evas_object_smart_callback_del(cancel_button_, "clicked", + ColorPickerBackKeyCallback); + } #if BUILDFLAG(IS_TIZEN) if (popup_) { - eext_object_event_callback_del(popup_, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(layout_, EEXT_CALLBACK_BACK, ColorPickerBackKeyCallback); } #endif } void InputPicker::Layout::AddDatePickerCallbacks() { - evas_object_smart_callback_add(ok_button_, "clicked", + evas_object_smart_callback_add(set_button_, "clicked", DatePickerSelectFinishedCallback, this); + evas_object_smart_callback_add(cancel_button_, "clicked", + DatePickerBackKeyCallback, this); if (input_type_ == ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD || input_type_ == ui::TEXT_INPUT_TYPE_DATE_TIME || @@ -489,16 +501,20 @@ void InputPicker::Layout::AddDatePickerCallbacks() { } #if BUILDFLAG(IS_TIZEN) - eext_object_event_callback_add(popup_, EEXT_CALLBACK_BACK, + eext_object_event_callback_add(layout_, EEXT_CALLBACK_BACK, DatePickerBackKeyCallback, this); #endif } void InputPicker::Layout::DeleteDatePickerCallbacks() { - if (ok_button_) { - evas_object_smart_callback_del(ok_button_, "clicked", + if (set_button_) { + evas_object_smart_callback_del(set_button_, "clicked", DatePickerSelectFinishedCallback); } + if (cancel_button_) { + evas_object_smart_callback_del(cancel_button_, "clicked", + DatePickerBackKeyCallback); + } if (input_type_ == ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD || input_type_ == ui::TEXT_INPUT_TYPE_DATE_TIME || @@ -515,7 +531,7 @@ void InputPicker::Layout::DeleteDatePickerCallbacks() { #if BUILDFLAG(IS_TIZEN) if (popup_) { - eext_object_event_callback_del(popup_, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(layout_, EEXT_CALLBACK_BACK, DatePickerBackKeyCallback); } #endif @@ -525,7 +541,7 @@ void InputPicker::Layout::DeleteDatePickerCallbacks() { void InputPicker::Layout::ColorPickerItemSelectedCallback(void* data, Evas_Object* obj, void* event_info) { - int r = 0, g = 0, b = 0, a = 0; + int r(0), g(0), b(0), a(0); Elm_Object_Item* color_it = static_cast(event_info); elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a); evas_object_color_set(static_cast(data), r, g, b, a); @@ -537,7 +553,7 @@ void InputPicker::Layout::ColorPickerSelectFinishedCallback(void* data, void* event_info) { Layout* picker_layout = static_cast(data); - int r = 0, g = 0, b = 0, a = 0; + int r(0), g(0), b(0), a(0); evas_object_color_get(picker_layout->color_rect_, &r, &g, &b, &a); picker_layout->parent_->web_view_->web_contents() @@ -596,7 +612,10 @@ void InputPicker::Layout::DatePickerSelectFinishedCallback(void* data, break; } - picker_layout->parent_->RemoveDatePicker(); + // call the callback + picker_layout->parent_->web_view_->GetDateTimeChooser()->ReplaceDateTime( + std::string(dateStr)); + picker_layout->parent_->RemoveDatePicker(false); } // static @@ -616,7 +635,6 @@ void InputPicker::Layout::DatePickerItemChangedCallback(void* data, } } -#if BUILDFLAG(IS_TIZEN) // static void InputPicker::Layout::ColorPickerBackKeyCallback(void* data, Evas_Object* obj, @@ -635,15 +653,20 @@ void InputPicker::Layout::DatePickerBackKeyCallback(void* data, Evas_Object* obj, void* event_info) { Layout* picker_layout = static_cast(data); - if (picker_layout) - picker_layout->parent_->RemoveDatePicker(); + if (picker_layout) { + picker_layout->parent_->web_view_->GetDateTimeChooser()->CancelDialog(); + // pass true to RemoveDatePicker to cancelDateTimeDialog + picker_layout->parent_->RemoveDatePicker(true); + } } -#endif -InputPicker::InputPicker(EWebView* view) : web_view_(view) {} +InputPicker::InputPicker(EWebView* view) + : web_view_(view), picker_layout_(nullptr) {} + +InputPicker::~InputPicker() {} void InputPicker::ShowColorPicker(int r, int g, int b, int a) { - picker_layout_ = Layout::CreateAndShowColorPickerLayout(this, r, g, b); + picker_layout_.reset(Layout::CreateAndShowColorPickerLayout(this, r, g, b)); if (!picker_layout_) { LOG(ERROR) << "Failed to create color picker."; // We need to notify engine that default color is chosen @@ -678,24 +701,23 @@ void InputPicker::ShowDatePicker(ui::TextInputType input_type, gmtime_r(&timep, &tm); } struct tm* current_time = &tm; - switch (input_type) { case ui::TEXT_INPUT_TYPE_DATE: case ui::TEXT_INPUT_TYPE_WEEK: case ui::TEXT_INPUT_TYPE_MONTH: { - picker_layout_ = - Layout::CreateAndShowDateLayout(this, current_time, input_type); + picker_layout_.reset( + Layout::CreateAndShowDateLayout(this, current_time, input_type)); break; } case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD: case ui::TEXT_INPUT_TYPE_DATE_TIME: case ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL: { - picker_layout_ = - Layout::CreateAndShowDateTimeLayout(this, current_time, input_type); + picker_layout_.reset( + Layout::CreateAndShowDateTimeLayout(this, current_time, input_type)); break; } case ui::TEXT_INPUT_TYPE_TIME: { - picker_layout_ = Layout::CreateAndShowTimeLayout(this, current_time); + picker_layout_.reset(Layout::CreateAndShowTimeLayout(this, current_time)); break; } default: @@ -705,6 +727,11 @@ void InputPicker::ShowDatePicker(ui::TextInputType input_type, if (!picker_layout_) { LOG(ERROR) << "Failed to create date picker."; + // We need to notify engine that empty string is chosen + // otherwise selecting will never be finished. + + // Call the callback + web_view_->GetDateTimeChooser()->ReplaceDateTime(std::string()); } } @@ -716,11 +743,13 @@ void InputPicker::RemoveColorPicker() { web_view_->web_contents().DidEndColorChooser(); } -void InputPicker::RemoveDatePicker() { +void InputPicker::RemoveDatePicker(bool cancel) { if (!picker_layout_) return; + if (cancel) + web_view_->GetDateTimeChooser()->CancelDialog(); picker_layout_.reset(); } -} // namespace content +} // namespace content \ No newline at end of file diff --git a/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.h b/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.h index ab2737ef..2733bcd6 100644 --- a/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.h +++ b/tizen_src/ewk/efl_integration/browser/input_picker/input_picker.h @@ -12,13 +12,18 @@ #include "ewk/efl_integration/eweb_view.h" #include "ui/base/ime/text_input_type.h" +#if BUILDFLAG(IS_TIZEN) +#include +#endif + class EWebView; namespace content { class InputPicker { public: - explicit InputPicker(EWebView* web_view); + explicit InputPicker(EWebView* view); + ~InputPicker(); InputPicker(const InputPicker&) = delete; InputPicker& operator=(const InputPicker&) = delete; @@ -29,19 +34,18 @@ class InputPicker { private: class Layout { public: - static std::unique_ptr - CreateAndShowColorPickerLayout(InputPicker* parent, int r, int g, int b); - static std::unique_ptr CreateAndShowDateLayout( - InputPicker* parent, - struct tm* currentTime, - ui::TextInputType type); - static std::unique_ptr CreateAndShowDateTimeLayout( - InputPicker* parent, - struct tm* currentTime, - ui::TextInputType type); - static std::unique_ptr CreateAndShowTimeLayout( - InputPicker* parent, - struct tm* currentTime); + static Layout* CreateAndShowColorPickerLayout(InputPicker* parent, + int r, + int g, + int b); + static Layout* CreateAndShowDateLayout(InputPicker* parent, + struct tm* currentTime, + ui::TextInputType type); + static Layout* CreateAndShowDateTimeLayout(InputPicker* parent, + struct tm* currentTime, + ui::TextInputType type); + static Layout* CreateAndShowTimeLayout(InputPicker* parent, + struct tm* currentTime); ~Layout(); @@ -52,13 +56,15 @@ class InputPicker { Layout& operator=(const Layout&) = delete; bool AddBaseLayout(const char* title, const char* layout_group); - bool AddOKButton(); + bool AddButtons(); bool AddColorSelector(int r, int g, int b); void AddColorPickerCallbacks(); void DeleteColorPickerCallbacks(); void AddDatePickerCallbacks(); void DeleteDatePickerCallbacks(); + bool SetDatetimePicker(Evas_Object* picker, const char* style); + static void ColorPickerSelectFinishedCallback(void* data, Evas_Object* obj, void* event_info); @@ -72,27 +78,28 @@ class InputPicker { Evas_Object* obj, void* event_info); -#if BUILDFLAG(IS_TIZEN) static void ColorPickerBackKeyCallback(void* data, Evas_Object* obj, void* event_info); static void DatePickerBackKeyCallback(void* data, Evas_Object* obj, void* event_info); -#endif - InputPicker* parent_ = nullptr; + InputPicker* parent_; Evas_Object* conformant_ = nullptr; Evas_Object* popup_ = nullptr; Evas_Object* layout_ = nullptr; - Evas_Object* ok_button_ = nullptr; + Evas_Object* set_button_ = nullptr; + Evas_Object* cancel_button_ = nullptr; Evas_Object* color_picker_ = nullptr; Evas_Object* color_rect_ = nullptr; Evas_Object* date_picker_ = nullptr; Evas_Object* time_picker_ = nullptr; - - ui::TextInputType input_type_; +#if BUILDFLAG(IS_TIZEN) && !BUILDFLAG(IS_TIZEN_TV) + Eext_Circle_Surface* circle_surface_ = nullptr; +#endif + ui::TextInputType input_type_ = ui::TEXT_INPUT_TYPE_NONE; bool is_color_picker_ = false; int red_ = 0; int green_ = 0; @@ -100,7 +107,7 @@ class InputPicker { }; void RemoveColorPicker(); - void RemoveDatePicker(); + void RemoveDatePicker(bool cancel); EWebView* web_view_; std::unique_ptr picker_layout_; @@ -108,4 +115,4 @@ class InputPicker { } // namespace content -#endif // EWK_EFL_INTEGRATION_BROWSER_INPUT_PICKER_INPUT_PICKER_H_ +#endif // EWK_EFL_INTEGRATION_BROWSER_INPUT_PICKER_INPUT_PICKER_H_ \ No newline at end of file diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 821c731..fcad346 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -363,6 +363,11 @@ Evas_Object* EWebView::GetHostWindowDelegate(const content::WebContents* wc) { return thiz->evas_object_; } +Evas_Object* EWebView::GetElmWindow() const { + Evas_Object* parent = elm_object_parent_widget_get(evas_object_); + return parent ? elm_object_top_widget_get(parent) : nullptr; +} + void EWebView::SetURL(const GURL& url) { NavigationController::LoadURLParams params(url); params.override_user_agent = NavigationController::UA_OVERRIDE_TRUE; @@ -2135,8 +2140,10 @@ bool EWebView::SetColorPickerColor(int r, int g, int b, int a) { } void EWebView::InputPickerShow(ui::TextInputType input_type, - double input_value) { + double input_value, + content::DateTimeChooserEfl* date_time_chooser) { input_picker_.reset(new InputPicker(this)); + date_time_chooser_ = date_time_chooser; input_picker_->ShowDatePicker(input_type, input_value); } diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index f76d97b..93a0b53 100755 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -22,6 +22,7 @@ #include "base/synchronization/waitable_event.h" #include "browser/input_picker/input_picker.h" #include "browser/selectpicker/popup_picker.h" +#include "content/browser/date_time_chooser_efl.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/browser/selection/selection_controller_efl.h" #include "content/public/browser/context_menu_params.h" @@ -191,6 +192,7 @@ class EWebView { Ewk_Context* context() const { return context_.get(); } Evas_Object* evas_object() const { return evas_object_; } Evas_Object* native_view() const { return native_view_; } + Evas_Object* GetElmWindow() const; Evas* GetEvas() const { return evas_object_evas_get(evas_object_); } PermissionPopupManager* GetPermissionPopupManager() const { return permission_popup_manager_.get(); @@ -439,7 +441,9 @@ class EWebView { void RequestColorPicker(int r, int g, int b, int a); bool SetColorPickerColor(int r, int g, int b, int a); - void InputPickerShow(ui::TextInputType input_type, double input_value); + void InputPickerShow(ui::TextInputType input_type, + double input_value, + content::DateTimeChooserEfl* date_time_chooser); void ShowContentsDetectedPopup(const char*); @@ -498,6 +502,10 @@ class EWebView { void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll, const gfx::Vector2dF& latest_overscroll_delta); + content::DateTimeChooserEfl* GetDateTimeChooser() { + return date_time_chooser_; + } + private: void InitializeContent(); void InitializeWindowTreeHost(); @@ -644,6 +652,7 @@ class EWebView { std::unique_ptr host_; std::unique_ptr focus_client_; std::unique_ptr window_parenting_client_; + content::DateTimeChooserEfl* date_time_chooser_ = nullptr; }; const unsigned int g_default_tilt_motion_sensitivity = 3; diff --git a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc index d010dc8..31e1496 100644 --- a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc +++ b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc @@ -89,4 +89,11 @@ void WebContentsEflDelegateEwk::OrientationLock( void WebContentsEflDelegateEwk::OrientationUnlock() { WebViewDelegateEwk::GetInstance().RequestHandleOrientationUnlock(web_view_); +} + +void WebContentsEflDelegateEwk::OpenDateTimeDialog( + ui::TextInputType dialog_type, + double dialog_value, + content::DateTimeChooserEfl* date_time_chooser) { + web_view_->InputPickerShow(dialog_type, dialog_value, date_time_chooser); } \ No newline at end of file diff --git a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h index 98065a1..38f8222 100644 --- a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h +++ b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h @@ -44,6 +44,10 @@ class WebContentsEflDelegateEwk : public content::WebContentsEflDelegate { virtual void OrientationLock( device::mojom::ScreenOrientationLockType) override; virtual void OrientationUnlock() override; + void OpenDateTimeDialog( + ui::TextInputType dialog_type, + double dialog_value, + content::DateTimeChooserEfl* date_time_chooser) override; private: EWebView* web_view_; -- 2.7.4