Commit graph

34596 commits

Author SHA1 Message Date
Sam Atkins 8e82544dce LibWeb: Stop treating undefined lengths as valid
When converting this code to use Optional, I accidentally left in the
initialization, so it *always* had a value, and always created a Length
from it. Oops.
2022-02-16 21:51:15 +01:00
Sam Atkins 48edaa2085 LibWeb: Remove content-size hack from SVGFormattingContext
Everything functions fine without it. :^)
2022-02-16 21:47:53 +01:00
Sam Atkins 5d2ce68f53 LibWeb: Stop treating all SVG elements as inline
This fixes hit testing on SVG elements, with no obvious downsides.
2022-02-16 21:47:53 +01:00
Sam Atkins aba8774c9c LibWeb: Give SVG geometry elements a position
This makes the selected-in-the-inspector outline appear in the right
place. We take the stroke-width into account when producing the
bounding box, which makes the fit nice and snug. :^)
2022-02-16 21:47:53 +01:00
Sam Atkins ae93aeb414 LibWeb: Give <svg> elements a size again
This replaces the unused width() and height() methods. The size now
defaults to 100% by 100% as in the spec.
2022-02-16 21:47:53 +01:00
Rafał Babiarz d159511d85 Base: Add test page for progress bar element 2022-02-16 15:34:08 -05:00
Rafał Babiarz 21e353980f LibWeb: Add basic implementation of progress bar element 2022-02-16 15:34:08 -05:00
Ali Mohammad Pur d8388f30c8 Meta: Make the WrapperGenerator generate includes based on imports
We no longer include all the things, so each generated IDL file only
depends on the things it actually needs now.
A possible downside is that all IDL files have to explicitly import
their dependencies.

Note that non-IDL dependencies still remain and are injected into all
generated files, this can be resolved later if desired by allowing IDL
files to import headers.
2022-02-16 22:48:32 +03:30
Ali Mohammad Pur a59800b4a0 LibWeb: Add imports to all IDL files that depend on others 2022-02-16 22:48:32 +03:30
Ali Mohammad Pur eccdf4eb4b LibWasm: Fix validation of if-else blocks
We were doing a number of things wrong:
- Switching to the parent context in the else meant that we couldn't
  break out of the else section anymore
- We were not validating the resulting values, and so the stack was
  in a relatively unknown state after 'else'

This commit fixes these issues :^)
2022-02-16 22:48:32 +03:30
Ali Mohammad Pur 385b07dcda LibWeb: Implement responseType and response for XHR
This makes us capable of loading non-utf8 content via XHR.
2022-02-16 22:48:32 +03:30
Ali Mohammad Pur 16c0646b9d LibWeb: Implement a very basic version of TextDecoder
We had a very basic implementation of TextEncoder, let's add a
TextDecoder next to that :^)
2022-02-16 22:48:32 +03:30
Ali Mohammad Pur 57997ed336 Meta: Support DOMExceptions when invoking IDL getters/setters 2022-02-16 22:48:32 +03:30
Ali Mohammad Pur ce6adf25e5 Meta: Add support for enumerations to the IDL compiler 2022-02-16 22:48:32 +03:30
Ali Mohammad Pur 4f2d898a51 LibWasm: Make MemoryInstance allocation fail if initial growth fails
...instead of silently ignoring the failure in the constructor.
2022-02-16 22:48:32 +03:30
Ali Mohammad Pur 117ca843bd LibWeb: Don't check for get().is_empty() in WebAssemblyMemoryConstructor
Object.get() does not return empty values, this was causing the
constructed memory object to have a maximum of 0, which failed silently
in the constructor.
2022-02-16 22:48:32 +03:30
Tim Schumacher bc67264453 Utilities: Add a basic install utility 2022-02-16 19:51:52 +01:00
Vitaly Dyachkov b2e6ba8d7f LibGUI: Make a copy of source_rows before resizing it in sort_mapping() 2022-02-16 19:51:01 +01:00
Timothy Flynn 4f19deb13b LibWeb: Implement reverse lookup to labels from their labelable nodes
This enables, for example, clicking on the check box, dragging the mouse
over to the label, releasing the mouse to act as a click on the check
box.

