Skip to content

Conversation

@AnujPanta1
Copy link
Contributor

@AnujPanta1 AnujPanta1 commented Sep 11, 2025

5123b3a

[WebDriver][BiDi] Implement the browsingContext.captureScreenshot command
https://bugs.webkit.org/show_bug.cgi?id=288325
rdar://145987196

Reviewed by NOBODY (OOPS!).

Adds captureScreenshot support to capture screenshots of browsing contexts with rectangle
clipping and format options. Uses existing WebAutomationSession screenshot
infrastructure. Needs additional work surrounding supporting all origins, formatting
options, and element reference resolutions.

* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp:
(WebKit::BidiBrowsingContextAgent::captureScreenshot):
(WebKit::BidiBrowsingContextAgent::getOriginRectangle):
(WebKit::BidiBrowsingContextAgent::normalizeRect):
(WebKit::BidiBrowsingContextAgent::rectangleIntersection):
(WebKit::BidiBrowsingContextAgent::parseClipRectangle):
(WebKit::BidiBrowsingContextAgent::parseBoxClipRectangle):
(WebKit::BidiBrowsingContextAgent::parseElementClipRectangle):
(WebKit::BidiBrowsingContextAgent::performScreenshotCapture):
(WebKit::BidiBrowsingContextAgent::parseImageFormatType):
(WebKit::BidiBrowsingContextAgent::imageFormatTypeToString):
(WebKit::BidiBrowsingContextAgent::convertImageFormat const):
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.h:
* Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json:
* Source/WebKit/UIProcess/Automation/protocol/BidiScript.json:

5123b3a

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@AnujPanta1 AnujPanta1 requested a review from cdumez as a code owner September 11, 2025 08:58
@AnujPanta1 AnujPanta1 self-assigned this Sep 11, 2025
@AnujPanta1 AnujPanta1 added the WebDriver Bugs in WebDriver label Sep 11, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 11, 2025
Copy link
Contributor

@burg burg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good WIP so far!

@AnujPanta1 AnujPanta1 removed the merging-blocked Applied to prevent a change from being merged label Sep 19, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 19, 2025
…mand

https://bugs.webkit.org/show_bug.cgi?id=288325
rdar://145987196

Reviewed by NOBODY (OOPS!).

Adds captureScreenshot support to capture screenshots of browsing contexts with rectangle
clipping and format options. Uses existing WebAutomationSession screenshot
infrastructure. Needs additional work surrounding supporting all origins, formatting
options, and element reference resolutions.

* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp:
(WebKit::BidiBrowsingContextAgent::captureScreenshot):
(WebKit::BidiBrowsingContextAgent::getOriginRectangle):
(WebKit::BidiBrowsingContextAgent::normalizeRect):
(WebKit::BidiBrowsingContextAgent::rectangleIntersection):
(WebKit::BidiBrowsingContextAgent::parseClipRectangle):
(WebKit::BidiBrowsingContextAgent::parseBoxClipRectangle):
(WebKit::BidiBrowsingContextAgent::parseElementClipRectangle):
(WebKit::BidiBrowsingContextAgent::performScreenshotCapture):
(WebKit::BidiBrowsingContextAgent::parseImageFormatType):
(WebKit::BidiBrowsingContextAgent::imageFormatTypeToString):
(WebKit::BidiBrowsingContextAgent::convertImageFormat const):
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.h:
* Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json:
* Source/WebKit/UIProcess/Automation/protocol/BidiScript.json:
@AnujPanta1 AnujPanta1 removed the merging-blocked Applied to prevent a change from being merged label Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebDriver Bugs in WebDriver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants