From c862df8f818167c2ea4aa66b680669f06c2b4f36 Mon Sep 17 00:00:00 2001 From: Tae-Jeong Lee Date: Fri, 13 Sep 2013 14:22:01 +0900 Subject: [PATCH] Temporary fix for asking geolocation permission popup crash. [Issue#] N/A [Problem] A crash occurs when webkit ask geolocation permission to wrt. [Cause] The ui popup has been created base on 'ewk_view' obejct. [Solution] Fixed to creating popup based on window object by getParentWindow() api. Change-Id: I62fa67da6de5d07cba52f6162290e3ff9af9dcd0 --- src/view/common/view_logic_certificate_support.cpp | 2 + .../common/view_logic_get_parent_window_util.h | 57 ++++++++++++++++++++++ .../common/view_logic_security_origin_support.cpp | 4 +- src/view/webkit/view_logic_usermedia_support.cpp | 4 +- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 src/view/common/view_logic_get_parent_window_util.h diff --git a/src/view/common/view_logic_certificate_support.cpp b/src/view/common/view_logic_certificate_support.cpp index 50f2fc4..5e02bba 100755 --- a/src/view/common/view_logic_certificate_support.cpp +++ b/src/view/common/view_logic_certificate_support.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace ViewModule { @@ -93,6 +94,7 @@ Evas_Object* CertificateSupportUtil::createPopup( { LogDebug("createPopup"); + Evas_Object* parentWindow = PopupUtil::getParentWindow(window); Evas_Object* popup = elm_popup_add(window); elm_object_style_set(popup, "popup/default"); evas_object_size_hint_weight_set(popup, diff --git a/src/view/common/view_logic_get_parent_window_util.h b/src/view/common/view_logic_get_parent_window_util.h new file mode 100644 index 0000000..8dc2707 --- /dev/null +++ b/src/view/common/view_logic_get_parent_window_util.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file view_logic_get_parent_window_util.h + * @author Tae-Jeong Lee (taejeong.lee@samsung.com) + */ + +#ifndef VIEW_LOGIC_GET_PARENT_WINDOW_UTIL_H_ +#define VIEW_LOGIC_GET_PARENT_WINDOW_UTIL_H_ + +#include +#include + +namespace ViewModule { +namespace PopupUtil { + +static Evas_Object* getParentWindow(Evas_Object* object) +{ + Evas_Object* parent = elm_object_parent_widget_get(object); + Evas_Object* win = parent; + + while (parent) { + const char* type = elm_object_widget_type_get(parent); + if (type) { + if (!strncmp(type, "elm_win", strlen("elm_win"))) { + win = parent; + break; + } + } + parent = elm_object_parent_widget_get(parent); + } + + if (!win) + { + LogError("Parent window was not found!"); + win = object; + } + + return win; +} + +} //namespace ViewModule +} //namespace PopupUtil +#endif //VIEW_LOGIC_GET_PARENT_WINDOW_UTIL_H_ diff --git a/src/view/common/view_logic_security_origin_support.cpp b/src/view/common/view_logic_security_origin_support.cpp index 11711a6..900b9d8 100644 --- a/src/view/common/view_logic_security_origin_support.cpp +++ b/src/view/common/view_logic_security_origin_support.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace ViewModule { @@ -92,7 +93,8 @@ Evas_Object* SecurityOriginSupportUtil::createPopup( void* data) { LogDebug("createPopup"); - Evas_Object* popup = elm_popup_add(window); + Evas_Object* parentWindow = PopupUtil::getParentWindow(window); + Evas_Object* popup = elm_popup_add(parentWindow); elm_object_style_set(popup, "popup/default"); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, diff --git a/src/view/webkit/view_logic_usermedia_support.cpp b/src/view/webkit/view_logic_usermedia_support.cpp index f3260ee..7e1adde 100755 --- a/src/view/webkit/view_logic_usermedia_support.cpp +++ b/src/view/webkit/view_logic_usermedia_support.cpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace ViewModule { using namespace SecurityOriginDB; @@ -45,7 +46,8 @@ void askUserForUsermediaPermission(Evas_Object* window, PermissionData* data) { LogDebug("askUserForUsermediaPermission called"); - Evas_Object* popup = elm_popup_add(window); + Evas_Object* parentWindow = PopupUtil::getParentWindow(window); + Evas_Object* popup = elm_popup_add(parentWindow); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(popup, USERMEDIA_USE_ASK_BODY); -- 2.7.4