This was implemented for labels / labelable nodes with the "for"
attribute already. This implements the same for labelable nodes that are
inside the label.
2022-02-16 19:18:57 +01:00
Max Desiatov 4b85866746 Documentation: Add Rosetta/Homebrew macOS note
This should prevent a build issue caused by a potential
conflicting zstd installation on M1 Mac.

This was manifested in a linker error when building
the GNU toolchain:

```
Undefined symbols for architecture arm64:
[gcc/build]   "_ZSTD_compress", referenced from:
```
2022-02-16 11:29:31 -05:00
Adam Plumb 7a035558e1 LibWeb: Set cursor on mousemove for non-text elements 2022-02-16 15:16:39 +00:00
Michiel Visser 45004022ad LibProtocol: Fix crash on EOF when using Request::stream_into
`Request::stream_into_impl` would call `stream.write_or_error` with a
zero length buffer when EOF was reached. However, the
`Core::Stream::Stream::write_or_error` implementation verifies that the
buffer lenght is non-zero, resulting in a crash. With this change the
zero length buffer is never written to the stream.
2022-02-16 17:28:46 +03:30
Lenny Maiorani 7070713ec8 DevTools: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-02-16 07:33:15 -05:00
Lady Gegga 84f87a9f76 Base: Add Control Pictures to font Katica Regular 10
2400-2426 https://www.unicode.org/charts/PDF/U2400.pdf
2022-02-16 13:25:03 +01:00
Edwin Hoksberg c646afc26c LibWeb: Support Element.closest(selectors) 2022-02-16 07:23:27 -05:00
Timothy Flynn 70ede2825e LibUnicode: Use BCP 47 data to filter valid calendar names 2022-02-16 07:23:07 -05:00
Timothy Flynn 71d86261c3 LibUnicode: Use BCP 47 data to filter valid numbering system names
There isn't too much of an effective difference here other than that the
BCP 47 data contains some aliases we would otherwise not handle.
2022-02-16 07:23:07 -05:00
Timothy Flynn 63c3437274 LibUnicode: Use BCP 47 data to generate available calendars and numbers
BCP 47 will be the single source of truth for known calendar and number
system keywords, and their aliases (e.g. "gregory" is an alias for
"gregorian"). Move the generation of available keywords to where we
parse the BCP 47 data, so that hard-coded aliases may be removed from
other generators.
2022-02-16 07:23:07 -05:00
Timothy Flynn 89ead8c00a LibJS+LibUnicode: Parse Unicode keywords from the BCP 47 CLDR package
We have a fair amount of hard-coded keywords / aliases that can now be
replaced with real data from BCP 47. As a result, the also changes the
awkward way we were previously generating keys. Before, we were more or
less generating keywords as a CSV list of keys, e.g. for the "nu" key,
we'd generate "latn,arab,grek" (ordered by locale preference). Then at
runtime, we'd split on the comma. We now just generate spans of keywords
directly.
2022-02-16 07:23:07 -05:00
Timothy Flynn d0fc61e79b LibUnicode: Extract the BCP 47 package from the CLDR
This package was originally meant to be included in CLDR version 40, but
was missed in their release scripts. This has been resolved:
https://unicode-org.atlassian.net/browse/CLDR-15158

Unfortunately, the CLDR was re-released with the same version number. So
to bust the build's CLDR cache, change the "version" used to detect that
we need to redownload the CLDR.
2022-02-16 07:23:07 -05:00
serenitydev 23c72c6728 AK: Fix userland parsing of rounded floating point numbers
Parse JSON floating point literals properly,
No longer throwing a SyntaxError when the decimal portion
of the number exceeds the capacity of u32.

Added tests to AK/TestJSON and LibJS/builtins/JSON/JSON.parse
2022-02-16 07:22:51 -05:00
Linus Groh af75503c17 LibJS/Tests: Run prettier on modulo-basic.js 2022-02-16 11:23:25 +00:00
Anonymous 1e0facb7ee LibJS: Implement the Number::remainder AO using fmod
The ECMA verbiage for modulus is the mathematical definition implemented
by fmod, so let's just use that rather than trying to reimplement all
the edge cases.
2022-02-16 11:18:41 +00:00
Anonymous 602190f66f LibJS: Fix mixing of logical and coalescing operators
The same expression is not allowed to contain both the
logical && and || operators, and the coalescing ?? operator.

