Commit Graph

34622 Commits

Author SHA1 Message Date
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
Linus Groh
3f7086f91a LibWeb: Add an optional pointer to an HTMLParser to the HTMLTokenizer
This is needed to access the 'adjusted current node' in the 'Markup
declaration open state'. We don't want to create a full parser for
something like syntax highlighting, so it's optional (null) by default.
2022-02-15 23:24:34 +01:00
Linus Groh
9130ecfd5e LibWeb: Remove unused HTMLParser function declaration
There is no implementation of this function:
HTMLParser::stack_of_open_elements_has_element_with_tag_name_in_scope
2022-02-15 23:24:34 +01:00
Linus Groh
f61fb08492 LibWeb: Add spec links to each HTML tokenizer state section
I didn't add full spec comments this time, but this is better than
nothing :^)
2022-02-15 23:24:34 +01:00
Maciej
ed33ea13ab LibWeb: Add stubs for document.write and document.writeln
ACID3 test page throws exception about document.write. Let's at least
get rid of it by defining these stubs.

I added document.writeln too because it is similar.
2022-02-15 16:23:06 -05:00
Lenny Maiorani
deba345ca7 LibArchive: Default initialize member variables
Problem:
- `memset` is used to initialize data instead of using default
  initialization.

Solution:
- Default initialize all member variables.
- Eliminate use of `memset` in favor of C++ braced initialization.
2022-02-15 23:00:19 +02:00
Lenny Maiorani
847efd8aca LibArchive: Use constexpr variables where possible 2022-02-15 23:00:19 +02:00
Lenny Maiorani
583e197897 LibArchive: Refactor Tar to make DRY (Don't Repeat Yourself)
Problem:
- The getters and setters duplicate code for conversions.
- Getters are returning `const StringView` rather than non-`const`.

Solution:
- Factor out common code to helper functions.
- Return `StringView` as non-`const`.
2022-02-15 23:00:19 +02:00
Lenny Maiorani
0ec688f86e Demos: 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-15 23:00:03 +02:00
Idan Horowitz
ab14abc40f Meta: Actually run gml-format in CI
Third time's a charm.
2022-02-15 19:33:46 +02:00
Idan Horowitz
a8e329461f Applications: Run gml-format 2022-02-15 19:33:46 +02:00
Ali Mohammad Pur
a1cb2c371a AK+Kernel: OOM-harden most parts of Trie
The only part of Unveil that can't handle OOM gracefully is the
String::formatted() use in the node metadata.
2022-02-15 18:03:02 +02:00
Ali Mohammad Pur
80e6198563 AK: Conditionally disable a few variant ctors/assignments
We shouldn't let copy/move ctors or assignments be instantiated if the
assignee type does not have a copy/move constructor (even if they're not
used anywhere).
2022-02-15 18:03:02 +02:00
Ali Mohammad Pur
7a58c510e5 AK: Add a 'SpecializationOf' concept
The counterpart to the IsSpecializationOf<...> template.
2022-02-15 18:03:02 +02:00
Idan Horowitz
bc38155b9c Meta: Increase Azure CI timeout for Lagom builds 2022-02-15 18:02:54 +02:00
thankyouverycool
aefb2bcf43 FontEditor: Add a ListView to sort glyphs by their Unicode block 2022-02-15 10:13:19 -05:00
thankyouverycool
6704bc0072 CharacterMap: Add a ListView to sort glyphs by their Unicode block 2022-02-15 10:13:19 -05:00
thankyouverycool
170afc2f47 LibGUI: Allow GlyphMapWidget to filter by code point ranges 2022-02-15 10:13:19 -05:00
thankyouverycool
5658524aa3 Tests: Add Unicode tests for CharacterType block properties 2022-02-15 10:13:19 -05:00
thankyouverycool
0505e031f1 Meta+LibUnicode: Download and parse Unicode block properties
This parses Blocks.txt for CharacterType properties and creates
a global display array for use in apps.
2022-02-15 10:13:19 -05:00
Andreas Kling
32b8023ad1 LibWeb: Don't delay document load event forever with cached style sheets
If we try to <link> a stylesheet that was already cached, we'll get a
synchronous resource_did_load() callback. Because of this, it's
necessary to set up the document load event delayer *before* calling
set_resource(), as otherwise we'd be stuck without a load event forever.
2022-02-15 14:14:02 +01:00
Andreas Kling
9f02afd8fe LibWeb: Don't delay document load event forever with cached CSS imports
If we try to @import a stylesheet that was already cached, we'll get a
synchronous resource_did_load() callback. Because of this, it's
necessary to set up the document load event delayer *before* calling
set_resource(), as otherwise we'd be stuck without a load event forever.
2022-02-15 14:14:02 +01:00
Andreas Kling
4708a65160 LibWeb: Force a relayout when scrolling to anchor
This ensures that the layout information is current, even when the
scroll request happens immediately upon page load.

This fixes an issue where reloading ACID2 wouldn't scroll down to the
"#top" anchor point.
2022-02-15 14:14:02 +01:00
Andreas Kling
1b2e1c19e1 LibWeb: Don't trigger page load for fragment navigation within same URL 2022-02-15 13:51:17 +01:00
Andreas Kling
b34dd0fb24 LibWeb: Repaint entire viewport after document layout
This fixes an issue with the eyes on ACID2 not appearing until the
page is repainted after loading.
2022-02-15 13:41:19 +01:00