Commit graph

35873 commits

Author SHA1 Message Date
Sam Atkins 7e98c8eaf6 AK+Tests: Fix StringUtils::contains() being confused by repeating text
Previously, case-insensitively searching the haystack "Go Go Back" for
the needle "Go Back" would return false:

1. Match the first three characters. "Go ".
2. Notice that 'G' and 'B' don't match.
3. Skip ahead 3 characters, plus 1 for the outer for-loop.
4. Now, the haystack is effectively "o Back", so the match fails.

Reducing the skip by 1 fixes this issue. I'm not 100% convinced this
fixes all cases, but I haven't been able to find any cases where it
doesn't work now. :^)
2022-03-18 23:51:56 +00:00
djwisdom 00eca26085 Base+Fonts: Glyphs 00A0-017F temporarily removed
Will put them back again after adjusting the style of the glyphs.
2022-03-19 00:51:41 +01:00
djwisdom e00f459e36 Base+Fonts: Remove Satori Code fonts 2022-03-19 00:51:41 +01:00
djwisdom ed850026d8 Base: Updated Satori font 2022-03-19 00:51:41 +01:00
djwisdom 33e68c0cad Base: Added Satori Code font 2022-03-19 00:51:41 +01:00
djwisdom e0b1eeef02 Base+Fonts: Ataraxia Light terminal font
Inspired by Cathode terminal font
2022-03-19 00:51:41 +01:00
Karol Kosek 677e4845a7 PixelPaint: Add Cut action
It's just the Copy action with erasing selection at the end.
2022-03-19 00:50:59 +01:00
Karol Kosek 580c6080b5 PixelPaint: Put undo/redo actions on top of the Edit menu
To be consistent with the order with other apps on the system. :^)
2022-03-19 00:50:59 +01:00
Lenny Maiorani a51fce6c0f LibCards+Games: Change name of card type to card suit
Playing cards have a `suit` such as `hearts`/`diamonds`, not a
`type`. Make the internal naming consistent with the way playing cards
are typically named.
2022-03-18 23:49:34 +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
Lenny Maiorani 759857b597 LibSoftGPU: Avoid copying data when doing triangle rasterization
Several large-ish objects shouldn't be copied to the stack when a
reference will do.
2022-03-18 23:41:06 +00:00
Tom 9f59d7d9a0 WindowServer: Fix animation crash
If an Animation's on_stop handler cleared itself inside the on_stop
event handler, it would remove itself from the animation map that was
still being iterated, leading to a crash.

To solve this, we'll iterate over the animations using the
remove_all_matching function, which enables us to delete it by simply
returning true when the animation finished. In the event that the
Animation is kept alive elsewhere and the on_stop event clears its own
reference, we need to temporarily bump the reference count. Another
advantage is that we only need to bump the reference count when an
animation is finished, whereas before this we bumped it
unconditionally.
2022-03-18 20:00:30 +01:00
Lenny Maiorani 56046d3f9b Libraries: Change enums to enum classes in LibCards 2022-03-18 19:59:43 +01:00
Lenny Maiorani d3893a73fb Libraries: Change enums to enum classes in LibAudio 2022-03-18 19:59:43 +01:00
Lenny Maiorani be360db223 Libraries: Change enums to enum classes in LibArchive 2022-03-18 19:59:43 +01:00
Daniel Lemos 3eb6016dda LibWeb: Add some default style for <textarea> elements and a test 2022-03-18 19:59:19 +01:00
Lenny Maiorani f912a48315 Userland: Change static const variables to static constexpr
`static const` variables can be computed and initialized at run-time
during initialization or the first time a function is called. Change
them to `static constexpr` to ensure they are computed at
compile-time.

This allows some removal of `strlen` because the length of the
`StringView` can be used which is pre-computed at compile-time.
2022-03-18 19:58:57 +01:00
Timothy Flynn 31515a9147 AK: Mark the StringView user-defined literal as consteval
Even though the StringView(char*, size_t) constructor only runs its
overflow check when evaluated in a runtime context, the code generated
here could prevent the compiler from optimizing invocations from the
StringView user-defined literal (verified on Compiler Explorer).

This changes the user-defined literal declaration to be consteval to
ensure it is evaluated at compile time.
2022-03-18 19:56:50 +01:00
Andreas Kling 3b037726e9 LibWeb: Invalidate layout after setting Element.innerHTML
It's not enough to only relayout here, since the API can substantially
change the DOM. We have to rebuild the layout tree.
2022-03-18 19:54:46 +01:00
Lady Gegga 50d1490a33 Base: Add new bitmap font tengchaH 2022-03-18 19:33:27 +01:00
Andreas Kling a19b9b727d LibWeb: Place right-side floats relative to their containing block
We were incorrectly placing them relative to the BFC root, but CSS2
says they are relative to their own containing block.
2022-03-18 19:28:58 +01:00
Simon Wanner 48efdaa8c4 LibWeb: Update hit_test for CSS Transforms
This now also takes a FloatPoint instead of an IntPoint to avoid
excessive rounding when multiple transforms apply on top of each other.
2022-03-18 18:51:42 +01:00
Simon Wanner a2331e8dd3 LibWeb: Implement CSS transforms on stacking contexts
Since there is currently no easy way to handle rotations and skews
with LibGfx this only implements translation and scaling by first
constructing a general 4x4 transformation matrix like outlined in
the css-transforms-1 specification. This is then downgraded to a
Gfx::AffineTransform in order to transform the destination rectangle
used with draw_scaled_bitmap()

While rotation would be nice this already looks pretty good :^)
2022-03-18 18:51:42 +01:00
Simon Wanner 7c79fc209f LibWeb: Establish a new stacking context for elements with transform 2022-03-18 18:51:42 +01:00
Simon Wanner 9c97bd0de4 LibGfx: Add AffineTransform::inverse 2022-03-18 18:51:42 +01:00
Simon Wanner a3c80f05ba LibWeb: Apply the 'transform' presentational attribute to SVG elements 2022-03-18 18:51:42 +01:00
Simon Wanner c4f46893f6 LibWeb: Add parsing support for the remaining transform functions 2022-03-18 18:51:42 +01:00
Sam Atkins ad4f35ff37 LibWeb: Mark more CSS properties as not affecting layout
- background properties
- box-shadow
- cursor
- SVG fill/stroke properties
- image-rendering
- outline properties
- pointer-events
- user-select

This should be basically all of them. I skipped `opacity` and
`transform` since establishing a stacking context feels like a
layout-affecting thing, but I could be very wrong on that!
2022-03-18 18:49:08 +01:00
Andreas Kling 39b7fbfeb9 LibWeb: Rewrite CSS float implementation to use offset-from-edge
The previous implementation used relative X offsets for both left and
right-side floats. This made right-side floats super awkward, since we
could only determine their X position once the width of the BFC root was
known, and for BFC roots with automatic width, this was not even working
at all most of the time.

This patch changes the way we deal with floats so that BFC keeps track
of the offset-from-edge for each float. The offset is the distance from
the BFC root edge (left or right, depending on float direction) to the
"innermost" margin edge of the floating box.

Floating box are now laid out in two passes: while going through the
normal flow layout, we put floats in their *static* position (i.e the
position they would have occupied if they weren't floating) and then
update the Y position value to the final one.

The second pass occurs later on, when the BFC root has had its width
assigned by the parent context. Once we know the root width, we can
set the X position value of floating boxes. (Because the X position of
right-side floats is relative to the right edge of the BFC root.)
2022-03-18 15:18:48 +01:00
Andreas Kling 28642de6ed LibWeb: Make LineBuilder aware of the current LayoutMode
This will allow us to override the available space correctly when doing
intrinsic sizing.
2022-03-18 15:18:48 +01:00
Andreas Kling 915ee66bd6 LibWeb: Implement shrink-to-fit layout on top of intrinsic size cache
Using the intrinsic size cache means we only perform the nested layout
to determine intrinsic size *once* per root layout pass.

Furthermore, by using a throwaway FormattingState, details of the nested
layout can't leak into and mutate the outer layout.
2022-03-18 15:18:48 +01:00
Andreas Kling 39ca39204b LibWeb: Cache intrinsic sizes on the root FormattingState
Instead of caching them with the current state, we can cache them at the
root of the state tree. Since intrinsic sizes are immutable during the
same layout, this allows layout to take advantage of intrinsic sizes
discovered during nested layout (and avoids a *lot* of duplicate work.)
2022-03-18 15:18:48 +01:00
Andreas Kling d3932b5880 LibWeb: Give FormattingState a reference to its root state
FormattingStates can have parents, in case we're performing nested
layouts to determine something's intrinsic size. In those cases, it will
soon be useful to find the outermost (root) state.
2022-03-18 15:18:48 +01:00
Andreas Kling 60c781ebc7 LibWeb: Simplify Layout::Node::containing_block()
Use first_ancestor_of_type<BlockContainer>() instead of implementing a
custom traversal lambda.
2022-03-18 15:18:48 +01:00
Andreas Kling 6625edb5d2 Kernel: When receiving unexpected TCP flags, print the flags
It'll be easier to understand what might be happening if we know which
unexpected flags are actually showing up. :^)
2022-03-18 15:18:48 +01:00
Andreas Kling f0dde1cee1 Kernel: Rename TCPFlags::PUSH => PSH
Let's use the proper name of this TCP flag.
2022-03-18 15:18:48 +01:00
Andreas Kling 15dc48b431 LibWeb: Make PaintableBox::enclosing_stacking_context() cheaper
No need to call the expensive establishes_stacking_context() here, as
we've already built the stacking context tree and can simply test for
the presence of existing stacking contexts.
2022-03-18 15:18:48 +01:00
Andreas Kling ef8a72ff3f LibWeb: Move available_space_for_line() from IFC to BFC
This is preparation for allowing blocks with their own internal BFC to
flow around floating boxes in the parent BFC.

Note that IFC still has the available_space_for_line() API, which
returns space available within the IFC's own containing block, while the
BFC available_space_for_line() returns space available within its root.
2022-03-18 15:18:48 +01:00
Andreas Kling fc6b7fcd97 AK: Add const variant of Vector::in_reverse() 2022-03-18 15:18:48 +01:00
Brian Gianforcaro f47c92bd2e Kernel: Mark serenity_dev_ functions as static
This avoids multiple definition errors when linking software which
may utilize these functions from different compilation units.
2022-03-18 11:59:35 +00:00
Brian Gianforcaro 83abc83d3c Ports/stress-ng: Update stress-ng to 0.13.12
This required updating a bunch of patches which had conflicts
in the latest version.

New Patches:
- serenity: Add bogus O_NDELAY just to allow the port to compile
- serenity: Disable nice() stress workload as we do not implement it
- serenity: Disable prctl stressor on serenity
2022-03-18 11:59:35 +00:00
Joe Petrus 011b6df63a Games: Add MasterWord
A simple wordle clone.
2022-03-18 04:55:21 -07:00
Liav A d56544aca0 Kernel/Graphics: Don't declare VGA changing-state methods as const 2022-03-18 03:46:23 -07:00
Sam Atkins 174a25db5b LibWeb: Combine identical relative/regular selector parsing functions 2022-03-18 11:34:02 +01:00
Sam Atkins 5b0187477b LibWeb: Implement :nth-[last-]child(n of foo) syntax
In Selectors level 4, `:nth-child()` and `:nth-last-child()` can both
optionally take a selector-list argument. This selector-list acts as a
filter, so that only elements matching the list are counted. For
example, this means that the following are equivalent:

```css
:nth-child(2n+1 of p) {}
p:nth-of-type(2n+1) {}
```
2022-03-18 11:34:02 +01:00
Sam Atkins 0e4c35b4b2 Base: Add of foo tests to nth-child and nth-last-child test pages
Also split the selector-list up for easier debugging.
2022-03-18 11:34:02 +01:00
Sam Atkins f241827f6a LibWeb: Calculate specificity for special pseudo-classes
This fixes the specificity for :not(), :is() and :where(). Also, we now
clamp the specificity numbers instead of letting them overflow, and I
sprinkled in some spec comments for good measure.
2022-03-18 11:34:02 +01:00
Sam Atkins 993653317c LibWeb: Implement the :where() selector
This is identical to :is() except for specificity, so we can use the
same code paths. :^)
2022-03-18 11:34:02 +01:00
Sam Atkins 47eb4b2db7 Base: Add a test page for the CSS :where() selector
This behaves identically to :is() except for specificity, so this test
page is identical to the other one. It's not because I'm lazy. :^)
2022-03-18 11:34:02 +01:00
Sam Atkins c148ed50bb LibWeb: Implement the :is() selector
This lets us finally get rid of a FIXME in the default style sheet. :^)
2022-03-18 11:34:02 +01:00