summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
AgeCommit message (Collapse)Author
2022-03-10LibWeb: Display pseudo-elements in the DOM inspectorSam Atkins
This patch only makes them appear in the tree - they are not yet inspectable themselves.
2022-02-25LibWeb: Implement the ::marker pseudo-elementSam Atkins
This matches the marker boxes of list-items.
2022-02-25LibWeb: Create layout nodes for ::before and ::after pseudo-elements :^)Sam Atkins
For now, we only handle their `content` being text, but it's a start!
2022-02-21LibWeb: Create list-item markers during layout tree constructionAndreas Kling
Previously, these were added during layout. This didn't fit into the new world where layout doesn't mutate the tree incrementally, so this patch adds logic to Layout::TreeBuilder for adding a marker to each list-item box after its children have been constructed.
2022-02-05LibWeb: Compute element style in Layout::TreeBuilderAndreas Kling
Instead of making each Layout::Node compute style for itself, we now compute it in TreeBuilder before even calling create_layout_node(). For non-element DOM nodes, we create the style and layout tree node in TreeBuilder. This allows us to move create_layout_node() from DOM::Node to DOM::Element.
2021-10-27LibWeb: Don't create anonymous table boxes around whitespaceAndreas Kling
This was confusing table layout by adding empty whitspace table boxes that wound up stealing a bunch of horizontal space.
2021-10-06LibWeb: Rename Layout::BlockBox => BlockContainerAndreas Kling
There's a subtle difference here. A "block box" in the spec is a block-level box, while a "block container" is a box whose children are either all inline-level boxes in an IFC, or all block-level boxes participating in a BFC. Notably, an "inline-block" box is a "block container" but not a "block box" since it is itself inline-level.
2021-10-06LibWeb: Start work towards modern CSS "display" valuesAndreas Kling
Until now, we've internally thought of the CSS "display" property as a single-value property. In practice, "display" is a much more complex property that comes in a number of configurations. The most interesting one is the two-part format that describes the outside and inside behavior of a box. Switching our own internal representation towards this model will allow for much cleaner abstractions around layout and the various formatting contexts. Note that we don't *parse* two-part "display" yet, this is only about changing the internal representation of the property. Spec: https://drafts.csswg.org/css-display
2021-10-04LibWeb: Handle inline-block children of a flex-container as blockTobias Christiansen
We don't want to wrap the inline-blocks the same way we want to wrap pure inline children.
2021-09-29LibWeb: Flexbox: Wrap inline Nodes if their parent is display: flexTobias Christiansen
2021-09-08LibWeb: Rename InitialContainingBlockBox => InitialContainingBlockAndreas Kling
The "Box" suffix added nothing here.
2021-09-03Everywhere: Prevent risky implicit casts of (Nonnull)RefPtrDaniel Bertalan
Our existing implementation did not check the element type of the other pointer in the constructors and move assignment operators. This meant that some operations that would require explicit casting on raw pointers were done implicitly, such as: - downcasting a base class to a derived class (e.g. `Kernel::Inode` => `Kernel::ProcFSDirectoryInode` in Kernel/ProcFS.cpp), - casting to an unrelated type (e.g. `Promise<bool>` => `Promise<Empty>` in LibIMAP/Client.cpp) This, of course, allows gross violations of the type system, and makes the need to type-check less obvious before downcasting. Luckily, while adding the `static_ptr_cast`s, only two truly incorrect usages were found; in the other instances, our casts just needed to be made explicit.
2021-08-05LibWeb: Ignore svg elements outside of <svg> when building layout treeK-Adam
An svg layout element without a `SVGSVGElement` ancestor caused a failed assertion before, because the svg context does not exist when `paint()` is called
2021-06-24AK: Rename downcast<T> => verify_cast<T>Andreas Kling
This makes it much clearer what this cast actually does: it will VERIFY that the thing we're casting is a T (using is<T>()).
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-19LibWeb: Properly handle thead and tfooter HTML tagsAdam Hodgen
As the spec for the table fixup algorythm says: > Treat table-row-groups in this spec also encompass the specialized > table-header-groups and table-footer-groups.
2021-04-06LibWeb: Rename "for_each_in_subtree(_of_type)" to ↵Luke
"for_each_in_inclusive_subtree(_of_type)" This is because it includes the initial node that the function was called on, which makes it "inclusive" as according to the spec. This is important as there are non-inclusive variants, particularly used in the node mutation algorithms.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-10LibWeb: Generate layout nodes for shadow subtreesAndreas Kling
Elements with shadow roots will now recurse into those shadow trees while building the layout tree. This is the first step towards basic Shadow DOM support. :^)
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling