Commit Graph

7774 Commits

Author SHA1 Message Date
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
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
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
brapru
d456af1cd3 LibCore+LibHTTP: Check the status of the socket after EINPROGRESS
Previously the system would assume the socket was connected after the
file descriptor became writeable. Just because the fd is signaled as
ready for output does not necessarily indicate the socket is connected.
Instead, we should check the status of the socket with SO_ERROR and
handle successes/errors accordingly.
2021-08-13 20:30:19 +04:30
brapru
8059f28977 Utilities: Add program argument for netstat to display connection pid
Adds netstat command line argument to display slash-separated pair of
the id and name of the process that owns the socket. User must have
superuser privileges to see information on non-owned sockets.
2021-08-13 20:03:57 +04:30
Ali Mohammad Pur
15f95220ae AK+Everywhere: Delete Variant's default constructor
This was exposed to the user by mistake, and even accumulated a bunch of
users that didn't blow up out of sheer luck.
2021-08-13 17:31:39 +04:30
Jesse Buhagiar
90e6b9d453 LibGL: Implement glColor3fv 2021-08-13 16:54:37 +04:30
Brian Gianforcaro
27111cfc6c SystemMonitor: Unveil /usr/local/bin so symbolization works on ports 2021-08-13 11:08:38 +02:00
Jean-Baptiste Boric
b6b6add78f LibC: Implement pause function 2021-08-13 03:16:58 +02:00
Jean-Baptiste Boric
f2b8b46bb0 LibC: Implement sigsuspend function 2021-08-13 03:16:58 +02:00
Andreas Kling
7abf58ecaf Profiler: Store event type as enum
Also check for the most common event type (sample) first instead of
leaving it as the fallback. This avoids a lot of string comparisons
while parsing profiles.
2021-08-13 03:06:07 +02:00
Andreas Kling
5a2ccbffc5 Profiler: Remove "Signpost " prefix from timeline tooltips 2021-08-13 03:03:53 +02:00
sin-ack
4c6a97e757 Shell: Make caller specify the string parsing end condition
Heredocs have a different parse end condition than double-quoted
strings. parse_doublequoted_string_inner would assume that a string
would always end in a double quote, so let's generalize it to
parse_string_inner and have it take a StringEndCondition enum which
specifies how the string terminates.
2021-08-13 01:20:35 +04:30
sin-ack
c419b1ade6 Shell: Remove dbgln related to process group IDs
This is insignificant debugging information and will print out during
runs with Lagom.
2021-08-12 22:42:50 +02:00
Liav A
65730f459d SystemServer: Generalize chown_all_framebuffer_devices function
Instead of neatly searching for all framebuffer device nodes and
changing ownership of them, let's generalize this function so we can
apply the same pattern on tty nodes.
2021-08-12 21:10:55 +02:00
Daniel Bertalan
c2c12e9dc5 LibC+DynamicLoader: Prevent GCC from removing null checks
GCC implements `fputc`, `fputs` and `fwrite` as builtin functions, whose
`FILE*` argument is implicitly marked `__attribute__((nonnull))`. This
causes our `VERIFY(stream)` statements to be removed. This does not
happen with Clang, as they do not use the `nonnull` attribute in this
way.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
b19fe744ab LibWeb: Remove pointless type casts
In these cases, the parameters' static type matched the desired dynamic
type, so these calls were discarded.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
f95a11a7da LibC: Don't delete null check in gettimeofday
The `nonnull` attribute may delete null checks in the generated code, as
per the [GCC documentation]:

> The compiler may also perform optimizations based on the knowledge
> that nonnul parameters cannot be null. This can currently not be
> disabled other than by removing the nonnull attribute.

Disassembling the function as compiled by GCC, we can see that there is
no branch based on if `tv` is null.  This means that `gettimeofday`
would produce UB if passed a null parameter, even if we wanted to
predictably return an error.  Clang refuses to compile this due to a
`pointer-bool-conversion` warning.

In this commit, `settimeofday` is changed as well to match
`gettimeofday`'s null argument handling.

[GCC documentation]:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-nonnull-function-attribute
2021-08-12 21:10:44 +02:00
Ali Mohammad Pur
8b6397446e LibWasm: Move some Values and Vector<Value>s instead of copying them 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
fa2ae02564 LibWasm: Avoid calculating stack bounds on each wasm call
We only need to know the initial bounds, which we calculate by default
when the interpreter is constructed.
This cuts down on syscalls and makes wasm calls a lot cheaper.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
2b35e9f9be LibWasm: Generate Value::type() on the fly instead of storing it
The variant member already contains enough information to give us the
type when needed, so remove the type member and synthesize it when
needed, this allows lots of optimisation opportunaties when copying and
moving Values around.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
4060f18d7e LibWasm: Replace memory write macros with templated functions 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
b6381f785d LibWasm: Make memory operation address calculation match the spec
...or rather, match what the spec _means_ to say, not what it actually
says.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
ad3de4648a LibWasm: Replace memory read macros with templated functions 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
563b402f04 LibWasm: Replace the numeric operation macros with templated functions
This should make debugging and profiling much better, at little to no
runtime cost.
Also moves off the operator definitions to a separate header, so it
should also improve the editing experience quite a bit.
2021-08-12 21:03:53 +02:00
Liav A
bf1adc2d5d Kernel+LibC: Use 64 bit values for ino_t
Since the InodeIndex encapsulates a 64 bit value, it is correct to
ensure that the Kernel is exposing the entire value and the LibC is
aware of it.

This commit requires an entire re-compile because it's essentially a
change in the Kernel ABI, together with a corresponding change in LibC.
2021-08-12 20:57:32 +02:00
Stephan Unverwerth
e405f436b6 3DFileViewer: Allow zooming via mouse wheel 2021-08-12 20:57:19 +02:00