Commit Graph

4276 Commits

Author SHA1 Message Date
Timothy Flynn
bf060adcf9 Browser+LibWebView+WebContent: Do not domain match on cookie updates
Updating cookies through these hooks happens in one of two manners:
1. Through the Browser's storage inspector.
2. Through WebDriver's delete-cookies operation.

In (1), we should not restrict ourselves to being able to delete cookies
for the current page. For example, it's handy to open the inspector from
the welcome page and be able to delete cookies for any domain.

In (2), we already are only interacting with cookies that have been
matched against the document URL.
2022-12-08 17:14:48 +01:00
Linus Groh
ae0606711c LibWeb/Fetch: Remove redundant timingInfo variables
This is an editorial change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/e8b67b0
2022-12-08 15:37:19 +00:00
Linus Groh
a06b97dae0 LibWeb/Fetch: Share validation logic in the Headers class
This is an editorial change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/f435978
2022-12-08 15:37:19 +00:00
Linus Groh
3414a6ba20 LibWeb/Fetch: Remove Authorization header upon cross-origin redirect
This is a change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/9004f4e
2022-12-08 15:37:19 +00:00
Linus Groh
2f1bda3347 LibWeb/Fetch: Tweak wording in some spec comments
This is a change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/223ca89
2022-12-08 15:37:19 +00:00
Linus Groh
a156722744 LibWeb/Fetch: Update spec comment to decode bytes to string
This is a change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/a04d096
2022-12-08 15:37:19 +00:00
Linus Groh
1c9bb2d8b4 LibWeb/Fetch: Refactor forbidden request-headers
This is a change in the Fetch spec.

See:
- https://github.com/whatwg/fetch/commit/92e6c91
- https://github.com/whatwg/xhr/commit/494431a
2022-12-08 15:37:19 +00:00
Linus Groh
011f6a6cb4 LibWeb/Fetch: Use tuple syntax for headers in spec comments
This is an editorial change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/b482186
2022-12-08 15:37:19 +00:00
Andreas Kling
d88c7fee32 LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>
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. :^)
2022-12-08 13:01:11 +00:00
Sam Atkins
bd272e638c LibWeb: Introduce CSSPixels and DevicePixels classes
These are an attempt to separate the internal "pixel" used by CSS from
the actual "pixel" that exists on the display. Because of things like
2x display scaling, the ratio between these can vary, so having
distinct types will help prevent errors when converting from one unit
to the other.

`CSSPixels` refers to the `px` unit used on the web, which depending on
the device may or may not map to 1 pixel on the physical display. It's
a wrapper around `float`, and will be used by LibWeb for size and
position values up until we go to paint them to the screen.

`DevicePixels` on the other hand is a 1-to-1 pixel on the physical
display. It's a wrapper around `int`.
2022-12-08 12:46:03 +00:00
Aliaksandr Kalenik
f0ab127a41 LibWeb: Consider strut while calculating baseline for a line
Strut should be taken in account while computing baseline of
a line. Otherwise it results in wrong alignment in boxes that
has inline elements without any text.

