mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibHTML: Introduce LayoutBox and LayoutNodeWithStyleAndBoxModelMetrics
To streamline the layout tree and remove irrelevant data from classes that don't need it, this patch adds two new LayoutNode subclasses. LayoutNodeWithStyleAndBoxModelMetrics should be inherited by any layout node that cares about box model metrics (margin, border, and padding.) LayoutBox should be inherited by any layout node that can have a rect. This makes LayoutText significantly smaller (from 140 to 40 bytes) and clarifies a lot of things about the layout tree. I'm also adding next_sibling() and previous_sibling() overloads to LayoutBlock that return a LayoutBlock*. This is okay since blocks only ever have block siblings. Do also note that the semantics of is<T> slightly change in this patch: is<T>(nullptr) now returns true, to facilitate allowing to<T>(nullptr).
This commit is contained in:
parent
f4f5ede10a
commit
4814253589
18 changed files with 219 additions and 141 deletions
|
@ -2,7 +2,7 @@
|
|||
#include <LibHTML/Layout/LayoutBreak.h>
|
||||
|
||||
LayoutBreak::LayoutBreak(const HTMLBRElement& element)
|
||||
: LayoutNode(&element)
|
||||
: LayoutNodeWithStyleAndBoxModelMetrics(&element, StyleProperties::create())
|
||||
{
|
||||
set_inline(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue