Commit Graph

27729 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
43da0701fc LibWeb: Implement navigate() for Location object 2023-08-22 20:30:06 +02:00
Aliaksandr Kalenik
5f21285337 LibWeb: Add Window::navigable() 2023-08-22 20:30:06 +02:00
Aliaksandr Kalenik
343c709566 LibWeb: Add m_page in TraversableNavigable 2023-08-22 20:30:06 +02:00
Andreas Kling
5a704453af LibWeb: Implement "close a top-level traversable" 2023-08-22 20:30:06 +02:00
MacDue
bf55b49070 LibGfx: Fix SVG/canvas radial gradients with focal point != start center
Previously, it was assumed the focal point was the center of the start
circle. This is only the case if the start radius is zero or the centers
of the start and end circle are the same.

This was pretty hard to spot until repeating SVG radial gradients where
added, where the maths broke near the focal point.
2023-08-22 20:25:57 +02:00
Sam Atkins
c171810030 LibWeb: Make CalculatedStyleValue::dump() infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
7fe97ee6c5 LibWeb: Make StyleValue::to_string() infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
ccfe197e5a LibWeb: Make serializing CSS Parser types infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
846c719e49 LibWeb: Make serializing Supports rules infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
91114c157b LibWeb: Make serializing selectors infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
afa27bad19 LibWeb: Make serializing media-queries infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
2754c16e97 LibWeb: Make serializing GridTrack classes infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
6bee81cfb6 LibWeb: Make serializing basic CSS types infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
b5893ee115 LibWeb: Make Serialize functions infallible 2023-08-22 17:51:48 +01:00
Andrew Kaster
b3bd232a5e LibWeb: Implement StructuredSerialize for BigIntObject and Symbol 2023-08-22 13:08:08 +02:00
Andrew Kaster
f3cf7496a1 LibWeb: Add spec steps to StructuredSerialize
In preparation for serializing more types, let's move the implementation
closer to the steps in the spec.
2023-08-22 13:08:08 +02:00
Andrew Kaster
96600e77c2 LibJS: Enable storing Value and Handle<Value> in HashMaps
We have the right conversions to make this work, so let's make it
possible to have a `HashMap<JS::Handle<T>, V>` and look for a specific
T inside it without having to create a temporary handle.

This involves adding some operator== implementations, and some
specializations of AK::Traits.
2023-08-22 13:08:08 +02:00
Andi Gallo
685ef4ec82 LibWeb: Stop collecting lookahead items on forced break
This avoids a crash since such items don't have a node nor CSS
properties. Fixes crashes on Wikipedia pages which contain preformatted
code.
2023-08-22 11:33:45 +02:00
Aliaksandr Kalenik
cca779e7f6 LibWeb: Treat grid items with z-index != auto as positioned elements 2023-08-22 11:33:24 +02:00
Aliaksandr Kalenik
95a8dec373 LibWeb: Treat grid item as it creates stacking context during painting
Grid specification https://www.w3.org/TR/css-grid-2/#z-order defines
special painting order for grid items which should be the same as for
defined for inline-blocks in CSS2.
2023-08-22 11:33:24 +02:00
Aliaksandr Kalenik
b4064320bd LibWeb: Add m_is_grid_item in Layout::Node
This information is going to be needed during painting to treat grid
items as stacking contexts.
2023-08-22 11:33:24 +02:00
stelar7
434d95ef55 LibWeb: Add missing promise rejection in execute_async_script 2023-08-21 13:22:04 -06:00
stelar7
b0adf96eff LibWeb: Implement the timeout step of execute_async_script 2023-08-21 13:22:04 -06:00
stelar7
23b378822b LibWeb: Stub out Release Actions
This allows WPT to open the browser, and it no longer instantly crashes
2023-08-21 13:22:04 -06:00
Andi Gallo
3d7e788981 LibWeb: Improve the line breaking algorithm
Check the width of the next token after white space to decide line
breaks. The next width can also be the total width of multiple tokens.
This better follows the CSS Text specification and matches behavior of
other browsers.

Fixes #20388.
2023-08-21 19:31:00 +02:00
Andreas Kling
0103940cee LibWeb: Resolve viewport-relative <img sizes> values
We still don't know how to resolve font-relative lengths in <img sizes>
since we don't always have font size information available at this stage
in the pipeline, but we can at least handle viewport-relative lengths.

This fixes an issue on many websites where low-resolution images were
loaded (appropriate for a small viewport) even when the viewport is big.
2023-08-21 13:56:18 +02:00
Andreas Kling
ae5313d33c LibWeb: Add Document::viewport_rect()
This is a convenience helper that returns an empty rect if there is no
browsing context (to get the actual rect from).
2023-08-21 13:56:18 +02:00
Sam Atkins
b8e694c0f2 LibWeb: Implement the :dir() selector pseudo-class 2023-08-21 13:51:56 +02:00
Sam Atkins
5b125811f1 LibWeb: Add support for pseudo-class functions that take an ident param
This is prep work for `:dir()`, though other pseudo-classes may well use
it in the future too.
2023-08-21 13:51:56 +02:00
Sam Atkins
9522f761a3 LibWeb: Implement "directionality" of an Element 2023-08-21 13:51:56 +02:00
Sam Atkins
9f83c0f0da LibWeb: Add Element::is_document_element() helper
This is *not* the same as `Node::is_document()`, just to be confusing.
It basically means it's the root element.
2023-08-21 13:51:56 +02:00
Ali Mohammad Pur
3c176bafee LibWasm: Implement a few SIMD instructions 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
2462064fcd LibWasm+LibWeb: Parse and validate all Wasm SIMD instructions 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
b005691497 LibWasm: Disallow out-of-range br_table labels 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
8668851cb1 LibWasm: Do not allow self-referencial globals
This is written in a somewhat roundabout way in the spec, so the
initial implementation did not implement it correctly.
2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
94f5389934 AK: Add a 'HostIsLittleEndian' constant and use it instead of BYTE_ORDER
Previously we were using the preprocessor everywhere we needed this
constant, so let's move away from that and use a constexpr constant.
2023-08-21 13:39:32 +03:30
Sam Atkins
0d021a63c7 LibUnicode: Generate data for bidirectional character types
This will let us examine code points to determine the rtl/ltr direction
of a piece of text.
2023-08-20 16:21:35 -04:00
nipos
abf7941bb9 LibCore: Change Errno to Error in FreeBSD and NetBSD-specific functions 2023-08-20 12:48:37 -06:00
Bastiaan van der Plaat
0facfd3257 LibWeb: Make handle_mousewheel wheel delta use pixels 2023-08-20 12:17:58 -06:00
Abhishek Raturi
7d588db6c8 HackStudio: Change the collection_index for highlight selected text
Change the value for `highlight_selected_text_span_collection_index`
to avoid the conflict with `search_results_span_collection_index`.
And pass the selection instead of calling selected_text() again
2023-08-20 19:13:37 +01:00
Abhishek Raturi
e63cf3b94a HackStudio: Highlight all the occurances of selected text in editor
This feature is similar(somewhat) to the Clion's highlight all
occurances of word under caret. This is not perfect implementation
since there is a issue with resetting the `spans` `attributes` such as
`color`, `background_color`

HackStudio: Reset spans upon mousedown_event after double clicking

Reset the spans upon mousedown_event after double clicking the text
(to highlight all occurrances). Avoid highlighting if whitespace is
selected
2023-08-20 19:13:37 +01:00
MacDue
46f42d9755 LibWeb: Add support for the SVG gradient spreadMethod attribute 2023-08-20 20:04:10 +02:00
MacDue
1ecb2cf28c LibGfx: Add FIXME for SVG/canvas radial gradients
The current implementation assumes the focal point is the center of the
start circle, for most cases the difference this makes is very subtle,
but becomes more apparent with spreadMethod=repeat/reflect.
2023-08-20 20:04:10 +02:00
MacDue
b9294e5fdf LibGfx: Add support for SVG repeat/reflect gradients 2023-08-20 20:04:10 +02:00
Sam Atkins
a48b2c1c66 LibWeb: Fill in missing kinds of calc() expansion in StyleComputer
This is all of them currently, except Length, because we lack the needed
information to be able to expand font-relative lengths.

The whole way `expand_unresolved_values()` works is awkward, but at some
point we'll be able to run the simplification algorithm on the
calculation, which will either return a single value, or a new
calculation that's simplified as much as possible.

Mostly I just wanted that FIXME log message to go away, because it's
overwhelming on certain sites.
2023-08-20 19:38:03 +02:00
Sam Atkins
2c7603f2ae LibWeb: Add helper for creating <dimension> CSS tokens 2023-08-20 19:38:03 +02:00
Andreas Kling
27ddfa84fa LibWeb: Accept height: {min,max,fit}-content
And treat them as "auto" for now, per CSS-SIZING-3, with a FIXME about
supporting more layout directions.

This fixes an issue on MDN where `height: max-content` was not
overriding height from non-CSS presentational hints.
2023-08-20 19:37:50 +02:00
Andreas Kling
90e95d38d7 LibWeb: Make align-items: normal behave like stretch on flex items
CSS-ALIGN-3 tells us that `normal` behavior inside flex containers is
simply to behave as `stretch` so this patch makes them behave the same
inside FFC.

Furthermore, we change the `align-items` initial value to `normal`,
matching other engines.
2023-08-20 19:37:50 +02:00
Aliaksandr Kalenik
d05be0d504 LibWeb: Fix Request::visit_edges to actually visit m_body
This fixes bug introduced in bdd3a16b16
that `m_body` is not visited because `BodyType` variant has
`JS::NonnullGCPtr` instead of `JS::GCPtr`.
2023-08-20 19:08:37 +02:00
Andi Gallo
769f11f9ae LibWeb: Implement table missing cells fixup
Fixes #19936.
2023-08-20 18:38:15 +02:00