This patch changes how "forbidden" tokens are handled, using a
finite set instead of an Vector. This supports much more efficient
merging of the forbidden tokens when propagating forward, and
allowing the return of forbidden tokens to parent contexts.
2022-02-16 11:18:41 +00:00
Andreas Kling 9c78c1bf81 WebContent: Exit peacefully when client dies during synchronous IPC
If we're waiting for the client (typically Browser) to respond to a
synchronous IPC message from our side (e.g window.alert()) and the
client disconnects instead, just exit peacefully.

Ultimately a WebContent process lives to serve its client. When the
client dies, there is no need for WebContent anymore.
2022-02-16 12:03:05 +01:00
Andreas Kling 5caeb8b747 LibC: Try to recover gracefully from failed LookupServer requests
gethostbyname() and gethostbyaddr() now set h_errno (per spec) and try
to recover and return (with an error) instead of choking in VERIFY()
whenever an I/O or protocol error occurs in the communication with
LookupServer.
2022-02-16 12:03:05 +01:00
serenitydev 083b58fd89 Utilities: Add the 'files' argument to the unzip utility 2022-02-16 10:57:14 +03:30
Andreas Kling eec34ae0e9 LibWeb: Make :checked selector actually look at checkedness
It was incorrectly testing for presence of the "checked" attribute.
2022-02-15 23:51:19 +01:00
Sam Atkins d2ade9800f LibWeb: Implement relative lengths in media queries :^)
As noted, this is not entirely right, since we are using the computed
font's metrics instead of the initial font's metrics, but we do not
have a good way to obtain the latter.
2022-02-15 23:31:42 +01:00
Sam Atkins 50cc008efd Base: Add relative-length tests to media-query test page 2022-02-15 23:31:42 +01:00
Sam Atkins 148efd7de7 LibWeb: Remove unused MediaFeatureValue::equals() and friends
At some point during development I moved the comparison logic outside of
MediaFeatureValue but didn't notice. Oops!
2022-02-15 23:31:42 +01:00
Andreas Kling 61115dc638 LibWeb: Implement activation behavior for <input type=checkbox>
We now fire the "input" and "change" events as specified.
2022-02-15 23:24:41 +01:00
Andreas Kling 8a89a7bd95 LibWeb: Make <input type=checkbox> honor the "checked" attribute
Implemented according to spec, although it's very possible that I missed
one or two details. :^)
2022-02-15 23:24:41 +01:00
Andreas Kling 05c9fd962d LibWeb: Add EventTarget::run_activation_behavior() 2022-02-15 23:24:41 +01:00
Andreas Kling bdf0254b16 LibWeb: Add Element::did_remove_attribute() virtual
This allows subclasses to react to DOM attributes being removed.
2022-02-15 23:24:41 +01:00
Andreas Kling e91b2c57c1 LibWeb: Allow label activation via any descendant of the label node
Previously we were only forwarding the activation to the labelled
control if the user clicked on an immediate child of <label>.
2022-02-15 23:24:41 +01:00
Andreas Kling f318045a8f LibWeb: Support implicit <label> targets
We already supported "<input id=id><label for=id>".
This patch implements the other labeling mode, where the first labelable
descendant of the <label> element becomes the labeled control.
2022-02-15 23:24:41 +01:00
Andreas Kling 1a323ec8d4 LibCore: Exit get_next_timer_expiration() sooner if possible
If we find a timer that needs to be fired immediately, we can stop
looking through the remaining timers.

This significantly reduces time spent in get_next_timer_expiration()
on ACID3. Of course, with a better data structure, we could reduce
time spent further. I've left a FIXME about that.
2022-02-15 23:24:41 +01:00
Linus Groh 06948df393 LibWeb: Fail gracefully when reaching the unimplemented part of the AAA
Pages such as https://html5test.com are testing all sorts of weird,
incomplete, and wrong HTML but can be useful or at least interesting for
development - let's try to avoid crashing the process.
2022-02-15 23:24:34 +01:00
Linus Groh 892f6394b8 LibWeb: Implement state switch for "[CDATA[" in HTML parser 2022-02-15 23:24:34 +01:00