janke99 / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 0 forks source link

CEF3: Add method for retrieving the dimensions of the visible HTML content area #748

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Use case: I must draw an additional view on top of the CEF view that performs 
some additional UI event handling and custom drawing.

In order to achieve this, while also leaving the scrollbars accessible for 
mouse events, I require information about the dimensions of the visible 
rendered area (the current view size, excluding the scrollbars).

I'd like to add this functionality to the CEF public interface, more exactly, 
to add a CefRect CefBrowser::GetVisibleRect method.

Original issue reported on code.google.com by mihai.o....@gmail.com on 10 Oct 2012 at 8:03

GoogleCodeExporter commented 9 years ago
Have you considered retrieving this information via JavaScript?

Original comment by magreenb...@gmail.com on 8 Mar 2013 at 9:50

GoogleCodeExporter commented 9 years ago
The use case we are experimenting implies having an additional view that draws 
ontop of the CEF view and performs custom drawing, as well as event filtering.
For example, if we click on a rectangular div in the webview, the topmost view 
will draw a selection box for the selected div and prevent the mouse event from 
reaching the browser view.

One problem identified with stacking these two views is accessing the 
scrollbars through mouse events. If the views have the same viewport, mouse 
clicks on the scrollbar area would get caught by the overlay (topmost) view 
which would prevent them from reaching the webview, meaning scrolling wouldn't 
work.
For windows and OSX 10.6, one potential solution to this problem is to draw the 
topmost view over the visible HTML content area (the part of the webview 
excluding scrollbars), thus leaving the scrollbars completely accessible to the 
browser view.

In our use case, when the webview performs drawing, we query WebKit for the 
visible content rect and also draw the overlay view, thus syncing the painting.
However, webview drawing is triggered when receiving a |ViewHostMsg_UpdateRect| 
message from Chromium. At this moment, we'd also like to know the current 
visible content area, so the overlay view can be consistent with the webview 
scrollable area.
In order to achieve this, we would like to try and push the following change to 
Chromium: add the visible html content area as a member of the 
|ViewHostMsg_UpdateRect_Params|.

As soon as we'll find the time to do this, we will continue the necessary work 
for enabling this information in CEF.

Also, to answer you question regarding JS: we have tried this solution, and 
we've had the following problems:
Even though accessing the info via js is perfectly plausible, the getter 
(triggered on a |window.resize| event), causes the overlay view not to be 
painted in sync with the webview, thus producing flickers and visible 
desynchronisation between the two views when resizing.

Original comment by mihai.o....@gmail.com on 12 Mar 2013 at 4:18

GoogleCodeExporter commented 9 years ago
CEF is transitioning from Google Code to Bitbucket project hosting. If you 
would like to continue receiving notifications on this issue please add 
yourself as a Watcher at the new location: 
https://bitbucket.org/chromiumembedded/cef/issue/748

Original comment by magreenb...@gmail.com on 14 Mar 2015 at 3:23