Clarify expectations for CefRenderHandler::GetViewRect (issue #1910)
This commit is contained in:
parent
64cd460c73
commit
09afa3a843
|
@ -33,7 +33,7 @@
|
||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=f2f3acb1df9815e4ac9bf34010ce260a2496ae5a$
|
// $hash=d259309846e69d866a834aa701bbf8c9562dd117$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||||
|
@ -68,7 +68,8 @@ typedef struct _cef_render_handler_t {
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to retrieve the root window rectangle in screen coordinates. Return
|
// Called to retrieve the root window rectangle in screen coordinates. Return
|
||||||
// true (1) if the rectangle was provided.
|
// true (1) if the rectangle was provided. If this function returns false (0)
|
||||||
|
// the rectangle from GetViewRect will be used.
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* get_root_screen_rect)(struct _cef_render_handler_t* self,
|
int(CEF_CALLBACK* get_root_screen_rect)(struct _cef_render_handler_t* self,
|
||||||
struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser,
|
||||||
|
@ -76,9 +77,9 @@ typedef struct _cef_render_handler_t {
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to retrieve the view rectangle which is relative to screen
|
// Called to retrieve the view rectangle which is relative to screen
|
||||||
// coordinates. Return true (1) if the rectangle was provided.
|
// coordinates. This function must always provide a non-NULL rectangle.
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* get_view_rect)(struct _cef_render_handler_t* self,
|
void(CEF_CALLBACK* get_view_rect)(struct _cef_render_handler_t* self,
|
||||||
struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser,
|
||||||
cef_rect_t* rect);
|
cef_rect_t* rect);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,8 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to retrieve the root window rectangle in screen coordinates. Return
|
// Called to retrieve the root window rectangle in screen coordinates. Return
|
||||||
// true if the rectangle was provided.
|
// true if the rectangle was provided. If this method returns false the
|
||||||
|
// rectangle from GetViewRect will be used.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||||
|
@ -78,10 +79,10 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to retrieve the view rectangle which is relative to screen
|
// Called to retrieve the view rectangle which is relative to screen
|
||||||
// coordinates. Return true if the rectangle was provided.
|
// coordinates. This method must always provide a non-empty rectangle.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) = 0;
|
virtual void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to retrieve the translation from view coordinates to actual screen
|
// Called to retrieve the translation from view coordinates to actual screen
|
||||||
|
|
|
@ -414,8 +414,12 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() const {
|
||||||
CefRect rc;
|
CefRect rc;
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->GetClient()->GetRenderHandler();
|
browser_impl_->GetClient()->GetRenderHandler();
|
||||||
if (handler.get())
|
CHECK(handler);
|
||||||
|
|
||||||
handler->GetViewRect(browser_impl_.get(), rc);
|
handler->GetViewRect(browser_impl_.get(), rc);
|
||||||
|
CHECK_GT(rc.width, 0);
|
||||||
|
CHECK_GT(rc.height, 0);
|
||||||
|
|
||||||
return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
|
return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +561,8 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->GetClient()->GetRenderHandler();
|
browser_impl_->GetClient()->GetRenderHandler();
|
||||||
if (handler.get())
|
CHECK(handler);
|
||||||
|
|
||||||
handler->OnPopupShow(browser_impl_.get(), true);
|
handler->OnPopupShow(browser_impl_.get(), true);
|
||||||
|
|
||||||
popup_position_ = pos;
|
popup_position_ = pos;
|
||||||
|
@ -595,8 +600,7 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->GetClient()->GetRenderHandler();
|
browser_impl_->GetClient()->GetRenderHandler();
|
||||||
if (!handler.get())
|
CHECK(handler);
|
||||||
return;
|
|
||||||
|
|
||||||
content::CursorInfo cursor_info;
|
content::CursorInfo cursor_info;
|
||||||
cursor.GetCursorInfo(&cursor_info);
|
cursor.GetCursorInfo(&cursor_info);
|
||||||
|
@ -717,26 +721,27 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->client()->GetRenderHandler();
|
browser_impl_->client()->GetRenderHandler();
|
||||||
if (handler.get() &&
|
CHECK(handler);
|
||||||
(!handler->GetScreenInfo(browser_impl_.get(), screen_info) ||
|
if (!handler->GetScreenInfo(browser_impl_.get(), screen_info) ||
|
||||||
screen_info.rect.width == 0 || screen_info.rect.height == 0 ||
|
screen_info.rect.width == 0 || screen_info.rect.height == 0 ||
|
||||||
screen_info.available_rect.width == 0 ||
|
screen_info.available_rect.width == 0 ||
|
||||||
screen_info.available_rect.height == 0)) {
|
screen_info.available_rect.height == 0) {
|
||||||
// If a screen rectangle was not provided, try using the view rectangle
|
// If a screen rectangle was not provided, try using the view rectangle
|
||||||
// instead. Otherwise, popup views may be drawn incorrectly, or not at all.
|
// instead. Otherwise, popup views may be drawn incorrectly, or not at all.
|
||||||
CefRect screenRect;
|
CefRect screenRect;
|
||||||
if (!handler->GetViewRect(browser_impl_.get(), screenRect)) {
|
handler->GetViewRect(browser_impl_.get(), screenRect);
|
||||||
NOTREACHED();
|
CHECK_GT(screenRect.width, 0);
|
||||||
screenRect = CefRect();
|
CHECK_GT(screenRect.height, 0);
|
||||||
|
|
||||||
|
if (screen_info.rect.width == 0 || screen_info.rect.height == 0) {
|
||||||
|
screen_info.rect = screenRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen_info.rect.width == 0 && screen_info.rect.height == 0)
|
if (screen_info.available_rect.width == 0 ||
|
||||||
screen_info.rect = screenRect;
|
screen_info.available_rect.height == 0) {
|
||||||
|
|
||||||
if (screen_info.available_rect.width == 0 &&
|
|
||||||
screen_info.available_rect.height == 0)
|
|
||||||
screen_info.available_rect = screenRect;
|
screen_info.available_rect = screenRect;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*results = ScreenInfoFrom(screen_info);
|
*results = ScreenInfoFrom(screen_info);
|
||||||
}
|
}
|
||||||
|
@ -751,7 +756,8 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
|
||||||
CefRect rc;
|
CefRect rc;
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->client()->GetRenderHandler();
|
browser_impl_->client()->GetRenderHandler();
|
||||||
if (handler.get() && handler->GetRootScreenRect(browser_impl_.get(), rc))
|
CHECK(handler);
|
||||||
|
if (handler->GetRootScreenRect(browser_impl_.get(), rc))
|
||||||
return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
|
return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
|
||||||
return GetViewBounds();
|
return GetViewBounds();
|
||||||
}
|
}
|
||||||
|
@ -852,11 +858,11 @@ void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->GetClient()->GetRenderHandler();
|
browser_impl_->GetClient()->GetRenderHandler();
|
||||||
if (handler.get()) {
|
CHECK(handler);
|
||||||
|
|
||||||
CefRange cef_range(range.start(), range.end());
|
CefRange cef_range(range.start(), range.end());
|
||||||
handler->OnTextSelectionChanged(browser_impl_.get(), selected_text,
|
handler->OnTextSelectionChanged(browser_impl_.get(), selected_text,
|
||||||
cef_range);
|
cef_range);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
|
@ -1242,8 +1248,7 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->client()->GetRenderHandler();
|
browser_impl_->client()->GetRenderHandler();
|
||||||
if (!handler.get())
|
CHECK(handler);
|
||||||
return;
|
|
||||||
|
|
||||||
// Don't execute SynchronizeVisualProperties while the OnPaint callback is
|
// Don't execute SynchronizeVisualProperties while the OnPaint callback is
|
||||||
// pending.
|
// pending.
|
||||||
|
@ -1326,8 +1331,8 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||||
CefRect());
|
CefRect());
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->client()->GetRenderHandler();
|
browser_impl_->client()->GetRenderHandler();
|
||||||
if (handler.get() &&
|
CHECK(handler);
|
||||||
handler->GetScreenInfo(browser_impl_.get(), screen_info)) {
|
if (handler->GetScreenInfo(browser_impl_.get(), screen_info)) {
|
||||||
new_scale_factor = screen_info.device_scale_factor;
|
new_scale_factor = screen_info.device_scale_factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1432,7 +1437,7 @@ void CefRenderWidgetHostViewOSR::CancelWidget() {
|
||||||
if (IsPopupWidget() && browser_impl_.get()) {
|
if (IsPopupWidget() && browser_impl_.get()) {
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->client()->GetRenderHandler();
|
browser_impl_->client()->GetRenderHandler();
|
||||||
if (handler.get())
|
CHECK(handler);
|
||||||
handler->OnPopupShow(browser_impl_.get(), false);
|
handler->OnPopupShow(browser_impl_.get(), false);
|
||||||
browser_impl_ = NULL;
|
browser_impl_ = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1467,12 +1472,10 @@ void CefRenderWidgetHostViewOSR::OnScrollOffsetChanged() {
|
||||||
if (browser_impl_.get()) {
|
if (browser_impl_.get()) {
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->client()->GetRenderHandler();
|
browser_impl_->client()->GetRenderHandler();
|
||||||
if (handler.get()) {
|
CHECK(handler);
|
||||||
handler->OnScrollOffsetChanged(browser_impl_.get(),
|
handler->OnScrollOffsetChanged(browser_impl_.get(), last_scroll_offset_.x(),
|
||||||
last_scroll_offset_.x(),
|
|
||||||
last_scroll_offset_.y());
|
last_scroll_offset_.y());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
is_scroll_offset_changed_pending_ = false;
|
is_scroll_offset_changed_pending_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1534,11 +1537,10 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> handler =
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
browser_impl_->GetClient()->GetRenderHandler();
|
browser_impl_->GetClient()->GetRenderHandler();
|
||||||
if (handler.get()) {
|
CHECK(handler);
|
||||||
handler->OnImeCompositionRangeChanged(browser_impl_->GetBrowser(),
|
handler->OnImeCompositionRangeChanged(browser_impl_->GetBrowser(),
|
||||||
cef_range, rcList);
|
cef_range, rcList);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
viz::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
|
viz::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// implementations. See the translator.README.txt file in the tools directory
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
// for more information.
|
// for more information.
|
||||||
//
|
//
|
||||||
// $hash=98625368df8daaeca9df1791f1867828a6271a89$
|
// $hash=6cf6466ab2a1b87a1b57b5994aab64992b9f12dd$
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
||||||
|
@ -70,7 +70,7 @@ render_handler_get_root_screen_rect(struct _cef_render_handler_t* self,
|
||||||
return _retval;
|
return _retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEF_CALLBACK
|
void CEF_CALLBACK
|
||||||
render_handler_get_view_rect(struct _cef_render_handler_t* self,
|
render_handler_get_view_rect(struct _cef_render_handler_t* self,
|
||||||
cef_browser_t* browser,
|
cef_browser_t* browser,
|
||||||
cef_rect_t* rect) {
|
cef_rect_t* rect) {
|
||||||
|
@ -78,29 +78,26 @@ render_handler_get_view_rect(struct _cef_render_handler_t* self,
|
||||||
|
|
||||||
DCHECK(self);
|
DCHECK(self);
|
||||||
if (!self)
|
if (!self)
|
||||||
return 0;
|
return;
|
||||||
// Verify param: browser; type: refptr_diff
|
// Verify param: browser; type: refptr_diff
|
||||||
DCHECK(browser);
|
DCHECK(browser);
|
||||||
if (!browser)
|
if (!browser)
|
||||||
return 0;
|
return;
|
||||||
// Verify param: rect; type: simple_byref
|
// Verify param: rect; type: simple_byref
|
||||||
DCHECK(rect);
|
DCHECK(rect);
|
||||||
if (!rect)
|
if (!rect)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
// Translate param: rect; type: simple_byref
|
// Translate param: rect; type: simple_byref
|
||||||
CefRect rectVal = rect ? *rect : CefRect();
|
CefRect rectVal = rect ? *rect : CefRect();
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
bool _retval = CefRenderHandlerCppToC::Get(self)->GetViewRect(
|
CefRenderHandlerCppToC::Get(self)->GetViewRect(
|
||||||
CefBrowserCToCpp::Wrap(browser), rectVal);
|
CefBrowserCToCpp::Wrap(browser), rectVal);
|
||||||
|
|
||||||
// Restore param: rect; type: simple_byref
|
// Restore param: rect; type: simple_byref
|
||||||
if (rect)
|
if (rect)
|
||||||
*rect = rectVal;
|
*rect = rectVal;
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEF_CALLBACK
|
int CEF_CALLBACK
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// implementations. See the translator.README.txt file in the tools directory
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
// for more information.
|
// for more information.
|
||||||
//
|
//
|
||||||
// $hash=bd2800111c1f3f3a5c6107d0454a2b5fe67067b6$
|
// $hash=db89496c825cdc7fe1eaa4b7822d8492ae3a3f23$
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
|
||||||
|
@ -59,25 +59,21 @@ bool CefRenderHandlerCToCpp::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||||
}
|
}
|
||||||
|
|
||||||
NO_SANITIZE("cfi-icall")
|
NO_SANITIZE("cfi-icall")
|
||||||
bool CefRenderHandlerCToCpp::GetViewRect(CefRefPtr<CefBrowser> browser,
|
void CefRenderHandlerCToCpp::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
CefRect& rect) {
|
CefRect& rect) {
|
||||||
cef_render_handler_t* _struct = GetStruct();
|
cef_render_handler_t* _struct = GetStruct();
|
||||||
if (CEF_MEMBER_MISSING(_struct, get_view_rect))
|
if (CEF_MEMBER_MISSING(_struct, get_view_rect))
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
// Verify param: browser; type: refptr_diff
|
// Verify param: browser; type: refptr_diff
|
||||||
DCHECK(browser.get());
|
DCHECK(browser.get());
|
||||||
if (!browser.get())
|
if (!browser.get())
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
int _retval =
|
|
||||||
_struct->get_view_rect(_struct, CefBrowserCppToC::Wrap(browser), &rect);
|
_struct->get_view_rect(_struct, CefBrowserCppToC::Wrap(browser), &rect);
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval ? true : false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NO_SANITIZE("cfi-icall")
|
NO_SANITIZE("cfi-icall")
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// implementations. See the translator.README.txt file in the tools directory
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
// for more information.
|
// for more information.
|
||||||
//
|
//
|
||||||
// $hash=9e2bcb61512095fba2fca928f4696fbb39d9d3b1$
|
// $hash=46dd8560076264a776129a02ba11e2c2f56bf209$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_RENDER_HANDLER_CTOCPP_H_
|
#ifndef CEF_LIBCEF_DLL_CTOCPP_RENDER_HANDLER_CTOCPP_H_
|
||||||
|
@ -36,7 +36,7 @@ class CefRenderHandlerCToCpp
|
||||||
// CefRenderHandler methods.
|
// CefRenderHandler methods.
|
||||||
CefRefPtr<CefAccessibilityHandler> GetAccessibilityHandler() override;
|
CefRefPtr<CefAccessibilityHandler> GetAccessibilityHandler() override;
|
||||||
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
|
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
|
||||||
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
int viewX,
|
int viewX,
|
||||||
int viewY,
|
int viewY,
|
||||||
|
|
|
@ -1122,12 +1122,17 @@ bool BrowserWindowOsrGtk::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWindowOsrGtk::GetViewRect(CefRefPtr<CefBrowser> browser,
|
void BrowserWindowOsrGtk::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
CefRect& rect) {
|
CefRect& rect) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if (!glarea_)
|
rect.x = rect.y = 0;
|
||||||
return false;
|
|
||||||
|
if (!glarea_) {
|
||||||
|
// Never return an empty rectangle.
|
||||||
|
rect.width = rect.height = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float device_scale_factor;
|
float device_scale_factor;
|
||||||
{
|
{
|
||||||
|
@ -1137,11 +1142,9 @@ bool BrowserWindowOsrGtk::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
||||||
// The simulated screen and view rectangle are the same. This is necessary
|
// The simulated screen and view rectangle are the same. This is necessary
|
||||||
// for popup menus to be located and sized inside the view.
|
// for popup menus to be located and sized inside the view.
|
||||||
rect.x = rect.y = 0;
|
|
||||||
rect.width = DeviceToLogical(glarea_->allocation.width, device_scale_factor);
|
rect.width = DeviceToLogical(glarea_->allocation.width, device_scale_factor);
|
||||||
rect.height =
|
rect.height =
|
||||||
DeviceToLogical(glarea_->allocation.height, device_scale_factor);
|
DeviceToLogical(glarea_->allocation.height, device_scale_factor);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWindowOsrGtk::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool BrowserWindowOsrGtk::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -55,7 +55,7 @@ class BrowserWindowOsrGtk : public BrowserWindow,
|
||||||
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||||
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||||
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
int viewX,
|
int viewX,
|
||||||
int viewY,
|
int viewY,
|
||||||
|
|
|
@ -52,7 +52,7 @@ class BrowserWindowOsrMac : public BrowserWindow,
|
||||||
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||||
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||||
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
int viewX,
|
int viewX,
|
||||||
int viewY,
|
int viewY,
|
||||||
|
|
|
@ -1348,13 +1348,18 @@ bool BrowserWindowOsrMac::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
|
void BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
CefRect& rect) {
|
CefRect& rect) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
REQUIRE_MAIN_THREAD();
|
REQUIRE_MAIN_THREAD();
|
||||||
|
|
||||||
if (!nsview_)
|
rect.x = rect.y = 0;
|
||||||
return false;
|
|
||||||
|
if (!nsview_) {
|
||||||
|
// Never return an empty rectangle.
|
||||||
|
rect.width = rect.height = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const float device_scale_factor = [GLView(nsview_) getDeviceScaleFactor];
|
const float device_scale_factor = [GLView(nsview_) getDeviceScaleFactor];
|
||||||
|
|
||||||
|
@ -1365,11 +1370,8 @@ bool BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
bounds = [GLView(nsview_) convertRectToBackingInternal:bounds];
|
bounds = [GLView(nsview_) convertRectToBackingInternal:bounds];
|
||||||
|
|
||||||
// Convert to browser view coordinates.
|
// Convert to browser view coordinates.
|
||||||
rect.x = rect.y = 0;
|
|
||||||
rect.width = DeviceToLogical(bounds.size.width, device_scale_factor);
|
rect.width = DeviceToLogical(bounds.size.width, device_scale_factor);
|
||||||
rect.height = DeviceToLogical(bounds.size.height, device_scale_factor);
|
rect.height = DeviceToLogical(bounds.size.height, device_scale_factor);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWindowOsrMac::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool BrowserWindowOsrMac::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -50,12 +50,15 @@ bool ClientHandlerOsr::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||||
return osr_delegate_->GetRootScreenRect(browser, rect);
|
return osr_delegate_->GetRootScreenRect(browser, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientHandlerOsr::GetViewRect(CefRefPtr<CefBrowser> browser,
|
void ClientHandlerOsr::GetViewRect(CefRefPtr<CefBrowser> browser,
|
||||||
CefRect& rect) {
|
CefRect& rect) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
if (!osr_delegate_)
|
if (!osr_delegate_) {
|
||||||
return false;
|
// Never return an empty rectangle.
|
||||||
return osr_delegate_->GetViewRect(browser, rect);
|
rect.width = rect.height = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
osr_delegate_->GetViewRect(browser, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientHandlerOsr::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool ClientHandlerOsr::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ClientHandlerOsr : public ClientHandler,
|
||||||
// These methods match the CefRenderHandler interface.
|
// These methods match the CefRenderHandler interface.
|
||||||
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||||
CefRect& rect) = 0;
|
CefRect& rect) = 0;
|
||||||
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) = 0;
|
virtual void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) = 0;
|
||||||
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
int viewX,
|
int viewX,
|
||||||
int viewY,
|
int viewY,
|
||||||
|
@ -87,7 +87,7 @@ class ClientHandlerOsr : public ClientHandler,
|
||||||
|
|
||||||
// CefRenderHandler methods.
|
// CefRenderHandler methods.
|
||||||
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
int viewX,
|
int viewX,
|
||||||
int viewY,
|
int viewY,
|
||||||
|
|
|
@ -870,7 +870,7 @@ bool OsrWindowWin::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OsrWindowWin::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
void OsrWindowWin::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
DCHECK_GT(device_scale_factor_, 0);
|
DCHECK_GT(device_scale_factor_, 0);
|
||||||
|
|
||||||
|
@ -879,7 +879,6 @@ bool OsrWindowWin::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||||
device_scale_factor_);
|
device_scale_factor_);
|
||||||
rect.height = DeviceToLogical(client_rect_.bottom - client_rect_.top,
|
rect.height = DeviceToLogical(client_rect_.bottom - client_rect_.top,
|
||||||
device_scale_factor_);
|
device_scale_factor_);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -114,7 +114,7 @@ class OsrWindowWin
|
||||||
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||||
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||||
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) OVERRIDE;
|
||||||
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
int viewX,
|
int viewX,
|
||||||
int viewY,
|
int viewY,
|
||||||
|
|
|
@ -324,13 +324,12 @@ class OSRTestHandler : public RoutingTestHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
// CefRenderHandler methods
|
// CefRenderHandler methods
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override {
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override {
|
||||||
if (test_type_ == OSR_TEST_RESIZE && started()) {
|
if (test_type_ == OSR_TEST_RESIZE && started()) {
|
||||||
rect = CefRect(0, 0, kOsrWidth * 2, kOsrHeight * 2);
|
rect = CefRect(0, 0, kOsrWidth * 2, kOsrHeight * 2);
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
rect = CefRect(0, 0, kOsrWidth, kOsrHeight);
|
rect = CefRect(0, 0, kOsrWidth, kOsrHeight);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -47,9 +47,8 @@ class AccessibilityTestHandler : public TestHandler,
|
||||||
CefRefPtr<CefRenderHandler> GetRenderHandler() override { return this; }
|
CefRefPtr<CefRenderHandler> GetRenderHandler() override { return this; }
|
||||||
|
|
||||||
// Cef Renderer Handler Methods
|
// Cef Renderer Handler Methods
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override {
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override {
|
||||||
rect = CefRect(0, 0, kOsrWidth, kOsrHeight);
|
rect = CefRect(0, 0, kOsrWidth, kOsrHeight);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -24,9 +24,8 @@ class DisplayTestHandler : public RoutingTestHandler, public CefRenderHandler {
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> GetRenderHandler() override { return this; }
|
CefRefPtr<CefRenderHandler> GetRenderHandler() override { return this; }
|
||||||
|
|
||||||
bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override {
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override {
|
||||||
rect = CefRect(0, 0, kOsrWidth, kOsrHeight);
|
rect = CefRect(0, 0, kOsrWidth, kOsrHeight);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
Loading…
Reference in New Issue