Commit graph

33203 commits

Author SHA1 Message Date
Andreas Kling
f5c5efa067 LibWeb: Allow CSS floating objects to flow across multiple lines
If we run out of horizontal space when placing floating objects,
we now perform a "break" and continue with a new line of floats
below the bottommost margin edge of the current line.

This is definitely not 100% to-spec yet, but a huge improvement
on ACID1 already. :^)
2022-01-23 01:22:41 +01:00
Andreas Kling
0ea438e45b LibWeb: Put BFC floating object state into a struct
This patch adds a BFC::FloatSideData struct so we can contain left and
right floating object layout state in a struct. This is preparation for
adding more per-side state.
2022-01-23 01:22:41 +01:00
Andreas Kling
70a56d21dc LibWeb: Don't do horizontal inline line layout twice for last line
After pruning empty last line boxes, we now avoid re-running the
horizontal fragment positioning step, since that would be wasted work.
2022-01-23 01:22:41 +01:00
Andreas Kling
b1fd801436 LibWeb: Pass correct state to TextNode::compute_text_for_rendering()
This is poorly factored. TextNode needs to know whether the most
recently inserted fragment on the current line was empty or ended in
whitespace. This is used when deciding what to do with leading
whitespace in text nodes.

Let's keep this working for now, but we should eventually sort this out
and make text chunk iteration not depend on this information.
2022-01-23 01:22:41 +01:00
Andreas Kling
36e2799131 LibWeb: Make InlineLevelIterator::m_container a Layout::BlockContainer&
This is always a block container (the IFC's containing block.)
2022-01-23 01:22:41 +01:00
Andreas Kling
9f39ad8929 LibWeb: Ignore some collapsible whitespace when building lines
When collapsing whitespace, we can skip over all-whitespace chunks at
the start of each line, and immediately following fragments that
themselves end in whitespace.
2022-01-23 01:22:41 +01:00
Andreas Kling
766d816db3 LibWeb: Remove old Layout::Node::split_into_lines() API
Now that we build lines incrementally, we no longer need the atomic line
splitting API.

The new InlineLevelIterator and LineBuilder setup does have some
regressions from the old behavior, but we can deal with them as we go.
2022-01-23 01:22:41 +01:00
Andreas Kling
ba49dc82e0 LibWeb: Align inline-level boxes to the baseline of the line box
Vertical inline alignment is still very unsophisticated, but let's at
least put everything within each line on the same baseline.
2022-01-23 01:22:41 +01:00
Andreas Kling
2b631cde45 LibWeb: Avoid creating an empty first line box in block containers 2022-01-23 01:22:41 +01:00
Andreas Kling
251b2f49a2 LibWeb: Make LineBuilder respect LayoutMode::OnlyRequiredLineBreaks
In this layout mode, we should only break when forced (e.g by an
explicit <br> tag.) This is used when determining intrinsic sizes.)
2022-01-23 01:22:41 +01:00
Andreas Kling
78f2ddfc14 LibWeb: Make InlineLevelIterator ignore list item marker boxes
Marker boxes are managed explicitly by the corresponding list item box.
2022-01-23 01:22:41 +01:00
Andreas Kling
d3adc94ce8 LibWeb: Dimension inline-block boxes before deciding about line breaks
We won't know if we need to break before the inline-block box until
after we've dimensioned it.
2022-01-23 01:22:41 +01:00
Andreas Kling
67b3f769fb LibWeb: Teach InlineLevelIterator to skip across inline-block elements
We don't want to descend into inline-block containers when iterating
inline-level items, since that would make the inline-level children of
the inline-block bubble up to the containing block of the inline-block.
2022-01-23 01:22:41 +01:00
Andreas Kling
ce8043c6c2 LibWeb: Use LineBuilder in IFC to layout line boxes incrementally
This resolves a long-standing architectural problem in LibWeb that made
it unable to place CSS floating objects correctly due to not having
final vertical position information when computing the amount of
available horizontal space for each line.
2022-01-23 01:22:41 +01:00
Andreas Kling
00bde9ca51 LibWeb: Add Layout::LineBuilder class for incremental line box layout
This class will be used to place items on lines incrementally instead of
the current two-phase approach.
2022-01-23 01:22:41 +01:00
Andreas Kling
ae301d2b02 LibWeb: Remove duplicate type checks in SelectorEngine
After confirming the rule types, we can use static_cast instead of
verify_cast to avoid some extra work.
2022-01-23 01:22:41 +01:00
Andreas Kling
77650fe886 LibWeb: Remove duplicate checks in for_each_effective_style_rule()
After confirming the rule types, we can use static_cast instead of
verify_cast to avoid some extra work.
2022-01-23 01:22:41 +01:00
Andreas Kling
39b2046c42 LibWeb: Move available_space_for_line() into InlineFormattingContext 2022-01-23 01:22:41 +01:00
Andreas Kling
1f603c54ff LibWeb: Add inline-level iterator that enumerates items for line layout
This patch adds a new mechanism that allows InlineFormattingContext to
build line boxes incrementally instead of all-in-one go.

