-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web-render: Scafolding the visual formatting model.
- Loading branch information
1 parent
0ed35a0
commit 06699d7
Showing
9 changed files
with
154 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
namespace Web::Css { | ||
|
||
/// CSS Computed Style | ||
struct ComputedValues { | ||
}; | ||
|
||
} // namespace Web::Css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#pragma once | ||
|
||
#include <karm-layout/spacing.h> | ||
#include <karm-math/rect.h> | ||
#include <web-css/computed-values.h> | ||
#include <web-dom/element.h> | ||
|
||
namespace Web::Render { | ||
|
||
// 9 MARK: Visual formatting model | ||
// https://www.w3.org/TR/CSS22/visuren.html | ||
|
||
struct Box { | ||
Strong<Dom::Element> _el; | ||
Strong<Css::ComputedValues> _style; | ||
|
||
Math::Rectf _bound{}; | ||
Layout::Spacingf _margin{}; | ||
Layout::Spacingf _padding{}; | ||
Layout::Spacingf _border{}; | ||
|
||
Box(Strong<Dom::Element> el, Strong<Css::ComputedValues> style) | ||
: _el(el), _style(style) { | ||
} | ||
|
||
virtual ~Box() = default; | ||
}; | ||
|
||
struct ParentBox { | ||
virtual ~ParentBox() = default; | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#block-level | ||
struct BlockLevelBox : | ||
public Box { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#block-boxes | ||
struct BlockContainerBox : | ||
public ParentBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#block-boxes | ||
struct BlockBox : | ||
public BlockLevelBox, | ||
public BlockContainerBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#inline-formatting | ||
struct LineBox : | ||
public ParentBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#anonymous-block-level | ||
struct InlineLevelBox : | ||
public Box { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#anonymous-block-level | ||
struct InlineBox : | ||
public InlineLevelBox, | ||
public ParentBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#anonymous | ||
class AnonymousInlineBoxes : | ||
public InlineLevelBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#inline-boxes | ||
class AtomicInlineLevelBox : | ||
public InlineLevelBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#inline-boxes | ||
class InlineBlockBox : | ||
public AtomicInlineLevelBox, | ||
public BlockContainerBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#block-boxes | ||
class ReplacedBox { | ||
}; | ||
|
||
// https://www.w3.org/TR/CSS22/visuren.html#inline-boxes | ||
class InlineReplacedBox : | ||
public ReplacedBox, | ||
public AtomicInlineLevelBox { | ||
}; | ||
|
||
} // namespace Web::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include "box.h" | ||
|
||
namespace Web::Render { | ||
|
||
} // namespace Web::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include "box.h" | ||
|
||
namespace Web::Render { | ||
|
||
} // namespace Web::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "https://schemas.cute.engineering/stable/cutekit.manifest.component.v1", | ||
"id": "web-render", | ||
"type": "lib", | ||
"description": "Implementation of the CSS Visual Formatting Model (https://www.w3.org/TR/CSS22/visuren.html)", | ||
"requires": [ | ||
"karm-math", | ||
"karm-layout", | ||
"karm-gfx", | ||
"web-dom", | ||
"web-css" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include "box.h" | ||
|
||
namespace Web::Render { | ||
|
||
} // namespace Web::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include "box.h" | ||
|
||
namespace Web::Render { | ||
|
||
} // namespace Web::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include "box.h" | ||
|
||
namespace Web::Render { | ||
|
||
// 17.2.1 MARK: Anonymous table objects | ||
// https://www.w3.org/TR/CSS22/tables.html#anonymous-boxes | ||
|
||
} // namespace Web::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters