Commit Graph

4622 Commits

Author SHA1 Message Date
Timothy Flynn
137e98cb6f LibUnicode: Add public accessors to generated locale data 2021-08-26 22:04:09 +01:00
Timothy Flynn
b7a95cba65 LibUnicode: Implement grammar validators for Unicode TR-35
ECMA-402 requires validating user input against the EBNF grammar for
Unicode locales described in TR-35: https://www.unicode.org/reports/tr35

This commit adds validators for that grammar, as well as other helper to
e.g. canonicalize a locale string.
2021-08-26 22:04:09 +01:00
Timothy Flynn
ea21573ed8 LibUnicode: Download Unicode's CLDR database and generate locale data
The Unicode standard publishes a database known as the Common Locale
Data Repository (CLDR). This is a massive set of data from which anyone
implementing Unicode's Technical Standard #35 may generate their
implementation: https://www.unicode.org/reports/tr35/

This commit updates LibUnicode to download the compressed database and
extract a small subset. That subset is used to generate a list of
available locales and the territories (AKA regions) associated with each
locale.
2021-08-26 22:04:09 +01:00
Stephan Unverwerth
b54573739c LibGL: Implement glTexEnvf
This controls how fetched texels are combined with the color that was
produced by a preceding texture unit or with the vertex color if it is
the first texture unit.

Currently only a small subset of possible combine modes is implemented
as required by glquake.
2021-08-26 19:54:31 +02:00
Stephan Unverwerth
19a08ff187 LibGL: Implement glPixelStorei
This sets the length of a row for the image to be transferred. This
value is measured in pixels. When a rectangle with a width less than
this value is transferred the remaining pixels of this row are skipped.
2021-08-26 19:53:57 +02:00
Andreas Kling
1fa5fba432 LibWeb: Make the base StyleValue::to_length() return an undefined length
Previously it was returning an "auto" length. This caused all the new
"initial" values to effectively turn into auto values long before layout
had a chance to resolve them.

This broke replaced elements with intrinsic size but no specified width
or height, and is the reason that Mr. ACID2 temporarily lost his eyes.
2021-08-26 13:25:52 +02:00
Andreas Kling
243e9a8b4a LibWeb: Correct CSS initial values for min-width and min-height
The initial value for these is auto, not 0.
2021-08-26 13:25:52 +02:00
Andreas Kling
cf8f1c5a5f LibWeb: Remove unused CSS::StyleProperties::string_or_fallback() 2021-08-26 13:25:52 +02:00
Andreas Kling
eeddaa988a ConfigServer+LibConfig: Add pledge_domains() API
This API lets applications specify which configuration domains they
will be accessing throughout their lifetime. It works similarly in
spirit to the kernel's pledge().

You cannot pledge_domains() more than once, and once you have used it,
it's no longer possible to access any other configuration domain.

This is obviously just a first cut of this mechanism, and we may need
to tweak it further as we go.
2021-08-26 00:54:28 +02:00
Andreas Kling
870ecd5190 LibConfig: VERIFY that a Core::EventLoop exists before connecting
It's not possible to connect to ConfigServer without having an event
loop available. This VERIFY makes it much easier to understand why
things are not working. :^)
2021-08-26 00:54:28 +02:00
Andreas Kling
67a0fa2b78 LibCore: Add Core::EventLoop::has_been_instantiated()
This static bool getter can be used to VERIFY that an event loop exists,
in situations where one is expected.

This is helpful if the absence of an event loop would generate strange
and/or loud errors that don't immediately point to this as a cause.
2021-08-26 00:54:27 +02:00
Andreas Kling
82d8cd2b87 Terminal+LibVT: Use LibConfig instead of Core::ConfigFile 2021-08-26 00:54:27 +02:00
Andreas Kling
bdcd0abf9d Userland: Introduce ConfigServer and LibConfig
ConfigServer is an IPC service that provides access to application
configuration and settings. The idea is to replace all uses of
Core::ConfigFile with IPC requests to ConfigServer.

This first cut of the API is pretty similar to Core::ConfigFile.

The old:

    auto config = Core::ConfigFile::open_for_app("App");
    auto value = config->read_entry("Group", "Key");

The new:

    auto value = Config::read_string("App", "Group", "Key");

