Commit graph

35014 commits

Author SHA1 Message Date
Samuel Fry c113d3fae9 LibWeb: Support parsing column-width 2024-08-26 08:26:22 +01:00
Andreas Kling 84ab8bf797 LibWeb: Make CSS :hover selector match shadow-inclusive ancestors
Before this change, :hover wouldn't match anything outside the shadow
boundary when hovering elements inside a shadow tree. This was most
noticeable when hovering the text inside an input element and hover
styles disappearing from the hosting input element itself.
2024-08-25 12:53:08 +02:00
Tim Ledbetter f3405b6eb2 LibWeb: Implement Navigator.serviceWorker
This currently returns a stubbed `ServiceWorkerContainer` object.
2024-08-25 09:48:30 +02:00
Tim Ledbetter 53ab6fa403 LibWeb: Stub the ServiceWorkerContainer interface 2024-08-25 09:48:30 +02:00
Tim Ledbetter 0c0a4a6042 LibWeb: Stub the ServiceWorkerRegistration interface 2024-08-25 09:48:30 +02:00
Tim Ledbetter d3e076f963 LibWeb: Implement cloning steps for HTMLTextAreaElement 2024-08-25 09:48:19 +02:00
Tim Ledbetter 71cfa705d1 LibWeb: Implement cloning steps for HTMLInputElement 2024-08-25 09:48:19 +02:00
Timothy Flynn d8c69a0e9e LibWebView+WebContent: Monitor for system time zone changes
This creates a TimeZoneWatcher in the UI process to inform all open
WebContent processes when the time zone changes. The WebContent process
will clear its time zone cache to retrieve a fresh zone the next time
it is asked for one.
2024-08-25 09:47:42 +02:00
Timothy Flynn 577efcdc32 LibCore: Create a system time zone watcher
This creates platform-dependent monitors to detect when the system time
zone changes. On Linux, we use a file watcher to monitor files such as
/etc/localtime for changes. On macOS, this uses CFNotificationCenter to
be notified by the OS when the time zone changes.

Note: the macOS implementation requires running in a process which is
running the CoreFoundation event loop. Both the AppKit and Qt chromes
are doing so in the UI process, but this means we cannot run this
monitor in the WebContent process.
2024-08-25 09:47:42 +02:00
Timothy Flynn b31c11bca5 LibUnicode: Cache the system time zone
It's expensive to determine the system time zone from disk each time it
is requested. This makes LibUnicode cache the result, and provides an
API to clear that cache. This will let us set up a monitor to watch for
system time zone changes in platform-dependent ways.
2024-08-25 09:47:42 +02:00
Timothy Flynn e25681203e LibCore: Add support for monitoring symbolic links
Symbolic links are currently always followed to their target. This lets
us monitor the link file itself.
2024-08-25 09:47:42 +02:00
Timothy Flynn 9f496a9c65 LibCore: Improve support for the macOS file watcher with actual files
When asked to monitor a file (not a directory), we often need to instead
monitor the parent directory to receive FS events. For example, when a
symbolic link is deleted/created, we don't receive any events unless we
are watching the parent.
2024-08-25 09:47:42 +02:00
Timothy Flynn 574b4be433 LibCore: Remove deleted monitored files before invoking change callbacks
The caller may want to re-add the monitored file. It won't be able to do
so if we internally believe the file is still being monitored.
2024-08-25 09:47:42 +02:00
Timothy Flynn abc462999e LibCore: Remove monitored file data before invoking system calls
The monitored files can be internally removed by inotify. If we then try
to explicitly remove them, the inotify_rm_watch call will fail. We do
this when the file is deleted and we receive an IN_DELETE event. This
ensures we clean up the monitored files.
2024-08-25 09:47:42 +02:00
Timothy Flynn 61419cf717 LibCore: Silently ignore IN_IGNORED events
According to the inotify man page, this event is always generated after
a IN_DELETE, which we separately handle. Just ignore IN_IGNORED events
to avoid spamming stderr.
2024-08-25 09:47:42 +02:00
Andrew Kaster 49733ed09b LibWeb: Add an HTML tokenizer re-implementation in swift
It doesn't do much yet, the fun part was the scaffolding
2024-08-24 19:14:09 -06:00
Andrew Kaster e15dd3c22a LibGfx: Use new AK+Swift extensions to simplify parseHexString 2024-08-24 19:14:09 -06:00
Andreas Kling 349b17cc7a LibWeb: Don't paint text fragments with CSS visibility:hidden
We *could* even skip creating a paintable for hidden nodes, but that
means that dynamic updates to the CSS visibility property would require
mutating the paint tree, so let's keep it simple for now.
2024-08-24 14:53:26 +02:00
Jamie Mansfield 2e9aec984c LibWeb/HTML: Implement DataTransferItem.webkitGetAsEntry() 2024-08-24 14:53:11 +02:00
Jamie Mansfield 169163b002 LibWeb/EntriesAPI: Implement FileSystemEntry 2024-08-24 14:53:11 +02:00
Jamie Mansfield b583aec3ac LibWeb: Add [Clamp] extended attribute to WebSocket.close 2024-08-24 14:52:27 +02:00
Jamie Mansfield f02ca0c431 LibWeb: Expose TextMetrics to Worker 2024-08-24 11:25:19 +01:00
Jamie Mansfield 4133177895 LibWeb: Expose Worker to DedicatedWorker and SharedWorker 2024-08-24 11:25:19 +01:00
mrdcbrush b757ee0bc8 LibWebView: Add Kagi search engine to menu
LibWebView: Add Kagi search engine to selection menu
2024-08-24 11:21:25 +01:00
Andrew Kaster 33e50889f2 LibWeb: Add CustomStringConvertible extension for HTMLToken types 2024-08-23 19:17:20 -06:00
Andrew Kaster fb074f9d0c LibWeb: Add start of HTML Tokenizer in Swift
Currently it's just a Token class.
2024-08-23 19:17:20 -06:00
Jamie Mansfield 67976d041b LibWeb/FileAPI: Add [Clamp] extended attribute to Blob.slice
See:
 - http://wpt.live/FileAPI/blob/Blob-slice-overflow.any.html
2024-08-23 12:08:11 +01:00
Jamie Mansfield 9650a5ff33 LibWeb/FileAPI: Update Blob.slice for spec changes 2024-08-23 12:08:11 +01:00
Timothy Flynn 181ece4d9c LibWeb: Implement DataTransferItem.prototype.getAsString() 2024-08-23 10:10:34 +01:00
Timothy Flynn b978dba8bd LibWeb: Implement DataTransferItem.prototype.getAsFile()
This is used on imgur after drag-and-dropping an image onto its page.
2024-08-23 10:10:34 +01:00
simonkrauter 6c9adf3dbc LibWeb: Change where content selection via mouse is allowed
Previously, only DOM nodes with `is_editable()` allowed selection via
the mouse. This had the unwanted consequence, that read-only
input/textarea elements did not allow selection.

Now, `EventHandler::handle_mousedown()` asks the node's non-shadow
parent element over the new virtual method `is_child_node_selectable()`,
if selection of the node is allowed.
This method is overridden for `HTMLButtonElement` and
`HTMLInputElement`, to disallow selection of buttons and placeholders.

Fixes #579
2024-08-23 09:31:05 +01:00
simonkrauter a2e4259099 LibWeb: Introduce variable dom_node in EventHandler::handle_mousedown
to make the code more readable
2024-08-23 09:31:05 +01:00
Jamie Mansfield dda7325358 LibWeb/XHR: Expose FormData to Worker
See:
 - http://wpt.live/fetch/api/response/response-init-contenttype.any.worker.html
2024-08-22 19:52:06 -06:00
Andreas Kling 8eacfc8f10 LibWeb: Derive SVG root's natural size from width/height attributes
We were incorrectly looking at the CSS computed values for width and
height to determine the natural size of <svg> root elements.
This meant that elements where the attribute and computed value were
different values would end up with incorrect natural size.
2024-08-22 15:29:29 +02:00
Timothy Flynn b16b9709b9 LibWeb: Include the Content-Type boundary directive in form submissions
The spec requires that "multipart/form-data" Content-Type headers also
include a boundary directive. This allows the content server to validate
the submitted form data.

