Add hasErrata(), addErrata(), removeErrata()

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

Adds internal helpers to YGConfig to make bit manipulation more readable. We also expose `hasErrata()` to YGNode beacuse checking that will be a common pattern. We intentionally don't add mutating functions to the node, since current model is to inval a node on commiting whole config.

This is not exposed via the C ABI.

Reviewed By: yungsters

Differential Revision: D45765971

fbshipit-source-id: eadaee4b9cf5204ac4984ecc52cc08650d144a30
This commit is contained in:
Nick Gerleman
2023-05-11 05:30:57 -07:00
committed by Facebook GitHub Bot
parent 3b088c3383
commit 9e1b14cd9e
4 changed files with 21 additions and 4 deletions

View File

@@ -59,10 +59,22 @@ void YGConfig::setErrata(YGErrata errata) {
errata_ = errata;
}
void YGConfig::addErrata(YGErrata errata) {
errata_ |= errata;
}
void YGConfig::removeErrata(YGErrata errata) {
errata_ &= (~errata);
}
YGErrata YGConfig::getErrata() const {
return errata_;
}
bool YGConfig::hasErrata(YGErrata errata) const {
return (errata_ & errata) != YGErrataNone;
}
void YGConfig::setPointScaleFactor(float pointScaleFactor) {
pointScaleFactor_ = pointScaleFactor;
}