Commit graph

54590 commits

Author SHA1 Message Date
Jelle Raaijmakers
9240233378 Revert "AK: Refill a BufferedStream when it has less than the
...requested size"

This reverts commit 13573a6c4b.

Some clients of `BufferedStream` expect a non-blocking read by
`read_some` which the commit above made impossible by potentially
performing a blocking read. For example, the following command hangs:

    pro http://ipecho.net/plain

This is caused by the HTTP job expecting to read the body of the
response which is included in the active buffer, but since the buffered
data size is less than the buffer passed into `read_some`, another
blocking read is performed before anything is returned.

By reverting this commit, all tests still pass and `pro` no longer
hangs. Note that because of another bug related to `stdout` / `stderr`
mixing and the absence of a line ending, there is no output to the
command above except a progress update.
2023-09-11 21:38:24 -04:00
Sam Atkins
489f9c3151 LibWeb: Implement text-transform: math-auto
This is a simple mapping of some code-points to others.

I was going to use a ref test for this, but without knowing that the
font contains the code-points (which SerenitySans does not) we'd be
comparing a series of replacement characters to a series of replacement
characters, which doesn't tell you if they're the right code-points
underneath.
2023-09-11 17:03:22 +01:00
Sam Atkins
ce775ea701 LibWeb: Use a switch to handle TextTransform values
This makes it more obvious that we're missing some of these. (And makes
it easier to find this code when searching for a specific value.)
2023-09-11 17:03:22 +01:00
Sam Atkins
f7209fb9d4 LibWeb: Implement font-size: math
This is a MathML extension, basically a big hack to make parts of
equations smaller, such as sub/superscripts. The important thing is, it
works. :^)
2023-09-11 17:03:22 +01:00
Sam Atkins
6476dea898 LibWeb: Implement the math-depth CSS property
This one is a bit fun because it can be `add(<integer>)` or `auto-add`,
but children have to inherit the computed value not the specified one.
We also have to compute it before computing the font-size, because of
`font-size: math` which will be implemented later.
2023-09-11 17:03:22 +01:00
Sam Atkins
53f3ed026a LibWeb: Mark CalculatedStyleValue::resolve_integer() as const 2023-09-11 17:03:22 +01:00
Sam Atkins
6045143d39 LibWeb: Parse the math-shift and math-style CSS properties
Currently these have no effect, but they're simple, and `math-style`
influences `math-depth` which is coming next.
2023-09-11 17:03:22 +01:00
Sam Atkins
2ef5658f31 LibWeb: Add ComponentValue::is_function(name) and is_ident(name) helpers 2023-09-11 17:03:22 +01:00
Sam Atkins
f3124c492b LibWeb: Add display: math
This is a `<display-inside>` keyword added by the MathML spec, and has
the rough meaning of "display in the default way". It enables the
standard layout rules for each MathML element (and is ignored for
anything that isn't a MathML element).

I believe we'll need an actual MathML formatting context to do the
layout correctly, but we can at least support a couple of elements that
behave the same as HTML ones.
2023-09-11 17:03:22 +01:00
Sam Atkins
125d161b3f LibWeb: Move <display-foo> definitions into Enums.json
This eliminates a fair bit of boilerplate.
2023-09-11 17:03:22 +01:00
Sam Atkins
3b0980c89f LibWeb: Stop allowing invalid tokens in display values
Previously we were overly generous in what we accepted for `display`.
For example, we accepted:
- Multiple outside or inside identifiers
- Unrecognized identifiers
- Non-identifier tokens

Now, we reject all these cases. This makes us stop accepting the
`display: block math;` declaration in `MathML/Default.css`, and so the
one layout test we have containing MathML elements has changed to
reflect that.
2023-09-11 17:03:22 +01:00
Adam Harald Jørgensen
7bf842a974 Ladybird: Allow opening multiple URLs at once from the command line
Each URL is opened in a separate tab on startup, and the active tab is
the first URL supplied.
2023-09-11 17:01:17 +01:00
Aliaksandr Kalenik
40dea272d2 LibWeb: Add boxes for before/after pseudos post button layout tweak
When a button should use flex for alignment and also has ::before
and/or ::after, we previously did the following:
1. Prepended/appended the button's children with boxes for
   pseudo-elements.
2. Replaced the button's direct children with a flex container that
   contains its children.
As a result, the generated boxes for ::before/::after ended up as
children of the generated flex item, instead of being direct children
of the button layout box as they were supposed to be.

This change reverses these steps, ensuring that boxes for
pseudo-elements are generated only after modifications inside the
button layout are completed.
2023-09-11 15:19:56 +02:00
Aliaksandr Kalenik
0160d921e9 LibWeb: Set children of button layout box to be non-inline
When modifying the button layout during tree building to use flex for
vertical alignment, let's explicitly set the button box's children to
be non-inline. It doesn't make sense to layout the button as an IFC
when its only child is a flex container.
2023-09-11 15:19:56 +02:00
dependabot[bot]
38d9c4d19c CI: Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 09:11:27 -04:00
Shannon Booth
b738929195 LibDiff: Fix wrong index used when prepending context lines
`i` is used as the index for 'old lines' in diff generation, not 'new
lines'. Using the wrong index would mean that for certain diffs the
prefixed context information would have wrong content, and could even
result in a crash.

Fix this, and add a test for an input which was previously crashing.
2023-09-11 12:10:50 +01:00
Shannon Booth
4adbf1d041 LibWeb: Port DocumentFragment from DeprecatedString to String 2023-09-11 12:07:36 +01:00
Shannon Booth
bfc0773285 LibWeb: Add String versions for some functions in ParentNode
These functions are required in the porting of the DocumentFragment
interface from DeprecatedString to String. Unfortunately since
ParentNode is used by Document, we can't fully remove the deprecated
versions of these functions yet.
2023-09-11 12:07:36 +01:00
Shannon Booth
3e0849eb4f LibWeb: Add FlyString variants of get_element_by_id
Unfortunately we can't port these functions entirely over to FlyString
from DeprecatedString as Document includes NonElementParentNode and has
not yet been ported over to new AK string. In the mean time, this should
help up in porting over NonElementParentNode itself.
2023-09-11 12:07:36 +01:00
Shannon Booth
b2f3aa1c76 LibWeb: Use length() getter in CharacterData algorithms
Closer matching spec text, as well as pre-existing use in
CharacterData::substring_data. This helps in porting of this file over
to new String which has no length member function.
2023-09-11 12:07:36 +01:00
Timothy Flynn
e8f14f8cd0 Ladybird: Add an audio context menu to the AppKit chrome 2023-09-11 06:52:37 -04:00
Sam Atkins
2cb816ad69 LibWeb: Alphabetize property names in Properties.json
And add a check to make sure it stays that way!
2023-09-11 10:42:00 +01:00
Sam Atkins
9f4e057085 LibWeb: Fall back to computed values in ResolvedCSSStyleDeclaration
We only need special-case code to handle two kinds of properties:
- Those with special rules, many of which are listed here:
  https://www.w3.org/TR/cssom-1/#resolved-values
- Shorthands, because we only store longhand values.

In other cases, we can fall back to the computed values that we already
have, and these will be correct. So, we can remove them from here. :^)
2023-09-11 10:42:00 +01:00
Sam Atkins
088cddaca1 LibWeb: Serialize Display values as a "short display" where possible 2023-09-11 10:42:00 +01:00
Sam Atkins
b78b5e6297 LibWeb: Generate property_is_shorthand(PropertyID) function
Sometimes we want to know if a property is a shorthand, but don't care
what its longhands are.
2023-09-11 10:42:00 +01:00
Jelle Raaijmakers
ec416563a8 Maps: Zoom on doubleclick 2023-09-10 22:45:42 +02:00
Jelle Raaijmakers
0f330a4dcf Maps: Scale cached tiles from lower and higher zoom levels
When zooming in or out, if a tile is not yet cached, Maps now also
checks the lower and higher zoom levels for cached tiles and composites
a preview tile that is shown until the actual tile is loaded in.
2023-09-10 22:45:42 +02:00
Jelle Raaijmakers
cf898f08ab Maps: Limit parallel downloading of tiles
Previously we would bombard RequestServer with as many requests as it
would take, but when frantically zooming in and out, we would run out of
fd's causing the Maps application to hang.

