summaryrefslogtreecommitdiff
path: root/Userland/Utilities/headless-browser.cpp
AgeCommit message (Collapse)Author
2023-05-21headless-browser: Prefer FileSystem over DeprecatedFileBen Wiederhake
2023-05-17Browser+Ladybird+LibWebView: Handle trivial content APIs in LibWebViewTimothy Flynn
The goal here is to reduce the amount of WebContent client APIs that are duplicated across every ViewImplementation. Across our three browsers, we currently: Ladybird - Mix some AK::Function callbacks and Qt signals to notify tabs of WebContent events. Browser - Use only AK::Function callbacks. headless-browser - Drop most events on the floor. Instead, let's only use AK::Function callbacks across all three browsers to propagate events to tabs. This allows us to invoke those callbacks directly from LibWebView instead of all three browsers needing to define a trivial `if (callback) callback();` override of a LibWebView virtual function. For headless-browser, we can simply not set these callbacks. As a first pass, this only converts WebContent events that are trivial to this approach. That is, events that were simply passed onto the tab or handled without much fuss.
2023-05-17Browser+Ladybird+LibWebView: Virtualize computing content/widget pointsTimothy Flynn
This will allow moving some copy-pasted functionality from web view implementations to the base LibWebView class.
2023-05-16Browser+LibWeb+WebContent: Broadcast video element context menu requestsTimothy Flynn
This just sets up the IPC to notify the browser process of context menu requests on video elements. The IPC contains a few pieces of information about the state of the video element.
2023-05-15Ladybird+LibWebView: Move backing store management code to LibWebViewAndreas Kling
This lets us share this code on all platforms, and makes resizing the window much faster on SerenityOS as well. :^)
2023-05-15Ladybird+LibWebView: Remember the size of the last paintAndreas Kling
This will allow us to change the size of the backing store bitmap without conflating the size of the bitmap and the size of the paint.
2023-05-08LibWeb: Add `--layout-test-mode` flag to HeadlessBrowsermartinfalisse
The `layout-test-mode` flag changes the font to be SerenitySans as this is the font used for layout tests for cross-platform compatibility of tests.
2023-04-24Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every fileTimothy Flynn
2023-04-15Ladybird+LibWebView: Add -P/--enable-callgrind-profiling optionMacDue
This adds a -P option to run Ladybird under callgrind. It starts with instrumentation disabled. To start capturing a profile (once Ladybird has launched) run `callgrind_control -i on` and to stop it again run `callgrind_control -i off`. P.s. This is pretty much stolen from Andreas (and is based on the patch everyone [that wants a profile] have been manually applying).
2023-03-25headless-browser: Don't print extra newline after layout tree dumpsAndreas Kling
The layout tree dump text already contains a final newline, so we don't need to use outln() and add an extra one.
2023-03-21LibGfx: Move all image loaders and writers to a subdirectoryLucas CHOLLET
2023-03-21Everywhere: Use `LibFileSystem` where trivialCameron Youell
2023-03-21WebContent+Everywhere: Add a WebContent IPC to activate a tabTimothy Flynn
2023-03-21WebContent+Everywhere: Add an option to not activate new tabs over IPCTimothy Flynn
WebDriver, for example, will want to create new tabs without activating them.
2023-03-16LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tabAliaksandr Kalenik
2023-03-16WebContent+LibWebView: Consolidate the way browsers connect to WebDriverTimothy Flynn
Currently, on Serenity, we connect to WebDriver from the browser-side of the WebContent connection for both Browser and headless-browser. On Lagom, we connect from within the WebContent process itself, signaled by a command line flag. This patch changes Lagom browsers to connect to WebDriver the same way that Serenity browsers do. This will ensure we can do other initializers in the same order across all platforms and browsers.
2023-03-13LibWeb+Ladybird+Userland: Port window.[alert,confirm,prompt] to StringTimothy Flynn
LibGUI and WebDriver (read: JSON) API boundaries use DeprecatedString, so that is as far as these changes can reach. The one change which isn't just a DeprecatedString to String replacement is handling the "null" prompt response. We previously checked for the null DeprecatedString, whereas we now represent this as an empty Optional<String>.
2023-03-13Everywhere: Remove unintentional partial stream reads and writesTim Schumacher
2023-03-13AK: Rename Stream::{read,write} to Stream::{read_some,write_some}Tim Schumacher
Similar to POSIX read, the basic read and write functions of AK::Stream do not have a lower limit of how much data they read or write (apart from "none at all"). Rename the functions to "read some [data]" and "write some [data]" (with "data" being omitted, since everything here is reading and writing data) to make them sufficiently distinct from the functions that ensure to use the entire buffer (which should be the go-to function for most usages). No functional changes, just a lot of new FIXMEs.
2023-03-13headless-browser: Add a mode to dump the layout tree after load finishTimothy Flynn
2023-03-13headless-browser: Support loading local file:// URLsTimothy Flynn
2023-03-13headless-browser: Massage URLs a bit before loadingTimothy Flynn
This is to mimic what Ladybird and Browser do before trying to load the URL.
2023-03-13headless-browser: Re-implement headless-browser using an OOPWVTimothy Flynn
headless-browser currently uses its own PageClient to load web pages in-process. Due to this, it also needs to set up a whole bunch of other objects needed to run LibWeb, e.g. image decoders, request servers, etc. This changes headless-browser to instead implement a WebView to launch WebContent out-of-process. This implementation is almost entirely empty, but can be filled in as-needed. For example, we may want to print JavaScript console messages.
2023-03-10Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_caseAndreas Kling
Let's make it clear that these functions deal with ASCII case only.
2023-02-28LibWeb: Rename Layout::InitialContainingBlock to Layout::ViewportAndreas Kling
The name "initial containing block" was wrong for this, as it doesn't correspond to the HTML element, and that's specifically what it's supposed to do! :^)
2023-02-13Everywhere: Remove the `AK::` qualifier from Stream usagesTim Schumacher
2023-02-13LibCore: Remove `Stream.h`Tim Schumacher
2023-02-13LibCore: Move Stream-based file into the `Core` namespaceTim Schumacher
2023-02-13LibCore: Move Stream-based sockets into the `Core` namespaceTim Schumacher
2023-02-13LibCore: Rename `File` to `DeprecatedFile`Tim Schumacher
As usual, this removes many unused includes and moves used includes further down the chain.
2023-02-10Everywhere: Remove needless copies of Error / ErrorOr instancesTimothy Flynn
Either take the underlying objects with release_* methods or move() the instances around.
2023-02-08AK: Remove the fallible constructor from `FixedMemoryStream`Tim Schumacher
2023-02-02LibWeb+LibWebSocket: DOM WebSocket subprotocol supportGuilherme Gonçalves
This adds support for WebSocket subprotocols to WebSocket DOM objects, with some necessary plumbing to LibWebSocket and its clients. See the associated pull request for how this was tested.
2023-02-01LibWeb+WebContent: Do not reference-count file request objectsTimothy Flynn
There is currently a memory leak with these file request objects due to the callback on_file_request_finish referencing itself in its capture list. This object does not need to be reference counted or allocated on the heap. It is only ever stored in a HashMap until a response is received from the browser, and it is not shared.
2023-01-29AK: Move memory streams from `LibCore`Tim Schumacher
2023-01-29AK: Move `Stream` and `SeekableStream` from `LibCore`Tim Schumacher
`Stream` will be qualified as `AK::Stream` until we remove the `Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is defined by `SeekableStream`, since defining its own would require us to qualify it with `AK::SeekMode` everywhere.
2023-01-26LibGfx: Remove `try_` prefix from bitmap creation functionsTim Schumacher
Those don't have any non-try counterpart, so we might as well just omit it.
2023-01-18LibGfx+Ladybird+Userland: Don't sniff for TGA images with only raw bytesLiav A
Because TGA images don't have magic bytes as a signature to be detected, instead assume a sequence of ReadonlyBytes is a possible TGA image only if we are given a path so we could check the extension of the file and see if it's a TGA image. When we know the path of the file being loaded, we will try to first check its extension, and only if there's no match to a known decoder, based on simple extension lookup, then we would probe for other formats as usual with the normal sniffing method.
2023-01-12LibCore+Userland: Make Core::Timer::create_single_shot() return ErrorOrSam Atkins
clang-format sure has some interesting opinions about where to put a method call that comes after a lambda. :thonk:
2023-01-05LibWeb+WebContent: Convert BrowsingContext to new pixel unitsSam Atkins
This fixes a few glitches. We no longer give the page double the width it should have, and we mark the correct area of the page as needing repainting.
2022-12-23LibCore: Remove the `force` parameter from File::removeTim Schumacher
About half of the usages were not using `force` anyways, and the other half presumably just got confused about what "force" really means in this context (which is "ignore nonexistent files"). The only 'legitimate' user, which is `rm`, instead now handles this completely internally instead.
2022-12-15headless-browser: Remove option to specify a WebDriver FD-passing socketTimothy Flynn
2022-12-15LibCore: Rename `MemoryStream` to `FixedMemoryStream`Tim Schumacher
This is to differentiate between the upcoming `AllocatingMemoryStream`, which automatically allocates memory as needed instead of operating on a static memory area.
2022-12-14LibGfx+Userland: Make Gfx::SystemTheme propagate errorsCygnix Proto
This patch introduces error propagation to Gfx::SystemTheme to remove instances of release_value_but_fixme_should_propagate_errors(). Userland applications that have been affected by this change have been updated to utilise this propagation and as a result 4 such instances of the aforementioned method have been removed.
2022-12-14LibWeb: Split PaintContext::viewport_rect() into device/css variantsSam Atkins
For now, everyone uses `device_viewport_rect()`, until I convert them.
2022-12-14LibWeb: Make PaintContext aware of CSS and DevicePixelsSam Atkins
Store the ratio between device and CSS pixels on the PaintContext, so that it can convert between the two. Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-10LibWeb+WebContent+headless-browser: Remove PaintContext::scroll_offset()Sam Atkins
Nobody uses this. They get the scroll_offset from the BlockContainer instead.
2022-12-10LibWeb+WebContent+headless-browser: Use CSSPixels for PageClient eventsSam Atkins
...and also for hit testing, which is involved in most of them. Much of this is temporary conversions and other awkwardness, which should resolve itself as the rest of LibWeb is converted to these new types. Hopefully. :thousandyakstare:
2022-12-10LibWeb+WebContent+headless-browser: Make Page aware of the display scaleSam Atkins
For now, we just report it as "1" everywhere. Replaced `screen_rect()` with `web_exposed_screen_area()` from the spec.
2022-12-08LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>Andreas Kling
This is a first step towards handling PNG encoding failures instead of just falling over and crashing the program. This initial step will cause encode() to return an error if the final ByteBuffer copy fails to allocate. There are more potential failures that will be surfaced by subsequent commits. Two FIXMEs were killed in the making of this patch. :^)