mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:17:35 +00:00
LibWeb: Add LayoutStyle, a place to store style info for layout & paint
StyleProperties is really only the specified "input" to what eventually becomes the used/computed style we use for layout and painting. Unlike StyleProperties, LayoutStyle will have strongly typed values for everything it contains (i.e no CSS::ValueID or strings, etc.) This first patch moves z-index into LayoutStyle.
This commit is contained in:
parent
5e83a97fa2
commit
6f28f08096
5 changed files with 76 additions and 4 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Layout/BoxModelMetrics.h>
|
||||
#include <LibWeb/Layout/LayoutPosition.h>
|
||||
#include <LibWeb/Layout/LayoutStyle.h>
|
||||
#include <LibWeb/Painting/PaintContext.h>
|
||||
#include <LibWeb/TreeNode.h>
|
||||
|
||||
|
@ -190,6 +191,7 @@ public:
|
|||
virtual LayoutNode& inline_wrapper() { return *this; }
|
||||
|
||||
const StyleProperties& specified_style() const;
|
||||
const ImmutableLayoutStyle& style() const;
|
||||
CSS::Position position() const;
|
||||
CSS::TextAlign text_align() const;
|
||||
|
||||
|
@ -259,6 +261,8 @@ public:
|
|||
const StyleProperties& specified_style() const { return m_specified_style; }
|
||||
void set_specified_style(const StyleProperties& style) { m_specified_style = style; }
|
||||
|
||||
const ImmutableLayoutStyle& style() const { return static_cast<const ImmutableLayoutStyle&>(m_style); }
|
||||
|
||||
CSS::Position position() const { return m_position; }
|
||||
CSS::TextAlign text_align() const { return m_text_align; }
|
||||
|
||||
|
@ -266,6 +270,10 @@ protected:
|
|||
explicit LayoutNodeWithStyle(const Node*, NonnullRefPtr<StyleProperties>);
|
||||
|
||||
private:
|
||||
void apply_style(const StyleProperties&);
|
||||
|
||||
LayoutStyle m_style;
|
||||
|
||||
NonnullRefPtr<StyleProperties> m_specified_style;
|
||||
CSS::Position m_position;
|
||||
CSS::TextAlign m_text_align;
|
||||
|
@ -293,6 +301,13 @@ inline const StyleProperties& LayoutNode::specified_style() const
|
|||
return parent()->specified_style();
|
||||
}
|
||||
|
||||
inline const ImmutableLayoutStyle& LayoutNode::style() const
|
||||
{
|
||||
if (m_has_style)
|
||||
return static_cast<const LayoutNodeWithStyle*>(this)->style();
|
||||
return parent()->style();
|
||||
}
|
||||
|
||||
inline CSS::Position LayoutNode::position() const
|
||||
{
|
||||
if (m_has_style)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue