gesture_recognizer_->AddGestureEventHelper(this);
}
-void RenderWidgetHostViewEfl::Init(Evas_Object* view) {
+void RenderWidgetHostViewEfl::Init(Evas_Object* view, const gfx::Size& size) {
DCHECK(view);
content_image_ = view;
evas_ = evas_object_evas_get(view);
im_context_ = IMContextEfl::Create(this);
if (is_hw_accelerated_) {
- gfx::Rect bounds = GetViewBoundsInPix();
- if (!bounds.IsEmpty()) {
- Init_EvasGL(bounds.width(), bounds.height());
- } else {
- int w, h;
- evas_object_image_size_get(content_image_, &w, &h);
- Init_EvasGL(w, h);
- }
+ DCHECK(!size.IsEmpty());
+ Init_EvasGL(size.width(), size.height());
}
#if defined(OS_TIZEN_MOBILE)
void set_magnifier(bool status);
void Init_EvasGL(int width, int height);
- void Init(Evas_Object* view);
+ void Init(Evas_Object* view, const gfx::Size& size);
void set_eweb_view(EWebView* webview) { web_view_ = webview; }
EWebView* eweb_view() const { return web_view_; }
void SetComposition(const ui::CompositionText& composition_text);
void ConfirmComposition(base::string16& text);
-
+
bool IsScrollOffsetChanged() const { return scroll_offset_changed_; }
void SetScrollOffsetChanged() { scroll_offset_changed_ = true; }
// the result of the callback is the first one that has been created.
contents_for_new_window_ = NULL;
} else {
- WebContents::CreateParams params(context_->browser_context());
- params.context = GetContentImageObject();
- web_contents_.reset(WebContents::Create(params));
+ InitializeContent();
}
web_contents_delegate_.reset(new WebContentsDelegateEfl(this));
web_contents_->SetDelegate(web_contents_delegate_.get());
}
void EWebView::HandleRendererProcessCrash() {
- const char* last_url = GetURL();
+ InitializeContent();
+}
+
+void EWebView::InitializeContent() {
+ int width, height;
+ evas_object_geometry_get(evas_object_, 0, 0, &width, &height);
+
+ if (width == 0 || height == 0) {
+ // The evas_object_ may not be part of the EFL/Elementary layout tree.
+ // As a result we may not know it's size, yet. In such case use window
+ // size instead. RenderWidgetHostViewEfl can already handle native view
+ // resizes, so when the final size of the widget is known it'll resize
+ // itself. In the meantime use window size to make sure the view can be
+ // initialized properly.
+ Evas* evas = evas_object_evas_get(evas_object_);
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas);
+ ecore_evas_geometry_get(ee, 0, 0, &width, &height);
+ CHECK(width > 0 && height > 0);
+ }
WebContents::CreateParams params(context_->browser_context());
params.context = GetContentImageObject();
+ params.initial_size = gfx::Size(width, height);
web_contents_.reset(WebContents::Create(params));
web_contents_delegate_.reset(new WebContentsDelegateEfl(this));
web_contents_->SetDelegate(web_contents_delegate_.get());
- bool callback_handled = false;
- SmartCallback<EWebViewCallbacks::WebProcessCrashed>().call(&callback_handled);
- if (!callback_handled)
- LoadHTMLString(kRendererCrashedHTMLMessage, NULL, last_url);
+ back_forward_list_.reset(
+ new tizen_webview::BackForwardList(web_contents_->GetController()));
+
+ LOG(INFO) << "Initial WebContents size: " << params.initial_size.ToString();
}
#if defined(OS_TIZEN_MOBILE) && !defined(EWK_BRINGUP)