
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).
13 lines
332 B
C++
13 lines
332 B
C++
#include <LibHTML/DOM/Element.h>
|
|
#include <LibHTML/Layout/LayoutBlock.h>
|
|
#include <LibHTML/Layout/LayoutInline.h>
|
|
|
|
LayoutInline::LayoutInline(const Element& element, NonnullRefPtr<StyleProperties> style)
|
|
: LayoutNodeWithStyleAndBoxModelMetrics(&element, move(style))
|
|
{
|
|
set_inline(true);
|
|
}
|
|
|
|
LayoutInline::~LayoutInline()
|
|
{
|
|
}
|