Skip to content

Commit c6f2a56

Browse files
committed
fix(render_handler): sync with current CEF API
CEF removed GetScreenRect (replaced by CefScreenInfo.rect from GetScreenInfo) and OnScrollOffsetChanged now passes (browser, x, y). The pyx/cpp glue had drifted: GetScreenRect was a dead Cython entry with no C++ caller (but still in the callback allowlist + docs), and OnScrollOffsetChanged dropped x/y on the floor.
1 parent 3e45abd commit c6f2a56

5 files changed

Lines changed: 7 additions & 46 deletions

File tree

api/API-index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@
347347
* [RenderHandler (interface)](RenderHandler.md#renderhandler-interface)
348348
* [GetRootScreenRect](RenderHandler.md#getrootscreenrect)
349349
* [GetViewRect](RenderHandler.md#getviewrect)
350-
* [GetScreenRect](RenderHandler.md#getscreenrect)
351350
* [GetScreenPoint](RenderHandler.md#getscreenpoint)
352351
* [GetScreenInfo](RenderHandler.md#getscreeninfo)
353352
* [OnPopupShow](RenderHandler.md#onpopupshow)

api/RenderHandler.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Table of contents:
1515
* [Callbacks](#callbacks)
1616
* [GetRootScreenRect](#getrootscreenrect)
1717
* [GetViewRect](#getviewrect)
18-
* [GetScreenRect](#getscreenrect)
1918
* [GetScreenPoint](#getscreenpoint)
2019
* [GetScreenInfo](#getscreeninfo)
2120
* [OnPopupShow](#onpopupshow)
@@ -74,18 +73,6 @@ Called to retrieve the view rectangle which is relative to screen
7473
coordinates. Return true if the rectangle was provided.
7574

7675

77-
### GetScreenRect
78-
79-
| Parameter | Type |
80-
| --- | --- |
81-
| browser | [Browser](Browser.md) |
82-
| rect_out | list[x,y,width,height] |
83-
| __Return__ | bool |
84-
85-
Called to retrieve the simulated screen rectangle. Return true
86-
if the rectangle was provided.
87-
88-
8976
### GetScreenPoint
9077

9178
| Parameter | Type |
@@ -213,6 +200,8 @@ Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
213200
| Parameter | Type |
214201
| --- | --- |
215202
| browser | [Browser](Browser.md) |
203+
| x | float |
204+
| y | float |
216205
| __Return__ | void |
217206

218207
Called when the scroll offset has changed.

src/browser.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ cdef class PyBrowser:
262262
# RenderHandler
263263
self.allowedClientCallbacks += ["GetRootScreenRect",
264264
"GetViewRect", "GetScreenPoint", "GetScreenInfo",
265-
"GetScreenRect",
266265
"OnPopupShow", "OnPopupSize", "OnPaint", "OnCursorChange",
267266
"OnScrollOffsetChanged",
268267
"StartDragging", "UpdateDragCursor",

src/client_handler/render_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void RenderHandler::OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser,
7474
double y)
7575
{
7676
REQUIRE_UI_THREAD();
77-
RenderHandler_OnScrollOffsetChanged(browser);
77+
RenderHandler_OnScrollOffsetChanged(browser, x, y);
7878
}
7979

8080

src/handlers/render_handler.pyx

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -85,34 +85,6 @@ cdef public cpp_bool RenderHandler_GetViewRect(
8585
(exc_type, exc_value, exc_trace) = sys.exc_info()
8686
sys.excepthook(exc_type, exc_value, exc_trace)
8787

88-
cdef public cpp_bool RenderHandler_GetScreenRect(
89-
CefRefPtr[CefBrowser] cefBrowser,
90-
CefRect& cefRect
91-
) except * with gil:
92-
cdef PyBrowser pyBrowser
93-
cdef list pyRect = []
94-
cdef py_bool ret
95-
try:
96-
pyBrowser = GetPyBrowser(cefBrowser, "GetScreenRect")
97-
callback = pyBrowser.GetClientCallback("GetScreenRect")
98-
if callback:
99-
ret = callback(browser=pyBrowser, rect_out=pyRect)
100-
if ret:
101-
assert (pyRect and len(pyRect) == 4), (
102-
"rectangle not provided or invalid")
103-
cefRect.x = pyRect[0]
104-
cefRect.y = pyRect[1]
105-
cefRect.width = pyRect[2]
106-
cefRect.height = pyRect[3]
107-
return True
108-
else:
109-
return False
110-
else:
111-
return False
112-
except:
113-
(exc_type, exc_value, exc_trace) = sys.exc_info()
114-
sys.excepthook(exc_type, exc_value, exc_trace)
115-
11688
cdef public cpp_bool RenderHandler_GetScreenPoint(
11789
CefRefPtr[CefBrowser] cefBrowser,
11890
int viewX, int viewY,
@@ -285,14 +257,16 @@ cdef public void RenderHandler_OnPaint(
285257
sys.excepthook(exc_type, exc_value, exc_trace)
286258

287259
cdef public void RenderHandler_OnScrollOffsetChanged(
288-
CefRefPtr[CefBrowser] cefBrowser
260+
CefRefPtr[CefBrowser] cefBrowser,
261+
double x,
262+
double y
289263
) noexcept with gil:
290264
cdef PyBrowser pyBrowser
291265
try:
292266
pyBrowser = GetPyBrowser(cefBrowser, "OnScrollOffsetChanged")
293267
callback = pyBrowser.GetClientCallback("OnScrollOffsetChanged")
294268
if callback:
295-
callback(browser=pyBrowser)
269+
callback(browser=pyBrowser, x=x, y=y)
296270
except:
297271
(exc_type, exc_value, exc_trace) = sys.exc_info()
298272
sys.excepthook(exc_type, exc_value, exc_trace)

0 commit comments

Comments
 (0)