Google Lens, for example, rejects forms missing this directive.
2024-08-22 14:21:13 +02:00
Timothy Flynn 1cdccf901b LibWeb: Transform errant return to a break in form submission
There are more steps to be run after extracting the form body and type.
2024-08-22 14:21:13 +02:00
Timothy Flynn 001d8384e5 LibWeb: Implement the DataTransferItem kind and type attributes 2024-08-22 14:21:13 +02:00
Timothy Flynn ceb9e30d42 LibWeb: Implement the DataTransferItemList indexed getter 2024-08-22 14:21:13 +02:00
Timothy Flynn 843f8f04a5 LibWeb: Implement the DataTransferItemList length attribute 2024-08-22 14:21:13 +02:00
Timothy Flynn 74d9cfbf2a LibWeb: Implement DataTransferItemList.prototype.add() 2024-08-22 14:21:13 +02:00
Timothy Flynn b3bfd02e64 LibWeb: Store a list of DataTransferItem on the DataTransfer object
When scripts receive a DataTransferItem from any IDL method, the spec
requires we return the same DataTransferItem for a particular item in
the drag data store. Meaning, we cannot just create these on the fly as
needed.

To do this, we store a list of DataTransferItem on the DataTransfer
object. We will return one of these objects any time one is requested by
a script.

It feels a bit weird to have the DataTransfer object store: the drag
data store, a DataTransferItemList, and a list of DataTransferItem. But
this is how other engines implement this as well. It basically has to be
this way as DataTransferItemList is just a proxy to the DataTransfer -
meaning, DataTransfer is the source of truth for all IDL access.
2024-08-22 14:21:13 +02:00
Timothy Flynn c82fec0a8c LibWeb: Add a factory method to create a DataTransferItem
A DataTransferItem is associated with a DataTransfer, and points to an
item in the drag data store. We don't yet support removing items from
the store, but when we do, we will clear the index stored here to set
the DataTransferItem's mode to "disabled".
2024-08-22 14:21:13 +02:00
Timothy Flynn 5c9287aa99 LibWeb: Implement separate DataTransfer factories for IDL / internal use
The IDL constructor has to take separate steps than a DataTransfer that
is internally constructed. Notably, an IDL-created object has its own
drag data store, and that store is placed in a read-write mode.
2024-08-22 14:21:13 +02:00
Timothy Flynn f7c4165dde LibWeb: Make the drag data store reference counted
Ownership of the drag data store is a bit weird. In a normal drag-and-
drop operation, the DragAndDropEventHandler owns the store. When events
are fired for the operation, the DataTransfer object assigned to those
events are "associated" with the store. We currently represent that with
an Optional<DragDataStore&>.

However, it's also possible to create DataTransfer objects from scripts.
Those objects create their own drag data store. This puts DataTransfer
in a weird situation where it may own a store or just reference one.

Rather than coming up with something like Variant<DDS, DDS&> or using
MaybeOwned<DDS> here, we can get by with just making the store reference
counted.
2024-08-22 14:21:13 +02:00
Timothy Flynn 1b70362954 LibWeb: Implement the DataTransfer items attribute 2024-08-22 14:21:13 +02:00
Timothy Flynn 34ad67e056 LibWeb: Remove unused DataTransfer-related IDL factories
The IDL for DataTransferItem and DataTransferItemList do not have
constructors.
2024-08-22 14:21:13 +02:00
Timothy Flynn 535f03b6cf LibWeb: Implement DataTransfer.prototype.getData()
This is used by Google Lens. It will always return the empty string when
dragging an image onto the Google Lens search field.
2024-08-22 14:21:13 +02:00
Timothy Flynn 0b0d44da27 LibWeb: Implement the ClipboardEvent IDL interface
We don't actually generate any such events ourselves. But Google Lens
will create one with the DataTransfer attribute set to that of any drop
event we send it.
2024-08-22 14:21:13 +02:00
Tim Ledbetter 2c5d626b21 LibWeb: Don't crash when converting small CSS::Ratio to CSSPixelFraction
Previously, a crash would occur in the if `CSSPixelFraction` was given a
denominator value less than the resolution of `CSSPixels` (1/64).

