Commit Graph

35759 Commits

Author SHA1 Message Date
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
Andreas Kling
b4bda4cdf3 LibWeb: Make invalidate_style() set child-needs-update on shadow hosts 2022-03-15 22:43:44 +01:00
Andreas Kling
03d6e1953f LibWeb: Improvements to Node::invalidate_style()
- Access members directly instead of going through accessors,
  avoiding a lot of redundant traversal done by accessors.

- Cross shadow boundaries and make sure that shadow trees get their
  dirty bits updated as well.

- Do the minimum amount of traversal needed when setting the "child
  needs style update" bit upwards through ancestors.
2022-03-15 20:02:30 +01:00
Andreas Kling
544c796bcf Browser: Rename Inspector table view member names to match contents 2022-03-15 20:00:51 +01:00
Vrins
4b4ee95cdb LibGUI: Set cursor when using highlighted_search in abstractview
Previously using the highlighted_search would not set the cursor
to the item found by the search. This results in some unfamiliar
behavior such as jumping back up to the previously selected element,
before searching, when using the arrow keys to navigate.
2022-03-15 20:00:09 +01:00
Vrins
044be82567 Browser: Allow jumping to stylenames by typing in the inspector
This adds the default behavior of search and highlighting of
abstractView to the inspectorWidget. Search results are based on
the titles in the first columns.
2022-03-15 20:00:09 +01:00
Andreas Kling
e5e621a63f Browser: Rename "Element" Inspector tab to "Box Model"
This tab shows the box model metrics, so let's call it "Box Model" :^)
2022-03-15 19:48:19 +01:00
Andreas Kling
1afd9467f2 Browser: Use accurate labels for the Inspector's style property tabs
"Styles" => "Computed"
"Computed" => "Resolved"

It'd be nice to show specified values as well, but we don't have great
infrastructure to do that yet.
2022-03-15 19:48:19 +01:00
Andreas Kling
e31fe3eeb8 LibWeb: Rename Element::specified_css_values() => computed_css_values()
Let's make it very clear that these are *computed* values, and not at
all the specified values. The specified values are currently discarded
by the CSS cascade algorithm.
2022-03-15 19:48:19 +01:00
Andreas Kling
43ef813f3d LibWeb: Rename Element::computed_style() to resolved_css_values()
This more accurately reflects what's actually being returned.
2022-03-15 19:48:19 +01:00
Andreas Kling
8aa24c45dd LibWeb: Make BrowsingContext::reset_cursor_blink_cycle() more robust
If the browsing context text cursor has become invalid for whatever
reason, don't try to repaint its associated node.
2022-03-15 19:48:19 +01:00
Andreas Kling
5b8290dfa3 LibWeb: Invalidate document style after Node.insertBefore() 2022-03-15 19:48:19 +01:00
Andreas Kling
cf49e93b04 LibWeb: Invalidate style on media query evaluation change 2022-03-15 19:48:19 +01:00
Andreas Kling
a033dfc885 LibWeb: Actually connect ShadowRoot to its host element
This way we can traverse from inside a shadow root across the boundary
to the outside. :^)
2022-03-15 19:48:19 +01:00
Andreas Kling
759bfbb572 LibWeb: Use StyleComputer::invalidate_rule_cache() directly everywhere
Get rid of the old, roundabout way of invalidating the rule cache by
incrementing the StyleSheetList "generation".

Instead, when something wants to invalidate the rule cache, just have it
directly invalidate the rule cache. This makes it much easier to see
what's happening anyway.
2022-03-15 19:48:19 +01:00
Andreas Kling
72e6bff8b8 LibWeb: Remove unused code for constructing partial layout trees
We only ever build the whole layout tree in one go. Maybe one day we'll
support partial rebuilds, but for now, let's keep things simple.
2022-03-15 19:48:19 +01:00
Andreas Kling
88173648e3 LibWeb: Create HTMLInputElement UA shadow tree when inserted into DOM
Previously, we were creating a user-agent shadow tree when constructing
a layout tree. This meant that we did DOM manipulation (and consequently
style invalidation) during layout tree construction, which made things
very hard to reason about in Layout::TreeBuilder.

Simply everything by simply creating the UA shadow tree when the input
element inserted into a parent node instead.
2022-03-15 19:48:19 +01:00
Andreas Kling
511d4951b0 LibWeb: Don't access layout nodes in StyleComputer
Style computation always happens *before* layout, so we can't rely on
things having (or not having) layout nodes, as that information will
always be one step behind.

Instead, we have to use the DOM to find all the information we need.
2022-03-15 19:48:19 +01:00
Andreas Kling
cf69cc7f7d LibWeb: Invalidate style when a browsing context's viewport is resized
Anything with viewport-relative CSS lengths (vw/vh/vmin/vmax) needs to
have its style recomputed if the viewport size changes.
2022-03-15 19:48:19 +01:00
Andreas Kling
2be4064ca8 LibWeb: Add fast_is<ParentNode>() 2022-03-15 19:48:19 +01:00
Andreas Kling
32dd4bf1b9 LibWeb: Recurse into shadow trees when updating style
The style update mechanism was happily ignoring shadow subtrees.
Fix this by checking if an element has a shadow root, and recursing into
it if needed.
2022-03-15 19:48:19 +01:00
Andreas Kling
5d941ddf3a LibWeb: Make style invalidation cross shadow boundaries
Before this change, style invalidation didn't propagate upwards across
shadow boundaries, so our shadow trees were sitting there with invalid
style, never actually getting updated.
2022-03-15 19:48:19 +01:00
Andreas Kling
fdb647c097 LibWeb: Use a WeakPtr for DocumentFragment's "host" field
We had a reference cycle between fragments and their hosts.
2022-03-15 19:48:19 +01:00
Andreas Kling
7a82a6dfe8 LibWeb: Add equals() override to a bunch of StyleValue subclasses
The less we fall back to string-based equality testing, the better.
2022-03-15 19:48:19 +01:00
Linus Groh
fb60ada6ce LibJS: Handle non-Error this object in Error.prototype.stack getter
This is taken from the abandoned error stacks proposal, which
already serves as the source of truth for the setter. It only requires
the this value to be an object - if it's not an Error object, the getter
returns undefined.
I have not compared this behavior to the non-standard implementations of
the stack property in other engines, but presumably the spec authors
already did that work.

This change gets the Sentry browser SDK working to a point where it can
actually send uncaught exceptions via the API :^)
2022-03-15 17:32:48 +01:00
Linus Groh
37e988675f LibJS/Tests: Consolidate Error.prototype.stack tests
We don't usually separate tests for the getter and setter of a property,
and that error-stack.js (getter) test belongs in builtins/.
2022-03-15 17:32:48 +01:00
Linus Groh
ecba29c158 LibJS: Set internal function name of NativeError constructors
By using the same NativeFunction constructor as plain ErrorConstructor
and passing the name, TypeError & co. will now include their name in
backtraces and such.
Eventually we should probably rely on [[InitialName]] for this, but for
now that's how it works.
2022-03-15 17:32:48 +01:00
Timothy Flynn
04bb17ca94 LibJS: Reorganize spec steps for Intl.RelativeTimeFormat
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/a3ae343
2022-03-15 17:30:58 +01:00
Timothy Flynn
8941d0b49e LibJS: Reorganize spec steps for Intl.PluralRules
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/d7c7157
2022-03-15 17:30:58 +01:00
Timothy Flynn
812d3a7ef8 LibJS: Reorganize spec steps for Intl.NumberFormat
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/110cb1f
2022-03-15 17:30:58 +01:00
Timothy Flynn
d6868d1e9d LibJS: Reorganize spec steps for Intl.Locale
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/31f6003
2022-03-15 17:30:58 +01:00
Timothy Flynn
6677e03a52 LibJS: Reorganize spec steps for Intl.ListFormat
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/61bc370
2022-03-15 17:30:58 +01:00
Timothy Flynn
72462bed2f LibJS: Reorganize spec steps for Intl.DisplayNames
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/5b51804
2022-03-15 17:30:58 +01:00
Timothy Flynn
1f9c5c186f LibJS: Reorganize spec steps for Intl.DateTimeFormat
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/97e1ecc
2022-03-15 17:30:58 +01:00
Timothy Flynn
194ca06f78 LibJS: Reorganize spec steps for Intl.Collator
This is an editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/7c13db4

This also normalizes the spelling of the "Internal slots" heading in
Intl.Collator, which is another editorial change in the Intl spec:
https://github.com/tc39/ecma402/commit/ec064bd
2022-03-15 17:30:58 +01:00
djwisdom
421eef0f86 Base+Font: Satori font regular+bold 2022-03-15 17:29:09 +01:00
Undefine
004e045adc Utilities: Add an lscpu utility 2022-03-15 15:44:17 +00:00
Pierce Andjelkovic
1b14840b48 Ports: Allow harfbuzz to be built with cmake 3.18.4
CMake defaults to the current directory if the source or build 
directory is not specified. Harfbuzz builds into an alternate 
directory so it fails. This change specifies the directory prior 
to any additional parameters so the build can succeed with 
cmake 3.18.4.
2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
c24ba8c5ad Ports: Add config_sub_path to flex 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
67de6446a9 Ports: Add config.sub location to diffutils config.sub 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
9b437718fb Ports: Point gnucobol to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
108808bb8f Ports: Point indent to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
a7ba108d1d Ports: Point libarchive to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
7b2e0af13f Ports: Point libexpat to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
37161afbdf Ports: Point libtool to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
901cb247fb Ports: Point nasm to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
52656accb1 Ports: Point yasm to the correct config.sub location 2022-03-15 14:03:07 +00:00