Window creation mis-setup Evas_Object hierarchy
authorAntonio Gomes <a1.gomes@samsung.com>
Fri, 9 Oct 2015 22:20:52 +0000 (18:20 -0400)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
When a new window is created originated from window.open
or target=_blank, we have to follow EWK procedure
of creating windows: a smart signal is emitted, and the embedding
app can allow or deny the creation.
In that process, RWHVEfl is created when
WebContentsView::CreateViewForWidget is called from
WebContentsImplEfl::HandleNewWebContentsCreate.

RWHVEfl owns SelectionControllEfl. At the time of its
creation, we have to ensure that the EFL widgets are
properly set up. Patch adds a hook to allow that.

In regular window creation, for example, when user clicks
a new window/tab button, the regular chromium flow is taken,
instead of this special codepath.

Original beta/m42 patch:
- http://165.213.202.130/gerrit/#/c/90112/ , reviewed by
Janusz Majnert, arno renevier.

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=14476

Reviewed by: a.renevier

Change-Id: If250990897051af40fee36224bdc278521bb6d9a
Signed-off-by: Antonio Gomes <a1.gomes@samsung.com>
tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc
tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc
tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h

index 72cc4a4..945d0fb 100644 (file)
@@ -265,7 +265,9 @@ WebContents* WebContentsImplEfl::HandleNewWebContentsCreate(
 
   // Added for EFL port
   new_contents->platform_data_ = platform_data;
-  // Added for EFL port
+  if (efl_delegate_)
+      efl_delegate_->SetUpSmartObject(platform_data, new_contents->GetNativeView());
+  // End of EFL port specific code.
 
   // Save the window for later if we're not suppressing the opener (since it
   // will be shown immediately).
index 586ee5c..1009809 100644 (file)
@@ -44,6 +44,12 @@ class CONTENT_EXPORT WebContentsEflDelegate {
   // such case the function should return true. Returning false means new web
   // contents creation should be handled in normal, synchronous manner.
   virtual bool WebContentsCreateAsync(WebContentsCreateCallback) = 0;
+
+  // Make it possible to early hook native_view and its associated smart
+  // parent.
+  // This is needed when a window is created with window.open or target:_blank,
+  // where RenderWidgetHostViewXXX objects are created earlier in the call chain.
+  virtual void SetUpSmartObject(void* platform_data, void* native_view) = 0;
 };
 
 } // namespace content
index 949708a..8f22a2c 100644 (file)
@@ -212,6 +212,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* GetEvas() const { return evas_object_evas_get(evas_object_); }
   PermissionPopupManager* GetPermissionPopupManager() const
   {
index 87648fc..da37b94 100644 (file)
@@ -33,3 +33,9 @@ bool WebContentsEflDelegateEwk::WebContentsCreateAsync(
   web_view_->CreateNewWindow(callback);
   return true;
 }
+
+void WebContentsEflDelegateEwk::SetUpSmartObject(void* platform_data, void* native_view) {
+  EWebView* new_web_view = static_cast<EWebView*>(platform_data);
+  Evas_Object* _native_view = static_cast<Evas_Object*>(native_view);
+  evas_object_smart_member_add(_native_view, new_web_view->evas_object());
+}
index 12de17f..8b60c1c 100644 (file)
@@ -18,6 +18,8 @@ class WebContentsEflDelegateEwk : public content::WebContentsEflDelegate {
 
   bool WebContentsCreateAsync(WebContentsCreateCallback) override;
 
+  void SetUpSmartObject(void*platform_data, void* native_view) override;
+
  private:
   EWebView* web_view_;