Commit graph

35805 commits

Author SHA1 Message Date
Andreas Kling d71b0e4638 LibWeb: Don't discard update_style_recursively() return value
This was causing us to miss layout invalidations. With this fixed, we
can remove the invalidation from Element::recompute_style() along with
the associated FIXME.

Thanks to Idan for spotting this! :^)
2022-03-16 21:30:39 +01:00
Andreas Kling bec0c96aea LibWeb: Mark a bunch of CSS border-* properties as not affecting layout
border*-width and border-collapse affect layout, but all the color,
style and radius ones will only need a repaint if changed. :^)
2022-03-16 21:30:04 +01:00
Simon Wanner cc77bb5067 LibJS: Relax line and column number restrictions in Error stack tests 2022-03-16 18:55:55 +00:00
Andreas Kling aaed7b11f8 LibWeb: Mark all text-decoration* CSS properties as not affecting layout 2022-03-16 19:16:45 +01:00
Andreas Kling ccc37032a4 LibWeb: Don't call establishes_stacking_context() during painting
By the time we're painting, we've already built the stacking context
tree. So instead of asking if a box establishes a stacking context, we
can ask if its paintable *has* a stacking context.

This was taking up ~6% of the profile when mousing around on the HTML
specification. With this change, it disappears completely. :^)
2022-03-16 19:16:45 +01:00
Linus Groh e31d1620a8 LibPthread: Define SEM_FAILED in semaphore.h
This makes the _multiprocessing module from the Python port build. :^)
2022-03-16 18:03:52 +00:00
Linus Groh 9882848e0b Kernel: Define IF_NAMESIZE in net/if.h
This makes the _socket module from the Python port build. :^)
2022-03-16 18:03:25 +00:00
Andreas Kling 910fded482 LibWeb: Flush any pending layout updates before processing mouse events
We want to make sure the layout and paint trees are up-to-date before
handling any mouse events.
2022-03-16 18:50:56 +01:00
Andreas Kling 0e8b538e0a LibWeb: Invalidate less style when moving between hovered nodes
Instead of invalidating style for the entire document, we now locate the
nearest common ancestor between the old and new innermost hovered node,
and only invalidate that ancestor and its descendants.

This drastically reduces the amount of style update work when mousing
around on GitHub (and any other pages, really.) It's actually really
really snappy now. Very cool! :^)
2022-03-16 18:06:45 +01:00
Andreas Kling f1711a562a LibWeb: Avoid layout invalidation for some CSS property changes
Use the new CSS::property_affects_layout() helper to figure out if we
actually need to perform a full relayout after recomputing style.

There are three tiers of required invalidation after an element receives
new style: none, repaint only, or full relayout.

This avoids the need to rebuild the layout tree (and perform layout on
it) when trivial properties like "color" etc are changed.
2022-03-16 18:06:45 +01: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
Andreas Kling df5c123d8c LibWeb: Schedule a relayout after setting CharacterData.data 2022-03-16 18:06:45 +01:00
Andreas Kling 28721874e8 LibWeb: Schedule a relayout after setting Element.innerHTML 2022-03-16 18:06:45 +01:00
Andreas Kling a2b9609793 LibGfx: Make FontDatabase API use FlyString for family and variant
This reduces work done by font lookups.
2022-03-16 18:06:45 +01:00
Ali Mohammad Pur cb6b372a3b Meta: Actually copy the new wasm per-file results after generating them
Otherwise the website data won't be updated.
2022-03-16 20:19:24 +03:30
Lenny Maiorani 5b59375a56 AK: Fix implicit and narrowing conversions in Base64 2022-03-16 16:19:53 +00:00
Lenny Maiorani 8d1d4d4f09 AK: Make static constexpr variables to avoid stack copy in Base64
Alphabet and lookup table are created and copied to the stack on each
call. Create them and store them in static memory.
2022-03-16 16:19:53 +00:00
Lenny Maiorani d00b79568f Libraries: Use default constructors/destructors in LibJS
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-16 16:19:40 +00:00
Ali Mohammad Pur 07c7827dee Meta: Don't use heredocs as file paths
Heredocs are passed to stdin, so make `jq` read it from stdin instead of
treating it as a file path argument.
2022-03-16 19:48:04 +03:30
Ali Mohammad Pur c0dbea43f3 Meta: Run Wasm spec tests on master push
...and report the results on libjs-website.
2022-03-16 15:44:52 +00: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
Ali Mohammad Pur 8b50009e9b LibTest: Provide detailed per-file JSON output with --per-file
This makes test-js style runners dump out output in the same format as
libjs-test262's per-file output.
2022-03-16 15:44:52 +00:00
Daniel Lemos 3063aedb0c Ports: Add Lua's package manager LuaRocks
Ports: Add LuaRocks to AvailablePorts.md

