summaryrefslogtreecommitdiff
path: root/Ladybird/WebContentView.cpp
AgeCommit message (Collapse)Author
2023-05-23LibGfx+Everywhere: Change `Gfx::Rect` to be endpoint exclusiveJelle Raaijmakers
Previously, calling `.right()` on a `Gfx::Rect` would return the last column's coordinate still inside the rectangle, or `left + width - 1`. This is called 'endpoint inclusive' and does not make a lot of sense for `Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would return 4 as its right side. This same problem exists for `.bottom()`. This changes `Gfx::Rect` to be endpoint exclusive, which gives us the nice property that `width = right - left` and `height = bottom - top`. It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly the same. All users of `Gfx::Rect` have been updated accordingly.
2023-05-21Ladybird: Remove unused IODevice.h includeBen 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-17Ladybird: Move ownership of the JS console/inspector to the tab objectTimothy Flynn
This is to match Browser, where ownership of all "subwidgets" is placed on the tab as well. This further lets us align the web view callbacks to match Browser's OOPWV as well, which will later let us move them into the base LibWebView class.
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-17Ladybird: Remove unused JS console methodsTimothy Flynn
Note that the real implementations of these functions are: notify_server_did_output_js_console_message notify_server_did_get_js_console_messages Which have the same method bodies as these unused variants.
2023-05-17Browser+Ladybird+LibWebView: Move some common functions to LibWebViewTimothy Flynn
The implementations of handle_web_content_process_crash and take_screenshot are exactly the same across Browser and Ladybird. Let's reduce some code duplication and move them to LibWebView.
2023-05-16Ladybird: Add screenshot actions to the page context menuTimothy Flynn
Browser on Serenity has these actions already.
2023-05-16Ladybird: Add a context menu for image elementsTimothy Flynn
2023-05-16Ladybird: Add a context menu for link elementsTimothy Flynn
2023-05-16Ladybird: Move the page context menu from the BrowserWindow to the TabTimothy Flynn
This will allow us to show different context menus depending on what element is clicked, much like we do for Browser on Serenity.
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: Make resizing the window a lot less laggyAndreas Kling
While resizing, we now pad the shared bitmap allocations with 256 pixels extra in both axes. This avoids churning through huge allocations for every single resize step. We also don't reallocate at all when making the window smaller. 3 seconds after the user stops resizing, we resize the backing stores again so they fit the window perfectly.
2023-05-15Ladybird: Only request repaint for what's in the visible viewportAndreas Kling
Before this change, we asked WebContent to fill the whole shared bitmap with content, even if we couldn't show it all in the viewport.
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-15Ladybird: Floor the WebContentView viewport offset at 0, 0Andreas Kling
This fixes an unpleasant visual glitch when resizing the window. When the user makes our QAbstractScrollArea larger, the scroll bars can end up with negative values, which we were happily forwarding to the WebContent process and asking it to paint the whole page at an offset.
2023-05-14Ladybird: Send the double click event to WebContentLuke Wilde
2023-05-09Ladybird: Allow right clicking and inspecting elementsMacDue
This adds "Inspect Element" (currently the only entry) to the context menu for the page, which will do what you expect (most of the time), and bring up the Inspector with hovered element selected.
2023-04-30Ladybird: Let WebContent know if the current system theme is darkAndreas Kling
This means we now actually respect @media (prefers-color-scheme: dark) by default when in dark mode. :^)
2023-04-25Ladybird: Remove Web::Platform plugins for Qt in favor of LibCoreAndreas Kling
Now that the Core::EventLoop is driven by a QEventLoop in Ladybird, we don't need to patch LibWeb with Web::Platform plugins. This patch removes EventLoopPluginQt and TimerQt. Note that we can't just replace the Web::Platform abstractions with LibCore stuff immediately, since the Web::Platform APIs use JS::SafeFunction for callbacks.
2023-04-25LibCore: Simplify Core::Notifier by only allowing one event typeAndreas Kling
Not a single client of this API actually used the event mask feature to listen for readability AND writability. Let's simplify the API and have only one hook: on_activation.
2023-04-24Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every fileTimothy Flynn
2023-04-23Ladybird: Implement the JavaScript console using a WebContentViewTimothy Flynn
This aligns the Ladybird console implementation with the Browser console a bit more, which uses OutOfProcessWebView for rendering console output. This allows us to style the console output to try and match the system theme. Using a WebContentView is simpler than trying to style the old QTextEdit widget, as the console output is HTML with built-in "-libweb-palette-*" colors. These will override any color we set on the QTextEdit widget.
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-04-14Ladybird: Display Qt cursors corresponding to missing CSS cursorsSrikavin Ramkumar
2023-03-26Ladybird: Open target _blank links in new tabCoderdreams
2023-03-21LibGfx: Move all image loaders and writers to a subdirectoryLucas CHOLLET
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-16Ladybird: Implement `notify_request_open_new_tab`Aliaksandr Kalenik
2023-03-16LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tabAliaksandr Kalenik
2023-03-16Ladybird: Generate window handle during client creationAliaksandr Kalenik
Generate handle UUID for top-level context that is going to run in created WebContent process and sent it over IPC. Co-authored-by: Timothy Flynn <trflynn89@pm.me>
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-15Ladybird: Get the system's current color theme settings from QtAndreas Kling
There isn't a 1:1 equivalent for all ColorRoles between Qt and LibGfx, but we can at least make an effort to translate the various QPalette preferred colors. This makes text selection look a lot more "native" in Ladybird. :^)
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-13Ladybird+LibWebView: Move WebContent process launcher to LibWebViewTimothy Flynn
This is to allow headless-browser to reuse this code. We have a similar helper for launching SQLServer from Ladybird.
2023-03-08Ladybird: Send window size and position to WebContent processAliaksandr Kalenik
2023-03-07Ladybird: Handle close event in WebContentViewAliaksandr Kalenik
2023-03-07LibWebView+WebContent: Propagate close from WebContent to LibWebViewAliaksandr Kalenik
2023-02-22Ladybird: Support inspecting the accessibility treeMacDue
This allows viewing the ARIA accessibility tree Epigenetic added in #16430, but now in Ladybird!
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-08Ladybird: Don't overwrite argv[0] in spawn_helper_process()MacDue
This is already set correctly at the caller.
2023-02-06Ladybird: Specify window size in layout dump modeAliaksandr Kalenik
2023-02-02Ladybird: Abstract spawning helper processes into separate methodsAndrew Kaster
This will let us use the same path discovery methods for WebContent, SQLServer, and any other helper processes we need to launch.
2023-02-01Ladybird: Store the WebContent QSocketNotifier on the stackTimothy Flynn
This was being heap allocated with naked-new and never freed. Caught by AddressSanitizer.
2023-01-29AK: Move memory streams from `LibCore`Tim Schumacher