From: k2.nagaraju Date: Fri, 30 Nov 2018 07:01:57 +0000 (+0530) Subject: Enable macros based on runtime platform info X-Git-Tag: submit/tizen_4.0/20190916.115728~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8369c9321fbfd55abd762afd364ad313eaf0505;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Enable macros based on runtime platform info 1. Enable macros based on runtime platform info 2. For unified platform, there is no way to get the platform info at build time. so removed the code which is enabling feature specific macro at build time. Change-Id: I30c778df888063dd532aadfdde1ed0744db4fabc Signed-off-by: k2.nagaraju --- diff --git a/common/common.gyp b/common/common.gyp index 6d7d88baf..27c650def 100644 --- a/common/common.gyp +++ b/common/common.gyp @@ -55,14 +55,6 @@ 'ttrace', ], }, - 'conditions': [ - ['tizen_feature_web_ime_support == 1', { - 'defines': ['IME_FEATURE_SUPPORT'], - }], - ['tizen_feature_watch_face_support == 1', { - 'defines': ['WATCH_FACE_FEATURE_SUPPORT'], - }], - ], 'direct_dependent_settings': { 'libraries': [ '-lxwalk_tizen_common', diff --git a/common/platform_info.h b/common/platform_info.h index 20732f77f..1bf507cf4 100644 --- a/common/platform_info.h +++ b/common/platform_info.h @@ -39,7 +39,9 @@ enum _profile { #define TIZEN_FEATURE_rotary_event_support \ (common::getProfile() & ((common::kPROFILE_WEARABLE))) #define TIZEN_FEATURE_display_resize_support \ - (common::getProfile() & ((common::kPROFILE_WEARABLE))) + (common::getProfile() & ((common::kPROFILE_WEARABLE))) +#define TIZEN_FEATURE_model_formfactor_circle \ + (common::getProfile() & ((common::kPROFILE_WEARABLE))) extern enum _profile getProfile(void); diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index 945b02e37..9e2922a30 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -48,53 +48,9 @@ BuildRequires: pkgconfig(launchpad) BuildRequires: pkgconfig(ttrace) BuildRequires: pkgconfig(jsoncpp) BuildRequires: pkgconfig(vc-webview) - -%define chromium_efl_workaround_ewk_settings 0 - -%if "%{?profile}" == "mobile" -%define tizen_feature_rotary_event_support 0 -%define tizen_feature_web_ime_support 0 -%define tizen_feature_watch_face_support 0 -%endif - -%if "%{?profile}" == "wearable" -%define tizen_feature_rotary_event_support 1 -%define tizen_feature_web_ime_support 1 -%define tizen_feature_watch_face_support 1 -%define chromium_efl_workaround_ewk_settings 1 -%endif - -%if "%{?profile}" == "tv" -%define tizen_feature_rotary_event_support 0 -%define tizen_feature_web_ime_support 1 -%define tizen_feature_watch_face_support 0 -%endif - -# If it is unified environment. -%if "%{?profile}" != "mobile" && "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common" -%define tizen_feature_rotary_event_support 1 -%define tizen_feature_web_ime_support 1 -%define tizen_feature_watch_face_support 1 -%endif - -# In "unified" build environment, where "profile" is none of mobile/wearable/tv/common/ivi, but a new value or undefined, -# all the "feature"s are to be supported and be activated selectively at runtime/inittime. -# (the profile is probed at runtime) - -# tizen_feature_rotary..._support (==> platform_info / wearable) -# tizen_feature_web_ime_support (==> platform_info / wearable || TV) -# tizen_feature_watch_face_support (==> platform_info / wearable) -# tizen_feature_manual_rotate_support (==> platform_info / mobile) - -%if 0%{?tizen_feature_web_ime_support} BuildRequires: pkgconfig(capi-ui-inputmethod) -%endif - -%if 0%{?tizen_feature_watch_face_support} BuildRequires: pkgconfig(capi-appfw-watch-application) BuildRequires: pkgconfig(appcore-watch) -%endif - Requires: /usr/bin/systemctl @@ -130,38 +86,24 @@ GYP_OPTIONS="$GYP_OPTIONS -Dbuild_type=Release" %endif # Feature flags -# TODO: in unified environment, the following feature flags are useless (always on) -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_rotary_event_support=%{?tizen_feature_rotary_event_support}" -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_ime_support=%{?tizen_feature_web_ime_support}" -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_watch_face_support=%{?tizen_feature_watch_face_support}" -# Not required anymore -#GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_manual_rotate_support=%{?tizen_feature_manual_rotate_support}" - # Extension Path GYP_OPTIONS="$GYP_OPTIONS -Dextension_path=%{extension_path}" # Injected bundle GYP_OPTIONS="$GYP_OPTIONS -Dinjected_bundle_path=%{injected_bundle_path}" -# Chromium-EFL generated CAPI header files differently per profile. -# Until they are unified a function "ewk_settings_form_candidate_data_enabled_set()" cannot be used for wearable. -# Therefore, until chromium-efl gets refactored to emit devel packages equally for every profile, let's keep this. -GYP_OPTIONS="$GYP_OPTIONS -Dchromium_efl_workaround_ewk_settings=%{chromium_efl_workaround_ewk_settings}" - # Tizen product tv GYP_OPTIONS="$GYP_OPTIONS -Dtizen_product_tv=%{!?TIZEN_PRODUCT_TV:0}" GYP_OPTIONS_BASE="$GYP_OPTIONS" # TODO: do not use model_build_feature. -GYP_OPTIONS="$GYP_OPTIONS_BASE -Dtizen_model_formfactor=rectangle" echo "PROFILE = %{?profile}" # If it is unified or wearable, create circular-display extension %if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common" # TODO: do not use model_build_feature. -GYP_OPTIONS="$GYP_OPTIONS_BASE -Dtizen_model_formfactor=circle" mkdir -p build_circle ./tools/gyp/gyp $GYP_OPTIONS xwalk_tizen.gyp ninja -C out/Default %{?_smp_mflags} diff --git a/runtime/browser/native_watch_window.cc b/runtime/browser/native_watch_window.cc index 0052781c5..db74e3623 100644 --- a/runtime/browser/native_watch_window.cc +++ b/runtime/browser/native_watch_window.cc @@ -17,7 +17,7 @@ #include "runtime/browser/native_watch_window.h" #include "common/logger.h" -#include +#include #include namespace runtime { diff --git a/runtime/browser/popup.cc b/runtime/browser/popup.cc index 70aaee106..47f33cebd 100644 --- a/runtime/browser/popup.cc +++ b/runtime/browser/popup.cc @@ -17,6 +17,7 @@ #include "runtime/browser/popup.h" #include "common/logger.h" +#include "common/platform_info.h" #include "runtime/browser/native_window.h" #include "runtime/browser/popup_string.h" #include "runtime/common/constants.h" @@ -27,27 +28,17 @@ namespace { const char* kWRTEdjePath = "/usr/share/edje/xwalk/xwalk_tizen.edj"; -#ifdef MODEL_FORMFACTOR_CIRCLE const char* kWRTIconDeletePath = "/usr/share/icons/xwalk/tw_ic_popup_btn_delete.png"; const char* kWRTIconCheckPath = "/usr/share/icons/xwalk/tw_ic_popup_btn_check.png"; const char* kLayoutTheme = "content/circle/buttons2"; -const char* kContentTitle = "elm.text.title"; -const char* kContentText = "elm.text"; - -const char* kStylePopup = "circle"; -const char* kStyleCheck = "small"; -const char* kStyleButtonLeft = "popup/circle/left"; -const char* kStyleButtonRight = "popup/circle/right"; -#else -const char* kContentTitle = "title,text"; -const char* kContentText = NULL; - -const char* kStylePopup = "default"; -const char* kStyleCheck = "default"; -const char* kStyleButtonLeft = "popup"; -const char* kStyleButtonRight = "popup"; -#endif // MODEL_FORMFACTOR_CIRCLE +const char* kContentTitle = TIZEN_FEATURE_model_formfactor_circle ? "elm.text.title" : "title,text"; +const char* kContentText = TIZEN_FEATURE_model_formfactor_circle ? "elm.text" : NULL; + +const char* kStylePopup = TIZEN_FEATURE_model_formfactor_circle ? "circle" : "default"; +const char* kStyleCheck = TIZEN_FEATURE_model_formfactor_circle ? "small" : "default"; +const char* kStyleButtonLeft = TIZEN_FEATURE_model_formfactor_circle ? "popup/circle/left" : "popup"; +const char* kStyleButtonRight = TIZEN_FEATURE_model_formfactor_circle ? "popup/circle/right" : "popup"; const char* kContentButton1 = "button1"; const char* kContentButton2 = "button2"; @@ -84,17 +75,17 @@ static Evas_Object* AddButton(Popup* popup, const char* str_id, elm_object_part_content_set(popup->popup(), content, btn); evas_object_smart_callback_add(btn, kStateClicked, ButtonClickedCallback, popup); -#ifdef MODEL_FORMFACTOR_CIRCLE - Evas_Object* icon = elm_image_add(btn); - if (!strcmp(content, kContentButton1)) { - elm_image_file_set(icon, kWRTIconDeletePath, NULL); - } else { - elm_image_file_set(icon, kWRTIconCheckPath, NULL); + if (TIZEN_FEATURE_model_formfactor_circle) { + Evas_Object* icon = elm_image_add(btn); + if (!strcmp(content, kContentButton1)) { + elm_image_file_set(icon, kWRTIconDeletePath, NULL); + } else { + elm_image_file_set(icon, kWRTIconCheckPath, NULL); + } + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn, "elm.swallow.content", icon); + evas_object_show(icon); } - evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_part_content_set(btn, "elm.swallow.content", icon); - evas_object_show(icon); -#endif // MODEL_FORMFACTOR_CIRCLE return btn; } @@ -154,9 +145,8 @@ static Evas_Object* AddCheckBox(Evas_Object* parent) { Evas_Object* check = elm_check_add(parent); elm_object_style_set(check, kStyleCheck); evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); -#ifndef MODEL_FORMFACTOR_CIRCLE - elm_object_style_set(check, "multiline"); -#endif // MODEL_FORMFACTOR_CIRCLE + if (!TIZEN_FEATURE_model_formfactor_circle) + elm_object_style_set(check, "multiline"); elm_check_state_set(check, EINA_TRUE); return check; } @@ -172,24 +162,24 @@ Popup* Popup::CreatePopup(NativeWindow* window) { elm_object_style_set(popup, kStylePopup); Evas_Object* layout = elm_layout_add(popup); -#ifdef MODEL_FORMFACTOR_CIRCLE - elm_layout_theme_set(layout, "layout", "popup", kLayoutTheme); - elm_object_content_set(popup, layout); + Evas_Object* box; + if (TIZEN_FEATURE_model_formfactor_circle) { + elm_layout_theme_set(layout, "layout", "popup", kLayoutTheme); + elm_object_content_set(popup, layout); - Evas_Object* box = elm_box_add(layout); -#else - Evas_Object* box = elm_box_add(popup); -#endif // MODEL_FORMFACTOR_CIRCLE + box = elm_box_add(layout); + } else { + box = elm_box_add(popup); + } elm_box_padding_set(box, 0, 10); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); -#ifdef MODEL_FORMFACTOR_CIRCLE - elm_object_part_content_set(layout, "elm.swallow.content", box); -#else - elm_object_part_content_set(popup, "default", box); -#endif // MODEL_FORMFACTOR_CIRCLE + if (TIZEN_FEATURE_model_formfactor_circle) + elm_object_part_content_set(layout, "elm.swallow.content", box); + else + elm_object_part_content_set(popup, "default", box); evas_object_show(box); evas_object_event_callback_add(popup, EVAS_CALLBACK_RESIZE, NULL, NULL); @@ -276,10 +266,10 @@ void Popup::SetCheckBox(const std::string& str_id) { kTextDomainRuntime, str_id.c_str()); } -#ifdef MODEL_FORMFACTOR_CIRCLE - elm_object_part_content_set(box_, "elm.swallow.checkbox", check_box_); - evas_object_size_hint_min_set(check_box_, 0, 80); -#endif // MODEL_FORMFACTOR_CIRCLE + if (TIZEN_FEATURE_model_formfactor_circle) { + elm_object_part_content_set(box_, "elm.swallow.checkbox", check_box_); + evas_object_size_hint_min_set(check_box_, 0, 80); + } elm_box_pack_end(box_, check_box_); evas_object_show(check_box_); } @@ -290,11 +280,7 @@ bool Popup::GetCheckBoxResult() const { void Popup::SetTitle(const std::string& str_id) { elm_object_domain_translatable_part_text_set( -#ifdef MODEL_FORMFACTOR_CIRCLE - layout_, -#else - popup_, -#endif // MODEL_FORMFACTOR_CIRCLE + TIZEN_FEATURE_model_formfactor_circle ? layout_ : popup_, kContentTitle, kTextDomainRuntime, str_id.c_str()); @@ -309,12 +295,12 @@ void Popup::SetBody(const std::string& str_id) { elm_entry_utf8_to_markup(str_id.c_str())); evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); -#ifdef MODEL_FORMFACTOR_CIRCLE - evas_object_color_set(label, 255, 255, 255, 255); - elm_object_part_content_set(box_, "elm.swallow.label", label); -#else - evas_object_color_set(label, 0, 0, 0, 255); -#endif // MODEL_FORMFACTOR_CIRCLE + if (TIZEN_FEATURE_model_formfactor_circle) { + evas_object_color_set(label, 255, 255, 255, 255); + elm_object_part_content_set(box_, "elm.swallow.label", label); + } else { + evas_object_color_set(label, 0, 0, 0, 255); + } elm_box_pack_end(box_, label); evas_object_show(label); } diff --git a/runtime/browser/runtime.cc b/runtime/browser/runtime.cc index 8e68210b4..097f9dc15 100644 --- a/runtime/browser/runtime.cc +++ b/runtime/browser/runtime.cc @@ -25,12 +25,8 @@ #include "runtime/common/constants.h" #include "runtime/browser/runtime.h" #include "runtime/browser/ui_runtime.h" -#ifdef IME_FEATURE_SUPPORT #include "runtime/browser/ime_runtime.h" -#endif // IME_FEATURE_SUPPORT -#ifdef WATCH_FACE_FEATURE_SUPPORT #include "runtime/browser/watch_runtime.h" -#endif // WATCH_FACE_FEATURE_SUPPORT #define MAIN_LOOP_INTERVAL 1 @@ -41,22 +37,13 @@ Runtime::~Runtime() { std::unique_ptr Runtime::MakeRuntime( common::ApplicationData* app_data) { - if (app_data->app_type() == common::ApplicationData::UI) { - return std::unique_ptr(new UiRuntime(app_data)); - } -#ifdef IME_FEATURE_SUPPORT - else if (TIZEN_FEATURE_web_ime_support && - app_data->app_type() == common::ApplicationData::IME) { + if (TIZEN_FEATURE_web_ime_support && + app_data->app_type() == common::ApplicationData::IME) { return std::unique_ptr(new ImeRuntime(app_data)); - } -#endif // IME_FEATURE_SUPPORT -#ifdef WATCH_FACE_FEATURE_SUPPORT - else if (TIZEN_FEATURE_watch_face_support && - app_data->app_type() == common::ApplicationData::WATCH) { + } else if (TIZEN_FEATURE_watch_face_support && + app_data->app_type() == common::ApplicationData::WATCH) { return std::unique_ptr(new WatchRuntime(app_data)); - } -#endif // WATCH_FACE_FEATURE_SUPPORT - else { + } else { return std::unique_ptr(new UiRuntime(app_data)); } } diff --git a/runtime/browser/watch_runtime.cc b/runtime/browser/watch_runtime.cc index 749e4f90f..56e7fe533 100755 --- a/runtime/browser/watch_runtime.cc +++ b/runtime/browser/watch_runtime.cc @@ -14,8 +14,6 @@ * limitations under the License. */ -#include - #include #include diff --git a/runtime/browser/watch_runtime.h b/runtime/browser/watch_runtime.h index 7fd5c3add..d9b2dc7a5 100644 --- a/runtime/browser/watch_runtime.h +++ b/runtime/browser/watch_runtime.h @@ -18,7 +18,7 @@ #define XWALK_RUNTIME_BROWSER_WATCH_RUNTIME_H_ #include -#include +#include #include #include "common/application_data.h" diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index cff30b981..1461b180f 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -17,6 +17,7 @@ #include "runtime/browser/web_application.h" #include +#include #include #include #include @@ -28,10 +29,6 @@ #include #include -#ifdef WATCH_FACE_FEATURE_SUPPORT -#include -#endif - #include "common/application_data.h" #include "common/app_db.h" #include "common/app_control.h" @@ -326,12 +323,12 @@ WebApplication::WebApplication( is_window_inactive_(false), ewk_context_( ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH)), - firstframe_delay_timer_(NULL), has_ownership_of_ewk_context_(true), window_(window), appid_(app_data->app_id()), app_data_(app_data), - locale_manager_(new common::LocaleManager()) { + locale_manager_(new common::LocaleManager()), + firstframe_delay_timer_(NULL) { Initialize(); } @@ -347,12 +344,12 @@ WebApplication::WebApplication( is_close_page_called_(false), is_window_inactive_(false), ewk_context_(context), - firstframe_delay_timer_(NULL), has_ownership_of_ewk_context_(false), window_(window), appid_(app_data->app_id()), app_data_(app_data), - locale_manager_(new common::LocaleManager()) { + locale_manager_(new common::LocaleManager()), + firstframe_delay_timer_(NULL) { Initialize(); } diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc index 01050c5dc..73efa44d8 100755 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -226,10 +226,8 @@ void WebViewImpl::Initialize() { InitPopupWaitCallback(); InitUsermediaCallback(); InitEditorClientImeCallback(); -#ifdef ROTARY_EVENT_FEATURE_SUPPORT if (TIZEN_FEATURE_rotary_event_support) InitRotaryEventCallback(); -#endif // ROTARY_EVENT_FEATURE_SUPPORT Ewk_Settings* settings = ewk_view_settings_get(ewk_view_); ewk_settings_scripts_can_open_windows_set(settings, EINA_TRUE); @@ -237,10 +235,8 @@ void WebViewImpl::Initialize() { // TODO: After chromium-efl is refactored to supply the same header for tizen internal package building, this condition should be removed. // This is because chromium-efl does not declare ewk_settings_form_candidate_data_enabled_set() if it's wearable. // Chromium-efl should declare all function for Tizen packages while unsupported functions return errorcode or 0 without doing anything. -#ifndef CHROMIUM_EFL_WORKAROUND_EWK_SETTINGS if (common::getProfile() != common::kPROFILE_WEARABLE) ewk_settings_form_candidate_data_enabled_set(settings, EINA_TRUE); -#endif ewk_settings_default_text_encoding_name_set(settings, kDefaultEncoding); // TODO(sngn.lee): "protocolhandler,registration,requested" @@ -943,7 +939,6 @@ void WebViewImpl::InitEditorClientImeCallback() { smart_callbacks_["editorclient,ime,closed"] = ime_closed_callback; } -#ifdef ROTARY_EVENT_FEATURE_SUPPORT void WebViewImpl::InitRotaryEventCallback() { auto rotary_callback = [](void* user_data, Evas_Object*, @@ -968,7 +963,6 @@ void WebViewImpl::InitRotaryEventCallback() { eext_rotary_object_event_callback_add(ewk_view_, rotary_callback, this); eext_rotary_object_event_activated_set(ewk_view_, EINA_TRUE); } -#endif // ROTARY_EVENT_FEATURE_SUPPORT std::string WebViewImpl::GetUrl() { return std::string(ewk_view_url_get(ewk_view_)); diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index 1a4327231..1153d8f18 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -45,6 +45,16 @@ 'browser/prelauncher.cc', 'browser/preload_manager.h', 'browser/preload_manager.cc', + 'browser/ime_runtime.h', + 'browser/ime_runtime.cc', + 'browser/ime_application.h', + 'browser/ime_application.cc', + 'browser/native_ime_window.h', + 'browser/native_ime_window.cc', + 'browser/watch_runtime.h', + 'browser/watch_runtime.cc', + 'browser/native_watch_window.h', + 'browser/native_watch_window.cc', ], 'ldflags': [ '-pie', @@ -65,53 +75,15 @@ 'notification', 'launchpad', 'vc-webview', + 'capi-ui-inputmethod', + 'capi-appfw-watch-application', + 'appcore-watch', ], }, 'conditions': [ ['tizen_product_tv == "1"', { 'defines': ['TIZEN_PRODUCT_TV'], }], - ['tizen_model_formfactor == "circle"', { - 'defines': ['MODEL_FORMFACTOR_CIRCLE', - 'DISPLAY_RESIZE_SUPPORT'], - }], - ['tizen_feature_rotary_event_support == 1', { - 'defines': ['ROTARY_EVENT_FEATURE_SUPPORT'], - }], - ['tizen_feature_web_ime_support == 1', { - 'defines': ['IME_FEATURE_SUPPORT'], - 'sources': [ - 'browser/ime_runtime.h', - 'browser/ime_runtime.cc', - 'browser/ime_application.h', - 'browser/ime_application.cc', - 'browser/native_ime_window.h', - 'browser/native_ime_window.cc', - ], - 'variables': { - 'packages': [ - 'capi-ui-inputmethod', - ], - }, - }], - ['tizen_feature_watch_face_support == 1', { - 'defines': ['WATCH_FACE_FEATURE_SUPPORT'], - 'sources': [ - 'browser/watch_runtime.h', - 'browser/watch_runtime.cc', - 'browser/native_watch_window.h', - 'browser/native_watch_window.cc', - ], - 'variables': { - 'packages': [ - 'capi-appfw-watch-application', - 'appcore-watch', - ], - }, - }], - ['chromium_efl_workaround_ewk_settings == 1', { - 'defines': ['CHROMIUM_EFL_WORKAROUND_EWK_SETTINGS'], - }], ], }, # end of target 'xwalk_runtime' {