Commit graph

29216 commits

Author SHA1 Message Date
Ben Wiederhake
50698a0db4 AK: Prevent accidental misuse of BumpAllocator
In particular, we implicitly required that the caller initializes the
returned instances themselves (solved by making
UniformBumpAllocator::allocate call the constructor), and BumpAllocator
itself cannot handle classes that are not trivially deconstructible
(solved by deleting the method).

Co-authored-by: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-10-23 19:02:54 +01:00
Ben Wiederhake
5d865d574a AK: Fix BumpAllocator iteration if last object doesn't align
This fixes two bugs:

1. `end_offset` was missing the alignment that might have been
   introduced while computing `base_ptr`.
2. Ignoring point 1, `end_offset` computed the offset of the first byte
   that is outside the current chunk. However, this might be in the
   middle of a (hypothetical) object! The loop treats `end_offset` as if
   it points to the first byte beyond the last (valid) object. So if the
   last few bytes of the chunk are unused, the loop iterates once too
   often.

Found by OSS Fuzz, long-standing issue (since 2021-07-31)
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38733
(This probably also resolves some other issues that go through
RegexMatcher.)

See also: 0f1425c895
2021-10-23 19:02:54 +01:00
Ben Wiederhake
885b69c877 AK: Check consistency during BumpAllocator allocation 2021-10-23 19:02:54 +01:00
Liav A
8e55c4bfaf Kernel/PCI: Remove InterruptDisabler usage
Instead, just ensure we pick the m_access_lock and then m_scan_lock when
doing a scan/re-scan of the PCI configuration space so we know nobody
can actually access the PCI configuration space during the scan.

The m_scan_lock is now a Spinlock, to ensure we cannot yield to other
process while we do the PCI configuration space scanning.
2021-10-23 19:17:44 +02:00
Liav A
72e831e9e9 Kernel/PCI: Ensure m_domains is not empty if scanning with memory access 2021-10-23 19:17:44 +02:00
Liav A
40b1e6376b Kernel/PCI: Split Access::rescan_hardware method
To ensure clarity, this method is essentially splitted to two methods to
be called according to the access type being determined beforehand.
2021-10-23 19:17:44 +02:00
Liav A
d395ac8f59 Kernel/PCI: Rename Access::scan_pci_domains method
We rename it to scan_pci_domains_from_acpi_mcfg_table to ensure clarity,
because this method relies on the ACPI MCFG table to work.
2021-10-23 19:17:44 +02:00
Liav A
ca32ee5714 Kernel/PCI: Simplify detect_optimal_access_type function
Instead of getting the kernel commandline argument as function parameter
we just take internally in the function.
2021-10-23 19:17:44 +02:00
Sam Atkins
79522db5d0 HackStudio: Add syntax-highlighting for CSS files 2021-10-23 19:07:44 +02:00
Sam Atkins
d2690e551c TextEditor: Add syntax-highlighting for CSS files 2021-10-23 19:07:44 +02:00
Sam Atkins
6f71516409 LibWeb: Syntax-highlight CSS within HTML :^) 2021-10-23 19:07:44 +02:00
Sam Atkins
38f6140159 LibWeb: Implement first draft of CSS syntax highlighting :^)
This works at the Token level, which is quick and easy but has
drawbacks: We don't know when something is a property name or a value,
or if something is part of a selector. But, this works for now.
2021-10-23 19:07:44 +02:00
Sam Atkins
ecf5368535 LibWeb: Record position information in CSS Tokens
This is a requirement to be able to use the Tokens for syntax
highlighting.
2021-10-23 19:07:44 +02:00
Sam Atkins
9a2eecaca4 LibWeb: Add CSS Tokenizer::consume_as_much_whitespace_as_possible()
This is a step in the spec in 3 places, and we had it implemented
differently in each one. This unifies them and makes it clearer what
we're doing.
2021-10-23 19:07:44 +02:00
Sam Atkins
dfbdc20f87 LibWeb: Add spec links to CSS Tokenizer
Also renamed `starts_with_a_number()` -> `would_start_a_number()` to
better match spec terminology.
2021-10-23 19:07:44 +02:00
Sam Atkins
6edd7a4d73 LibWeb: Implement hashless hex color quirk
https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk

The CSS parser should now be completely quirky! :^)

The code is a bit awkward, especially the prepending-0s step, but at
least it won't be running too often.
2021-10-23 18:53:17 +02:00
Sam Atkins
d1f489b847 LibWeb: Explicitly cast parameters to Color::from_hsl/hsla()
CLion was giving me the angry red underlines about this.
2021-10-23 18:53:17 +02:00
Sam Atkins
21b65de1ec LibGfx+LibWeb: Move "transparent" keyword into Color::from_string()
It seemed odd to have this one color handled separately, when
`Color::from_string()` implements all other CSS colors.
2021-10-23 18:53:17 +02:00
Idan Horowitz
2ab089fa21 LibJS: Convert RegExpStringIteratorPrototype to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
063ce946b7 LibJS: Convert RegExpPrototype functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
9b3c91aa65 LibJS: Convert the RegExpExec AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
a89d9d2c6f LibJS: Convert the RegExpBuiltinExec AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
a2fbf6a3d5 LibJS: Convert the MakeIndicesArray AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
e3181a7ded LibJS: Convert RegExpConstructor functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
844be7a0a5 LibJS: Convert the RegExpCreate AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
d9f5e2d461 LibJS: Convert the RegExpInitialize AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
35faf50941 LibJS: Convert PromisePrototype functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
5af8f72d54 LibJS: Convert PromiseConstructor functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
81bdb20c61 LibJS: Convert the PromiseResolve AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
0d602c5ec5 LibJS: Convert the NewPromiseCapability AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
2b87f77578 LibJS: Convert DatePrototype functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
ba39a54bb8 LibJS: Convert DateConstructor functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
306c25f3c2 LibJS: Convert the NumberToBigInt AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
f7bafea661 LibJS: Convert TypedArrayConstructor functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
92b25cacd1 LibJS: Convert TypedArrayPrototype functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
94be1f772a LibJS: Convert typed_array_merge_sort to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
86aa8a14ea LibJS: Convert the TypedArraySpeciesCreate AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
18c2d537c7 LibJS: Convert StringPrototype functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
38c4693c70 LibJS: Convert the CreateHTML AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
0948bd8c1e LibJS: Convert the PadString AO to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
70a35f9600 LibJS: Convert resolve_best_locale to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Idan Horowitz
28e1e03234 LibJS: Convert StringConstructor functions to ThrowCompletionOr 2021-10-23 18:01:51 +02:00
Andreas Kling
f27d768745 LibGUI: Don't force flush pending paints whenever mouse moves
This patch removes a hack that forced any pending repaints to happen
immediately whenever you moved the mouse over a window.

The purpose of that mechanism was to ensure that quick button presses
still show up visually, and since that is now accomplished via
Widget::repaint(), we no longer need this.
2021-10-23 17:57:05 +02:00
Andreas Kling
d196fbce5b LibGUI: Repaint buttons immediately on mouse up/down events
This ensures that rapidly clicking a button doesn't look like it's
"swallowing" some of the mouse events.

This already worked okay due to a hack in Window, but this will allow us
to get rid of that hack.
2021-10-23 17:54:59 +02:00
Andreas Kling
24651f854c LibGUI: Add Widget::repaint() to force an immediate repaint
In most situations, Widget::update() is preferable, since that allows us
to coalesce repaints and avoid redundant work, reducing system load.

However, there are some cases where you really want a paint to happen
right away, to make sure that the user has a chance to see a short-lived
visual state.
2021-10-23 17:53:11 +02:00
Andreas Kling
da86f4e384 LibGUI: Use move semantics in GUI::MultiPaintEvent 2021-10-23 17:38:38 +02:00
Andreas Kling
877ddaa016 LibWeb: Fix off-by-one in initial containing block overflow calculation
We're using the outermost right and bottom child edges to determine the
width and height of the ICB. However, since these edges are *within* the
respective child's rectangle, we have to add 1 when turning them into
width and height values.

This fixes an issue where scrolling a document would shrink its viewport
rect by 1 pixel (on both axes) on every scroll step.
2021-10-23 16:10:44 +02:00
Andreas Kling
79f2e8ae2a LibGUI: Make exclusive button group act as a single focusable unit
Before this change, using the Tab key would cycle through all the
individual buttons in an exclusive group (e.g radio buttons.)
This felt wrong, since a group of exclusive buttons is really a single
logical input with a limited number of possible choices.

This patch makes such groups behave as a single focusable unit instead,
by dynamically updating the focus policies so that only the currently
checked button is focusable.

We also allow keyboard navigation within the button group via the arrow
keys. This had to be specialized in GUI::AbstractButton, since the
default behavior of arrow keys is to traverse the focus chain.
2021-10-23 16:10:44 +02:00
Andreas Kling
0d8373287c LibGUI: Add GUI::KeyEvent::is_arrow_key() 2021-10-23 16:10:44 +02:00
Andreas Kling
d91732f959 LibGUI: Mark GUI::RadioButton as "checkable"
Any AbstractButton that uses the "checked" state should mark itself
"checkable", this was a weird oversight.
2021-10-23 16:10:44 +02:00