// being created occurs).
virtual void DidCreateNewDocument() {}
virtual void DidCreateDocumentElement() {}
-#if BUILDFLAG(IS_EFL)
- virtual void DidUpdateMainFrameLayout() {}
-#endif
// TODO(dgozman): replace next two methods with DidFinishNavigation.
// DidCommitProvisionalLoad is only called for new-document navigations.
// Use DidFinishSameDocumentNavigation for same-document navigations.
UpdateEncoding(frame_, frame_->View()->PageEncoding().Utf8());
}
-#if BUILDFLAG(IS_EFL)
-void RenderFrameImpl::DidUpdateMainFrameLayout() {
- for (auto& observer : observers_)
- observer.DidUpdateMainFrameLayout();
-}
-#endif
-
void RenderFrameImpl::RunScriptsAtDocumentReady() {
DCHECK(initialized_);
GetContentClient()->renderer()->RunScriptsAtDocumentEnd(this);
blink::WebDocumentLoader* document_loader) override;
void DidClearWindowObject() override;
void DidCreateDocumentElement() override;
-#if BUILDFLAG(IS_EFL)
- void DidUpdateMainFrameLayout() override;
-#endif
void RunScriptsAtDocumentElementAvailable() override;
void DidReceiveTitle(const blink::WebString& title) override;
void DidDispatchDOMContentLoadedEvent() override;
// This method may not invalidate the frame, nor execute JavaScript code.
virtual void DidCreateDocumentElement() {}
-#if BUILDFLAG(IS_EFL)
- virtual void DidUpdateMainFrameLayout() {}
-#endif
-
// Like |didCreateDocumentElement|, except this method may run JavaScript
// code (and possibly invalidate the frame).
virtual void RunScriptsAtDocumentElementAvailable() {}
if (!web_view_client_)
return;
-#if BUILDFLAG(IS_EFL)
- if (MainFrameImpl() && MainFrameImpl()->Client())
- MainFrameImpl()->Client()->DidUpdateMainFrameLayout();
-#endif
-
for (auto& observer : observers_)
observer.DidUpdateMainFrameLayout();
needs_preferred_size_update_ = true;
"renderer/render_thread_observer_efl.h",
"renderer/tizen_extensible.cc",
"renderer/tizen_extensible.h",
+ "renderer/web_view_observer_efl.cc",
+ "renderer/web_view_observer_efl.h",
"web_contents_observer_efl.cc",
"web_contents_observer_efl.h",
"wrt/dynamicplugin.cc",
#include "renderer/gin_native_bridge_dispatcher.h"
#include "renderer/plugins/plugin_placeholder_efl.h"
#include "renderer/render_frame_observer_efl.h"
+#include "renderer/web_view_observer_efl.h"
#include "third_party/blink/public/platform/url_conversion.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/platform/web_url_request_extra_data.h"
#endif
}
-#if !defined(EWK_BRINGUP) // FIXME: m108 bringup
-void ContentRendererClientEfl::RenderViewCreated(content::RenderView* render_view) {
- ApplyCustomMobileSettings(render_view->GetWebView());
+void ContentRendererClientEfl::WebViewCreated(
+ blink::WebView* web_view,
+ bool was_created_by_renderer,
+ const url::Origin* outermost_origin) {
+ ApplyCustomMobileSettings(web_view);
+
+ new WebViewObserverEfl(web_view);
#if !defined(EWK_BRINGUP) // FIXME: m94 bringup
- // Deletes itself when render_view is destroyed.
- new RenderViewObserverEfl(render_view, this);
new editing::EditorClientAgent(render_view);
-#endif
-
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
render_view->SetWrtUrlParser(wrt_url_parser_.get());
#endif
}
-#endif
bool ContentRendererClientEfl::OverrideCreatePlugin(
content::RenderFrame* render_frame,
class ContentRendererClientEfl : public content::ContentRendererClient {
public:
ContentRendererClientEfl();
+
+ ContentRendererClientEfl(const ContentRendererClientEfl&) = delete;
+ ContentRendererClientEfl& operator=(const ContentRendererClientEfl&) = delete;
+
~ContentRendererClientEfl() override;
void RenderThreadStarted() override;
-
void RenderFrameCreated(content::RenderFrame* render_frame) override;
-#if !defined(EWK_BRINGUP) // FIXME: m108 bringup
- void RenderViewCreated(content::RenderView* render_view);
-#endif
+ void WebViewCreated(blink::WebView* web_view,
+ bool was_created_by_renderer,
+ const url::Origin* outermost_origin) override;
bool OverrideCreatePlugin(
content::RenderFrame* render_frame,
const blink::WebPluginParams& params,
bool shutting_down_ = false;
};
-#endif
+#endif // CONTENT_RENDERER_CLIENT_EFL_H
#endif
}
-void RenderFrameObserverEfl::DidUpdateMainFrameLayout() {
- blink::WebView* view = render_frame()->GetWebView();
- if (!view || !view->MainFrame() || !view->MainFrame()->IsWebLocalFrame())
- return;
-
- gfx::Size contents_size =
- view->MainFrame()->ToWebLocalFrame()->DocumentSize();
-
- // Fall back to contentsPreferredMinimumSize if the mainFrame is reporting a
- // 0x0 size (this happens during initial load).
- if (contents_size.IsEmpty()) {
- contents_size = render_frame()
- ->GetWebView()
- ->ContentsPreferredMinimumSize();
- }
-
- if (contents_size == last_sent_contents_size_)
- return;
-
- last_sent_contents_size_ = contents_size;
- Send(new EwkHostMsg_DidChangeContentsSize(render_frame()->GetRoutingID(),
- contents_size.width(),
- contents_size.height()));
-}
-
void RenderFrameObserverEfl::WillSubmitForm(
const blink::WebFormElement& form) {
GURL url(blink::WebStringToGURL(form.Action()));
int world_id) override;
void WillReleaseScriptContext(v8::Handle<v8::Context> context,
int world_id) override;
- void DidUpdateMainFrameLayout() override;
-
void DidCreateDocumentElement() override;
private:
gfx::Size max_scroll_offset_;
gfx::Size last_scroll_offset_;
- gfx::Size last_sent_contents_size_;
service_manager::BinderRegistry registry_;
blink::AssociatedInterfaceRegistry associated_interfaces_;
};
--- /dev/null
+// Copyright 2022 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 "renderer/web_view_observer_efl.h"
+
+#include "common/render_messages_ewk.h"
+#include "content/public/renderer/render_frame.h"
+#include "third_party/blink/public/web/web_local_frame.h"
+#include "third_party/blink/public/web/web_view.h"
+
+WebViewObserverEfl::WebViewObserverEfl(blink::WebView* web_view)
+ : blink::WebViewObserver(web_view) {}
+
+WebViewObserverEfl::~WebViewObserverEfl() = default;
+
+void WebViewObserverEfl::OnDestruct() {
+ delete this;
+}
+
+void WebViewObserverEfl::DidUpdateMainFrameLayout() {
+ blink::WebView* webview = GetWebView();
+ blink::WebFrame* main_frame = webview->MainFrame();
+ if (!main_frame || !main_frame->IsWebLocalFrame())
+ return;
+
+ gfx::Size contents_size = main_frame->ToWebLocalFrame()->DocumentSize();
+
+ // Fall back to contentsPreferredMinimumSize if the mainFrame is reporting a
+ // 0x0 size (this happens during initial load).
+ if (contents_size.IsEmpty())
+ contents_size = GetWebView()->ContentsPreferredMinimumSize();
+
+ if (contents_size == last_sent_contents_size_)
+ return;
+
+ last_sent_contents_size_ = contents_size;
+
+ content::RenderFrame* render_frame =
+ content::RenderFrame::FromWebFrame(main_frame->ToWebLocalFrame());
+ render_frame->Send(new EwkHostMsg_DidChangeContentsSize(
+ render_frame->GetRoutingID(), contents_size.width(),
+ contents_size.height()));
+}
--- /dev/null
+// Copyright 2022 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 WEB_VIEW_OBSERVER_EFL_H_
+#define WEB_VIEW_OBSERVER_EFL_H_
+
+#include "third_party/blink/public/web/web_view_observer.h"
+#include "ui/gfx/geometry/size.h"
+
+class WebViewObserverEfl : public blink::WebViewObserver {
+ public:
+ WebViewObserverEfl(blink::WebView* web_view);
+
+ WebViewObserverEfl(const WebViewObserverEfl&) = delete;
+ WebViewObserverEfl& operator=(const WebViewObserverEfl&) = delete;
+
+ // blink::WebViewObserver implementation.
+ void OnDestruct() override;
+ void DidUpdateMainFrameLayout() override;
+
+ private:
+ ~WebViewObserverEfl() override;
+
+ gfx::Size last_sent_contents_size_;
+};
+
+#endif // WEB_VIEW_OBSERVER_EFL_H_