Andreas Kling
c517dfde12
LibWeb: Honor the flexbox spec's "automatic minimum size" everywhere
...
`min-width: auto` and `min-height: auto` have special behavior on flex
items. We already handled it in many cases but there were two places
where it was incorrectly treated as 0. This fixes that.
2022-07-19 12:45:50 +02:00
Andreas Kling
789f258412
LibWeb: Reject negative values for flex-grow
and flex-shrink
2022-07-19 12:45:50 +02:00
Linus Groh
ed49b66f25
LibWeb: Implement '5.1. Headers class' from the Fetch API :^)
2022-07-19 00:27:35 +01:00
Linus Groh
b5ab1f6b4a
LibWeb: Implement HeaderList::sort_and_combine()
2022-07-19 00:27:35 +01:00
Linus Groh
bad6ad8861
LibWeb: Implement CaseInsensitiveBytesTraits::equals()
...
Turns out HashTable::contains() doesn't solely use hash() for equality
checks, so the lack of a proper equals() implementation broke the check
in convert_header_names_to_a_sorted_lowercase_set() and caused duplicate
entries in header_names_set.
2022-07-19 00:27:35 +01:00
Linus Groh
2726fc9c73
LibWeb: Move Fetch infra into the Web::Fetch::Infrastructure namespace
...
The Fetch spec unfortunately will cause a name clash between the Request
concept and the Request JS object - both cannot live in the Web::Fetch
namespace, and WrapperGenerator generally assumes `Web::<Name>` for
things living in the `<Name>/` subdirectory, so let's instead move infra
code into its own namespace - it already sits in a (sub-)subdirectory
anyway.
2022-07-19 00:27:35 +01:00
Kenneth Myhra
0a511e29d1
LibWeb: Add support for Blob to XHR::send()
2022-07-18 14:57:58 +01:00
Kenneth Myhra
9b3da5a142
LibWeb: Move extract_body() towards spec compliance
2022-07-18 14:57:58 +01:00
Kenneth Myhra
bc4ccadcac
LibWeb: XHR::extra_body() rewrite to use Variant::visit()
2022-07-18 14:57:58 +01:00
Kenneth Myhra
48b59aaeb1
LibWeb: Mark body argument of extract_body() as const reference
2022-07-18 14:57:58 +01:00
Kenneth Myhra
1b9f5fa28a
LibWeb: Mark URLSearchParams::to_string() as const
2022-07-18 14:57:58 +01:00
Kenneth Myhra
42e76d8de9
LibWeb: Rename safely_extract_body() to extract_body()
...
We have not yet implemented safely_extract_body so renaming this to
extract_body() and adding a spec link.
2022-07-18 14:57:58 +01:00
MacDue
0c521381a3
LibWeb: Replace LibGfx gradient painting with new GradientPainting
2022-07-18 10:10:22 +01:00
MacDue
469491906f
LibWeb: Add GradientPainting for painting linear-gradients
...
This implements support for painting linear-gradients in a spec
correct way :^).
Right now it supports:
- Multi-stop gradients
- Color stop fixups
- Using pre-multiplied alpha mixing when required
- Painting gradients at arbitrary angles
It still needs to support:
- Transition hints
- Double position color stops
However what is implemented now seems to be accurate to other
browsers, and covers the most common use cases.
2022-07-18 10:10:22 +01:00
MacDue
4246d04e5a
LibWeb: Calculate to <corner> angles for linear-gradients
...
This also renames LinearGradientStyleValue::angle() to
LinearGradientStyleValue::angle_degrees() to make the unit more
obvious.
2022-07-18 10:10:22 +01:00
Linus Groh
6619483169
LibWeb: Update incorrect Fetch namespaces
...
Oops, this namespace rename wasn't committed yet.
2022-07-18 08:14:04 +01:00
Linus Groh
58fda93ea2
LibWeb: Add Blob to Fetch's Body::SourceType variant
2022-07-18 08:11:25 +01:00
Linus Groh
c501453425
LibWeb: Use Fetch's HeaderList::get_decode_and_split() in XMLHttpRequest
2022-07-18 08:10:54 +01:00
Linus Groh
bc68539e26
LibWeb: Add & use TRY_OR_RETURN_OOM macro
...
This is a convenient way to return a DOM exception for operations that
return ErrorOr and only have an OOM failure path.
2022-07-17 21:08:10 +01:00
MacDue
cbc04a6285
LibWeb: Support painting simple linear-gradients
...
This is just a quick test that everything is working. Currently
it paints the gradients with the existing
painter.fill_rect_with_gradient(). This can only handle two-color
orthogonal gradients.
2022-07-17 20:11:38 +01:00
MacDue
ee7e9e7c86
LibWeb: Allow having a linear-gradient() as a background-image
2022-07-17 20:11:38 +01:00
MacDue
ae6c0258a4
LibWeb: Parse the linear-gradient() CSS function
...
This should parse linear-gradient()s as defined in the W3 spec
https://drafts.csswg.org/css-images/#linear-gradients .
Note: This currently cannot parse multi-position color stops,
these are shown on MDN and work in Firefox and Chrome, though do
not seem to be defined in the spec.
See: https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#gradient_with_multi-position_color_stops
P.s. This also allows -webkit-linear-gradient for compatibility.
2022-07-17 20:11:38 +01:00
MacDue
259bb30c35
LibWeb: Add LinearGradientStyleValue
2022-07-17 20:11:38 +01:00
MacDue
8603541e56
LibWeb: Add serialize_a_srgb_value()
...
This moves the logic from ColorStyleValue::to_string() to a standalone
function.
2022-07-17 20:11:38 +01:00
Luke Wilde
aa9f7cc597
LibWeb: Fix queuing mutation records for node removal
...
Step 19 of node removal was missing, which allows the mutations of the
descendants of the removed node to still be observed by the parent.
Step 20 of node removal queued the mutation record for the removed
node instead of it's parent. Since queuing takes place after the node
is removed from the tree, the mutation record would be lost as the only
inclusive ancestor of the node at this point is only the node itself.
2022-07-17 18:21:09 +01:00
Andreas Kling
9b46091f38
LibWeb: Rename LayoutState::NodeState => LayoutState::UsedValues
...
This object contains all the CSS "used values" as seen during the layout
process, so calling it "used values" seems appropriate. :^)
2022-07-17 14:11:37 +02:00
Andreas Kling
52862c72d0
LibWeb: Rename FormattingState to LayoutState
...
This seems a bit more descriptive (and also a bit shorter).
2022-07-17 14:11:36 +02:00
Andreas Kling
0d8f9019c8
LibWeb: Implement basic stretch alignment for flex-wrap: wrap
...
We currently ignore the `align-content` property, that's a FIXME
for our future selves.
2022-07-17 14:11:36 +02:00
Andreas Kling
9fc43d5766
LibWeb: Update flex container intrinsic size algorithm to draft spec
...
The CSSWG draft Flexbox spec is a bit clearer on some details, so let's
update our implementation to match the latest version.
2022-07-17 14:11:36 +02:00
Andreas Kling
c964a6b548
LibWeb: Paper over a VERIFY() crash in ResourceLoader for now
2022-07-17 14:11:36 +02:00
Linus Groh
ac36d272d3
LibWeb: Avoid needless copies during Blob construction
2022-07-17 00:34:25 +01:00
Kenneth Myhra
5806eeec08
LibWeb: Add support for XHR response type Blob
2022-07-17 00:23:19 +01:00
Kenneth Myhra
df8c49f6bf
LibWeb: Introduce Blob
2022-07-17 00:23:19 +01:00
Linus Groh
8da3914bdc
LibWeb: Add definitions from '2.2.6. Responses' in the Fetch spec
2022-07-16 21:05:00 +01:00
Linus Groh
7116a7d2bf
LibWeb: Add definitions from '2.2.5 Requests' in the Fetch spec
2022-07-15 14:15:30 +02:00
Linus Groh
4f02bac39c
LibWeb: Add a couple of missing includes to Fetch's Headers.h
2022-07-15 14:15:30 +02:00
Linus Groh
2b06e4b98b
LibWeb: Mark Origin::serialize() as const
2022-07-15 14:15:30 +02:00
Andreas Kling
884b7fad48
LibWeb: Remove weird is_undefined_or_auto() helper in FFC
...
This was a leftover from when ComputedValues stored sizes in Optionals.
Now that we've gotten rid of the "undefined" state, there's no need for
this helper, we can just access the size values directly.
2022-07-15 14:11:19 +02:00
Andreas Kling
0636e1db61
LibWeb: Update flex line "remaining free space" when finished
...
Since we re-use this value later in the layout algorithm, we have to
update it before leaving the "resolve flexible lengths" step.
2022-07-15 14:11:19 +02:00
Linus Groh
db5c455238
LibWeb: Use newly added 'Status' Fetch infrastructure in XMLHttpRequest
2022-07-14 00:42:26 +01:00
Linus Groh
aa852fd9f2
LibWeb: Use newly added 'Headers' Fetch infrastructure in XMLHttpRequest
2022-07-14 00:42:26 +01:00
Linus Groh
d232f3fc41
LibWeb: Use newly added 'Methods' Fetch infrastructure in XMLHttpRequest
2022-07-14 00:42:26 +01:00
Linus Groh
f507f68d4a
LibWeb: Add definitions from '2.2.4. Bodies' in the Fetch spec
...
...at least the ones that don't require an implementation of the Streams
spec :^)
2022-07-14 00:42:26 +01:00
Linus Groh
1694279dd8
LibWeb: Add definitions from '2.2.3. Statuses' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
dd9bf10151
LibWeb: Add definitions from '2.2.2. Headers' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
9244f1697d
LibWeb: Add definitions from '2.2.1. Methods' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
9d60010b44
LibWeb: Mark Fetch::collect_an_http_quoted_string() [[nodiscard]]
2022-07-14 00:42:26 +01:00
Linus Groh
f42f0cceaa
LibWeb: Make Fetch::collect_an_http_quoted_string()'s 2nd param optional
2022-07-14 00:42:26 +01:00
Linus Groh
fad69fcacd
LibWeb: Move Fetch::collect_an_http_quoted_string() into HTTP.{cpp,h}
...
The Fetch spec is too big to have a generic AbstractOperations.{cpp,h}
file, so let's keep AOs in their section-specific files.
2022-07-14 00:42:26 +01:00
Linus Groh
e3798886ed
LibWeb: Add & use 'HTTP whitespace' from '2.2. HTTP' in the Fetch spec
...
We had two independent definitions of this already, both referring to
the Fetch spec.
2022-07-14 00:42:26 +01:00