This also fixes red box in Acid 2.
2022-12-07 17:50:13 +01:00
Linus Groh
525f22d018 LibJS: Replace standalone js_string() with PrimitiveString::create()
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
MacDue
1574f2c3f6 Meta+Userland: Pass Gfx::FloatSize by value
Just two floats like Gfx::FloatPoint.
2022-12-07 11:48:27 +01:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
e011eafd37 Meta+Userland: Pass Gfx::FloatPoint by value
Just a small 8-byte value like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
MacDue
bbc149ebb9 Meta+Userland: Pass Gfx::Color by value
Gfx::Color is always 4 bytes (it's just a wrapper over u32) it's less
work just to pass the color directly.

This also updates IPCCompiler to prevent from generating
Gfx::Color const &, which makes replacement easier.
2022-12-07 11:48:27 +01:00
Linus Groh
c756585deb LibWeb: Ignore -Wshadow in TRY_OR_RETURN_OOM() 2022-12-06 21:31:00 +00:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Aliaksandr Kalenik
f74251606d LibWeb: Do not try to place out-of-flow blocks in anonymous nodes
Currently placing floating blocks in anonymous nodes makes
https://stackoverflow.com/ hang so let's leave it to try
to place only absolute blocks in anonymous nodes for now.

Also it breaks flex formatting when element with floating is
flex child.
2022-12-06 08:53:10 +01:00
MacDue
385ba1280b LibWeb: Fix box-shadows where the border-radius is < the blur-radius
This fixes a rendering issue where box-shadows would not appear or
render completely broken if the blur radius was larger than the
border radius (border-radius < 2 * blur-radius to be exact).
2022-12-05 17:48:51 +01:00
Aliaksandr Kalenik
ca123350cc LibWeb: Inherit TableFormattingContext from FC instead of BFC 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
fae0b96fe4 LibWeb: Add vertical-align support for table cells 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
ba64d0462c LibWeb: Move box_baseline from LineBuilder.cpp to LayoutState.cpp 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
2f38f8c84a LibWeb: Implement intrinsic width calculation for TFC 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
dbf76e8ae1 LibWeb: Take rowspan into account while table formatting 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
1c6783cd7e LibWeb: Start implementation of CSS Table 3 spec
Here I try to address bug where content of table overflows
it's width (hacker news is an example of such site) by
reimplementing some parts of table formatting context.

Now TFC implements first steps of:
https://www.w3.org/TR/css-tables-3/#table-layout-algorithm
but column width and row height distribution steps are
still very incomplete.
2022-12-05 17:47:48 +01:00
Victor Song
88ecc4a1e5 WebContent+WebDriver: Implement POST /session/{id}/window endpoint 2022-12-04 09:33:55 -05:00
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
MacDue
6dbe7b06b3 LibWeb: Fix integer overflow in gradient painting
This would cause rendering glitches at the edges of gradients (at
certain angles).
2022-12-03 16:05:02 +00:00
MacDue
28028be2fc LibWeb: Support repeating-radial-gradient()s 2022-12-03 09:06:51 -05:00
Marco Cutecchia
55c5c97ab5 LibWeb: Log failures to decode image resources inside ImageResource 2022-12-02 11:26:29 +01:00
Marco Cutecchia
07fb0882bf LibWeb: Add null checks before derefencing Bitmaps in ImageStyleValue 2022-12-02 11:26:29 +01:00
Timothy Flynn
4a30446999 LibWeb: Support displaying HTMLInputElement placeholder values
This adds support for parsing the ::placeholder pseudo-element and
injecting an anonymous layout node with that element when the input
element's data is empty.
2022-12-01 11:18:11 -05:00
Timothy Flynn
fddbc2e378 LibWeb: Ensure the number of pseudo elements stays up-to-date
The ::placeholder pseudo element was added in commit 1fbad9c, but the
total number of pseudo elements was not updated. Instead of this manual
bookkeeping, add a dummy value at the end of the enumeration for the
count.
2022-12-01 11:18:11 -05:00
Mateusz Górzyński
4dfdca74e2 LibWeb: Handle <relative-size> values in the font-size CSS property 2022-11-30 19:58:17 +00:00
Mateusz Górzyński
a551e02e5e LibWeb: Handle <absolute-size> values in the font-size CSS property 2022-11-30 19:58:17 +00:00
MacDue
65acfe6c60 LibWeb: Handle degenerate radial gradients 2022-11-30 14:24:04 +00:00
MacDue
476acae04f LibWeb: Paint radial-gradient()s
This almost looks too easy now :^), but it's just another way to sample
the gradient line.
2022-11-30 14:24:04 +00:00
MacDue
d1b06af307 LibWeb: Add missing equals() function for ConicGradientStyleValue
Also, tidy up the one for LinearGradientStyleValue.
2022-11-30 14:24:04 +00:00
MacDue
22a7611e1c LibWeb: Parse radial-gradient()s 2022-11-30 14:24:04 +00:00
MacDue
040dac558e LibWeb: Implement RadialGradientStyleValue
Adds a style value for `radial-gradient()`s and implements some helpers
for resolving their properties.
2022-11-30 14:24:04 +00:00
MacDue
f1f1977e2d LibWeb: Move color stop list parsing to standalone functions
This makes these slightly less clunky to use for other gradient types.
2022-11-30 14:24:04 +00:00
MacDue
c02163c31f LibWeb: Allow optional values to be missing when parsing <position>s 2022-11-30 14:24:04 +00:00
MacDue
b7d436fe1b LibWeb: Only floor conic-gradient() angles for hard-edge gradients
This avoids a few little jaggy edges on gradients that are meant to
have smooth transitions.
2022-11-30 14:24:04 +00:00
Andreas Kling
9d4e0ba442 LibWeb: Fix WebIDL overload resolution with platform object arguments
We now check if an argument value is a platform object that implements
the relevant IDL interface when resolving overloads.

This makes passing a Path2D object to CanvasRenderingContext2D.fill()
actually choose the Path2D overload. :^)
2022-11-30 14:43:22 +01:00
Andreas Kling
12ddeeb9ce LibWeb: Add PlatformObject::implements_interface(String)
This can be used to ask a PlatformObject if it implements a given IDL
interface. It's implemented by a chain of virtual overrides that get
inserted for each subclass by the WEB_PLATFORM_OBJECT macro.
2022-11-30 14:43:22 +01:00
Andreas Kling
00a98c24a2 LibWeb: Update incorrect WEB_PLATFORM_OBJECT base class for two classes 2022-11-30 14:43:22 +01:00
Andreas Kling
c266284559 LibWeb: Support creating Path2D objects from SVG path strings
This reuses the SVG path parsing code.
2022-11-30 14:43:22 +01:00
Andreas Kling
65d762130a LibWeb: Factor out SVG path parsing from SVGPathElement
Converting a Vector<PathInstruction> is now done by a free function so
that we can share this code with HTML::Path2D. :^)
2022-11-30 14:43:22 +01:00
MacDue
6daef6303a LibWeb: Use AntiAliasingPainter for canvas painting 2022-11-30 07:58:44 +01:00
martinfalisse
964c18419f LibWeb: Use span value if given in the grid-*-end property
Previously were not using the span value if it was given in the
grid-column/row-end properties.
2022-11-29 19:27:31 +01:00
Timothy Flynn
99d8c115a0 LibWeb: Remove outdated FIXME regarding application cache selection
This algorithm, and window.applicationCache, was removed from the spec:
https://github.com/whatwg/html/commit/e4330d5

This also adds a spec link and comments to the affected parser method.
2022-11-29 19:04:31 +01:00
Andreas Oppebøen
ad25a415ae LibWeb: Return the position at end-of-line in TextCursor hit-test
When starting to drag the cursor below the text, we would start the
selection from the closest point in the line above in the last
fragment. This is not the behavior seen in other browsers, and it
causes weird behavior when the cursor is to the left of the last
fragment, for instances when trying to select with the text
`before <span>middle</span> after`.

By starting the selection from the _end_ of the last fragment,
including the line end character, selection behavior is similar to
that of other browsers.
2022-11-29 13:52:01 +00:00
Andreas Kling
e3b8a8f7c8 LibWeb: Treat unresolvable percentage width on inline-block as auto 2022-11-28 19:14:05 +01:00
Kyle Lanmon
31290c8527 LibSyntax: Teach each highlighter about it's comment syntax 2022-11-27 18:28:43 -07:00
Aliaksandr Kalenik
1c1b750bff LibWeb: Support box-sizing in flex formatting context
Makes pass 8/10 tests in https://wpt.live/css/css-flexbox/box-sizing-001.html
2022-11-27 10:25:17 +01:00
Baitinq
02a2018ec4 WebDriver: Implement stub for /session/{id}/print 2022-11-27 00:37:28 +00:00
Baitinq
45214fdb1a LibWeb+WebContent: Label redirects with new FrameLoader::Type::Redirect
Previously we labeled redirects as normal FrameLoader::Type::Navigation,
now we introduce a new FrameLoader::Type::Redirect and label redirects
with it. This will allow us to handle redirects in the browser
differently (such as for overwritting the latest history entry when a
redirect happens) :^)
2022-11-26 11:03:24 +01:00
Baitinq
73e87d694e LibWeb: Don't collapse TextNode if it's editable
Fixes #16127
2022-11-26 01:21:02 +01:00
Daniel Ehrenberg
09841f56ed LibWeb: Add initial implementation of structured clone
This implementation only works for cloning Numbers, and does not try to
do all the spec steps for structured serialize and deserialize.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-26 00:47:23 +01:00
Sam Atkins
b517032354 LibWeb: Return correct value from EventHandler::fire_keyboard_event()
The returned bool should be true if the event was consumed, aka if we
should ignore it. But `dispatch_event()` returns true if
you *shouldn't* ignore it, so we have to invert that return value.
2022-11-26 00:44:49 +01:00
Ali Mohammad Pur
af511a64cd LibWeb: Add support for accessing exported wasm table instances 2022-11-26 02:23:15 +03:30
Baitinq
d6bb110d89 LibWeb: Handle disabling of StyleSheet HTMLLinkElements
We now can handle dynamic updating of the disabled attribute of a <link>
of the stylesheet type.

We do this by hooking the adding and removing attribute's handlers and
dynamically loading/removing the stylesheet if it has been
enabled/disabled.
2022-11-25 22:52:05 +01:00
Andreas Kling
2157745093 LibWeb: Add missing [SameObject] extended attributes in IDL files 2022-11-25 22:49:59 +01:00
Andreas Kling
8540c4e574 LibWeb: Implement [SameObject] for HTMLTableElement.{rows,tBodies} 2022-11-25 22:49:59 +01:00
Andreas Kling
ad36bc72f4 LibWeb: Implement [SameObject] behavior for HTMLTableSectionElement.rows 2022-11-25 22:49:59 +01:00
Andreas Kling
d7c58aa58d LibWeb: Implement [SameObject] behavior for HTMLFormElement.elements 2022-11-25 22:49:59 +01:00
Andreas Kling
7d8ff0c581 LibWeb: Implement [SameObject] behavior for HTMLTableRowElement.cells 2022-11-25 22:49:59 +01:00
Aliaksandr Kalenik
2b246d980a LibWeb: Fix typo in calculate_inner_height 2022-11-25 17:06:59 +01:00
Aliaksandr Kalenik
7bc7790912 LibWeb: Flex, grid and table containers should not create BFC
Fixes https://github.com/SerenityOS/serenity/issues/16082
2022-11-25 10:45:37 +01:00
Timothy Flynn
7edd57dc87 LibWeb+WebDriver: Support running headless WebDriver sessions
This adds an "extension capability" for clients to indicate that a
headless browser should be used for the session.
2022-11-24 00:10:56 +00:00
Timothy Flynn
46b2cb308d LibWeb+WebContent: Virtualize methods needed for WebDriver in PageClient
WebDriver currently uses the WebContent::ConnectionFromClient IPC class
directly for these features. To support headless-browser, WebDriver will
instead need to rely on PageClient to provide these.
2022-11-24 00:10:56 +00:00
Timothy Flynn
c917a59abe LibWeb+WebContent: Virtualize PageClient methods needed for all clients 2022-11-24 00:10:56 +00:00
Timothy Flynn
1f08cb7020 LibWeb+WebContent: Move pending dialog handling from PageHost to Page
Currently, all handling of pending dialogs occurs in PageHost. In order
to re-use this functionality to run WebDriver in a headless move, move
it to Page.
2022-11-24 00:10:56 +00:00
Aliaksandr Kalenik
7c00619e47 LibWeb: Use calculate_inner_width to compute min and max widths
Use calculate_inner_width that consider box-sizing in compute_width
to resolve min_width and max_width.
2022-11-23 23:11:39 +01:00
Aliaksandr Kalenik
428db6e766 LibWeb: Return max margin box width from greatest_child_width
Return max margin box width instead of max border box width
from greatest_child_width.

This change fixes:
https://wpt.live/css/CSS2/margin-padding-clear/margin-008.xht
2022-11-23 23:11:39 +01:00
Andreas Kling
15c324a70b Userland+Tests: Remove a few more LibJS/{AST.h,Parser.h} includes 2022-11-23 16:05:59 +00:00
Andreas Kling
3503c658fb LibJS+LibWeb: Move JS::ModuleRequest to its own header file
This allows us to not include LibJS/AST.h in a couple more places.
2022-11-23 16:05:59 +00:00
Andreas Kling
38c7fdaac1 LibWeb: Avoid including LibJS/Parser.h in a handful of cpp files 2022-11-23 16:05:59 +00:00
Andreas Kling
71067cbc6c LibJS+LibWeb: Make Runtime/AbstractOperations.h not include AST.h
This led to considerable fallout and many files had to be patched with
now-missing include statements.
2022-11-23 16:05:59 +00:00
Andreas Kling
b81816a539 LibJS+LibWeb: Make CyclicModule.h not include AST.h
This led to some fallout as many things in LibJS and LibWeb were pulling
in other things via CyclicModule.h
2022-11-23 16:05:59 +00:00
Andreas Kling
e6331031c4 LibJS: Make Parser::Error a standalone ParserError class
This allows us to forward declare it and reduce the number of things
that need to include Parser.h.
2022-11-23 16:05:59 +00:00
Aliaksandr Kalenik
0ca1af00e7 LibWeb: Try to place out-of-flow blocks only in anonymous blocks
This change makes out-of-flow blocks to be considered for joining
only to anonymous blocks that have inline children. It finally
solved the problem that out-of-flow break anonymous blocks into
chunks causing wrong layout without regressing Acid2.
2022-11-23 15:05:57 +01:00
Andreas Kling
b0b022507b LibJS: Reduce AST memory usage by shrink-wrapping source range info
Before this change, each AST node had a 64-byte SourceRange member.
This SourceRange had the following layout:

    filename:       StringView (16 bytes)
    start:          Position (24 bytes)
    end:            Position (24 bytes)

The Position structs have { line, column, offset }, all members size_t.

To reduce memory consumption, AST nodes now only store the following:

    source_code:    NonnullRefPtr<SourceCode> (8 bytes)
    start_offset:   u32 (4 bytes)
    end_offset:     u32 (4 bytes)

SourceCode is a new ref-counted data structure that keeps the filename
and original parsed source code in a single location, and all AST nodes
have a pointer to it.

The start_offset and end_offset can be turned into (line, column) when
necessary by calling SourceCode::range_from_offsets(). This will walk
the source code string and compute line/column numbers on the fly, so
it's not necessarily fast, but it should be rare since this information
is primarily used for diagnostics and exception stack traces.

With this, ASTNode shrinks from 80 bytes to 32 bytes. This gives us a
~23% reduction in memory usage when loading twitter.com/awesomekling
(330 MiB before, 253 MiB after!) :^)
2022-11-22 21:13:35 +01:00
Aliaksandr Kalenik
3d74d72bcb LibWeb: Do not try to join floats into anonymous block
Making floats to join anonymous block caused regressions in
Acid2 Test so let's leave it to be only absolute blocks who
might be joined into anonymous block when possible.
2022-11-22 21:13:01 +01:00
Aliaksandr Kalenik
aa08c825ec LibWeb: Support box-sizing in BFC
Add support for box-sizing in block formatting context, support
for Flex Formatting Context and Grid Formatting Context is missing
2022-11-22 12:43:36 +01:00
martinfalisse
513a123728 LibWeb: Handle multiple line names in the CSS Grid
Prevent crashing when multiple line names are declared in the
grid-template-* CSS properties by skipping over the character separating
each line name.
2022-11-21 21:48:25 +00:00
Andreas Kling
849499988e LibJS+LibWeb: Make JS::ExecutionContext protect its Web::HTML::ESO owner
We can't be nuking the ESO while its owned execution context is still on
the VM's execution context stack, as that may lead to a use-after-free.

This patch solves this by adding a `context_owner` field to each context
and treating it as a GC root.
2022-11-21 19:22:09 +00:00
Baitinq
2f16198bd6 LibWeb: Remove unused should_invalidate_styles_on_attribute_changes()
This getter and setter were previously labelled as a "hack" and used to
disable style invalidation on attribute changes during the HTML parsing
phase (as it caused big sites's loading to be slow). These functions
are currently not used, so they can be removed:^)
2022-11-21 10:12:07 +01:00
Andreas Kling
e54ae1bd11 LibWeb: Don't implement bogus assertion in prepare-the-script-element
The HTML spec is asking us to make a possibly-bogus assertion, so let's
disable it for now.

Spec bug: https://github.com/whatwg/html/issues/8534
2022-11-21 10:08:50 +01:00
Andreas Kling
b21b27fda3 LibWeb: Update the HTML parser part that deals with text in <script>
This commit adds inline spec comments to the part of the parser that
ends up calling HTMLScriptElement::prepare().

The code is tweaked to match the spec more closely.
2022-11-21 10:08:50 +01:00
Andreas Kling
1aac1085b3 LibWeb: Update HTMLScriptElement prepare and execute to latest HTML spec
The net result is some nice simplification of the prepare algorithm
and a bit of initial scaffolding for import maps support.
2022-11-21 10:08:50 +01:00
Andreas Kling
7d45927d41 LibWeb: Rename HTMLScriptElement "non-blocking" to "force async"
This has been renamed in the spec, so let's do it here too.
2022-11-21 10:08:50 +01:00
Andreas Kling
7b9138be55 LibWeb: Add spec links to HTMLScriptElement member variables
This makes it much easier to see which members represent something in
the spec, and which ones are LibWeb implementation details.
2022-11-21 10:08:50 +01:00
Aliaksandr Kalenik
767cdf7b11 LibWeb: Return content box position from calculate_static_position
This change makes calculate_static_position to return content box
for both x and y (at least for the case when children are not inline).
It makes it possible to be consistent about x and y when calculating
box offset inside layout_absolutely_positioned_element.
2022-11-20 21:54:39 +01:00
MacDue
8a5d2be617 Everywhere: Remove unnecessary mutable attributes from lambdas
These lambdas were marked mutable as they captured a Ptr wrapper
class by value, which then only returned const-qualified references
to the value they point from the previous const pointer operators.

Nothing is actually mutating in the lambdas state here, and now
that the Ptr operators don't add extra const qualifiers these
can be removed.
2022-11-19 14:37:31 +00:00
MacDue
66a428ae03 LibJS+LibWeb: Return non-const types from Ptr class operators
Even if the pointer value is const, the value they point to is not
necessarily const, so these functions should not add the qualifier.

This also removes the redundant non-const implementations of these
operators.
2022-11-19 14:37:31 +00:00
Timothy Flynn
fa2579ffa9 LibWeb: Implement most of WebDriver capability matching
We don't completely implement version matching, and currently ignore the
"proxy" capability.
2022-11-18 15:30:29 +00:00
Timothy Flynn
021eb04640 LibWeb: Extract out the User-Agent browser name and version
This way we can re-use these elsewhere, and if they ever change again,
those other uses will get updated automatically.
2022-11-18 15:30:29 +00:00
Timothy Flynn
e0c7b5747d LibWeb+WebDriver: Begin processing and matching WebDriver capabilities
Still some TODOs here:
* We don't handle all capabilities (e.g. proxy)
* We don't match the capabilities against the running browser

But this will parse the capabilities JSON object received from the
WebDriver client.
2022-11-18 12:21:57 +00:00
Timothy Flynn
5b5b563968 LibWeb: Do not reject valid WebDriver script timeouts
The spec's text is pretty awkward here, but the way we've currently
transcribed it to C++ means we reject valid script timeouts. This meant
the following would fail:

    TimeoutsConfiguration config {}; // Default values.
    auto json = timeouts_object(config);
    config = TRY(json_deserialize_as_a_timeouts_configuration(json));
