Commit graph

24914 commits

Author SHA1 Message Date
LuK1337 7f99497378 Pong: Add menus before showing the window
Otherwise, space is reserved but menus aren't shown.
2021-07-31 08:08:31 +02:00
Idan Horowitz 64a98d0f90 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainTime 2021-07-31 00:16:41 +01:00
Idan Horowitz 010761aff4 LibJS: Implement Temporal.PlainDateTime.prototype.withPlainDate 2021-07-31 00:16:41 +01:00
Idan Horowitz f657c86d58 LibJS: Implement Temporal.PlainDateTime.prototype.withCalendar 2021-07-31 00:16:41 +01:00
Sam Atkins 4c4482c7f6 LibWeb: Ignore unquoted data urls in CSS
Previously we were only ignoring quoted ones (eg `url("data:...")`), so
now we ignore unquoted ones (eg `url(data:...)`) too.
2021-07-31 00:18:11 +02:00
Sam Atkins d113bc7704 Base: Add CSS url(data:...) cases to test page
Also, it wasn't linked to from welcome.html, so now it is.
2021-07-31 00:18:11 +02:00
Sam Atkins 23d869138f LibWeb: Parse calc() values in new CSS Parser
This is a port of the code from DeprecatedCSSParser, to work with CSS
Tokens and TokenStream. I've modified it as little as possible.
2021-07-31 00:18:11 +02:00
Sam Atkins 21c59efbb9 LibWeb: Treat CSS calc() values as "builtin_or_dynamic" 2021-07-31 00:18:11 +02:00
Sam Atkins d6668dbc56 LibWeb: Allow peeking more than 1 token ahead in CSS Parser 2021-07-31 00:18:11 +02:00
Sam Atkins 919eb7c0aa LibWeb: Parse box-shadow property in new CSS Parser
Previous multi-value properties use a ValueListStyleValue, which then
gets parsed into its sub-properties in the StyleResolver. However, that
is not ideal, especially as it exposes StyleResolver to the inner
workings of the Parser and Tokenizer, which it should not need to know
about.

The way `box-shadow` was implemented as a StyleValue subclass means that
the parsing can happen inside the Parser instead, which seems like a
better solution. Converting the other complicated cases (background,
font, list-style) is on my todo list for later.
2021-07-31 00:18:11 +02:00
Sam Atkins 697bffa3bd LibWeb: Convert CSS parse_{color,length}() lambdas into methods
This lets us get the Length and Color values directly, without having to
create a StyleValue object and then throw it away again, when parsing
the box-shadow property in the next commit.
2021-07-31 00:18:11 +02:00
Sam Atkins 1b72766e4e LibWeb: Fix issues with CSS attribute selector handling
This is three small, related changes:

1. Element::has_attribute() now returns true if the attribute exists but
has no value. (eg, `<div foo />` -> `has_attribute("foo")`)

2. SelectorEngine::matches_attribute() now makes sure there is a first
segment before comparing it, fixing a crash.

3. CSS::Parser now converts attribute names in attribute selectors to
lowercase, to match the expectations of the rest of the system.
Converting to lowercase is not always correct, depending on language,
but since we only currently support HTML, and that expects them to be
case-insensitive, it is fine for now.
2021-07-31 00:18:11 +02:00
Sam Atkins 242c342fad Base: Expand test page for CSS attribute selectors
Now that we support more types of attribute selectors in the parser,
we need a way to test them. :^)
2021-07-31 00:18:11 +02:00
Sam Atkins 6034fc0ee6 LibWeb: Make CSS 'An+B' parsing spec-compliant
Parsing this pattern from CSS tokens turns out to be slightly crazy, but
thankfully well documented in the spec.

The spec lists the cases in order of simple -> complicated, but this
would cause problems in code, since `<n-dimension> <signed-.integer>`
would never by reached, as `<n-dimension>` comes before. Instead, I
have grouped them by their first token.

