Fix zooming in fullscreen mode
authorDaniel Waślicki <d.waslicki@partner.samsung.com>
Mon, 16 Jun 2014 21:51:20 +0000 (14:51 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
[Issue] After opening HTML element in fullscreen mode
with element.requestFullScreen() method, browser allowed
to zoom in and out content under fullscreen layer. It caused
incorrect display of the top layer.

[Solution] Disable pinch events (which are responsible for zooming)
when web_contents is in fullscreen mode or
in case that they are disabled with switch --disable-pinch.

Task: CBWEBCORE-136
Change-Id: I5891f07fee141e0975f90f95f43e708f67eb4dff

tizen_src/impl/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/impl/eweb_view.cc
tizen_src/impl/eweb_view.h
tizen_src/impl/web_contents_delegate_efl.cc
tizen_src/impl/web_contents_delegate_efl.h

index b17a82d..e29b2e5 100644 (file)
@@ -1099,6 +1099,14 @@ void RenderWidgetHostViewEfl::OnDidInputEventHandled(const blink::WebInputEvent*
 #endif
 
 void RenderWidgetHostViewEfl::HandleGesture(ui::GestureEvent* event) {
+  if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
+       event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
+       event->type() == ui::ET_GESTURE_PINCH_END) &&
+      (!pinch_zoom_enabled_ || eweb_view()->IsFullscreen())) {
+    event->SetHandled();
+    return;
+  }
+
   blink::WebGestureEvent gesture = content::MakeWebGestureEventFromUIEvent(*event);
 
   gesture.x = event->x();
index fcea01d..c3dac41 100644 (file)
@@ -1504,6 +1504,11 @@ void MHTMLCallbackDetails::Run(Evas_Object* obj, const std::string& mhtml_conten
     callback_func_(obj, mhtml_content.c_str(), user_data_);
 }
 
+bool EWebView::IsFullscreen() {
+  WebContents* web_contents = web_contents_delegate_->web_contents();
+  return web_contents_delegate_->IsFullscreenForTabOrPending(web_contents);
+}
+
 void EWebView::ExitFullscreen() {
   RenderViewHost* rvh = web_contents_delegate_->web_contents()->GetRenderViewHost();
   if (!rvh)
index 99693ce..940704a 100644 (file)
@@ -231,6 +231,7 @@ class EWebView
 
   bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data);
   void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id);
+  bool IsFullscreen();
   void ExitFullscreen();
   double GetScale();
   void DidChangePageScaleFactor(double scale_factor);
index bb50674..df426a2 100755 (executable)
@@ -117,11 +117,18 @@ void WebContentsDelegateEfl::CloseContents(WebContents* source) {
 
 void WebContentsDelegateEfl::ToggleFullscreenModeForTab(WebContents* web_contents,
       bool enter_fullscreen) {
+  is_fullscreen_ = enter_fullscreen;
   if(enter_fullscreen)
     web_view_->SmartCallback<EWebViewCallbacks::EnterFullscreen>().call();
   else
     web_view_->SmartCallback<EWebViewCallbacks::ExitFullscreen>().call();
 }
+
+bool WebContentsDelegateEfl::IsFullscreenForTabOrPending(
+      const WebContents* web_contents) const {
+  return is_fullscreen_;
+}
+
 void WebContentsDelegateEfl::RegisterProtocolHandler(WebContents* web_contents,
         const std::string& protocol, const GURL& url, const string16& title, bool user_gesture) {
   scoped_ptr<Ewk_Custom_Handlers_Data> protocol_data(new Ewk_Custom_Handlers_Data(protocol.c_str(), url.host().c_str(),
index 86d047d..a67bad3 100755 (executable)
@@ -56,6 +56,8 @@ class WebContentsDelegateEfl
 
   virtual void ToggleFullscreenModeForTab(WebContents* web_contents,
                                           bool enter_fullscreen) OVERRIDE;
+  virtual bool IsFullscreenForTabOrPending(
+      const WebContents* web_contents) const OVERRIDE;
   virtual void RequestMediaAccessPermission(
       WebContents* web_contents,
       const MediaStreamRequest& request,
@@ -153,6 +155,7 @@ class WebContentsDelegateEfl
                               IPC::Message* reply);
 
   EWebView* web_view_;
+  bool is_fullscreen_;
   scoped_ptr<WebContents> web_contents_;
 
   struct ContentSecurityPolicy {