1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:27:35 +00:00
serenity/Userland/Libraries/LibWeb
Andreas Kling 64959a8504 LibWeb: Express intrinsic size layout via size constraints
Previously, we had three layout modes:

- Normal:
    - Everything uses the computed values from CSS.

- MinContent:
    - Containing blocks act as if they have 0 width.
    - All line breaking opportunities are taken.

- MaxContent:
    - Containing blocks act as if they have infinite width.
    - Only forced line breaks are accepted.

The above was based on a set of misunderstandings of CSS sizing.
A major problem with the above was that *all* containing blocks
behaved differently during intrinsic size layout, not just the
relevant one.

With this patch there are only two layout modes:

- Normal:
    - Everything uses the computed values from CSS.

- IntrinsicSizeDetermination:
    - One or more boxes have size constraints applied.

There are two size constraints per layout box, set here:

- FormattingState::NodeState::width_constraint
- FormattingState::NodeState::height_constraint

They are of type SizeConstraint and can be one of None, MinContent,
or MaxContent. The default is None.

When performing an IntrinsicSizeDetermination layout, we now assign
a size constraint to the box we're trying to determine the intrinsic
size of, which is then honored by using two new helpers to query
the dimensions of containing blocks:

- FormattingContext::containing_block_width_for(Box)
- FormattingContext::containing_block_height_for(Box)

If there's a relevant constraint in effect on the Box, the size of
its containing block is adjusted accordingly.

This is essentially an implementation of the "available space"
constraints from CSS-SIZING-3. I'm sure some things will break from
this, and we'll have to deal with that separately.

Spec: https://drafts.csswg.org/css-sizing-3/#available
2022-07-11 18:57:45 +02:00
..
Bindings LibWeb: Implement XMLSerializer 2022-07-05 21:25:05 +02:00
Cookie Userland: Remove a few gratuitous IPC namespace qualifiers 2022-04-03 15:18:20 +01:00
Crypto Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
CSS LibWeb: Make sure CSS::ComputedValues has initial size values 2022-07-09 22:16:35 +02:00
DOM LibWeb: Trigger a relayout after setting Element.innerHTML 2022-07-05 21:27:37 +02:00
DOMParsing AK: Use an enum instead of a bool for String::replace(all_occurences) 2022-07-06 11:12:45 +02:00
Encoding LibWeb: Implement a very basic version of TextDecoder 2022-02-16 22:48:32 +03:30
Fetch LibWeb: Implement spec-compliant MIME type struct and parser 2022-02-12 12:53:28 +01:00
Geometry LibWeb: Add imports to all IDL files that depend on others 2022-02-16 22:48:32 +03:30
HighResolutionTime Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
HTML LibWeb: Store MessageEvent::m_data in a JS::Handle 2022-07-11 14:49:25 +01:00
IntersectionObserver LibWeb: Use the specification defined types in IntersectionObserverInit 2022-04-02 13:13:37 +03:00
Layout LibWeb: Express intrinsic size layout via size constraints 2022-07-11 18:57:45 +02:00
Loader LibWeb: Add timeout_callback to ResourceLoader::load() 2022-07-03 13:26:32 +02:00
MimeSniff Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
NavigationTiming LibWeb: Use long long where it was replaced with long 2022-06-06 22:34:45 +01:00
Page LibWeb: Simplify some WeakPtr assignments 2022-07-04 22:30:59 +02:00
Painting LibWeb: Tiebreak corner color on existence of corresponding borders 2022-07-10 12:46:57 +02:00
RequestIdleCallback LibWeb: Implement the infrastructure necessary for requestIdleCallback 2022-04-02 23:52:25 +01:00
ResizeObserver LibWeb: Add the ResizeObserverBoxOptions IDL enum 2022-04-02 13:13:37 +03:00
Scripts Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Selection LibWeb: Add imports to all IDL files that depend on others 2022-02-16 22:48:32 +03:30
SVG LibWeb: Make sure CSS::ComputedValues has initial size values 2022-07-09 22:16:35 +02:00
Tests LibWeb: Capture <script> element's node document on execution 2021-12-21 13:50:00 -08:00
UIEvents LibWeb: Dispatch dblclick UI Events on double click 2022-06-20 12:55:50 +01:00
URL AK: Use an enum instead of a bool for String::replace(all_occurences) 2022-07-06 11:12:45 +02:00
WebAssembly AK: Return Optional<T&> from HashMap<..., T>::get() 2022-04-04 12:48:31 +02:00
WebGL LibWeb/WebGL: Add WebGLRenderingContextBase.canvas 2022-06-27 22:54:41 +01:00
WebSockets LibWeb: Abstract the LibProtocol WebSockets connection 2022-05-15 12:17:36 +02:00
XHR LibWeb: Add URLSearchParams as part of union type for XHR::send() 2022-07-08 12:37:01 +02:00
XML Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
CMakeLists.txt LibWeb: Implement XMLSerializer 2022-07-05 21:25:05 +02:00
Dump.cpp LibWeb: Support CSSRule.type 2022-04-11 21:10:08 +02:00
Dump.h LibWeb: Implement initial CSSFontFaceRule and FontFace classes 2022-03-28 22:25:25 +02:00
FontCache.cpp LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
FontCache.h LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Forward.h LibWeb: Implement XMLSerializer 2022-07-05 21:25:05 +02:00
idl_files.cmake LibWeb: Implement XMLSerializer 2022-07-05 21:25:05 +02:00
ImageDecoding.cpp LibWeb: Abstract the image decoding via Web::ImageDecoding::Decoder 2022-05-15 12:17:36 +02:00
ImageDecoding.h LibWeb: Abstract the image decoding via Web::ImageDecoding::Decoder 2022-05-15 12:17:36 +02:00
Namespace.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Namespace.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Origin.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TreeNode.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00