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
Linus Groh
df3e25f1bb
LibWeb: Add & use 'HTTP tab or space' from '2.2. HTTP' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
7c2c9b6859
LibWeb: Add definitions from '2.1. URL' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
de74ba587f
LibWeb: Add a stub PolicyContainer struct
2022-07-14 00:42:26 +01:00
Linus Groh
22a627fc1a
LibWeb: Move Origin into the HTML namespace
...
Origin is defined in the HTML Standard, and therefore belongs into the
HTML directory and namespace in LibWeb.
https://html.spec.whatwg.org/multipage/origin.html#origin
2022-07-14 00:42:26 +01:00
Linus Groh
1748362e05
LibWeb: Add 'byte-{lower,upper}case' operations from the Infra spec
...
Usually operations that mirror AOs from the Infra spec are simply part
of the underlying data structures in AK directly, but these don't seem
generally useful enough to add them as ByteBuffer methods.
2022-07-14 00:42:26 +01:00
Ankur Sundara
400ef9913e
LibWeb: Fix regexes for XHR
...
Regexes for is_method and is_header_name did not escape the "-"
and unintentionally allowed for "," to be part of a
method/header name, not following the spec.
This commit escapes the "-" character to follow the spec.
2022-07-13 22:52:10 +02:00
Andreas Kling
d2b887a793
LibWeb: Only create one wrapper for inline content inside flex container
...
Due to a missing `return` statement, we were creating two anonymous
wrapper blocks around each piece of inline content inside a flex
container.
This had no visual impact, since they ended up with 0x0 dimensions,
but we were wasting a fair bit of time running layout on them.
2022-07-13 01:26:29 +02:00
Andreas Kling
3ee5bdcfb7
LibWeb: Traverse shadow-including subtree when adopting DOM nodes
...
This takes care of two FIXMEs and fixes an issue on Google Docs where
we'd mix boxes from different documents in the same layout tree.
(This happened because shadow trees remained attached to their old
document when their host was adopted.)
2022-07-12 23:17:17 +02:00
Andreas Kling
7d7d5f0b1b
LibWeb: Use fit-content size for flex items with indefinite cross size
2022-07-12 23:12:11 +02:00