Commit graph

4382 commits

Author SHA1 Message Date
Andreas Kling
6f78377864 Kernel+LibC: Share definitions for sys/wait.h 2021-08-14 19:58:11 +02:00
Andreas Kling
661bd992b0 Kernel+LibC: Share definitions for net/{if,if_arp,route}.h 2021-08-14 19:58:11 +02:00
Andreas Kling
ff50122dc5 Kernel+LibC: Share definitions for futex.h 2021-08-14 19:58:11 +02:00
Andreas Kling
6fd7212476 Kernel+LibC: Share definitions for signal.h 2021-08-14 19:58:11 +02:00
Andreas Kling
9dc1350177 Kernel+LibC: Share definitions for netinet/in.h 2021-08-14 19:58:11 +02:00
Andreas Kling
b92e6b02e5 Kernel+LibC: Share definitions for sys/socket.h and sys/un.h 2021-08-14 19:58:11 +02:00
Andreas Kling
d277cdfd4c Kernel+LibC: Share definitions for termios.h 2021-08-14 19:58:11 +02:00
Andreas Kling
a8d1c2dde9 Kernel+LibC: Share definitions for sys/mman.h 2021-08-14 19:58:11 +02:00
Andreas Kling
0a78056453 Kernel+LibC: Share definitions for time.h and sys/stat.h 2021-08-14 19:58:11 +02:00
Andreas Kling
740140a661 Kernel+LibC: Share definitions in fcntl.h and sys/types.h
This patch begins the work of sharing types and macros between Kernel
and LibC instead of duplicating them via the kludge in UnixTypes.h.

The basic idea is that the Kernel vends various POSIX headers via
Kernel/API/POSIX/ and LibC simply #include's them to get the macros.
2021-08-14 19:58:11 +02:00
Daniel Bertalan
fbdf17ae68 LibC: Don't flatten malloc and free
This is no longer needed as per the previous commit, UserspaceEmulator's
malloc tracer now correctly handles functions called from within
`malloc` and `free`. This might also have a benefit on performance
because forcibly inlining all function calls pessimizes cache locality.
2021-08-14 18:42:14 +02:00
Daniel Bertalan
87ef2718bc UserspaceEmulator+LibC: Use sys$emuctl() to disable auditing in malloc
It was fragile to use the address of the body of the memory management
functions to disable memory auditing within them. Functions called from
these did not get exempted from the audits, so in some cases
UserspaceEmulator reported bogus heap buffer overflows.

Memory auditing did not work at all on Clang because when querying the
addresses, their offset was taken relative to the base of `.text` which
is not the first segment in the `R/RX/RW(RELRO)/RW(non-RELRO)` layout
produced by LLD.

Similarly to when setting metadata about the allocations, we now use the
`emuctl` system call to selectively suppress auditing when we reach
these functions. This ensures that functions called from `malloc` are
affected too, and no issues occur because of the inconsistency between
Clang and GCC memory layouts.
2021-08-14 18:42:14 +02:00
Sam Atkins
46b93174fc LibWeb: Treat multi-value CSS properties as StyleValueList by default
Some properties, such as `margin`, take multiple values but are not
complicated enough to require special-case handling. These no longer
parsed after my previous StyleValue changes, so this fixes that.

In the future we may want to configure whether to allow this for each
property.
2021-08-14 15:09:19 +02:00
Stephan Unverwerth
949d27f21b LibGL: Implement glDrawElements 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
e64d0d43d2 LibGL: Implement glDrawArrays 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
b9261ade52 LibGL: Implement glTexCoord4fv 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
f776402632 LibGL: Implement glTexCoordPointer 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
f52f40925c LibGL: Implement glColorPointer 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
07b9cba6e6 LibGL: Implement glVertexPointer 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
886f154c2a LibGL: Implement glEnableClientState and glDisableClientState 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
5f863016ca LibGL: Implement glDepthMask 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
010e344a8e LibGL: Add missing defines needed for glquake 2021-08-14 12:49:29 +02:00
Sam Atkins
afc434c416 LibWeb: Remove ValueListStyleValue :^)
This was the whole point of this PR. No more dealing with
ComponentValues in StyleResolver!
2021-08-14 12:45:01 +02:00
Sam Atkins
678760bd87 LibWeb: Parse multiple font-family values
Apart from now gathering comma-separated font-family names into a
StyleValueList, this also corrects the logic for parsing a single
font-family. Previously, we did not handle unquoted font names at all,
and now they are handled including when they are several words separated
by whitespace.

Modified the logic for `font` to use `parse_font_family_value()`.
`FontStyleValue.font_families()` is now a StyleValueList instead of a
vector, so that it can be better handled in StyleResolver.

We also finally remove the CSS::ParsingContext in
set_property_expanding_shorthands(). :^)
2021-08-14 12:45:01 +02:00
Sam Atkins
75450d2250 LibWeb: Handle StyleValueList for background-image
Also removed the string-parsing code I'd accidentally missed removing
before. Oops!
2021-08-14 12:45:01 +02:00
Sam Atkins
6f9263de04 LibWeb: Implement and use BackgroundRepeatStyleValue
This wraps an x and y background-repeat value. Potentially, we could use
this in place of the background-repeat-x and background-repeat-y
pseudo-properties, but for now StyleResolver splits it into those
properties, like it did before.
2021-08-14 12:45:01 +02:00
Sam Atkins
e6c0cb5a7f LibWeb: Implement and use OverflowStyleValue
Also added a test page for the `overflow` properties. They apparently
don't work, but at least they do parse.
2021-08-14 12:45:01 +02:00
Sam Atkins
168865dbdc LibWeb: Implement and use BorderRadiusStyleValue
This parses the elliptical border-radius values, though currently we
only support circular ones. So, to_length() is overloaded to return the
horizontal-radius. This means the code in Layout/Node.cpp does not need
to change for now.
2021-08-14 12:45:01 +02:00
Sam Atkins
cb3e097663 LibWeb: Implement and use BorderStyleValue 2021-08-14 12:45:01 +02:00
Sam Atkins
c27f99fc1d LibWeb: Implement and use FlexFlowStyleValue 2021-08-14 12:45:01 +02:00
Sam Atkins
ab57d7b408 LibWeb: Correct initial values for flex CSS properties
`flex-basis` and `flex-shrink` had different default values than are
dictated in the spec.
2021-08-14 12:45:01 +02:00
Sam Atkins
2644d2c221 LibWeb: Implement and use FlexStyleValue
This is not just moving the code from StyleResolver to Parser. The logic
has changed to allow for the `flex-basis` to come before or after the
`flex-grow/shrink` values, as well as handle the special one-value
cases.

Also added test cases to flex.html to check the parsing. It does parse
correctly, but elements with `flex-basis: auto` do not calculate their
width correctly.
2021-08-14 12:45:01 +02:00
Sam Atkins
44a082391b LibWeb: Implement and use TextDecorationStyleValue
Modified text-decoration.html to better test that the values can be in
any order, and that it adopts the color from the `color` property if no
decoration color is specified. Right now, it always does because we do
not support a different decoration color. Later, we need to support the
`currentcolor` special CSS value for this purpose.
2021-08-14 12:45:01 +02:00
Sam Atkins
0e15561df0 LibWeb: Implement and use ListStyleStyleValue
Yes, the name is silly, but it's a StyleValue for list-style, so...
yeah. :^)

Since `list-style-type` and `list-style-image` can both have `none` as a
value, and can appear in any order, we have to handle it separately, and
then assign either or both of those to `none` depending on how many
`none`s there are, and whether those sub-properties already have values.

Added some extra test cases to lists.html to cover list-style-image and
list-style-position parts of the list-style shorthand, and the `none`
values.
2021-08-14 12:45:01 +02:00
Sam Atkins
dcbfb61816 LibWeb: Implement and use BackgroundStyleValue
This one represents one secton of a `background` property, since it can
have multiple background values separated by commas. Eventually, we will
represent that as a List of BackgroundStyleValues.

Also modified some background-foo properties in StyleResolver so that
the is_background_x() functions could be removed.

I realized that our handling of var() in shorthand properties is wrong,
so have been removing the is_builtin_or_dynamic() calls from the parsing
code for shorthands. This broke our var() test page, so I have replaced
the use of 'background' with 'background-color' there.
2021-08-14 12:45:01 +02:00
Sam Atkins
59501f1940 LibWeb: Implement and use FontStyleValue
After working with the code for a while, it makes more sense to put all
the parsing in Parser, instead of some of it living in StyleResolver.
That means our current ValueListStyleValue needs to be replaced with
specific StyleValue types for the properties that are shorthands or
otherwise combine several values together.