Ports: Add ReadMe.md for the patches
2022-03-16 14:14:01 +00:00
Daniel Lemos a4e5c6201e Ports: Make lua depends and build with readline 2022-03-16 14:12:30 +00:00
Tim Schumacher 4cbf78ce6a Ports: Add a dependency on libiconv to tig 2022-03-16 14:10:59 +00:00
Tim Schumacher d3f3bb1853 Ports: Add a dependency on libiconv to p7zip 2022-03-16 14:10:59 +00:00
Tim Schumacher 8ffba7e2cf Ports: Add libpng and libjpeg dependencies to imgcat
Those don't seem to be strictly required, but we already have those
ports, might as well add a few more formats to the mix.
2022-03-16 14:10:59 +00:00
Tim Schumacher aad776048e Ports: Add a dependency on zlib to ntbtls 2022-03-16 14:10:59 +00:00
Tim Schumacher 1cab2e54e1 Ports: Fail if config.{sub,guess} don't replace existing files
This should help with finding misconfigured config.sub and config.guess
settings.
2022-03-16 14:10:59 +00:00
Tim Schumacher 26b4e74f4a Ports: Add a dependency on pcre to citron 2022-03-16 14:10:59 +00:00
Tim Schumacher 46399e3dc0 Ports: Disable SDL support for libmpeg2
We do not have a port of SDL.
2022-03-16 14:10:59 +00:00
ry-sev 23643cf21b HackStudio: Move editors inside tab widgets
This will move the editors inside a tab widget and the user
will be able to add new editors as tabs as well as add new
tab widgets. The user will be able to easily switch between
editors as well as the tab widgets.
2022-03-16 14:36:46 +01:00
Olivier De Cannière da714f771d LibGUI: Make only the targeted tab of TabWidget respond to double click
Previously, when double clicking on the tab bar, all tabs would respond
to the double click even if they weren't clicked on.

This issue, for example, prevented renaming of individual tabs in
Spreadsheet and instead asked the user to rename all tabs one by one.
2022-03-16 14:25:47 +01:00
Simon Wanner deef2911e9 LibWeb: Expose HTMLSelectElement::options
Use the stub implementation of HTMLOptionsCollection to expose the
`option` children of `select` elements.

This fixes a JS error on openstreetmap.org, which occured when JQuery
code tried to access `options.length`:
https://github.com/jquery/jquery/blob/main/src/attributes/val.js#L121
2022-03-16 14:25:09 +01:00
Simon Wanner 624527f15e LibWeb: Add stub implementation of HTMLOptionsCollection
This is a subtype of `DOM::HTMLCollection` that only holds
`HTMLOptionElement`s. In this stub implementation only `item`,
`namedItem` and `length`, inherited from HTMLCollection, are exposed.
This is good enough for applications that only read the collection.
2022-03-16 14:25:09 +01:00
Luke Wilde 6f4dde253f Ports: Update OpenSSL to 1.1.1n 2022-03-16 13:01:23 +00:00
Timothy Flynn 1a99cc4a14 LibWeb: Use the cached HTMLInputElement type within associated getters 2022-03-16 13:03:55 +01:00
Timothy Flynn 95b084a08f LibWeb: Cache HTMLInputElement's parsed type attribute when it changes
This will let us avoid parsing the type each time type() or type_state()
are invoked.
2022-03-16 13:03:55 +01:00
Andreas Kling 1ac0116688 LibWeb: Invalidate layout on BrowsingContext resize
Even if style didn't change, we still need to force a layout, since the
initial containing block depends on the viewport size.
2022-03-16 12:52:46 +01:00
Andreas Kling 6ad8330102 LibWeb: Make parent- and root-relative font-size work better
Relative font-sizes like "2em" were previously resolved against the
fallback value (10px) which led to incorrect layouts in many places.

Fix this by resolving relative font-sizes against the absolutized
font-size of the parent or root element as appropriate.
2022-03-16 12:52:46 +01:00
sin-ack 5d2b741ec9 LibWeb: Add hack to dispatch load event for <object>s
This increases our Acid3 score to 81/100 on the live website, and fixes
the 5 second spin locally.
2022-03-16 10:07:06 +01:00
Andreas Kling b1096c2ae4 LibWeb: Make Element::set_shadow_root() disconnect any previous root 2022-03-16 00:38:44 +01:00
sin-ack d2a99eded7 LibWeb: Convert usages of type() to type_state()
This doesn't have any performance benefit yet as we still do string
comparisons everytime, but it should improve once type_state() has a
better implementation.
2022-03-16 00:38:31 +01:00
sin-ack 57a85b1017 LibWeb: Ensure that radio group is updated when radio is checked from JS
Fixes test 56 in Acid3.

Farewell, radio eyes, you will be missed. :^(
2022-03-16 00:38:31 +01: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
sin-ack b3df222e52 LibWeb: Fire a UIEvents::MouseEvent for HTMLElement.click()
This still is not perfectly correct but it's enough to trigger the
activation behavior of elements and gain us a point on Acid3. :^)
2022-03-16 00:38:31 +01:00
sin-ack 29583104d2 LibWeb: Refactor all LabelableNode subclasses + input event handling :^)
This commit is messy due to the Paintable and Layout classes being
tangled together.

The RadioButton, CheckBox and ButtonBox classes are now subclasses of
FormAssociatedLabelableNode. This subclass separates these layout nodes
from LabelableNode, which is also the superclass of non-form associated
labelable nodes (Progress).

ButtonPaintable, CheckBoxPaintable and RadioButtonPaintable no longer
call events on DOM nodes directly from their mouse event handlers;
instead, all the functionality is now directly in EventHandler, which
dispatches the related events. handle_mousedown and related methods
return a bool indicating whether the event handling should proceed.

Paintable classes can now return an alternative DOM::Node which should
be the target of the mouse event. Labels use this to indicate that the
labeled control should be the target of the mouse events.

HTMLInputElement put its activation behavior on run_activation_behavior,
which wasn't actually called anywhere and had to be manually called by
other places. We now use activation_behavior which is used by
EventDispatcher.

This commit also brings HTMLInputElement closer to spec by removing the
did_foo functions that did ad-hoc event dispatching and unifies the
behavior under run_input_activation_behavior.
2022-03-16 00:38:31 +01:00
Andreas Kling 06ccc45157 LibWeb: Don't create HTMLInputElement's UA shadow tree for buttons
We don't need an internal editable text node inside buttons. :^)
2022-03-16 00:26:02 +01:00
Andreas Kling b8ee4dfda8 LibWeb: Don't compute style *again* for elements in Layout::TreeBuilder
TreeBuilder wasn't taking advantage of the fact that we already have
computed style cached on each DOM::Element by the time we're
constructing a layout tree.

So instead of using the cached style, we recomputed it from scratch for
every element. This was done because invalidation was broken in many
places, but now that it's more or less trustworthy, stop recomputing
style on the fly in TreeBuilder and use what the preceding style update
pass gave us instead.

This basically cuts style computation work in half. :^)
2022-03-15 22:43:44 +01:00
Andreas Kling 1881761d0f LibWeb: Fix mistake in Node::invalidate_style()
We were not actually walking past the first ancestor when setting
child-needs-update bit upwards.

Also, let's walk all the way to the root, even if there's a
child-needs-update bit already set. This ensures that we always leave
this function with the ancestor chain in a sane state.
2022-03-15 22:43:44 +01:00