Commit graph

1282 commits

Author SHA1 Message Date
Sam Atkins d6901d2119 Meta: Add range checking to all numeric CSS types
We did already have range checking for the `<integer>` and `<number>`
types, but this patch adds this functionality to all numeric types
(dimensions and percentages).

The syntax in Properties.json is taken from the spec:
https://www.w3.org/TR/css-values-3/#numeric-ranges

eg, `length [0,∞]` defines that a Length is allowed as long as it has a
positive value.

The implementation here allows for any number to be the positive or
negative limit, even though only 0 and positive/negative infinity are
meaningful values without a unit.
2022-03-26 18:15:08 +01:00
Andreas Kling 261cd1d4c7 LibWeb: Mark CSS properties as not affecting stacking context by default
We were mistakenly treating all CSS properties as if changing them
requires a rebuild of the stacking context tree.
2022-03-25 11:57:30 +01:00
Tim Schumacher fad1114d4d Meta: Remove obsolete HeaderCheck .gitignore
This appears to be a remnant from the earlier HeaderCheck revisions,
where CMakeLists.txt was automatically generated.

Now that a (static) copy of CMakeLists.txt is checked in, this file
doesn't have any effect anymore.
2022-03-24 20:11:39 -07:00
Idan Horowitz 45c5fcf5cb Meta: Disable KASLR when debugging the kernel with GDB
This lets GDB resolve the kernel symbols correctly.
2022-03-24 23:36:56 +00:00
Idan Horowitz 5626e1b324 LibWeb: Rename PARSER_DEBUG => HTML_PARSER_DEBUG
Since this macro was created we gained a couple more parsers in the
system :^)
2022-03-24 21:37:49 +01:00
Lenny Maiorani e08cd4d608 CMake: Add serenity_lib_static 2022-03-24 03:04:57 +01:00
Timothy Flynn 324f709d29 LibWeb: Support IDL default values of "null" for optional arguments
This is a bit strange in the IDL syntax, but e.g., in HTMLSelectElement,
we have (simplified):

    undefined add(optional (HTMLElement or long)? before = null)

This could instead become:

    undefined add(optional (HTMLElement or long) before)

This change generates code for the former as if it were the latter.
2022-03-22 02:08:15 +01:00
Timothy Flynn 57296393ed LibWeb: Begin implementing SVGRectElement's SVGAnimatedLength attributes 2022-03-21 21:04:39 +01:00
Timothy Flynn 3ebc5cc58e LibWeb: Support generating IDL float types
The float type is used quite a bit in the SVG spec.
2022-03-21 21:04:39 +01:00
Andreas Kling 8c88ee1165 LibWeb: Only invalidate stacking context tree for opacity/z-index change
I came across some websites that change an elements CSS "opacity" in
their :hover selectors. That caused us to relayout on hover, which we'd
like to avoid.

With this patch, we now check if a property only affects the stacking
context tree, and if nothing layout-affecting has changed, we only
invalidate the stacking context tree, causing it to be rebuilt on next
paint or hit test.

This makes :hover { opacity: ... } rules much faster. :^)
2022-03-21 13:03:33 +01:00
Nico Weber 681fac07ed Meta: Always disable kvm on aarch64 hosts for now
run.sh builds i686 by default, and the aarch64 port of serenity
isn't very far along yet.

Without this change, `run.sh` without arguments unceremoniously
fails with:

    [0/1] cd .../serenity/Build/i686 && /usr...
          ENITY_ARCH=i686 /home/thakis/src/serenity/Meta/run.sh
    qemu-system-i386: invalid accelerator kvm

That's because /dev/kvm exists, but that's no good on a non-intel host.
2022-03-20 19:53:47 -07:00
Nico Weber 20c6dabaff Lagom: Build with -fsigned-char
When building on an arm host system, char defaults to unsigned,
leading to errors such as:

  serenity/AK/StringBuilder.cpp:198:20:
    error: comparison is always true due to limited range of data type
           [-Werror=type-limits]
    198 |             if (ch >= 0 && ch <= 0x1f)
        |

