Skip to content

Commit 67de658

Browse files
committed
vaev-engine: Expose padding, radii, size computation API as public.
1 parent ce676c7 commit 67de658

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/vaev-engine/layout/layout-impl.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ InsetsAu computeBorders(Tree& tree, Box& box) {
8989
return res;
9090
}
9191

92-
static InsetsAu _computePaddings(Tree& tree, Box& box, Vec2Au containingBlock) {
92+
InsetsAu computePaddings(Tree& tree, Box& box, Vec2Au containingBlock) {
9393
InsetsAu res;
9494
auto padding = box.style->padding;
9595

@@ -101,7 +101,7 @@ static InsetsAu _computePaddings(Tree& tree, Box& box, Vec2Au containingBlock) {
101101
return res;
102102
}
103103

104-
static Math::Radii<Au> _computeRadii(Tree& tree, Box& box, Vec2Au size) {
104+
Math::Radii<Au> computeRadii(Tree& tree, Box& box, Vec2Au size) {
105105
auto radii = box.style->borders->radii;
106106
Math::Radii<Au> res;
107107

@@ -123,7 +123,7 @@ Vec2Au computeIntrinsicSize(Tree& tree, Box& box, IntrinsicSize intrinsic, Vec2A
123123
}
124124

125125
auto borders = computeBorders(tree, box);
126-
auto padding = _computePaddings(tree, box, containingBlock);
126+
auto padding = computePaddings(tree, box, containingBlock);
127127

128128
auto output = _contentLayout(
129129
tree,
@@ -138,7 +138,7 @@ Vec2Au computeIntrinsicSize(Tree& tree, Box& box, IntrinsicSize intrinsic, Vec2A
138138
return output.size + padding.all() + borders.all();
139139
}
140140

141-
static Opt<Au> _computeSpecifiedSize(Tree& tree, Box& box, Size size, Vec2Au containingBlock, bool isWidth) {
141+
Opt<Au> computeSpecifiedSize(Tree& tree, Box& box, Size size, Vec2Au containingBlock, bool isWidth) {
142142
if (size.is<Keywords::MinContent>()) {
143143
auto intrinsicSize = computeIntrinsicSize(tree, box, IntrinsicSize::MIN_CONTENT, containingBlock);
144144
return isWidth ? Opt<Au>{intrinsicSize.x} : Opt<Au>{NONE};
@@ -202,12 +202,12 @@ void fillKnownSizeWithSpecifiedSizeIfEmpty(Tree& tree, Box& box, Input& input) {
202202
auto sizing = box.style->sizing;
203203

204204
if (input.knownSize.width == NONE) {
205-
auto specifiedWidth = _computeSpecifiedSize(tree, box, sizing->width, input.containingBlock, true);
205+
auto specifiedWidth = computeSpecifiedSize(tree, box, sizing->width, input.containingBlock, true);
206206
input.knownSize.width = specifiedWidth;
207207
}
208208

209209
if (input.knownSize.height == NONE) {
210-
auto specifiedHeight = _computeSpecifiedSize(tree, box, sizing->height, input.containingBlock, false);
210+
auto specifiedHeight = computeSpecifiedSize(tree, box, sizing->height, input.containingBlock, false);
211211
input.knownSize.height = specifiedHeight;
212212
}
213213
}
@@ -218,7 +218,7 @@ Output layout(Tree& tree, Box& box, Input input) {
218218
fillKnownSizeWithSpecifiedSizeIfEmpty(tree, box, input);
219219

220220
auto borders = computeBorders(tree, box);
221-
auto padding = _computePaddings(tree, box, input.containingBlock);
221+
auto padding = computePaddings(tree, box, input.containingBlock);
222222

223223
input.knownSize.width = input.knownSize.width.map([&](auto s) {
224224
return max(0_au, s - padding.horizontal() - borders.horizontal());
@@ -310,7 +310,7 @@ Output layout(Tree& tree, Box& box, Input input) {
310310
currFrag.metrics.borderSize = size;
311311
currFrag.metrics.padding = padding;
312312
currFrag.metrics.borders = borders;
313-
currFrag.metrics.radii = _computeRadii(tree, box, size);
313+
currFrag.metrics.radii = computeRadii(tree, box, size);
314314
currFrag.metrics.outlineOffset = resolve(tree, box, box.style->outline->offset);
315315
currFrag.metrics.outlineWidth = resolve(tree, box, box.style->outline->width);
316316

src/vaev-engine/layout/layout.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export InsetsAu computeMargins(Tree& tree, Box& box, Input input);
1212

1313
export InsetsAu computeBorders(Tree& tree, Box& box);
1414

15+
export InsetsAu computePaddings(Tree& tree, Box& box, Vec2Au containingBlock);
16+
17+
export Math::Radii<Au> computeRadii(Tree& tree, Box& box, Vec2Au size);
18+
19+
export Opt<Au> computeSpecifiedSize(Tree& tree, Box& box, Size size, Vec2Au containingBlock, bool isWidth);
20+
1521
export Vec2Au computeIntrinsicSize(Tree& tree, Box& box, IntrinsicSize intrinsic, Vec2Au containingBlock);
1622

1723
export Output layout(Tree& tree, Box& box, Input input);

0 commit comments

Comments
 (0)