Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Dec 2, 2024
1 parent 6853cb4 commit a543eec
Showing 1 changed file with 34 additions and 27 deletions.
61 changes: 34 additions & 27 deletions src/web/vaev-base/page.h
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
#pragma once

#include <karm-base/opt.h>

namespace Vaev {

// https://drafts.csswg.org/css-page/#marks
enum struct PageMarks {
NONE,
CROSS,
BOX,

_LEN,
};

// https://drafts.csswg.org/css-page/#margin-boxes
enum struct PageMargin {
NONE,
#define FOREACH_PAGE_MARGIN(ITER) \
ITER(TOP, "top") \
ITER(TOP_LEFT_CORNER, "top-left-corner") \
ITER(TOP_LEFT, "top-left") \
ITER(TOP_CENTER, "top-center") \
ITER(TOP_RIGHT, "top-right") \
ITER(TOP_RIGHT_CORNER, "top-right-corner") \
ITER(RIGHT, "right") \
ITER(RIGHT_TOP, "right-top") \
ITER(RIGHT_MIDDLE, "right-middle") \
ITER(RIGHT_BOTTOM, "right-bottom") \
ITER(BOTTOM, "bottom") \
ITER(BOTTOM_RIGHT_CORNER, "bottom-right-corner") \
ITER(BOTTOM_RIGHT, "bottom-right") \
ITER(BOTTOM_CENTER, "bottom-center") \
ITER(BOTTOM_LEFT, "bottom-left") \
ITER(BOTTOM_LEFT_CORNER, "bottom-left-corner") \
ITER(LEFT, "left") \
ITER(LEFT_BOTTOM, "left-bottom") \
ITER(LEFT_MIDDLE, "left-middle") \
ITER(LEFT_TOP, "left-top")

TOP, // NOSPEC: Parent of top-left, top-center, and top-right
TOP_LEFT_CORNER,
TOP_LEFT,
TOP_CENTER,
TOP_RIGHT,
TOP_RIGHT_CORNER,

RIGHT, // NOSPEC: Parent of top-right, right-middle, and right-bottom
RIGHT_TOP,
RIGHT_MIDDLE,
RIGHT_BOTTOM,

BOTTOM, // NOSPEC: Parent of bottom-left, bottom-center, and bottom-right
BOTTOM_RIGHT_CORNER,
BOTTOM_RIGHT,
BOTTOM_CENTER,
BOTTOM_LEFT,
BOTTOM_LEFT_CORNER,

LEFT, // NOSPEC: Parent of bottom-left, left-middle, and left-top
LEFT_BOTTOM,
LEFT_MIDDLE,
LEFT_TOP,

_LEN,
enum struct PageMargin {
#define ITER(ID, ...) ID,
FOREACH_PAGE_MARGIN(ITER)
#undef ITER
_LEN,
};

// https://drafts.csswg.org/css-page/#page-orientation-prop
Expand All @@ -49,4 +52,8 @@ enum struct PageOrientation {
_LEN
};

struct Page {
Opt<PageMargin> margin;
};

} // namespace Vaev

0 comments on commit a543eec

Please sign in to comment.