We now divide both parts of the ratio by the denominator in this case.
2024-08-22 13:49:41 +02:00
Gasim Gasimzada 785180dd45 LibJS+WebContent: Implement console.table
- Expose table from console object
- Add new Table log level
- Create a JS object that represents table rows and columns
- Print table as HTML using WebContentConsoleClient
2024-08-22 09:08:50 +01:00
Andreas Kling a2a9a11466 LibWebView: Update User-Agent spoofing strings with new versions
Also use an OrderedHashMap so they show up in the same order in UI.
2024-08-22 09:39:20 +02:00
Ali Mohammad Pur a60ecea16a LibWasm+LibWeb+test-wasm: Refcount Wasm::Module for function references
Prior to funcref, a partial chunk of an invalid module was never needed,
but funcref allows a partially instantiated module to modify imported
tables with references to its own functions, which means we need to keep
the second module alive while that function reference is present within
the imported table.
This was tested by the spectests, but very rarely caught as our GC does
not behave particularly predictably, making it so the offending module
remains in memory just long enough to let the tests pass.

This commit makes it so all function references keep their respective
modules alive.
2024-08-22 09:36:40 +02:00
Andreas Kling 5606ce412e LibWeb: Handle document/navigable disconnection during favicon decode
If the document is disconnected from the navigable by the time a favicon
decode completes successfully, we don't want to show the favicon for
whatever document is now loaded in the navigable.

Fix this by deferring getting the navigable until after the decode has
completed.
2024-08-22 09:34:54 +02:00
Andreas Kling bde2d3dc7b LibWeb: Adjust flex item intrinsic contributions through aspect ratio
When determining the intrinsic cross size contribution of a flex item
with a preferred aspect ratio, we have to account for any min/max
constraints in the main axis.
2024-08-21 13:38:39 +02:00
Francesco Gazzetta 81fbb5ebc2 LibGfx: Fix build with system skia
Compare with Userland/Libraries/LibWeb/CMakeLists.txt:780
2024-08-21 06:28:10 -04:00
Kenneth Myhra 26fe7a628c LibWeb: Capture incoming reason argument
Capture the incoming reason argument to
transform_stream_default_source_cancel_algorithm() on the
on_fulfilled_callback() of WebIDL::react_to_promise() on step 7.
2024-08-21 11:21:54 +01:00
Khaled Lakehal 514a2a1757 LibWeb: Add setter implementation for location.search
This commit implements the setter for `location.search`, allowing
updates to the query string of the URL.
2024-08-21 10:52:19 +01:00
Sam Atkins 5bd585d446 LibWeb/CSS: Add dump method to CalculatedStyleValue
The individual nodes all have dump methods, but there was no way of
calling them from the outside. So now there is.
2024-08-21 10:51:48 +01:00
Sam Atkins 3af6a69f1e LibWeb: Introduce color-function-specific style values
Instead of CSSColorValue holding a Gfx::Color, make it an abstract class
with subclasses for each different color function, to match the Typed-OM
spec. This means moving the color calculations from the parsing code to
the `to_color()` method on the style value.

This lets us have calc() inside a color function, instead of having to
fully resolve the color at parse time. The canvas fillStyle tests have
been updated to reflect this.

The other test change is Screenshot/css-color-functions.html: previously
we produced slightly different colors for an alpha of 0.5 and one of
50%, and this incorrect behavior was baked into the test. So now it's
more correct. :^)
2024-08-21 10:51:48 +01:00
Sam Atkins 27be8678c9 LibWeb/CSS: Introduce helper methods for parsing numeric values
"Parse a style value for <foo>", where we don't care if it's a literal
<foo> or a calculated one, is a really common thing that we previously
didn't have methods for.

A couple of methods we had have been extended to parse calc(), and the
others have been filled in.

The method for parsing the `flex` property's value is renamed
`parse_flex_shorthand_value()` as it conflicted.
2024-08-21 10:51:48 +01:00
Sam Atkins 79bd942dd1 LibWeb/CSS: Inline number/integer parsing
For simplicity in user code, the `parse_foo_value()` methods should
parse anything that is a `<foo>`. In these cases, that means a
number/integer or calculation that resolves to them.

These uses in parse_css_value_for_properties() specifically only want a
literal IntegerStyleValue/NumberStyleValue, as calc-parsing is done
elsewhere. So, do the parsing for them locally.
2024-08-21 10:51:48 +01:00
Sam Atkins 9bc71ab1fe LibWeb/CSS: Stop using parse_color()
Parsing a `Gfx::Color` no longer makes sense, as CSS has many ways of
defining a color, often in a dynamic way where the color value isn't
known until later. This is a small preparatory change before a much
larger color rewrite.
2024-08-21 10:51:48 +01:00
Sam Atkins 37ea4e3b5f LibWeb: Rename CSSColorValue::create() to create_from_color()
Soon, CSSColorValue will be an abstract class, and we'll instead create
a CSSRGB, CSSHSL, or other specific color type from the Typed-OM spec.
However, it's still useful to have an easy "just give me a style value
for this color" method. So change the name to distinguish this from the
usual StyleValue::create() methods.
2024-08-21 10:51:48 +01:00
Sam Atkins 4e48afd9a7 LibWeb: Store ShadowStyleValue's color as a StyleValue
Colors can be specified in a way that `Gfx::Color` can't represent, such
as named system colors, `currentColor`, or functions involving `calc()`.
2024-08-21 10:51:48 +01:00
Sam Atkins 581d00293c LibWeb: Rename ColorStyleValue -> CSSColorValue
This matches the name in the CSS Typed OM spec.
https://drafts.css-houdini.org/css-typed-om-1/#csscolorvalue

This is not (yet) the same as the CSSColorValue, but one step at a time.
2024-08-21 10:51:48 +01:00
Sam Atkins 8952764267 LibWeb/CSS: Introduce CSSNumericValue and CSSUnitValue type stubs
CSS-Typed-OM has the following hierarchy:

CSSStyleValue
- CSSNumericValue
  - CSSUnitValue
  - CSSMathValue
    - ...various math functions...

Somewhat unintuitively, numbers are also stored using CSSUnitValue with
`unit = "number"`.

There are no distinct classes for LengthStyleValue, etc in the spec, but
they're convenient for us, so they are implemented as subclasses of
CSSUnitValue, at least for now.
2024-08-21 10:51:48 +01:00
Tim Ledbetter fe42e2719f LibWeb: Don't crash when parsing HTMLInputElement invalid time values 2024-08-20 23:30:35 +01:00
Jelle Raaijmakers e926b4cbfb LibWeb: Make new ImageData() use unpremultiplied color data
This was already the case for `context.createImageData()`, but I forgot
to do the same for `new ImageData()`. Add a regression test for both
cases.
2024-08-20 20:39:09 +02:00
Jelle Raaijmakers bd55e85027 LibGfx: Implement Gfx::AlphaType for SkiaPainter
Always assuming unpremultiplied color data only worked for PNGs (which
are specced as unpremultiplied) and bitmaps with alpha set to 100%.
Properly propagate the Gfx::AlphaType of a bitmap to Skia.

The reference tests were updated to reflect this change, but visually
it's practically impossible to see the difference. A new test was added
to clearly expose this issue.

Fixes #1104
2024-08-20 20:39:09 +02:00
Jamie Mansfield aac342bf74 LibWeb/HTML: Update "can have its URL rewritten" for spec changes
This updates the spec comments and removes a FIXME. Functionally,
this doesn't change anything as a fix was already in place.

See:
 - https://github.com/whatwg/html/commit/89a387c
 - https://github.com/whatwg/html/issues/10551
2024-08-20 20:31:39 +02:00
Aliaksandr Kalenik bc20e3ac6c LibWeb: Do not allocate mask bitmap for CSS "clip-path" property
Instead, it could be applied directly as a clip path in Skia painter.

As a side bonus, we get rid of some DeprecatedPath and
AntiAliasingPainter usage.
2024-08-20 20:00:56 +02:00
Timothy Flynn 9f1517492c LibJS: Update spec link to the hashbang comment syntax
The proposal reached stage 4 and was merged into the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/2006dea
2024-08-20 12:24:49 -04:00
Timothy Flynn caf1606c9f LibJS: Mark a call to DetachArrayBuffer as infallible
Noticed while looking at the merged ArrayBuffer transfer proposal.
2024-08-20 12:24:49 -04:00
Timothy Flynn bf3e7d3ac4 LibJS: Update spec steps/links for the ArrayBuffer transfer proposal
The proposal reached stage 4 and was merged into the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/44bb0e0
2024-08-20 12:24:49 -04:00
Andreas Kling 4bc3055c0f LibWeb: Only invalidate shadow root when style sheet inside changes
We don't have to invalidate style for the entire document when a style
sheet changes inside of a shadow root.

To make this possible, StyleSheetList now keeps track of which
Document-or-ShadowRoot it corresponds to, instead of just tracking the
containing Document.

This avoids a lot of style recomputation on pages with lots of shadow
DOM content (like GitHub).
2024-08-20 16:10:33 +02:00
Andreas Kling e71ed67069 LibWeb: Show in dumps when elements represent a pseudo element
You can now tell in DOM dumps that an element represents e.g a text
input ::placeholder pseudo element.
2024-08-20 16:10:33 +02:00
Andreas Kling 62083bf586 LibWeb: Only recompute before and after pseudo element styles
Before this change, we would go through every known pseudo element and
compute style for it whenever recomputing the style of an element.

This led to disastrous performance on pages with selectors like
`::selection` or `::placeholder`, as they'd effectively match every
single element and thus we'd compute multiple additional styles for
every element in the DOM.

The fix is simple: only recompute `before` and `after` pseudo element
styles, since those are the only two pseudo elements that generate
*new* nodes -- other pseudo elements refer to (possibly) existing
nodes or concepts within the DOM (or internal shadow DOM).

This makes style updates take ~40ms on our GitHub repo instead of
~220ms. It's still slower than it should be, but a huge improvement.
2024-08-20 16:10:33 +02:00
Andreas Kling 2f3128333d LibWasm: Make BytecodeInterpreter overrides final
This gives us free devirtualization of some hot calls inside the
bytecode interpreter. Most notably the did_trap() checks.

Modest performance improvement on the https://figma.com/ landing page.
2024-08-20 12:01:43 +02:00
bbb651 e6a668ad91 HTML: BrowsingContext: Remove m_parent and fix is_ancestor_of
`BrowsingContext::m_parent` has been removed from the spec,
and previously `m_parent` was always null.

`BrowsingContext::is_top_level` was already always returning
true before because of that, and the updated spec algorithm
causes assertions to fail.

This fixes the following example:
```html
<a href="about:blank" target="test">a
<iframe name="test">
```
clicking the link twice no longer causes it to open in a new tab.
2024-08-20 09:36:11 +02:00
bbb651 f82e3345f2 HTML: Update coop-check-access-report to match spec 2024-08-20 09:36:11 +02:00
Andreas Kling dd1b8de671 Ladybird+LibWeb+LibGfx: Add option to force use of fontconfig
This allows us to get identical metrics on macOS and Linux. Without
this, Skia will use CoreText on macOS and give us slightly different
text metrics. That causes layout tests to be slightly different on
different platforms, which is a huge headache. So let's not do that.