Incremental build will eventually allow much better support for CSS
floating objects.
2022-01-23 01:22:41 +01:00
Andreas Kling
9358f108c4 LibWeb: Add TreeNode<T>::next_in_pre_order(T* stay_within) variant
This is a scoped variant of the pre-order traversal helper that aborts
when attempting to leave the `stay_within` node.
2022-01-23 01:22:41 +01:00
Linus Groh
1ce6c49f5e LibJS: Make CreateTemporalDuration infallible in PlainYearMonthPrototype
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/05793a8
2022-01-23 00:22:10 +00:00
Linus Groh
e16821f460 LibJS: Avoid ambiguity in TimeZone production
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/87a6b0d
2022-01-23 00:22:10 +00:00
Linus Groh
0e3def1d0b LibJS: Don't parse/re-format offset in parse_temporal_time_zone_string()
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6abe146
2022-01-23 00:22:10 +00:00
Linus Groh
31283b5e64 LibJS: Pass valid offset string directly to CreateTemporalTimeZone
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/75490b9
- https://github.com/tc39/proposal-temporal/commit/8b70e4b
2022-01-23 00:22:10 +00:00
Linus Groh
6d744eb4a7 LibJS: Use consistent name for offset strings
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/17f8cdb
2022-01-23 00:22:10 +00:00
Liav A
eb9c8f3895 Kernel/PCI: Add basic support for the VMD PCI bridge device 2022-01-23 01:12:55 +01:00
Jelle Raaijmakers
df73e8b46b Kernel: Allow program headers to align on multiples of PAGE_SIZE
These checks in `sys$execve` could trip up the system whenever you try
to execute an `.so` file. For example, double-clicking `libwasm.so` in
Terminal crashes the kernel.

This changes the program header alignment checks to reflect the same
checks in LibELF, and passes the requested alignment on to
`::try_allocate_range()`.
2022-01-23 00:11:56 +02:00
dayarthvader
67b7bbe1f6 ping: Handle optional field in the IPv4 header 2022-01-22 22:11:21 +00:00
Lady Gegga
194cad0fc1 Base: Update all Yak-emojis to high-res images 2022-01-22 22:05:48 +00:00
Lady Gegga
53be3b41a7 Base: Add 10CD19 & 10CD1A emojis to PUA codepoints
10CD19 (yaksticker), 10CD1A (yakkie)
2022-01-22 22:05:48 +00:00
Idan Horowitz
024ee0a99a CI: Fail Lagom linters step as soon as any linter fails
This prevents linters from covering the failure of previous linters by
overwriting the error code that Azure reads at the end of the step.
2022-01-22 21:40:09 +02:00
Idan Horowitz
bb340f1272 markdown-check: Ignore absolute icon paths
We have no good way to handle these yet, and there's no point in
forcing everyone to skip their pre-commit checks.
2022-01-22 21:40:09 +02:00
Federico Guerinoni
e37af0b073 umount: Port to LibMain 2022-01-22 13:31:52 +02:00
Federico Guerinoni
2291ef6c3c LibCore: Add syscall wrapper for umount() 2022-01-22 13:31:52 +02:00
Thitat Auareesuksakul
96d2c3a827 Keymaps: Add Thai keymap 2022-01-22 10:38:53 +01:00
Emanuele Torre
191566fc97 LibJS: Avoid potential signed integer overflow in CyclicModule.cpp
`auto count = 0;` will declare `count` as a `signed int`.

We don't want that since `count` is used to count the occurence of an
element in an `AK::Vector` that can have up to `SIZE_MAX` elements;
`SIZE_MAX` can overflow a `signed int` more than 4 billion times.
2022-01-22 10:38:41 +01:00
Lenny Maiorani
065525aba0 LibSoftGPU: Configure stats overlay period
Problem:
- The statistics overlay period is hardcoded to 500 ms. This time is
  very short and can result in the values being very "jumpy".

Solution:
- Increasing this value can result in more steady values which is
  useful when trying to evaluate the performance impact of a change. A
  new config value is offered in `Config.h` to let the developer
  change to any value desired.
2022-01-22 08:57:31 +03:30
Nico Weber
3831e5fcff Utilities+Lagom: Remove test-crypto
After 4d5ffd364a, Tests/{LibCrypto,LibTLS} test the same things
and test-crypto has been redundant since then.
2022-01-22 01:44:05 +00:00
Nico Weber
d670c13a3b LibWeb: Make attribute hidden have an effect; hide some other elements
This moves LibWeb to using the list of hidden elements from the spec.

Concretely, the following things are now explicitly marked
`display: none` in addition to before:

- elements with the `hidden` attribute
- area
- base
- basefont
- datalist
- param
- rp

The spec also wants `noframes` and `noembed` to be `display: none`,
but since support for frames and embeds doesn't exist yet, these
are omitted for now.

With this, everyone's favorite website http://45.33.8.238/ no longer
displays spans with attribute hidden. (Whitespace handling still
looks a bit off though.)
2022-01-22 01:28:42 +00:00
Nico Weber
a9c80ba33c LibHTTP: Move more happy-path logging behind CHTTPJOB_DEBUG 2022-01-22 01:28:01 +00:00
Nico Weber
46ffc98ebc LibHTTP: Move more happy-path logging behind HTTPSJOB_DEBUG 2022-01-22 01:28:01 +00:00
Nico Weber
6d532649d4 RequestServer+AK: Move happy-path logging behind REQUESTSERVER_DEBUG
vdbgln() was responsible for ~10% of samples on pv's flamegraph for
RequestServer (under request_did_finish) when loading github.com in
Browser and recording a whole-system profile. This makes that almost
completely disappear.
2022-01-22 01:28:01 +00:00
davidot
0e56dac51e js: Display a warning if multiple files are given
Also instead of making a frankenstein path with all the paths combined
just take the first one, this is needed for resolving modules.
2022-01-22 01:21:18 +00:00
davidot
2d4b345bb1 Spreadsheet: Enable dynamic import of javascript modules
This has some risks as it can (attempt to) load arbitrary files on the
filesystem but for now it can only load local files which do go through
normal file operations. But let's enable it for now to see what we can
do with it.
2022-01-22 01:21:18 +00:00
davidot
986ad3ccf0 LibJS: Use HostImportModuleDynamically in ShadowRealmImportValue
Now that module loading is implemented this just works :^).

Since ShadowRealm explicitly passed a null ScriptOrModule we attempt to
get the top most ScriptOrModule in HostImportModuleDynamically.
This won't work in general as the web specifies other behavior but for
LibJS there must always be an active script to call
HostImportModuleDynamically.
2022-01-22 01:21:18 +00:00
davidot
91b3e5b31f LibJS: Implement the ImportMeta MetaProperty
This "standard" implementation of this is to do nothing.
2022-01-22 01:21:18 +00:00
davidot
7cbf4b90e8 LibJS: Implement ImportCall and HostImportModuleDynamically
This allows us to load modules from scripts.
This can be dangerous as it can load arbitrary files. Because of that it
fails and throws by default. Currently, only js and JavaScriptTestRunner
enable the default hook.

This also adds tests to test-js which test module code. Because we
form a spec perspective can't "enter" a module this is the easiest way
to run tests without having to modify test-js to have special cases for
modules.
To specify modules in test-js we use the extension '.mjs' this is to
ensure the files are not executed. We do still want to lint these files
so the prettier scripts have changed to look for '.mjs' files as well.
2022-01-22 01:21:18 +00:00
davidot
023968a489 LibJS: Implement evaluation of im- and exports statements 2022-01-22 01:21:18 +00:00
davidot
779e677467 LibJS: Implement HostResolveImportedModule for LibJS
This loads modules with relative paths from the referencing module.
In this commit the only way to run a module is via the interpreter
which can link and evaluate a module (and all its dependencies).
2022-01-22 01:21:18 +00:00
davidot
1b8ccf9a66 LibJS: Implement Module linking and evaluating 2022-01-22 01:21:18 +00:00