2022-11-18 12:21:57 +00:00
MacDue
862320828f LibWeb: Fix clicking on links
Since ff2f31b LibWeb has segfaulted when clicking on links, as the
browsing context (a GCPtr) in the lambda was captured by reference
and was out of scope by the time the callback fired.
2022-11-18 10:08:43 +00:00
Timothy Flynn
f7bb835d09 LibWeb+LibWebView+WebContent+WebDriver: Implement Send Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn
f9b8742fff LibWeb+WebContent+WebDriver: Implement Get Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn
3e7d633954 LibWeb+WebContent+WebDriver: Implement Accept Alert 2022-11-16 17:23:56 +00:00
Timothy Flynn
7cf2feb047 LibWeb+WebContent+WebDriver: Implement Dismiss Alert 2022-11-16 17:23:56 +00:00
Timothy Flynn
159dcb9507 LibWeb: Fix typo in WebDriver section comment 2022-11-16 17:23:56 +00:00
Timothy Flynn
4b8729aea6 LibWeb: Add a flag to pause an HTML event loop's execution
This will be used to unblock the WebContent IPC event loop while waiting
for a dialog response.
2022-11-16 17:23:56 +00:00
Andreas Kling
4aeb1ffc12 LibWeb: Add naive layout for SVG foreign objects
We now layout foreign objects as if they form a nested block formatting
context. This probably isn't the most correct way to do this, but it's
a start.
2022-11-16 13:01:21 +01:00
Andreas Kling
0555684682 LibWeb: Sketch out basic support for SVG <foreignObject> elements
This patch adds basic DOM construction and IDL bindings for foreign
objects in SVG trees.
2022-11-16 13:01:21 +01:00
Andreas Kling
e9eba66361 LibWeb: Adjust foreignobject to foreignObject in HTML parser
This conversion was missing from the table we copied from the spec
for whatever reason.
2022-11-16 13:01:21 +01:00
Aliaksandr Kalenik
1b5b7e3b01 LibWeb: Solve width for absolute positioned elemenent according to spec
https://www.w3.org/TR/css-position-3/#abs-non-replaced-width
If left and width are auto and right is not auto, then
the width is shrink-to-fit. Then solve for left.
2022-11-16 03:10:26 +01:00
martinfalisse
35094fc744 LibWeb: Make auto-fit compatible with grid-gap
This fixes an error when using auto-fit with grid-gap, as previously
were not taking into account the fact that more columns had been added
to the grid yet the occupation grid had not grown.
2022-11-16 00:53:00 +01:00
martinfalisse
4b6534a26d LibWeb: Use fixed-size tracks for grid gap
Previously were incorrectly initializing the grid gap tracks as were
using the GridSize float constructor, which creates a flexible length.
What is actually wanted is a fixed-size track of a certain size,
indicated in pixels.
2022-11-16 00:53:00 +01:00
Torstennator
7c09d7c52f LibWeb: Change SVGContext initial fill_color to transparent
This patch changes the initialization of the fill_color of an SVGContext
to transparent instead of black to not draw a black filling if the
elements fill_color is defined as "none".
2022-11-15 22:59:25 +01:00
Aliaksandr Kalenik
adf0262b54 LubWeb: Call before_children_paint for positioned descendants
Add before_children_paint and after_children_paint calls for
positioned descendants with z-index: auto during painting
2022-11-15 22:53:47 +01:00
Aliaksandr Kalenik
f3d57e1157 LibWeb: Clip hidden overflow by absolute rect of containing block
Since handling overflow: hidden in PaintableBox::before_children_paint
while following paint traversal order can't result in correctly computed
clip rectangle for elements that create their own stacking context
(because before_children_paint is called only for parent but overflow:
hidden can be set somewhere deeper but not in direct ancestor), here
introduced new function PaintableBox::clip_rect() that computes clip
rectangle by looking into containing block.