You can now launch Ladybird and headless-browser with --force-fontconfig
to load fonts through fontconfig. Tests run in this mode by default.
2024-08-20 09:30:05 +02:00
Andreas Kling 3ed0381a2a LibGfx: Remove unused font code dealing with left-side bearing 2024-08-20 09:30:05 +02:00
Andreas Kling d4d7feffca LibWeb: Compensate for CRC2D transform in internal stored path
The CRC2D path should be unaffected by the CRC2D transform changing.
To achieve this, we transform the path to compensate whenever the
CRC2D transform is changed.
2024-08-20 09:30:05 +02:00
Andreas Kling 0d57de4236 LibWeb: Make 2D canvas save/restore perform save/restore on painter
This ensures that any internal state maintained by the painter gets
synchronized appropriately.
2024-08-20 09:30:05 +02:00
Andreas Kling 8540954bf8 LibWeb: Reject non-finite values in 2D canvas transforms 2024-08-20 09:30:05 +02:00
Andreas Kling 7032cb0235 LibWeb: Stop projecting everything through the current 2D canvas matrix
Now that the underlying Gfx::Painter is being transformed as we go,
we don't need to pre-emptively transform geometry before painting it.
2024-08-20 09:30:05 +02:00
Andreas Kling feae36f218 LibWeb: Flush 2D canvas transformation matrix after making changes to it 2024-08-20 09:30:05 +02:00
Andreas Kling 5aeb8ebebc LibWeb: Clip underlying Painter in CRC2D::clip() 2024-08-20 09:30:05 +02:00
Andreas Kling 57128f489a LibGfx: Remove most of AntiAliasingPainter 2024-08-20 09:30:05 +02:00
Andreas Kling 91737395f3 LibGfx: Remove unused PathClipper 2024-08-20 09:30:05 +02:00
Andreas Kling aabad3b94e LibGfx: Remove a bunch of no-longer-used OpenType font code
We're not quite ready to remove the old OpenType implementation yet,
but let's carve off some unused stuff.
2024-08-20 09:30:05 +02:00
Andreas Kling 137038b185 LibWeb: Port painting to use the new Skia-backed Gfx::Path
SVG and and CSS border rendering now sits on top of SkPath instead of
the old Gfx::DeprecatedPath.

Due to an imperceptible (255, 255, 255) vs (255, 254, 255) color diff
in one ref test, I changed that test to not depend on border rendering
for a positive result, since that was incidental.
2024-08-20 09:30:05 +02:00
Andreas Kling a3cc03f180 LibGfx+LibWeb: Add new Path class with Skia backend, use for 2D canvas
This thing is essentially a wrapper around an SkPath, although we do
some indirection via a PathImpl class to keep the door open for
alternative rasterizer/path backends in the future.

We also update the 2D canvas code, since that was the only code that
used Painter+DeprecatedPath, and this allows us to just drop that
code instead of temporarily supporting it until the next commit.
2024-08-20 09:30:05 +02:00
Andreas Kling c8f09312f7 LibGfx: Rename Path => DeprecatedPath 2024-08-20 09:30:05 +02:00
Andreas Kling de50d27870 LibGfx: Introduce a new Gfx::Painter with a Skia backend
This new painter is written with a virtual interface from the start,
and we begin with a Skia backend.

This patch adds enough to support our basic 2D HTML canvas usecase.
2024-08-20 09:30:05 +02:00
Andreas Kling 0c7670b226 LibGfx: Rename Painter => DeprecatedPainter 2024-08-20 09:30:05 +02:00
Timothy Flynn 099956a7cd LibWeb: Do not unconditionally prevent escape keys from being propagated
We should only block the escape key from being sent to the web page if
the CloseWatcherManager actually closed something.

We use the escape key in the Inspector to cancel editing a DOM field.
This unconditional early return broke this feature.
2024-08-20 09:29:48 +02:00
Timothy Flynn 53f775afb9 LibWeb: Add a testing helper to send a single named key to an element
Unlike internals.sendText(), this allows sending keys like the escape
key.
2024-08-20 09:29:48 +02:00
Timothy Flynn f14e7c7261 LibWeb: Add a helper to lookup a key code from its string name 2024-08-20 09:29:48 +02:00
Timothy Flynn 3ec5c1941f LibWeb+LibWebView: Add a button to the Inspector to export its contents
When working on the Inspector's HTML, it's often kind of tricky to debug
when an element is styled / positioned incorrectly. We don't have a way
to inspect the Inspector itself.

This adds a button to the Inspector to export its HTML/CSS/JS contents
to the downloads directory. This allows for more easily testing changes,
especially by opening the exported HTML in another browser's dev tools.

We will ultimately likely remove this button (or make it hidden) by the
time we are production-ready. But it's quite useful for now.
2024-08-20 09:28:25 +02:00