Commit graph

25650 commits

Author SHA1 Message Date
Sam Atkins
e3cbd366c7 Base: Correct flipped values in border-radius.html
Box 9 and Box 10 were in the wrong order somehow, so now they are not.
:^)
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
fd864fbb74 Utilities: Add 'file' and 'definitions' arguments to cpp-preprocessor
The 'file' argument allows specifying a file path.
The 'definitions' flag controls whether preprocessor definitions are
printed.
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
Itamar
06e47ce7aa Utilities: Rename PreprocessorTest=>cpp-preprocessor 2021-08-14 12:40:55 +02:00
Gunnar Beutner
7d493bbf98 Ports: Fix building the wget port 2021-08-14 12:40:49 +02:00
Gunnar Beutner
ff8e016d94 Ports: Fix building the nano port 2021-08-14 12:40:49 +02:00
Gunnar Beutner
f8d91c8f8f Ports: Make sure to remove the .la file after building libxml2
Otherwise libtool gets confused and tries to link against files that
don't exist.
2021-08-14 12:40:49 +02:00
Gunnar Beutner
5eae6ccfb0 Ports: Add missing dependency for libxml2
When xz was previously built we'd end up with a shared library for
libxml2 that depends on xz features but isn't linked against liblzma.
2021-08-14 12:40:49 +02:00
Gunnar Beutner
bd43530750 Ports: Make sure to remove the .la file after building libiconv
Otherwise libtool gets confused and tries to link against files that
don't exist.
2021-08-14 12:40:49 +02:00
Luke
e06660d33c Kernel/ProcFS: Get unveil stats instead of FDs stats for unveil data
It was accidentally using `procfs_get_fds_stats` instead of
`procfs_get_unveil_stats`.
2021-08-14 10:46:00 +02:00
Andreas Kling
0d21a1307e Profiler: Set the initial size of the timeline container to a snug fit 2021-08-14 01:28:26 +02:00
Andreas Kling
8f590cbeb8 Profiler: Add a "Signposts" tab next to the "Samples" tab
This tab provides a filtered listing of all the signpost events in the
currently selected time range.
2021-08-14 01:28:26 +02:00
Andreas Kling
9a334ebb3a Profiler: Don't lose sight of timeline tracks when zooming out
Update the track sizes before repositioning them. This ensures that they
always remain visible in the timeline container.
2021-08-14 01:28:26 +02:00
Andreas Kling
3cc5308ddc Profiler: Don't include signposts in the samples list 2021-08-14 01:28:26 +02:00
Andreas Kling
2da817615e Profiler: Store signposts in the main event stream
Instead of keeping a separate Vector<Event> for signposts, let them live
in the main event stream. For fast iteration, we instead keep a cache of
the signpost event indices.
2021-08-14 01:28:26 +02:00
Andreas Kling
f5db92448d Profiler: Use AK::Variant for type-specific data in Profile::Event
Each event has a different set of data depending on the event type.
2021-08-14 01:28:26 +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
Linus Groh
ea44d9e194 LibJS/Tests: Test iteration order of Map.prototype.keys() 2021-08-13 23:53:40 +01:00
Brian Gianforcaro
f00fde46f6 Meta: Tell user which Toolchain ARCH they need to build
There was some understandable confusion about this error now that we
have multiple toolchains.
2021-08-13 22:19:53 +02:00
Daniel Bertalan
85ea66932e Kernel: Allow kfree_aligned to be called on null pointers
The C++ standard specifies that `free` and `operator delete` should
be callable with nullptr. The non-aligned `kfree` already handles this,
but because of the pointer arithmetic to obtain the allocation start
pointer, the aligned version would produce undefined behavior.
2021-08-13 22:02:23 +02:00
Daniel Bertalan
5c7524b1d8 Kernel: Allow aligned operator new to return nullptr
In e7fb70b05, regular kmalloc was changed to return nullptr on
allocation failure instead of crashing. The `kmalloc_aligned_cxx`
wrapper used by the aligned operator new should do the same.
2021-08-13 22:02:23 +02:00
Gunnar Beutner
c5b069eb9d Ports: Build a shared library for curl
This fixes building the git port.
2021-08-13 21:29:48 +02:00
Gunnar Beutner
79db56eb82 Ports: Make sure re-installing the gcc port doesn't fail
Re-installing the gcc port would previously fail because we failed to
overwrite the symlink.
2021-08-13 21:29:48 +02:00
Gunnar Beutner
6eee60de41 Ports: Make sure HOST_* variables are set correctly for nested builds
When building a port as a dependency for another port the HOST_*
variables were previously initialized with values referring to the
SerenityOS toolchain.

Fixes #9168.
2021-08-13 21:29:48 +02:00
Gunnar Beutner
a1518e870d LibC: Add struct ifconf in net/if.h
This fixes building the scummvm port.
2021-08-13 21:29:48 +02:00
Daniel Bertalan
b2ec579e98 SystemMonitor: Don't fail if we don't have ports installed
In #9373, /usr/local/bin was added to the unveiled directories to make
symbolization work on ports. This directory only exists if at least one
port is installed, so unveil would fail with ENOENT if we had none.
2021-08-13 21:29:10 +02:00
Brian Gianforcaro
464dc42640 Kernel: Convert lock debug APIs to east const 2021-08-13 20:42:39 +02:00
Brian Gianforcaro
bffcb3e92a Kernel: Add lock debugging to ProtectedValue / RefCountedContended
Enable the LOCK_DEBUG functionality for these new APIs, as it looks
like we want to move the whole system to use this in the not so distant
future. :^)
2021-08-13 20:42:39 +02:00
Brian Gianforcaro
bea74f4b77 Kernel: Reduce LOCK_DEBUG ifdefs by utilizing Kernel::LockLocation
The LOCK_DEBUG conditional code is pretty ugly for a feature that we
only use rarely. We can remove a significant amount of this code by
utilizing a zero sized fake type when not building in LOCK_DEBUG mode.

This lets us keep the same API, but just let the compiler optimize it
away when don't actually care about the location the caller came from.
2021-08-13 20:42:39 +02:00
Brian Gianforcaro
6c18b4e558 Kernel: Introduce LockLocation abstraction from SourceLocation
Introduce a zero sized type to represent a SourceLocation, when we
don't want to compile with SourceLocation support.
2021-08-13 20:42:39 +02:00