Building with -fsigned-char makes things work like on Intel, and
it's what we already do in Kernel/CMakeLists.txt for the same reasons.
2022-03-20 19:53:47 -07:00
Brian Gianforcaro 97f622747b Everywhere: Move commonmark.spec.json to /home/anon/Tests 2022-03-20 22:20:59 +01:00
Brian Gianforcaro 95b295971d Everywhere: Move tests to /home/anon/Tests 2022-03-20 22:20:59 +01:00
Brian Gianforcaro 16bee0ba79 Everywhere: Move js/web/wasm tests under /home/anon/Tests 2022-03-20 22:20:59 +01:00
Brian Gianforcaro 67fc81a65a Everywhere: Move cpp-tests under /home/anon/Tests 2022-03-20 22:20:59 +01:00
Ali Mohammad Pur 612d5f201a Meta: Skip wasm tests whose modules cannot be loaded
Also add support for a few more assertion types to go along with it.
2022-03-20 10:44:32 +03:30
Brian Gianforcaro 66e7ac1954 Meta: Error out on find_program errors with CMake less than 3.18
We have seen some cases where the build fails for folks, and they are
missing unzip/tar/gzip etc. We can catch some of these in CMake itself,
so lets make sure to handle that uniformly across the build system.

The REQUIRED flag to `find_program` was only added on in CMake 3.18 and
above, so we can't rely on that to actually halt the program execution.
2022-03-19 15:01:22 -07:00
Itamar b6f358689c CMake: Modify include path when building from Hack Studio
With regular builds, the generated IPC headers exist inside the Build
directory. The path Userland/Services under the build directory is
added to the include path.

For in-system builds the IPC headers are installed at /usr/include/.
To support this, we add /usr/include/Userland/Services to the build path
when building from Hack Studio.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-03-19 22:02:44 +01:00
Itamar fe7d28e870 CMake: Install generated IPC headers under /usr/include in compile_ipc()
Generated IPC headers are now installed under /usr/include in the
system's filesystem image.
2022-03-19 22:02:44 +01:00
stelar7 60c228b914 LibWeb: Handle nullish this_value when creating idl functions 2022-03-19 17:40:23 +00:00
Lenny Maiorani 4c5e9f5633 Everywhere: Deduplicate day/month name constants
Day and month name constants are defined in numerous places. This
pulls them together into a single place and eliminates the
duplication. It also ensures they are `constexpr`.
2022-03-18 23:48:50 +00:00
Timothy Flynn c0dd188c4d LibTimeZone: Update to TZDB version 2022a
https://mm.icann.org/pipermail/tz-announce/2022-March/000070.html
2022-03-17 16:38:33 +00:00
Andreas Kling 275db39c94 LibWeb: Annotate which CSS properties may affect layout
This patch adds CSS::property_affects_layout(PropertyID) which tells us
whether a CSS property would affect layout if it were changed.

This will be used to avoid unnecessary relayout work when something
changes that really only requires us to repaint the page.

To mark a property as not affecting layout, set "affects-layout" to
false in the corresponding Properties.json entry. Note that all
properties affect layout by default.
2022-03-16 18:06:45 +01:00
Ali Mohammad Pur ab55abb0f8 Meta: Enable all wasm extensions when building test suite
...and let LibWasm do the validation instead of removing the test when a
module is invalid.
Also, one of the tests has an integer literal starting with zero, so
account for this to make it not fail :^)
2022-03-16 15:44:52 +00:00
sin-ack 436262ea3a Meta: Use the ImplementedAs value in the attribute setter
Co-Authored-By: Luke Wilde <lukew@serenityos.org>
2022-03-16 00:38:31 +01:00
Linus Groh 4260638121 Meta: Add copy-src to commands in ZSH autocomplete script 2022-03-14 22:20:35 +00:00
Linus Groh 7560f61b71 Meta: Add aarch64 to targets in ZSH autocomplete script 2022-03-14 22:20:24 +00:00
Andreas Kling 74fda2a761 LibWeb: Make CSS::property_initial_value() use an Array internally
Since we want to store an initial value for every CSS::PropertyID,
it's pretty silly to use a HashMap when we can use an Array.

This takes the function from ~2.8% when mousing around on GitHub all the
way down to ~0.6%. :^)
2022-03-13 18:09:43 +01:00
Jakub V. Flasar 6d2c298b66 Kernel: Move aarch64 Prekernel into Kernel
As there is no need for a Prekernel on aarch64, the Prekernel code was
moved into Kernel itself. The functionality remains the same.

SERENITY_KERNEL_AND_INITRD in run.sh specifies a kernel and an inital
ramdisk to be used by the emulator. This is needed because aarch64
does not need a Prekernel and the other ones do.
2022-03-12 14:54:12 -08:00
Sam Atkins eb6e4e6775 Meta: Port Generate_CSS_PropertyID_cpp to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins a850465a4b Meta: Port Generate_CSS_PropertyID_h to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins e80038d938 Meta: Port Generate_CSS_ValueID_cpp to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins dd238df42d Meta: Port Generate_CSS_ValueID_h to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins 7ce8a91341 Meta: Generate functions for validating media-query values
These work differently from how we validate StyleValues. There, we parse
a StyleValue from the CSS, and then see if it is allowed in the
property. That causes problems when the syntax is ambiguous - for
example, `0` can be a number or a Length.

Here instead, we ask what kinds of value are allowed for a
media-feature, and then only attempt to parse those kinds of value.
This makes the ambiguity problem go away. :^)

Each media-feature in the spec only accepts one type of value, and/or
some identifiers. This makes the switch statements for the type a bit
excessive, but the spec does not *require* that only one type is
allowed, so this is more future-proof.
2022-03-09 23:06:30 +01:00
Sam Atkins 0371d33132 LibWeb+Meta: Stop discrete media-features from parsing as ranges
Only "range" type media-features are allowed to appear in range syntax,
or have a `min-/max-` prefix.
2022-03-09 23:06:30 +01:00
Sam Atkins b7bb86462b Meta: Generate CSS::MediaFeatureID enum
This works largely the same as the PropertyID and ValueID generators,
but using LibMain, Core::Stream, and TRY().

Rather than have a MediaFeatureID::Invalid, I decided to return an
Optional. We'll see if that turns out better or not. :^)
2022-03-09 23:06:30 +01:00
Sam Atkins e986331a4f Meta: Move title/camel_casify() functions into their own file
These were duplicated among the CSS generators.
2022-03-09 23:06:30 +01:00
Andreas Kling fabcee016f LibWeb: Add basic support for DOM's NodeIterator and NodeFilter
This patch adds NodeIterator (created via Document.createNodeIterator())
which allows you to iterate through all the nodes in a subtree while
filtering with a provided NodeFilter callback along the way.

This first cut implements the full API, but does not yet handle nodes
being removed from the document while referenced by the iterator. That
will be done in a subsequent patch.
2022-03-09 16:43:00 +01:00
Sahan Fernando 04849c9561 Meta: Add SERENITY_GL environment variable to run.sh 2022-03-09 14:58:48 +03:30
Daniel Bertalan a25cc9619d Base+Meta: Make /usr/local read-write
This directory has to be writable if we want to install ports that have
been built inside Serenity. It's owned by root anyway, so having it be
read-only does not provide many security benefits.
2022-03-08 23:30:47 +01:00
davidot 6dd8ef485a Meta: Fix that the processor count was output to stderr and ignored
Because of ninja's default behavior of using all processors this gave
the correct behaviour because MAKEJOBS was empty. However this meant
that the processor count was printed to stderr when building.
2022-03-08 17:56:20 +01:00
davidot 3192cabc0e Meta: Read MAKEJOBS to limit jobs for ninja in serenity.sh
The default behavior of using all cores will still apply if no
MAKEJOBS variable is supplied.
2022-03-08 17:12:35 +01:00
Linus Groh 1422bd45eb LibWeb: Move Window from DOM directory & namespace to HTML
The Window object is part of the HTML spec. :^)
https://html.spec.whatwg.org/multipage/window-object.html
2022-03-08 00:30:30 +01:00
Matthew Olsson 73cf8205b4 LibPDF: Propagate errors in Parser and Document 2022-03-07 10:53:57 +01:00
Idan Horowitz 59e9e7cc61 LibWeb: Add a very basic and ad-hoc version of IDL overload resolution
This initial version lays down the basic foundation of IDL overload
resolution, but much of it will have to be replaced with the actual IDL
overload resolution algorithms once we start implementing more complex
IDL overloading scenarios.
2022-03-05 23:40:08 +01:00
Linus Groh 1719862d12 LibWeb: Hide some debug logging behind CANVAS_RENDERING_CONTEXT_2D_DEBUG
This can be quite noisy and isn't generally useful information.
2022-03-04 23:03:29 +01:00
Jelle Raaijmakers ae2591657d Meta: Add "SerenityOS" to the QEMU window title
Just a small quality of life improvement :^)
2022-03-03 11:47:18 +01:00
Liav A 629eed3a4c Meta: Add option to run SerenityOS on a QEMU MicroVM machine
The microvm machine type is a modern tool for kernel and firmware
developers to test their software against features like FDTs, second
IOAPIC, lack of legacy devices by default, the ability of using PCIe
without using PCI x86 IO ports, etc.

We can boot into such machine but we are limited in the functionality we
support currently for this type of virtual machine.
2022-03-02 18:41:54 +01:00
Liav A 2dbbec66e4 Meta: Add option to run SerenityOS on a QEMU ISA-PC machine
The ISA-PC machine type provides no PCI bus support, no IOAPIC support
and other modern PC features of our generation.

This is mainly a good environment for testing abstractions in the kernel
space, and can help with improving on them for the sake of porting the
OS to other chipsets and CPU architectures.
2022-03-02 18:41:54 +01:00