Commit Graph

41914 Commits

Author SHA1 Message Date
Tommy Murphy
0ee98c69c1 LibCompress: Brotli support metadata of skip_length=0
The relevant RFC section from
https://www.rfc-editor.org/rfc/rfc7932#section-9.2

MSKIPBYTES * 8 bits: MSKIPLEN - 1, where MSKIPLEN is
       the number of metadata bytes; this field is
       only present if MSKIPBYTES is positive;
       otherwise, MSKIPLEN is 0 (if MSKIPBYTES is
       greater than 1, and the last byte is all
       zeros, then the stream should be rejected as
       invalid)

So when skip_bytes is zero we need to break and
re-align bytes.

Added the relevant test case that demonstrates this from:
https://github.com/google/brotli/blob/master/tests/testdata/x.compressed
2022-10-11 22:49:33 -06:00
Kenneth Myhra
7ea987456a Documentation: Update CLion Configuration to use the x86-64 target
Since the default target is x86-64 after PR #15441 was merged, then let
us update the CLion Configuration accordingly.
2022-10-12 00:09:51 +02:00
Andreas Kling
e6de382679 LibWeb: Constrain abspos element heights by min-height and max-height 2022-10-11 22:31:51 +02:00
Andreas Kling
0e295f727a LibWeb: Fix dumb typos in solver helpers for abspos height 2022-10-11 22:23:13 +02:00
Sam Atkins
f754f45680 LibHTTP: Include request body in HttpRequest::from_raw_request() 2022-10-11 21:52:13 +02:00
Sam Atkins
437c6fc277 pro: Stop closing stdout early
This was causing a race-condition where sometimes the response body
would not get printed.

Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2022-10-11 21:52:13 +02:00
Sam Atkins
f06a7f40bf LibProtocol: Remove redundant return statement 2022-10-11 21:52:13 +02:00
Sam Atkins
ee72a11ca9 pro: Add argument --method/-m for controlling the HTTP method
This lets you send requests like DELETE.
2022-10-11 21:52:13 +02:00
Sam Atkins
53b7edd5b9 pro: Print the response code if it's an error 2022-10-11 21:52:13 +02:00
Sam Atkins
9b891a423b LibHTTP: Make HTTP method names more accessible
Previously you could only get the name of an HttpRequest::Method if you
already had an HttpRequest.
2022-10-11 21:52:13 +02:00
Andreas Kling
84953c5020 LibWeb: Calculate height of absolute-position elements according to spec
This patch implements the full "old model" height algorithm from the
CSS Positioned Layout spec. I went with the old model since we don't
yet have the machinery required to implement the new model.

Also, the width calculations already follow the old model, so this
is symmetric with that. Eventually we should of course implement the new
positioned layout model.
2022-10-11 21:49:48 +02:00
Andreas Kling
e77798f5fd LibWeb: Implement a large chunk of the Selection API
This patch implements enough of the Selection API specification
that we stop hitting unimplemented functions when loading Twitter.
2022-10-11 21:49:48 +02:00
Andreas Kling
317ab7a04b LibWeb: Make Range's boundary point comparison a public function
We'll need this in the Selection API implementation as well.
2022-10-11 21:49:48 +02:00
Andreas Kling
33c6559561 LibWeb: Add spec link for DOM::Document::m_selection 2022-10-11 21:49:48 +02:00
Andreas Kling
5ab501c92f LibWeb: Scroll elements into view when they become focused
This makes both user-interactive (tab keys) and programmatic focus
changes scroll the viewport if necessary to reveal the newly focused
element.
2022-10-11 21:49:48 +02:00
Andreas Kling
7dcbb403bb LibWeb: Update layout in Element.getClientRects()
We always have to flush any pending layout updates before inspecting the
layout tree.
2022-10-11 21:49:48 +02:00
Sam Atkins
a0d44026fc AK+Tests: Correct off-by-one error when right-trimming text
If the entire string you want to right-trim consists of characters you
want to remove, we previously would incorrectly leave the first
character there.

For example: `trim("aaaaa", "a")` would return "a" instead of "".

We can't use `i >= 0` in the loop since that would fail to detect
underflow, so instead we keep `i` in the range `size .. 1` and then
subtract 1 from it when reading the character.

Added some trim() tests while I was at it. (And to confirm that this was
the issue.)
2022-10-11 17:49:32 +02:00
Mart G
8202beeb2b WindowServer+LibGUI: Shrink window edge resize hot-spots
The hot-spots for resizing a window by dragging its corner are now
limited to a small area around the actual corner instead of an area with
1/3rd the length or width of the window.

The hot-spots to resize a window while holding a modifier key and the
right mouse button are unchanged.
2022-10-11 17:48:48 +02:00
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