void RenderFrameImpl::DidChangeSelection(bool is_empty_selection,
blink::SyncCondition force_sync) {
+#if !BUILDFLAG(IS_EFL)
+ // In EFL/TIZEN, application can get selection text in RWHVBase by using
+ // ewk_view_text_selection_text_get(). But selected text by javascript
+ // doesn't synced because of below condition. To support API properly
+ // we should sync selection information regardless of below condition.
+ // Additionally, when selecting text via context menu by pressing "Select"
+ // menu item, selection has to be sync'ed regardless of the conditions below.
if (!GetLocalRootWebFrameWidget()->HandlingInputEvent() &&
!GetLocalRootWebFrameWidget()->HandlingSelectRange())
return;
-
+#endif
if (is_empty_selection)
selection_text_.clear();
return user_agent_app_name_.c_str();
}
-const char* EWebView::GetSelectedText() const {
-#if !defined(USE_AURA)
- if (!rwhv())
+const char* EWebView::CacheSelectedText() {
+ if (!rwhva())
return "";
- return base::UTF16ToUTF8(rwhv()->GetSelectedText()).c_str();
-#else
- return "";
-#endif
+ selected_text_cached_ = base::UTF16ToUTF8(rwhva()->GetSelectedText());
+ return selected_text_cached_.c_str();
}
_Ewk_Frame* EWebView::GetMainFrame() {
bool GetPrivateBrowsing() const;
const char* GetUserAgent() const;
const char* GetUserAgentAppName() const;
- const char* GetSelectedText() const;
+ const char* CacheSelectedText();
Ewk_Settings* GetSettings() { return settings_.get(); }
_Ewk_Frame* GetMainFrame();
void UpdateWebKitPreferences();
mutable std::string user_agent_;
mutable std::string user_agent_app_name_;
std::unique_ptr<_Ewk_Auth_Challenge> auth_challenge_;
+ std::string selected_text_cached_;
Eina_List* popupMenuItems_;
Popup_Picker* popupPicker_;
const char* ewk_view_text_selection_text_get(Evas_Object* view)
{
EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, NULL);
- return impl->GetSelectedText();
+ return impl->CacheSelectedText();
}
void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)