webdriver: Elegantly handle "element screenshot" when bounding box has area zero (#39499)

It is possible that the bounding rectangle of an element has area 0.
This PR avoids panic in this case.

It is worth to mention that the panic itself won't kill the entire
program for interaction, but only the webdriver thread.

Testing: Manually tested on the case of #39495

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-09-27 10:20:35 +08:00 committed by GitHub
parent 4c25039d35
commit 2e8fac9395
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 10 deletions

View file

@ -144,7 +144,7 @@ pub enum WebDriverCommandMsg {
TakeScreenshot(
WebViewId,
Option<Rect<f32, CSSPixel>>,
IpcSender<Option<RasterImage>>,
IpcSender<Result<Option<RasterImage>, ()>>,
),
/// Create a new webview that loads about:blank. The embedder will use
/// the provided channels to return the top level browsing context id