This implements a tile download queue and limits the amount of parallel
downloads to 8. This fixes the hangs accompanied by this debug console
message:

    Peer endpoint error: recvfd: Too many open files (errno=24)

It does not fix other sporadic hangs caused by requests that are never
finished, however.
2023-09-10 22:45:42 +02:00
Bastiaan van der Plaat
494a8cb816 AK: Add to_radians and to_degrees math functions 2023-09-10 08:38:29 +01:00
Dan Klishch
9b7aa8f6b6 Meta: Do not spam "<compiler-name>: command not found"
In bd7d01e9, Meta/serenity.sh started checking cc and cxx if CC or CXX
respectively are not set in the environment. My machine does not have
cxx symlink in PATH, so every invocation of the script resulted in
the "cxx: command not found" message outputted to stderr, and that
became quite annoying.
2023-09-09 13:38:06 -06:00
Liav A
b49f2937f0 Kernel/TTY: Don't return NonnullLockRefPtr when creating MasterPTY
We can just return a normal NonnullRefPtr because nobody needs an actual
*LockRefPtrs here anymore.
2023-09-09 12:08:59 -06:00
Liav A
82428e2a05 Kernel/TTY: Protect SlavePTY pointer with proper spinlock
Instead of using a LockRefPtr, we could easily use SpinlockProtected to
ensure proper locking of this pointer.
2023-09-09 12:08:59 -06:00
Liav A
b55199c227 Kernel: Move TTY-related code to a new subdirectory under Devices
The TTY subsystem is represented with unix devices, so it should be
under the Devices directory like the Audio, Storage, GPU and HID
subsystems.
2023-09-09 12:08:59 -06:00
Tim Schumacher
c99c065a40 Ports/acpica-tools: Ignore unknown warning options
-Wlogical-op, -Wmissing-parameter-type, and -Wold-style-declaration
are unknown to Clang. While this isn't fatal by itself, it is very
noisy.
2023-09-09 11:28:59 -06:00
Tim Schumacher
1875d373e5 Ports/acpica-tools: Don't treat warnings as errors
This also removes existing patches that were trying to fix warnings
one-by-one.

Note that the patch making `CurrentSp` static was incorrect, the
variable needs to be on the stack for us to retrieve the current stack
address.
2023-09-09 11:28:59 -06:00
Jakub Berkop
54e79aa1d9 Kernel+ProfileViewer: Display additional filesystem events 2023-09-09 11:26:51 -06:00
Jakub Berkop
c184a0786f Kernel: Protect access to PerformanceEventBuffer strings with spinlock 2023-09-09 11:26:51 -06:00
kleines Filmröllchen
a0bcc9dd83 LibAudio: Skip empty MP3 scale factor bands in stereo intensity process
These were intentionally set up to be at the end of the granule size,
but since the stereo intensity loop is intentionally using a <= end
comparison (that’s how the scale factor bands work), we must skip these
dummy bands which would otherwise cause an out-of-bounds index.
2023-09-09 11:23:57 -06:00
kleines Filmröllchen
24f5914d18 LibAudio: Prevent overflow in QOA LMS prediction 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
ede8582def LibAudio: Check more FLAC partition order constraints as per the spec 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
dcc3d7bc35 LibAudio: Treat FLAC bps <= wasted_bps as error instead of crash
This can happen with some weird inputs, so instead, return an error; we
need at least one “effective” bit per sample so the bits per sample
cannot be less than or equal to the wasted bits per sample.
2023-09-09 11:23:57 -06:00
kleines Filmröllchen
c776ebcaf6 LibAudio: Only check subframe size if sample rate is constant 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
1bf81f84a0 LibAudio: Perform all seekpoint binary searches with comparisons
One was missed in the previous fix
2023-09-09 11:23:57 -06:00
kleines Filmröllchen
2b61193b71 LibAudio: Account for garbage shifts in several places in FLAC loader 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
b432674923 LibAudio: Prevent overflows during prediction
Saturating arithmetic leads to less screwed up audio in these cases.
2023-09-09 11:23:57 -06:00
Ali Caglayan
0347d04289 Ladybird: Add ladybird.nix to nix flake in Toolchain/
Add another dev shell to `Toolchain/flake.nix` called `ladybird.nix`
that pulls in the dependencies for building Ladybird.

Also update the documentation to mention building with a flake.
2023-09-09 11:22:00 -06:00
Sergey Bugaev
54265cec1c AK: Add InvokeResult 2023-09-09 11:21:15 -06:00
Dan Klishch
4c4e1e1aed JSSpecCompiler: Add if branch merging pass
It merges standalone IfBranch/ElseIfBranch nodes into IfElseIfChain
nodes. This will ease CFG generation later.
2023-09-09 11:20:43 -06:00
Dan Klishch
092ed1cc8a JSSpecCompiler: Allow storing NullableTrees in nodes
And use this in ElseIfBranch node.
2023-09-09 11:20:43 -06:00
Dan Klishch
4eede5282c JSSpecCompiler: Allow storing error text in ErrorNode
This will be the main way to communicate errors from compilation passes.
2023-09-09 11:20:43 -06:00