Expose box sizing getters and setters in Yoga (#1701)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1701

X-link: https://github.com/facebook/react-native/pull/46630

I would like to write some tests for box sizing that will drive a lot of my development as I implement content box. To do that, I need this publicly exposed. Obviously not that ideal since this currently does not do anything. Maybe we can name the value in such a way that its clear it is in development?

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63135970

fbshipit-source-id: 7520823bf925364eae45341531e012e80ec92284
This commit is contained in:
Joe Vilches
2024-09-25 15:46:55 -07:00
committed by Facebook GitHub Bot
parent 6212e561ad
commit 43d920eab0
18 changed files with 161 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
#include <yoga/algorithm/FlexDirection.h>
#include <yoga/enums/Align.h>
#include <yoga/enums/BoxSizing.h>
#include <yoga/enums/Dimension.h>
#include <yoga/enums/Direction.h>
#include <yoga/enums/Display.h>
@@ -206,6 +207,13 @@ class YG_EXPORT Style {
value == 0.0f || std::isinf(value.unwrap()) ? FloatOptional{} : value);
}
BoxSizing boxSizing() const {
return boxSizing_;
}
void setBoxSizing(BoxSizing value) {
boxSizing_ = value;
}
bool horizontalInsetsDefined() const {
return position_[yoga::to_underlying(Edge::Left)].isDefined() ||
position_[yoga::to_underlying(Edge::Right)].isDefined() ||
@@ -675,6 +683,7 @@ class YG_EXPORT Style {
Wrap flexWrap_ : bitCount<Wrap>() = Wrap::NoWrap;
Overflow overflow_ : bitCount<Overflow>() = Overflow::Visible;
Display display_ : bitCount<Display>() = Display::Flex;
BoxSizing boxSizing_ : bitCount<BoxSizing>() = BoxSizing::BorderBox;
StyleValueHandle flex_{};
StyleValueHandle flexGrow_{};