2019-06-06 19:36:56 -07:00
|
|
|
/*
|
2022-10-04 13:59:32 -07:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-03-28 10:28:53 -07:00
|
|
|
*
|
2019-10-15 10:30:08 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-03-28 10:28:53 -07:00
|
|
|
*/
|
2019-10-15 10:30:08 -07:00
|
|
|
|
2017-03-28 10:28:53 -07:00
|
|
|
#include <yoga/Yoga.h>
|
|
|
|
|
|
|
|
#include "./Config.hh"
|
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
/* static */ Config* Config::create(void) {
|
|
|
|
return new Config();
|
2017-03-28 10:28:53 -07:00
|
|
|
}
|
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
/* static */ void Config::destroy(Config* node) {
|
|
|
|
delete node;
|
2017-03-28 10:28:53 -07:00
|
|
|
}
|
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
Config::Config(void) : m_config(YGConfigNew()) {}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
Config::~Config(void) {
|
|
|
|
YGConfigFree(m_config);
|
2017-03-28 10:28:53 -07:00
|
|
|
}
|
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
void Config::setExperimentalFeatureEnabled(int feature, bool enabled) {
|
|
|
|
YGConfigSetExperimentalFeatureEnabled(
|
|
|
|
m_config, static_cast<YGExperimentalFeature>(feature), enabled);
|
2017-03-28 10:28:53 -07:00
|
|
|
}
|
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
void Config::setPointScaleFactor(float pixelsInPoint) {
|
|
|
|
YGConfigSetPointScaleFactor(m_config, pixelsInPoint);
|
2017-11-27 04:55:17 -08:00
|
|
|
}
|
|
|
|
|
2022-12-28 01:27:12 -08:00
|
|
|
void Config::setUseLegacyStretchBehaviour(bool useLegacyStretchBehaviour) {
|
|
|
|
YGConfigSetUseLegacyStretchBehaviour(m_config, useLegacyStretchBehaviour);
|
|
|
|
}
|
|
|
|
|
2023-04-27 13:53:45 -07:00
|
|
|
void Config::setErrata(int errata) {
|
|
|
|
YGConfigSetErrata(m_config, static_cast<YGErrata>(errata));
|
|
|
|
}
|
|
|
|
|
2022-12-28 01:27:12 -08:00
|
|
|
void Config::setUseWebDefaults(bool useWebDefaults) {
|
|
|
|
YGConfigSetUseWebDefaults(m_config, useWebDefaults);
|
|
|
|
}
|
|
|
|
|
2019-03-25 05:37:36 -07:00
|
|
|
bool Config::isExperimentalFeatureEnabled(int feature) const {
|
|
|
|
return YGConfigIsExperimentalFeatureEnabled(
|
|
|
|
m_config, static_cast<YGExperimentalFeature>(feature));
|
2017-03-28 10:28:53 -07:00
|
|
|
}
|
2022-12-28 01:27:12 -08:00
|
|
|
|
2023-04-27 13:53:45 -07:00
|
|
|
bool Config::useLegacyStretchBehaviour() const {
|
2022-12-28 01:27:12 -08:00
|
|
|
return YGConfigGetUseLegacyStretchBehaviour(m_config);
|
|
|
|
}
|
|
|
|
|
2023-04-27 13:53:45 -07:00
|
|
|
int Config::getErrata() const {
|
|
|
|
return static_cast<int>(YGConfigGetErrata(m_config));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Config::useWebDefaults() const {
|
2022-12-28 01:27:12 -08:00
|
|
|
return YGConfigGetUseWebDefaults(m_config);
|
|
|
|
}
|