Also renamed the NthChildPattern class to ANPlusBPattern, to match spec
terminology.
2021-07-31 00:18:11 +02:00
Sam Atkins 8d0ff98eff LibWeb: Parse CSS selectors according to the spec
The spec does not directly tell us how to parse selectors, so there are
likely some bugs here, but I've used the spec language where possible.
This is very much based on the previous selector parsing code.

Any parse error inside a selector makes the entire SelectorList
invalid, so nothing is returned.
2021-07-31 00:18:11 +02:00
Sam Atkins 8d1762ac62 LibWeb: Fix dump_selector() handling of attribute selectors
Encountering an attribute selector was immediately ending the dump
output by mistake, and it was assigning the match types to the wrong
variable.
2021-07-31 00:18:11 +02:00
Sam Atkins 6ea5d03f43 LibWeb: Bring Selector terminology in line with the CSS spec
- CompoundSelector -> *deleted*
- ComplexSelector -> CompoundSelector
- Relation -> Combinator

Our Selector is really a ComplexSelector, but only the Parser and
SelectorEngine need to know that, so keeping it named Selector makes it
more understandable for users.

Our CompoundSelector is really a CompoundSelectorAndCombinator.
Combining the two makes sense in our codebase, but the accurate name is
so long that I think it makes the code less readable.

Renamed some Combinators to also match the spec terminology:

- AdjacentSibling -> NextSibling
- GeneralSibling -> SubsequentSibling

The previous names are somewhat ambiguous, so hopefully this is clearer.
2021-07-31 00:18:11 +02:00
Sam Atkins ca436afeb5 LibWeb: Stop parsing integer CSS values as Lengths
This was a hack copied over from the old parser, but it was causing
problems with flex-grow, and probably other properties that accept
numbers. Removing it does not seem to break anything, so lets' remove
it! :^)
2021-07-31 00:18:11 +02:00
Sam Atkins e54531244f LibWeb: Define proper debug symbols for CSS Parser and Tokenizer
You can now turn debug logging for them on using `CSS_PARSER_DEBUG` and
`CSS_TOKENIZER_DEBUG`.
2021-07-31 00:18:11 +02:00
Sam Atkins af045cee22 LibWeb: Use references to CSS tokens instead of copying by value
A couple of places required a logic change to make this work, but mostly
it's a simple case of adding &.
2021-07-31 00:18:11 +02:00
Sam Atkins 7439fbd896 LibWeb: Get CSS @import rules working in new parser
Also added css-import.html, which tests the 3 syntax variations on
`@import` statements. Note that the optional media-query parameter to
`@import` is not handled yet.
2021-07-31 00:18:11 +02:00
Gunnar Beutner 8b2e76b838 Meta: Make audiodev detection more robust
This fixes audio on Windows as well as Linux systems which don't have
SDL.

Fixes #8903.
2021-07-30 23:51:26 +02:00
Thomas Wagenveld 9222064439 Documentation: Remove more potentially harmful Debian advice
Serenity build tooling autodetects gcc 10 so update-alternatives
is not necessary. Also, switching apt repositories on the fly can
cause issues with dependencies, package downgrades and leave the
system in a broken state.
2021-07-30 23:51:10 +02:00
Gunnar Beutner dff8b3d2d9 Meta: Make rsync a hard dependency and remove the fallback code
Previously we'd fall back to using cp if rsync wasn't available. Not
only is this considerably slower it also breaks when some of the files
in the target directory are symlinks because cp tries to dereference
them.

Fixes #8672.
2021-07-30 23:50:29 +02:00
Linus Groh 9ea8aa7ffe LibJS/Tests: Compare results in Temporal.Now.plainDateTimeISO() test 2021-07-30 22:13:13 +01:00
Linus Groh 2c85f076c8 LibJS/Tests: Compare results in Temporal.Now.plainDateTime() test 2021-07-30 22:13:13 +01:00
Timothy Flynn b3569fab7c LibJS: Add tests for Unicode property escapes
LibJS gets this for free from LibRegex, but let's add test cases for it.
2021-07-30 21:26:31 +01:00
Timothy Flynn d485cf29d7 LibRegex+LibUnicode: Begin implementing Unicode property escapes
This supports some binary property matching. It does not support any
properties not yet parsed by LibUnicode, nor does it support value
matching (such as Script_Extensions=Latin).
2021-07-30 21:26:31 +01:00
Timothy Flynn f1dd770a8a LibJS: Parse RegExp literals at AST creation time, not execution time
The spec requires that invalid RegExp literals must cause a Syntax Error
before the JavaScript is executed. See:
https://tc39.es/ecma262/#sec-patterns-static-semantics-early-errors

This is explicitly tested in the RegExp/property-escapes test262 tests.
For example, see unsupported-property-Line_Break.js:

    $DONOTEVALUATE();
    /\p{Line_Break}/u;

That RegExp literal is invalid because Line_Break is not a supported
Unicode property. $DONOTEVALUATE() just throws an exception when it is
executed. The test expects that this file will fail to be parsed.

Note that RegExp patterns can still be parsed at execution time by way
of "new RegExp(...)".
2021-07-30 21:26:31 +01:00
Timothy Flynn 1400e3cf58 LibRegex: Allow separately parsing patterns and creating Regex objects
Adds a static method to parse a regex pattern and return the result, and
a constructor to accept a parse result. This is to allow LibJS to parse
the pattern string of a RegExpLiteral once and hand off regex objects
any number of times thereafter.
2021-07-30 21:26:31 +01:00
Timothy Flynn b162517065 LibRegex: Take ownership of pattern string and fix move operations
The Regex object created a copy of the pattern string anyways, so tweak
the constructor to allow callers to move() pattern strings into the
regex.

The Regex move constructor and assignment operator currently result in
memory corruption. The Regex object stores a Matcher object, which holds
a reference to the Regex object. So when the Regex object is moved, that
reference is no longer valid. To fix this, the reference stored in the
Matcher must be updated when the Regex is moved.
2021-07-30 21:26:31 +01:00
Timothy Flynn 4a72b2c879 LibRegex: Allow RegexOptions to be declared at compile time 2021-07-30 21:26:31 +01:00
Timothy Flynn f1809db994 LibUnicode: Add public methods to compare and lookup Unicode properties
Adds methods to retrieve a Unicode property from a string and to check
if a code point matches a Unicode property.

Also adds a <LibUnicode/Forward.h> header.
2021-07-30 21:26:31 +01:00
Timothy Flynn 3f80791ed5 LibUnicode: Manually assign special code point properties
The Unicode standard defines a few extra properties that are not defined
in any UCD file, so we must assign them manually.
2021-07-30 21:26:31 +01:00
Timothy Flynn bba3152104 LibUnicode: Parse and generate PropertyAliases
These are all used for Unicode property escapes.
2021-07-30 21:26:31 +01:00
Timothy Flynn 761c16d873 LibUnicode: Parse and utilize DerivedCoreProperties
DerivedCoreProperties are pseudo-properties that are the union of other
categories and properties. For example, the derived property Math is the
union of the general category Sm and the property Other_Math.

Parsing these is necessary for implementing Unicode property escapes.
But it also has the added benefit that LibUnicode now does not need to
derive some of these properties at runtime.
2021-07-30 21:26:31 +01:00
Timothy Flynn 4eb4b06688 LibUnicode: Do not replace underscores in property names
Originally, this was done to make the generated enums look more like the
rest of Serenity's enums. But for Unicode property escapes, LibUnicode
will need to compare property names from a RegExp.prototype object to
these parsed property names, which will be easier without this
modification.
2021-07-30 21:26:31 +01:00
Timothy Flynn 5d09a00189 LibUnicode: Generate PropList enumeration as a bitmask
Rather than generating the PropList as a list of enums, generate it as
a bitmask. Not only will this be better for runtime property searching,
this will allow parsing of the DerivedCoreProperties list more easily.
2021-07-30 21:26:31 +01:00
Linus Groh 116c45d668 LibJS: Take prepare_temporal_fields() Vector arguments by const& 2021-07-30 20:52:39 +01:00
Brian Gianforcaro a4dc1eb330 Lagom: Fix oss-fuzz build error due to CMake typo
The OSS-Fuzz build was failing with the following error:

 /usr/bin/ld: cannot find -l{}
