}
}
+void InputManager::OverlayBoundsChanged(gfx::Rect bounds) {
+ LOG(INFO) << "new bounds: " << bounds.ToString();
+ for (auto& observer : m_observer_list) {
+ observer.OverlayBoundsChanged(bounds);
+ }
+}
+
} // namespace samsung_input_manager
#include "base/observer_list.h"
#include "base/scoped_observation.h"
#include "components/samsung/public/input_provider/input_provider.h"
+#include "ui/gfx/geometry/rect.h"
namespace samsung_input_manager {
int y){};
virtual void BrowserWindowFocusIn(){};
virtual void BrowserWindowFocusOut(){};
+ virtual void OverlayBoundsChanged(gfx::Rect bounds){};
};
void Init();
int y) override;
void BrowserWindowFocusIn() override;
void BrowserWindowFocusOut() override;
+ void OverlayBoundsChanged(gfx::Rect bounds) override;
private:
base::ObserverList<Observer>::Unchecked m_observer_list;
#include "components/samsung/public/samsung_config_key.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
+#include "content/public/browser/render_view_host.h"
namespace samsung_browser_controller {
this);
samsung_browser_main::SamsungBrowserCore::instance()
->AddLowMemoryStateObserver(this);
+ auto input_manager =
+ samsung_browser_main::SamsungBrowserCore::instance()->InputManager();
+ input_manager->AddObserver(this);
+
Browser* browser_ = samsung_browser_main::SamsungBrowserCore::instance()
->GetBrowserInstance();
if (browser_ == nullptr) {
}
tab_strip_model->RemoveObserver(this);
+ auto input_manager =
+ samsung_browser_main::SamsungBrowserCore::instance()->InputManager();
+ input_manager->RemoveObserver(this);
}
void SamsungWebContentsController::ReInit() {
}
}
+void SamsungWebContentsController::OverlayBoundsChanged(gfx::Rect bounds) {
+ Browser* browser = samsung_browser_main::SamsungBrowserCore::instance()
+ ->GetBrowserInstance();
+ LOG(INFO) << " bounds : " << bounds.ToString();
+ if (!browser || !browser->tab_strip_model()) {
+ LOG(INFO) << "Either browser or tab_strip mode is NULL";
+ return;
+ }
+
+ auto web_content = browser->tab_strip_model()->GetActiveWebContents();
+ if (!web_content) {
+ LOG(INFO) << " webview is null";
+ return;
+ }
+
+ if (content::RenderViewHost* render_view_host =
+ web_content->GetRenderViewHost()) {
+ if (auto& broadcast =
+ static_cast<content::RenderViewHostImpl*>(render_view_host)
+ ->GetAssociatedPageBroadcast()) {
+ LOG(INFO) << "scrolling into view port";
+ broadcast->ScrollFocusedNodeIntoView();
+ }
+ }
+ int ui_height =
+ 85; // Need to inveestigate how to get this height from chrome layer.
+ gfx::Rect newBounds = bounds;
+ newBounds.set_height(newBounds.height() - ui_height);
+ gfx::Rect currentBounds = web_content->GetNativeView()->bounds();
+ LOG(INFO) << "newBounds: " << newBounds.ToString();
+ LOG(INFO) << "currentBounds: " << currentBounds.ToString();
+ if (currentBounds == newBounds) {
+ LOG(INFO) << "webview already in right size";
+ }
+ web_content->GetNativeView()->SetBounds(newBounds);
+}
+
} // namespace samsung_browser_controller
#define CHROME_BROWSER_UI_SAMSUNG_WEB_CONTENTS_CONTROLLER_H_
#include "base/logging.h"
+#include "chrome/browser/ui/samsung/input_manager.h"
#include "chrome/browser/ui/samsung/samsung_browser_core.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "content/public/browser/web_contents.h"
class SamsungWebContentsController
: public samsung_browser_main::SamsungBrowserCore::BrowserStateObserver,
public samsung_browser_main::SamsungBrowserCore::LowMemoryStateObserver,
+ public samsung_input_manager::InputManager::Observer,
public TabStripModelObserver {
public:
explicit SamsungWebContentsController();
const TabStripModelChange& change,
const TabStripSelectionChange& selection) override;
+ void OverlayBoundsChanged(gfx::Rect bounds) override;
+
private:
int max_num_undiscarded_webviews_;
int max_tabs_;
#include "base/logging.h"
#include "components/samsung/public/input_provider/input_provider.h"
#include "tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.h"
+#include "ui/gfx/geometry/rect.h"
namespace samsung_browser_main {
m_ecoreEventHandlerMouseUp(nullptr),
input_provider_(input_provider),
evas_window_(nullptr),
- win_obj_(nullptr) {}
+ overlay_obj_(nullptr) {}
InputProviderImpl::~InputProviderImpl() {
DeInit();
}
}
+void InputProviderImpl::OverlayResized(void* data,
+ Evas* e,
+ Evas_Object* obj,
+ void* event_info) {
+ int x = 0, y = 0, w = 0, h = 0;
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ LOG(INFO) << " Size of overlay: x[" << x << "] y[" << y << "] w[" << w
+ << "] h[" << h << "];";
+ if (h == 1079 || h == 0) {
+ LOG(INFO) << "Invalid overlay dimensions";
+ return;
+ }
+
+ InputProviderImpl* self = static_cast<InputProviderImpl*>(data);
+ gfx::Rect overlayBounds(x, y, w, h);
+ if (self) {
+ self->input_provider_->OverlayBoundsChanged(overlayBounds);
+ }
+}
+
void InputProviderImpl::SetWindow(aura::WindowTreeHost* window_host) {
LOG(INFO) << "";
ui::EflWindow* window = static_cast<ui::EflWindow*>(
LOG(INFO) << "Got EFL Window";
if (window) {
evas_window_ = window->evas();
- win_obj_ = window->native_view();
- // RegisterCanvasEvents();
+ overlay_obj_ = window->native_view(); // For details about overlay check
+ // EflWindow::CreateOverlay()
+ evas_object_event_callback_add(overlay_obj_, EVAS_CALLBACK_RESIZE,
+ OverlayResized, this);
}
if (evas_window_) {
LOG(INFO) << "Success";
static void callbackWindowFocusIn(void* data, Evas* pEvas, void* eventInfo);
static void callbackWindowFocusOut(void* data, Evas* pEvas, void* eventInfo);
+ static void OverlayResized(void* data,
+ Evas* e,
+ Evas_Object* obj,
+ void* event_info);
+
Ecore_Event_Filter* m_filter;
Ecore_Event_Handler* m_ecoreEventHandlerMouseIn;
Ecore_Event_Handler* m_ecoreEventHandlerMouseOut;
const raw_ptr<InputProvider> input_provider_;
Evas* evas_window_;
- Evas_Object* win_obj_;
+ Evas_Object* overlay_obj_;
};
} // namespace samsung_browser_main
#endif // COMPONENTS_SAMSUNG_INPUT_PROVIDER_INPUT_PROVIDER_IMPL_H_
NotifyBrowserWindowFocusOut();
}
+void InputProvider::OverlayBoundsChanged(gfx::Rect bounds) {
+ for (auto& observer : m_observer_list) {
+ LOG(INFO) << "new bounds" << bounds.ToString();
+ observer.OverlayBoundsChanged(bounds);
+ }
+}
+
void InputProvider::NotifyBrowserWindowFocusOut() {
for (auto& observer : m_observer_list) {
observer.BrowserWindowFocusOut();
#include "base/scoped_observation.h"
#include "components/samsung/public/samsung_browser_enums.h"
#include "ui/aura/window_tree_host_platform.h"
+#include "ui/gfx/geometry/rect.h"
namespace samsung_browser_main {
virtual void MouseButton(KeyEventType keyType, int button, int x, int y){};
virtual void BrowserWindowFocusIn(){};
virtual void BrowserWindowFocusOut(){};
+ virtual void OverlayBoundsChanged(gfx::Rect bounds){};
};
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
-
void SetWindow(aura::WindowTreeHost* window_host);
bool CallbackFilter(std::string key,
void MouseUp(int button, int x, int y);
void BrowserWindowFocusIn();
void BrowserWindowFocusOut();
+ void OverlayBoundsChanged(gfx::Rect bounds);
private:
bool NotifyCallbackFilter(std::string key,
// Evas engine creates it's own egl window and egl surface to render.
// Eventually additional GEM memory is created for rendering. Enable evas
// manual rendering to prevent this symptom.
+#if !defined(SAMSUNG_NEXT_BROWSER)
ecore_evas_manual_render_set(ee_, EINA_TRUE);
+#endif
#if defined(USE_WAYLAND)
wl_window_ = ecore_evas_wayland2_window_get(ee_);
}
Evas_Object* EflWindow::CreateOverlay() {
+#if defined(SAMSUNG_NEXT_BROWSER)
+ elm_win_conformant_set(elm_win_, EINA_TRUE);
+ Evas_Object* conformant = elm_conformant_add(elm_win_);
+ evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(elm_win_, conformant);
+
+ evas_object_show(conformant);
+#endif
Evas_Object* layout = elm_layout_add(elm_win_);
base::FilePath edj_dir, main_edj;
Evas_Object* overlay = elm_bg_add(layout);
elm_object_part_content_set(layout, "content", overlay);
evas_object_geometry_set(overlay, 0, 0, bounds_.width(), bounds_.height());
+#if defined(SAMSUNG_NEXT_BROWSER)
+ elm_object_content_set(conformant, overlay);
+#endif
return overlay;
}
if (ime_style_ == ImeStyle::IME_STYLE_FLOATING) {
LOG(INFO) << "set floating_ui";
im_data.append("&action=floating_ui");
- } else if (ime_style_ == ImeStyle::IME_STYLE_DYNAMIC) {
+ }
+#if !defined(SAMSUNG_NEXT_BROWSER)
+ else if (ime_style_ == ImeStyle::IME_STYLE_DYNAMIC) {
LOG(INFO) << "set dynamic_ui";
im_data.append("&action=dynamic_ui");
}
-
+#endif
ecore_imf_context_input_panel_imdata_set(context_, im_data.c_str(),
im_data.length());