Here we implement FontStyleProperty, which represents a `font` CSS
property.

Also adjusted the fonts.html test page so that font-weights are featured
in test cases without things we do not yet support.
2021-08-14 12:45:01 +02:00
Sam Atkins
5e1fad2dff LibWeb: Use new StyleValueList for simple properties
Also, moved the repeated code for assigning 1-4 values to
top/right/bottom/left properties, into an assign_edge_values() lambda,
for convenience.
2021-08-14 12:45:01 +02:00
Sam Atkins
21c9825caf LibWeb: Implement new StyleValueList
StyleValueList is a list of StyleValues of the same type, for use in
properties like `margin` which accept a variable number of arguments.

I had originally hoped to simply swap the old ValueListStyleValue from
being a list of ComponentValues to one of StyleValues, but I can see now
that I will need to have both for a little while, so renamed the old
is_value_list() to is_component_value_list() temporarily.
2021-08-14 12:45:01 +02:00
Sam Atkins
81527f5eba LibWeb: Add StyleValue.is_builtin() convenience function 2021-08-14 12:45:01 +02:00
Sam Atkins
ed962be0fa LibWeb: Make 'auto' be both a Length and Identifier in CSS
I had accidentally parsed it in `parse_builtin_or_dynamic_value()`
instead of `parse_length()` before, which was confusing, so now it's
parsed along with other Lengths.

Whether it should be a Length is up for debate, and has been tripping me
up a few times, but a lot of code expects it to be one. For now, an
'auto' Length value (or any other value which overloads `is_auto()`)
also claims to be a `ValueID::Auto` identifier.
2021-08-14 12:45:01 +02:00
Sam Atkins
c8c2a8df56 LibWeb: Make '0' always be both a number and a length in CSS
A '0' token can be interpreted both as a Number, and as a Length. This
is problematic as in our CSS parser, we often call parse_css_value()
first, to figure out what something is, and then assign it. So we do not
know in advance whether we want a Length or not. Previously, it always
got parsed as a Length, and then every place that expected a
NumericStyleValue had to also check for a Length(0), which is easy to
forget to do.

In particular, this was causing issues with the `flex` property parsing.

To solve this, we now always parse 0 as a NumericStyleValue, and NSVs of
0 pretend to be a Length(0px) when asked. In two places, we were casting
to a LengthStyleValue* based on is_length(), which no longer works, so
those have been adjusted to use `StyleValue::to_length()` instead. They
also now check for `is_numeric()` first, to avoid the extra conversion
to a Length and back.

Possibly this opens up new issues elsewhere. In my testing it seems
fine, but until we can get CSS test suites running, it's hard to know
for certain.
2021-08-14 12:45:01 +02:00
Itamar
e57fdb63f8 Tests: Add regression tests for the LibCpp preprocessor
Similarly to the LibCpp parser regression tests, these tests run the
preprocessor on the .cpp test files under
Userland/LibCpp/Tests/preprocessor, and compare the output with existing
.txt ground truth files.
2021-08-14 12:40:55 +02:00
Itamar
a38c330c68 LibCpp: Move parser tests to Userland/Libraries/LibCpp/Tests/parser 2021-08-14 12:40:55 +02:00
Itamar
f6c9071f0d LibCpp: Evaluate function-like macro calls 2021-08-14 12:40:55 +02:00
Itamar
8505fcb8ae LibCpp: Understand preprocessor macro definition and invocation
The preprocessor now understands when a function-like macro is defined,
and can also parse calls to such macros.

The actual evaluation of function-like macros will be done in a
separate commit.
2021-08-14 12:40:55 +02:00
Itamar
c7d3a7789c LibCpp: Add lexer option to ignore whitespace tokens 2021-08-14 12:40:55 +02:00
Linus Groh
f51f5e135a LibJS/Tests: Remove outdated FIXME comment 2021-08-13 23:59:22 +01:00
Linus Groh
95059b9549 LibJS/Tests: Enable Proxy handler apply() thisArg test that now passes 2021-08-13 23:57:33 +01:00
Linus Groh
419c21c66f LibJS/Tests: Test iteration order of Map.prototype.entries() 2021-08-13 23:54:08 +01:00
Linus Groh
455b94af7f LibJS/Tests: Test iteration order of Map.prototype.values() 2021-08-13 23:54:02 +01:00