should_clip_overflow flag that disables clip for absolutely positioned
elements in before_children_paint and after_children_paint is removed
because after changing clip rectangle to be computed from not parent
but containing block it is not needed anymore (absolutely positioned
item is clipped if it's containing block has hidden overflow)
2022-11-15 22:53:47 +01:00
Aliaksandr Kalenik
c1401b37c4 LibWeb: Join out-of-flow block nodes in last parent child if possible
Join out-of-flow block nodes into last child of parent node if last
child has inline children.
2022-11-15 22:52:08 +01:00
Idan Horowitz
43c5b94ea6 LibWeb: Implement document.open(string, string, string) 2022-11-15 21:48:19 +00:00
Idan Horowitz
a63c7549e1 LibWeb: Implement window.open
This implementation is some-what complete, with the most common missing
/broken feature being opening pages in new tabs using the "_blank"
target.

This is currently broken due to 2 reasons:
 - We currently always claim the Window does not have transient
   activation, as we do not track the transient activation timestamp
   yet. This means that all such window.open calls are detected as
   pop-ups, and as such they are blocked. This can be easily bypassed
   by unchecking the 'Block Pop-ups' checkbox in the debug menu.
 - There is currently no mechanism for the WebContent process to
   request a new tab to be created by the Browser process, and as
   such the call to BrowsingContext::choose_a_browsing_context does not
   actually open another tab.
2022-11-15 21:48:19 +00:00
Idan Horowitz
d15d7636e5 LibWeb: Add window.open feature detection abstract operations 2022-11-15 21:48:19 +00:00
Idan Horowitz
798d7c6fae LibWeb: Add 'should block pop ups' user config to Page
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
ff2f31bc81 LibWeb: Bring BrowsingContext::choose_a_browsing_context closer to spec 2022-11-15 21:48:19 +00:00
Idan Horowitz
c948873c5b LibWeb: Add the 'opener browsing context' BrowsingContext property
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
b27f855107 LibWeb: Add the 'is popup' BrowsingContext property
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
efe94d9040 LibWeb: Support parsing a URL relative to environment settings object 2022-11-15 21:48:19 +00:00
Idan Horowitz
f69c135796 LibWeb: Implement the 'Entry Realm/{settings,global} object' concepts 2022-11-15 21:48:19 +00:00
Idan Horowitz
c9f9fcd8fd LibWeb: Remove accidentally commited dbglns 2022-11-15 21:48:19 +00:00
Timothy Flynn
05f41382bb Userland: Properly define IPC::encode and IPC::decode specializations
In order to avoid the base encode/decode methods from being used (and
failing a static assertion), we must be sure to declare/define the
custom type implementations as template specializations.

After this, LibIPC is no longer sensitive to include order.
2022-11-15 13:25:51 -05:00
Timothy Flynn
8e624c8f6d LibWeb+WebContent+WebDriver: Implement Find Elements From Shadow Root 2022-11-15 11:55:36 +00:00
Timothy Flynn
6d9bd04233 LibWeb+WebContent+WebDriver: Implement Find Element From Shadow Root 2022-11-15 11:55:36 +00:00
Timothy Flynn
4d9fd5d190 LibWeb+WebContent+WebDriver: Implement Get Element Shadow Root 2022-11-15 11:55:36 +00:00
Timothy Flynn
cb91e6067c LibWeb+WebContent+WebDriver: Implement Get Active Element
Unfortunately, nothing ever calls DOM::Document::set_active_element at
the moment, so this will always return ErrorCode::NoSuchElement.
2022-11-15 11:55:36 +00:00
Itamar
8d65df935e LibWeb: Handle inset properties in style_value_for_property()
This adds support for the Top, Right, Bottom and Left CSS properties
in style_value_for_property().
2022-11-14 21:22:27 +00:00
Aliaksandr Kalenik
2675b9390b LibWeb: Parse unknown media type in media queries
Prevent media query parser from falling back into
MediaQuery::create_not_all() for queries with unknown media type.
With this change following test works correctly:
http://wpt.live/css/css-conditional/at-media-001.html
2022-11-14 16:08:35 +00:00
Aliaksandr Kalenik
7f527ddde3 LibWeb: Support device-height and device-width media query values 2022-11-14 16:08:35 +00:00
Aliaksandr Kalenik
93238edf8f LibWeb: Respect media attribute of style tag 2022-11-14 14:47:37 +00:00
Linus Groh
93c0c73b9e LibWeb: Implement XMLHttpRequest.withCredentials 2022-11-14 10:00:11 +00:00
Linus Groh
bfa378660b LibWeb: Add a clarifying comment to XHR::m_response_object
Trying to change this to a JS::Object didn't quite work, so let's add
a helpful comment instead.
2022-11-14 10:00:11 +00:00
Linus Groh
fb57500394 LibWeb: Use HeaderList from Fetch for XHR author request headers 2022-11-14 10:00:11 +00:00
Linus Groh
c8184d85c1 LibWeb: Rename XHR::{m_request_headers => m_author_request_headers} 2022-11-14 10:00:11 +00:00
Linus Groh
6e53dd8767 LibWeb: Rename XHR::{m_url => m_request_url} 2022-11-14 10:00:11 +00:00
Linus Groh
29a8414a05 LibWeb: Rename XHR::{m_method => m_request_method} 2022-11-14 10:00:11 +00:00
Linus Groh
338ada66fa LibWeb: Add spec comments and links to XHR members 2022-11-14 10:00:11 +00:00
Linus Groh
04eaff3bb4 LibWeb: Rename XHR's ReadyState / m_ready_state to just State / m_state
This is what the spec calls it.
2022-11-14 10:00:11 +00:00
Timothy Flynn
9fbc4138bb LibWeb: Define the route for the Fullscreen Window command
This was missed in 4eefa292df.
2022-11-14 00:05:15 +00:00
Moustafa Raafat
6ff9a88c3b LibWeb: Support animated backgrounds 2022-11-13 16:53:22 -07:00
Igor Pissolati
bfdb30c74a LibWeb: Implement bare-bones HTMLElement.dir 2022-11-13 16:37:09 -07:00