Commit graph

24925 commits

Author SHA1 Message Date
Andreas Kling b56a2c3e4c KeyboardSettings: Remove outdated FIXME 2021-07-31 11:22:53 +02:00
Andreas Kling 363a901603 Kernel: Copy the "purgeable" flag when cloning AnonymousVMObject 2021-07-31 11:22:53 +02:00
Andreas Kling 7f7ba726f0 Browser: Change "Custom" => "Custom..." in menus where appropriate
If a menu item requires additional user input before the action can be
taken, it should have an ellipsis.
2021-07-31 11:22:53 +02:00
Karol Kosek ceadbafa97 HackStudio+TextEditor: Sync extensions from the FileIconProvider file
This adds more possible extensions for highlighting C/C++ files
and JavaScript module files.
2021-07-31 08:18:01 +02:00
Karol Kosek d1f5cd3c7e HackStudio: Don't use 'else' after 'return' 2021-07-31 08:18:01 +02:00
Karol Kosek bf322e072f HackStudio: Add syntax highlighting for HTML, Shell, and SQL files
.html files were recognised before -- the name was shown on
the statusbar, but it didn't actually enable the syntax highlighting.

This also sneaks a highlighting for JSON using JS highlighting.
It isn't technically correct, but so does TextEditor. :^)
2021-07-31 08:18:01 +02:00
Karol Kosek 68088b629b TextEditor: Add automatic syntax highlighting for Shell and .htm files 2021-07-31 08:18:01 +02:00
LuK1337 6e42cb8c55 KeyboardMapper: Add menus before showing the window
Otherwise, space is reserved but menus aren't shown.
2021-07-31 08:08:31 +02:00
LuK1337 5fa8a107df Calculator: Add menus before showing the window
Otherwise, space is reserved but menus aren't shown.
2021-07-31 08:08:31 +02:00
LuK1337 38767e262d Piano: Add menus before showing the window
Otherwise, space is reserved but menus aren't shown.
2021-07-31 08:08:31 +02:00
LuK1337 4b81b9718d Breakout: Add menus before showing the window
Otherwise, space is reserved but menus aren't shown.
2021-07-31 08:08:31 +02:00
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