summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/BlockContainer.h
AgeCommit message (Collapse)Author
2023-01-24LibWeb: Move scroll state from Layout::BlockContainer to Layout::BoxAndreas Kling
Let's allow any box to be scrollable, not just block containers.
2023-01-24LibWeb: Remove unused layout sibling getters in Layout::BlockContainerAndreas Kling
2023-01-11LibWeb: Make the paint tree GC-allocatedAndreas Kling
This simplifies the ownership model between DOM/layout/paint nodes immensely by deferring to the garbage collector for figuring out what's live and what's not.
2023-01-05LibWeb: Convert Layout Boxes to new pixel unitsSam Atkins
2022-12-07Meta+Userland: Pass Gfx::FloatPoint by valueMacDue
Just a small 8-byte value like Gfx::IntPoint.
2022-10-20LibWeb: Make the layout tree GC-allocatedAndreas Kling
This removes a set of complex reference cycles between DOM, layout tree and browsing context. It also makes lifetimes much easier to reason about, as the DOM and layout trees are now free to keep each other alive.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-11LibWeb: Move hit testing to the painting treeAndreas Kling
2022-03-11LibWeb: Move mouse event and label logic from layout to painting treeAndreas Kling
Input events have nothing to do with layout, so let's not send them to layout nodes. The job of Paintable starts to become clear. It represents a paintable item that can be rendered into the viewport, which means it can also be targeted by the mouse cursor.
2022-03-11LibWeb: Make Paintable ref-countedAndreas Kling
This will allow us to use a protective NonnullRefPtr to keep paintables alive while running arbitrary JavaScript in response to events.
2022-03-11LibWeb: Let Paintable perform the paintingAndreas Kling
This patch adds a bunch of Paintable subclasses, each corresponding to the Layout::Node subclasses that had a paint() override. All painting logic is moved from layout nodes into their corresponding paintables. Paintables are now created by asking a Layout::Box to produce one: static NonnullOwnPtr<Paintable> Layout::Box::create_paintable() Note that inline nodes still have their painting logic. Since they are not boxes, and all paintables have a corresponding box, we'll need to come up with some other solution for them.
2022-03-11LibWeb: Rename Painting::Box => PaintableAndreas Kling
Calling this "Box" made it very confusing to look at code that used both Layout::Box and Painting::Box. Let's try calling it Paintable instead.
2022-03-11LibWeb: Make Painting::Box virtual and add Painting::BoxWithLinesAndreas Kling
BlockContainer paint boxes are the only ones that have line boxes associated, so let's not waste memory on line boxes in all the other types of boxes. This also adds Layout::Box::paint_box() and the more tightly typed Layout::BlockContainer::paint_box() to get at the paint box from the corresponding layout box.
2022-03-11LibWeb: Move StackingContext and PaintPhase into the Painting namespaceAndreas Kling
2022-03-11LibWeb: Add Painting::Box and move things from Layout::Box into itAndreas Kling
The "paintable" state in Layout::Box was actually not safe to access until after layout had been performed. As a first step towards making this harder to mess up accidentally, this patch moves painting information from Layout::Box to a new class: Painting::Box. Every layout can have a corresponding paint box, and it holds the final used metrics determined by layout. The paint box is created and populated by FormattingState::commit(). I've also added DOM::Node::paint_box() as a convenient way to access the paint box (if available) of a given DOM node. Going forward, I believe this will allow us to better separate data that belongs to layout vs painting, and also open up opportunities for naturally invalidating caches in the paint box (since it's reconstituted by every layout.)
2022-02-21LibWeb: Start making our layout system "transactional"Andreas Kling
This patch adds a map of Layout::Node to FormattingState::NodeState. Instead of updating layout nodes incrementally as layout progresses through the formatting contexts, all updates are now written to the corresponding NodeState instead. At the end of layout, FormattingState::commit() is called, which transfers all the values from the NodeState objects to the Node. This will soon allow us to perform completely non-destructive layouts which don't affect the tree. Note that there are many imperfections here, and still many places where we assign to the NodeState, but later read directly from the Node instead. I'm just committing at this stage to make subsequent diffs easier to understand.
2022-01-23LibWeb: Remove old Layout::Node::split_into_lines() APIAndreas Kling
Now that we build lines incrementally, we no longer need the atomic line splitting API. The new InlineLevelIterator and LineBuilder setup does have some regressions from the old behavior, but we can deal with them as we go.
2022-01-20Userland: Add horizontal mouse scroll supportDmitry Petrov
2021-10-15LibWeb: Use W3C urls for CSS-DISPLAY spec linksSam Atkins
2021-10-06LibWeb: Move line boxes from Layout::Box to BlockContainerAndreas Kling
Per the spec, only a BlockContainer" can have line boxes, so let's not clutter up every Layout::Box with line boxes. This also allows us to establish an invariant that BFC and IFC always operate on a Layout::BlockContainer. Note that if BlockContainer has all block-level children, its line boxes are not used for anything. They are only used in the all inline-level children scenario.
2021-10-06LibWeb: Rename Layout::Node::is_block_box() => is_block_container()Andreas Kling
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.