Commit graph

42046 commits

Author SHA1 Message Date
Timothy Slater
eb9db167da HackStudio: Set proper action scope for editor shortcuts
This fixes issue #14429. The editor actions were not given a parent as
scope so defaulted to global. Because HackStudio can have multiple
editors and even multiple editor tab widgets, I chose the
VerticalSplitter that all editor tab widgets get added to as the parent.
With a Widget set as the parent, the action gets WidgetLocal scope and
allows the embedded terminals to receive shortcuts.

Thanks to Andreas for doing a quick look at this and pointing in the
right direction during an Office Hours stream :)
2022-10-11 11:12:41 +02:00
Tim Schumacher
a61a0a63c1 Toolchain: Force makeinfo to be a no-op
Neither are we changing any of our documentation files, nor do we need
any of the documentation that is likely being built.

With macOS potentially removing makeinfo from the default Xcode lineup,
SerenityOS not being able to install it at all currently due to a lack
of perl, and it otherwise just being a dependency that has to be
installed to make the build system happy, lets just stub it out.
2022-10-11 09:28:46 +02:00
Andreas Kling
0f2d5f91dc LibWeb: Fix two uninitialized variables in FormattingContext 2022-10-10 23:42:35 +02:00
Andreas Kling
a2348ebcc0 LibWeb: Make Window.getSelection() forward to Document.getSelection()
(And have document create the Selection object on demand.)
2022-10-10 21:23:03 +02:00
Andreas Kling
b945d164e2 LibWeb: Split intrinsic heights cache based on available width
Now that intrinsic heights (correctly) depend on the amount of available
width, we can't just cache the first calculated min-content and
max-content heights and reuse it without thinking.

Instead, we have to cache three pairs:

- min-content & max-content height with definite available width
- min-content & max-content height with min-content available width
- min-content & max-content height with max-content available width

There might be some more elegant way of solving this, but basically this
makes the cache work correctly when someone's containing block is being
sized under a width constraint.
2022-10-10 20:22:50 +02:00
Andreas Kling
4b74f36cd0 LibWeb: Resolve vertical margins against containing block width
We were incorrectly resolving them against the available width, which
may or may not be the same as the containing block width.

The specification for these properties says that percentages resolve
against the containing block width, so that's what we should do.
2022-10-10 20:22:50 +02:00
Andreas Kling
47e3daa40f LibWeb: Use *outside* available space for fit-content sizing in FFC
When calculating the fit-content width or height for a flex item, we
need to use the available space *outside* the item, not the available
space *inside*.
2022-10-10 20:22:50 +02:00
Andreas Kling
4a17e8713b LibWeb: Update FFC for spec change to intrinsic min-content cross size
We now know exactly how to calculate the min-content cross size for
multi-line flex containers, which is great. The other three intrinsic
constraints still fall back to the old ad-hoc code path.

5630e7b064
2022-10-10 20:22:50 +02:00
Andreas Kling
9869405802 LibWeb: Put HTML parser encoding sniffing debug logging behind a flag 2022-10-10 20:22:50 +02:00
Andreas Kling
3a675a024a LibWeb: Make DOMStringMap a LegacyPlatformObject
Since it has a custom named getter, it should have been this all along.
2022-10-10 20:22:50 +02:00
Andreas Kling
2c37df6241 LibWeb: Don't include DOMStringMap.h quite so much
This file was being included everywhere via HTMLElement and SVGElement,
but we don't actually need to do that.
2022-10-10 20:22:50 +02:00
Luke Wilde
081a617d8d LibWeb: Use the default CSS attributes for embedded content from HTML
The main benefit of this is respecting the iframe frameborder
attribute, as frameborder="0" is a pretty common way of removing
the default <iframe> border.

For example, it's on all YouTube embeds by default and on some
ReCAPTCHA embeds.
2022-10-10 19:33:34 +02:00
Luke Wilde
6a7c560849 LibWeb: Respect width and height attributes of <iframe>
We have to respect the width and height attributes of <iframe> elements
the same way as <img> elements.
2022-10-10 19:33:34 +02:00
Sam Atkins
8589f1115e Solitaire: Ignore all key presses while dragging cards
This prevents you from tab-moving cards while dragging some.
2022-10-10 16:16:01 +01:00
Sam Atkins
ff175389ab Solitaire: Make auto_move_eligible_cards_to_foundations() iterative
This doesn't need to be recursive, so let's make it not so.
2022-10-10 16:16:01 +01:00
Sam Atkins
5186e617bd LibCards+Games: Remove concept of a CardStack being focused
This was only used for asking the stack if it is the one we are moving
cards from. We now have a better way to do that, by comparing against
`CardGame::moving_cards_source_stack()`, which doesn't require manually
telling a stack that it is/isn't focused.
2022-10-10 16:16:01 +01:00
Sam Atkins
ef8b1e25aa LibCards: If dropping cards over multiple valid stacks, pick the closest
Previously, dropping a card that overlapped multiple stacks that could
accept it, would always choose the stack that came first in the stacks
list, usually the leftmost one. This would feel very odd if the card
was only slightly overlapping the left stack, and 90% over the right
one. So now, we keep looking for closer stacks even once we've found a
valid one.

There may be an option that feels even better, based on the position of
the card being dragged and the card on top of the stack we're dropping
onto, but this already fixes the issue and feels very nice. :^)
2022-10-10 16:16:01 +01:00
Sam Atkins
a4c1ee905f Spider: Use CardGame dragging functionality 2022-10-10 16:16:01 +01:00
Sam Atkins
7d37aebc07 Solitaire: Use CardGame dragging functionality 2022-10-10 16:16:01 +01:00
Sam Atkins
a2f0b67aea LibCards: Add support for card dragging
Solitaire and Spider have almost identical code for dragging cards from
one stack to another, so it makes sense to move that here. But using
the term "moving" for them, instead of "focused" which (to me at least)
was not clear what it meant.
2022-10-10 16:16:01 +01:00
Sam Atkins
5960c0556f LibCards+Games: Move mark_intersecting_stacks_dirty() to CardGame
As part of this, made a const overload for `Card::rect()`. We need the
non-const one too as it's used for modifying the position of a card
that's being dragged. I plan on changing that soon but we'll see.
2022-10-10 16:16:01 +01:00
Sam Atkins
12612703f9 LibCards+Spider: Move ensure_top_card_is_visible() logic to CardStack 2022-10-10 16:16:01 +01:00
Sam Atkins
b26383bc6c LibCards: Fix some minor clang-tidy issues 2022-10-10 16:16:01 +01:00
Sam Atkins
21a818ab50 LibCards: Combine CardStack constructors
And while I'm at it, clarify the name of `associated_stack` to
`covered_stack`. It's used in exactly one way, so we can make the code
clearer by giving it a less generic name.
2022-10-10 16:16:01 +01:00
Sam Atkins
bfa9ae809f LibCards+Games: Rename "draw" methods to "paint" for clarity
"Draw" is already a card-game term so using it for graphics was
 confusing me a lot!
2022-10-10 16:16:01 +01:00
Sam Atkins
6ef0504a42 LibCards+Games: Make CardGame responsible for managing CardStacks
Just moving some code around really.
2022-10-10 16:16:01 +01:00
Sam Atkins
46299f3853 LibCards+Games: Move "create a deck" logic to LibCards
`create_standard_deck()` is the usual 52-card deck, but more custom
setups (such as Spider's multiples-of-one-suit) can be created by
passing suit counts to `create_deck()`.
2022-10-10 16:16:01 +01:00
Andrew Kaster
1d533acbc0 AK+Userland: Replace Linux, macOS, and *BSD macros with platform defines
We have such nice platform macros, let's clean up any remnants of manual
__my_platform__ macros in LibCore, LibCompress and AK.
2022-10-10 12:23:12 +02:00
Andrew Kaster
539fb08551 Userland: Remove unecessary uses of __serenity__ macro 2022-10-10 12:23:12 +02:00
Andrew Kaster
828441852f Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY
Now that we have OS macros for essentially every supported OS, let's try
to use them everywhere.
2022-10-10 12:23:12 +02:00
Andrew Kaster
896d4e8dc1 LibRegex: Don't build LibRegex/C/Regex.cpp on Lagom
This file implements the POSIX APIs from <regex.h>, and is not suitable
for inclusion in a Lagom build. If we do include it, it will override
the host's regex functions and wreak havoc if it's resolved before the
host's implementation.
2022-10-10 12:23:12 +02:00
Andrew Kaster
a81475d9fb LibCore: Don't assume that the first address from getaddrinfo is IPv4
By passing AF_UNSPEC to getaddrinfo, we're telling the system's
implementation that we are ok getting either (or both) IPv4 and IPv6
addresses in our result. On my Ubuntu 22.04 system, the first addrinfo
returned for "www.google.com" holds an IPv6 address, which when
interpreted as an IPv4 sockaddr_in gives an address of 0.0.0.0.

This fixes TestTLSHandshake in Lagom locally.
2022-10-10 12:23:12 +02:00
Andrew Kaster
51ebf20200 Tests: Remove LibRegex benchmark test file that has become stale
This test file had #ifdef macros at the top that caused none of the
content to be compiled unless a developer manually wanted to run the
specific benchmarks within. As such, it has become stale. Remove it for
now, if someone wants to restore it in an always-runnable state, we can
restore the specific tests it's trying to benchmark.
2022-10-10 12:23:12 +02:00
Zaggy1024
0c07bed89c LibVideo: Initialize VP9 BitStream's reservoir field
Leaving it uninitialized could lead to undefined behavior.
2022-10-10 11:04:39 +01:00
MacDue
fef19aa589 PixelPaint: Add Hue/Saturation filter
This filter mimics the functionality from Photoshop and other image
editors, allowing you to adjust the hue, saturation, and lightness of
an image. I always found this a very handy feature :^)
2022-10-10 11:02:10 +01:00
MacDue
71fb1ed226 PixelPaint: Add InplaceFilter and convert FastBoxBlur to be one
This is a simple base class for filters that need to work on the image
in-place.
2022-10-10 11:02:10 +01:00
MacDue
467565e3d4 LibGfx: Add TintFilter
This is a very simpler filter that tints an image with a color.
2022-10-10 11:02:10 +01:00
MacDue
35b714163d LibWeb: Fix wrapping glitches on repeating-linear-gradient()s
This fixes some off-by-one wrapping issues that became visible when
running on x86_64. The problem still existed on i686, but by chance
did not show up due to a -/+ 0.000001 difference between the two.
2022-10-10 10:47:50 +02:00
Zaggy1024
bbc053fa56 LibVideo: Add LibVideo test to Lagom 2022-10-09 20:32:40 -06:00
Zaggy1024
d67231312e LibVideo: Add test to ensure that a VP9 WebM file will decode
This will test decoding of one second of video, to ensure that it can
fully decode the entire file.
2022-10-09 20:32:40 -06:00
Zaggy1024
b71d13be82 VideoPlayer: Allow display of multiple frames by clicking the image
For testing purposes, this allows opening of any filename by passing it
as an argument.

Additionally, there is a --benchmark option that will just call decode
for 100 frames and then exit, printing the time spent in the decoder.
2022-10-09 20:32:40 -06:00
Zaggy1024
63ba01cad2 LibVideo: Remove unnecessary dbgln calls
Debug prints are expensive, so doing them every frame seems excessive
now that the decoder is completely functional on some test videos.
2022-10-09 20:32:40 -06:00
Zaggy1024
7dcd5ed206 LibVideo: Make probability tables save to the specified index
Previously, saved probability tables were being inserted, causing the
Vector to increase in size when it should say fixed at a size of 4. This
changes the Vector to an Array<T, 4> which will default-initalize and
allow assigning to any index without previously setting size.
2022-10-09 20:32:40 -06:00
Zaggy1024
7d27273dc7 LibVideo: Ensure that syntax element counts don't overflow
Integer overflow could sometimes occur due to counts going above 255,
where the values should instead be clamped at their maximum to avoid
wrapping to 0.
2022-10-09 20:32:40 -06:00
Zaggy1024
7c87a8e302 LibVideo: Prevent decode_block from saving motion vectors out of bounds
This fixes an issue causing frame 3 of the test video to fail to parse
because a reference vector was incorrectly within the range for a high
precision delta vector read.
2022-10-09 20:32:40 -06:00
Zaggy1024
be0760871e LibVideo: Add support for VP9 superframes
This allows the second shown frame of the VP9 test video to be decoded,
as the second chunk uses a superframe to encode a reference frame and
a second to inter predict between the keyframe and the reference frame.
2022-10-09 20:32:40 -06:00
Zaggy1024
b0187dfc27 LibVideo: Implement inter prediction
This enables the second frame of the test video to be decoded.

It appears that the test video uses a superframe (group of multiple
frames) for the first chunk of the file, but we haven't implemented
superframe parsing.

We also ignore the show_frame flag, so for now, this
means that the second frame read out is shown when it should not be. To
fix this, another error type needs to be implemented that is "thrown" to
decoder's client so they know to send another sample buffer.
2022-10-09 20:32:40 -06:00
Zaggy1024
50d4217dbc LibVideo: Look up interpolation filter probability correctly
The above interpolation filter mode was being taken from the left side
instead, causing some parsing errors.

This also changes the magic number 3 to SWITCHABLE_FILTERS.
Unfortunately, the spec uses the magic number, so this value was taken
instead from the reference codec, libvpx.
2022-10-09 20:32:40 -06:00
Zaggy1024
17107303f0 LibVideo: Fix incorrect VP9 InterMode enum values
These values were referencing the wrong column of a table in the spec,
the values should start from 10.
2022-10-09 20:32:40 -06:00
Zaggy1024
03738aa006 LibVideo: Implement block parsing for inter frames
This gets the decoder closer to fully parsing the second frame without
any errors. It will still be unable to output an inter-predicted frame.
The lack of output causes VideoPlayer to crash if it attempts to read
the buffers for frame 1, so it is still limited to the first frame.
2022-10-09 20:32:40 -06:00