ConfigServer uses the ~/.config directory as its backing store
and all the files remain human-editable. :^)
2021-08-26 00:54:27 +02:00
Jean-Baptiste Boric
0248e6ae27 LibC: Check for expected size of struct __jmp_buf
This structure is accessed through assembly code inside setjmp.S, make
some effort to ensure both header and assembly files are in sync.
2021-08-26 00:54:23 +02:00
Jean-Baptiste Boric
295e89af04 LibC: Fix sigsetjmp on x86_64
Registers were clobbered, offset values into __jmp_buf were wrong...
2021-08-26 00:54:23 +02:00
Jean-Baptiste Boric
c87aa6d908 LibC: Fix sigsetjmp on i686
Calling sigprocmask() through the PLT requires setting the ebx register
to the address of the global offset table, otherwise chaos ensues. Also
the value of the ecx register was assumed to be preserved across that
function call despite the fact that it is caller-saved in the x86
calling convention.
2021-08-26 00:54:23 +02:00
Ali Mohammad Pur
04e3965b09 LibWasm: Use Operators::BitShiftRight for i64.shru
Using a left-shift operator for a right shift operation is not exactly
the most correct action :P
2021-08-26 00:51:30 +02:00
Jesse Buhagiar
924d890bfe LibGL: Implement fog effect in Software Rasterizer
We support three of the possible fog modes, EXP, EXP2 and LINEAR.
2021-08-25 23:50:54 +04:30
Jesse Buhagiar
d73cc3d0eb LibGL: Implement glFogi 2021-08-25 23:50:54 +04:30
Jesse Buhagiar
f55d2a22af LibGL: Implement glFogf 2021-08-25 23:50:54 +04:30
Jesse Buhagiar
7f1cd54b80 LibGL: Implement glFogfv
This currently just sets the fog colour in the rasterizer.
2021-08-25 23:50:54 +04:30
Karol Kosek
ffa7da0ca5 LibWeb: Handle CSS "ch" length unit (mostly)
This isn't 100% spec complaint, as it should use glyph_height()
depending on what the value of the writing-mode is, but we haven't
implemented it yet, so I think it'll be good enough for now.

This can be tested in https://wpt.live/css/css-values/ch-unit-008.html
Other css-unit tests fail as:
- 001 shows an issue related to a renderer (looks to me like you can't
  pass a width and height property to a span -- adding `display: block`
  to it passes the test),
- 002-004 and 009-012 use mentioned writing-mode,
- 016-017 loads custom fonts, which we also don't support (yet).
2021-08-25 17:55:53 +02:00
Sam Atkins
b92a6d6542 LibWeb: Implement CSS unset builtin value
This is equivalent to `initial` or `inherit`, depending on if the
property is inherited by default.
2021-08-25 12:14:34 +02:00
Sam Atkins
3296fd70b3 LibWeb: Intercept CSS initial/inherit values in StyleProperties
When property() previously would have returned an InitialStyleValue, we
now look up what the initial value would be, and return that instead.

We also intercep 'inherit', but inheritance is not implemented yet so we
just return nothing.

This does cause a regression on Acid2: The eyes no longer appear, and I
am not sure why. :^(
2021-08-25 12:14:34 +02:00
Sam Atkins
8995839e3f LibWeb: Generate property_initial_value() function from Properties.json
Since we have initial-value data in Properties.json already, it makes
sense to use that instead of needing to duplicate the same information
in ComputedValues.h

However, converting a StyleValue to the kind of types used in
InitialValues is non-trivial. So this may or may not actually be useful.
2021-08-25 12:14:34 +02:00
Sam Atkins
38ee69adfa LibWeb: Add StyleValue to Forward.h 2021-08-25 12:14:34 +02:00
Sam Atkins
543550d1df LibWeb: Quote all initial values in Properties.json
This is in preparation for parsing these into StyleValues automatically.
Having them all be Strings makes the generation code simpler.
2021-08-25 12:14:34 +02:00
Sam Atkins
6d39f4342d LibWeb: Use single shared instance of Inherit/InitialStyleValue
These are always the same, so we can avoid allocating them repeatedly
and just use a single instance of each. :^)
2021-08-25 12:14:34 +02:00
Sam Atkins
d2342caf42 LibWeb: Parse CSS builtins before other values
These are straightforward to parse, so doing them first saves
potentially expensive calculations inside parse_foo_value() functions.
2021-08-25 12:14:34 +02:00
Brian Gianforcaro
77d8a65498 LibJS: Fix incorrect Lexer VERIFY when parsing Unicode characters
This bug was discovered via OSS fuzz, it's possible to fall through
to this assert with a char_size == 1, so we need to account for that
in the VERIFY(..).

Repro test case can be found in the OSS fuzz bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37296
2021-08-25 09:21:23 +01:00
Ralf Donau
a501b903b5 LibCore: Set file offset in ConfigFile::sync 2021-08-24 18:17:09 +02:00
Andreas Kling
fd922cf92f LibWeb+WebContent: Add a simple API for running arbitrary JavaScript
This patch adds OutOfProcessWebView::run_javascript(StringView).
This can be used by the OOPWV embedder to execute arbitrary JavaScript
in the top-level browsing context on the WebContent process side.
2021-08-24 16:56:42 +02:00
Andreas Kling
dfa9dcca98 LibWeb+Browser: Remove unnecessary InProcessWebView.h includes 2021-08-24 16:37:28 +02:00
davidot
c108c8ff24 LibJS: Disallow yield expression correctly in formal parameters
And add ZERO WIDTH NO BREAK SPACE to valid whitespace.
2021-08-24 07:42:37 +01:00
davidot
7bcffd1b6a LibJS: Fix some small remaining issues with parsing unicode escapes
Added a test to ensure the behavior stays the same.
We now throw on a direct usage of an escaped keywords with a specific
error to make it more clear to the user.
2021-08-24 07:42:37 +01:00
Linus Groh
6ce05026b4 LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainMonthDay() 2021-08-24 01:53:30 +02:00
Linus Groh
ef581be4ec LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainYearMonth() 2021-08-24 01:53:30 +02:00
Linus Groh
fc58f93734 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainMonthDay() 2021-08-24 01:53:30 +02:00
Linus Groh
5573efa3bd LibJS: Implement Temporal.PlainDateTime.prototype.toPlainYearMonth() 2021-08-24 01:53:30 +02:00
Linus Groh
ad427f85ca LibJS: Implement Temporal.PlainDateTime.from() 2021-08-23 20:54:52 +01:00
Linus Groh
573587b83a LibJS: Fix logic error in RegulateISODate 2021-08-23 20:54:52 +01:00
Sam Atkins
226fe4b57d LibWeb: Paint inspection outline for InlineNodes :^)
This iterates the fragments of the containing block, and paints their
outlines if they are descendants of the InlineNode.

If multiple fragments are adjacent, eg:

```html
<span><b>Well</b> hello <i>friends!</i></span>
```

...then we get a double-thick outline between "Well", " hello " and
"friends!", but we can come back to this after we implement
non-rectangular outlines for the `outline` CSS property.
2021-08-23 15:59:29 +02:00
Sam Atkins
8eef509c1b LibWeb: Add DOMTreeModel::index_for_node()
This is needed for telling the DOM Inspector to select a given Node.
2021-08-23 15:59:29 +02:00
Maciej Zygmanowski
3597b6eb9d WindowServer+LibGfx: Move CursorParams to LibGfx
They will be used by MouseSettings in the next commit.
2021-08-23 01:41:53 +02:00
Timothy Flynn
4f186a9a1f LibJS: Implement Promise.race on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
949f294444 LibJS: Implement Promise.allSettled on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
4dffa40a8d LibJS: Implement Promise.any on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
98d8a858cd LibJS: Set the function names for the resolve, reject, and executor
These should all have a name with an empty string. Not only does test262
verify this, but it also verifies that (for the executor) the name
property is defined after the length property.
2021-08-23 00:01:46 +01:00
Timothy Flynn
5b303721e0 LibJS: Generalize PerformPromiseAll common functionality
PerformPromiseAll, PerformPromiseAny, PerformPromiseAllSettled, etc, all
have very similar iteration loops. To avoid duplicating this rather
large block of code, extract the common functionality into a separate
method.
2021-08-23 00:01:46 +01:00
Timothy Flynn
417523507e LibJS: Generalize PromiseAllResolveElementFunction common functionality
The element-resolving functions on the Promise constructor are all very
similar. To prepare for more of these functions to be implemented, break
out common parts into a base class.
2021-08-23 00:01:46 +01:00