2021-07-30 20:28:59 +01:00
Linus Groh 4d0f849654 LibJS: Replace TypeError with RangeError in GetOffsetNanosecondsFor
Also fix "a integral number" => "an integral number".
2021-07-30 19:53:25 +01:00
Sam Atkins 59a4e87a7e Documentation: Add BuildProfilingInstructions.md
After discussing on Discord about how to speed up the build time, I
received lots of helpful advice on measuring the build time, but none of
it was easily accessible. I thought other people might find it useful,
so I've written it down! :^)

Thanks goes to @bgianfo and @nico.
2021-07-30 20:51:11 +02:00
Luke 4ca14d6e67 Ports: Update OpenSSL to 1.1.1k 2021-07-30 20:49:56 +02:00
Luke f5d4de8b66 LibC: Stub mlock in sys/mman
mlock is supposed to prevent memory from being paged out to swap, which
we don't have currently.

Required by OpenSSL.
2021-07-30 20:49:56 +02:00
Martin Blicha add3a02ddd LibChess: Fix hashing of the chess board
The hash function should take the board by reference, not by value.
Also, the fact whether black can castle kingside or not was included
twice in the hash, unnecesarily.
2021-07-30 20:49:18 +02:00
Faeliore 8e3431d56d MailSettings: Add basic mail settings dialog
MailSettings: Add a GML file for Mail settings

MailSettings: Add an AF desktop file for Mail Settings

MailSettings: Unveil /res in mail settings, fix GML

MailSettings: Mail settings texteditor->textbox

MailSettings: Update mail username to correct category in settings

Modified Mail settings GML to properly represent ports >100

MailSettings: Update/fix mail settings GML

MailSettings: Adjust GML, add icons for mail settings

MailSettings: Change Okay button to OK

MailSettings: Change mail setting reset button to revert

MailSettings: Fix incorrect variable names in mail settings

MailSettings: Add newlines af EOF of all mail setting files

MailSettings: Mail settings linting issues fixed

MailSettings: Increase size of icon features
Code cleaning/styling changes as per gunnarbeutner review
Made settings descriptions more friendly per sin-ack review

MailSettings: Fixes as per PR comments

MailSettings: Fix checkbox weirdness

MailSettings: Adjust width of checkbox

MailSettings: Remove unneccessary update() call

MailSettings: Replace port SpinBox with ComboBox

MailSettings: Add colons to labels, remove port 110 option

MailSettings: Remove custom model, use ItemListModel

MailSettings: Change relative icon paths to absolute ones
2021-07-30 20:47:31 +02:00
Thomas Wagenveld 1bfd405353 Documentation: Update instructions for Debian
Simply adding a 'testing' repo on a Debian stable system is destructive
to the system. Add better hints on building Serenity on Debian.
2021-07-30 19:00:46 +02:00
Brian Gianforcaro 7fce0693a5 Prekernel: Disable KASAN, so it has no effect when enabled
I was working on some more KASAN changes and realized the system
no longer links when passing -DENABLE_KERNEL_ADDRESS_SANITIZER=ON.

Prekernel will likely never have KASAN support given it's limited
environment, so just suppress it's usage.
2021-07-30 16:58:09 +02:00
Andreas Kling 25b76462bf Revert "Kernel: Share committed COW pages between whole VMObject lineage"
This reverts commit 2c0df5e7e7.

This caused OOM on CI, so let's roll it back until we can figure it out.
2021-07-30 13:50:24 +02:00
Sam Atkins 5de7775d22 Browser: Show a message when attempting to search with no search engine
Previously, it just showed an error message saying that "" failed to
load, which made me think that search engines were broken.
2021-07-30 13:38:20 +02:00