!48999 【js】button FA模型涉及代回退

Merge pull request !48999 from yyuanche/FA_revert
This commit is contained in:
openharmony_ci 2024-11-20 09:51:10 +00:00 committed by Gitee
commit ce9d2661ef
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 60 additions and 39 deletions

View File

@ -35,20 +35,26 @@
#include "frameworks/bridge/declarative_frontend/view_stack_processor.h"
namespace OHOS::Ace {
std::unique_ptr<ButtonModel> ButtonModel::instance_ = nullptr;
std::mutex ButtonModel::mutex_;
ButtonModel* ButtonModel::GetInstance()
{
if (!instance_) {
std::lock_guard<std::mutex> lock(mutex_);
if (!instance_) {
#ifdef NG_BUILD
static NG::ButtonModelNG instance;
return &instance;
instance_.reset(new NG::ButtonModelNG());
#else
if (Container::IsCurrentUseNewPipeline()) {
static NG::ButtonModelNG instance;
return &instance;
} else {
static Framework::ButtonModelImpl instance;
return &instance;
}
if (Container::IsCurrentUseNewPipeline()) {
instance_.reset(new NG::ButtonModelNG());
} else {
instance_.reset(new Framework::ButtonModelImpl());
}
#endif
}
}
return instance_.get();
}
} // namespace OHOS::Ace

View File

@ -32,26 +32,30 @@
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/checkbox/checkbox_model_ng.h"
#include "core/components_v2/inspector/inspector_constants.h"
namespace OHOS::Ace {
namespace {
constexpr float CHECK_BOX_MARK_SIZE_INVALID_VALUE = -1.0f;
}
std::unique_ptr<CheckBoxModel> CheckBoxModel::instance_ = nullptr;
std::mutex CheckBoxModel::mutex_;
CheckBoxModel* CheckBoxModel::GetInstance()
{
if (!instance_) {
std::lock_guard<std::mutex> lock(mutex_);
if (!instance_) {
#ifdef NG_BUILD
static NG::CheckBoxModelNG instance;
return &instance;
instance_.reset(new NG::CheckBoxModelNG());
#else
if (Container::IsCurrentUseNewPipeline()) {
static NG::CheckBoxModelNG instance;
return &instance;
} else {
static Framework::CheckBoxModelImpl instance;
return &instance;
}
if (Container::IsCurrentUseNewPipeline()) {
instance_.reset(new NG::CheckBoxModelNG());
} else {
instance_.reset(new Framework::CheckBoxModelImpl());
}
#endif
}
}
return instance_.get();
}
} // namespace OHOS::Ace

View File

@ -32,6 +32,9 @@
namespace OHOS::Ace {
std::unique_ptr<RadioModel> RadioModel::instance_ = nullptr;
std::mutex RadioModel::mutex_;
enum class RadioIndicatorType {
TICK = 0,
DOT,
@ -40,18 +43,21 @@ enum class RadioIndicatorType {
RadioModel* RadioModel::GetInstance()
{
if (!instance_) {
std::lock_guard<std::mutex> lock(mutex_);
if (!instance_) {
#ifdef NG_BUILD
static NG::RadioModelNG instance;
return &instance;
instance_.reset(new NG::RadioModelNG());
#else
if (Container::IsCurrentUseNewPipeline()) {
static NG::RadioModelNG instance;
return &instance;
} else {
static Framework::RadioModelImpl instance;
return &instance;
}
if (Container::IsCurrentUseNewPipeline()) {
instance_.reset(new NG::RadioModelNG());
} else {
instance_.reset(new Framework::RadioModelImpl());
}
#endif
}
}
return instance_.get();
}
} // namespace OHOS::Ace

View File

@ -22,20 +22,26 @@
namespace OHOS::Ace {
std::unique_ptr<RatingModel> RatingModel::instance_ = nullptr;
std::mutex RatingModel::mutex_;
RatingModel* RatingModel::GetInstance()
{
if (!instance_) {
std::lock_guard<std::mutex> lock(mutex_);
if (!instance_) {
#ifdef NG_BUILD
static NG::RatingModelNG instance;
return &instance;
instance_.reset(new NG::RatingModelNG());
#else
if (Container::IsCurrentUseNewPipeline()) {
static NG::RatingModelNG instance;
return &instance;
} else {
static Framework::RatingModelImpl instance;
return &instance;
}
if (Container::IsCurrentUseNewPipeline()) {
instance_.reset(new NG::RatingModelNG());
} else {
instance_.reset(new Framework::RatingModelImpl());
}
#endif
}
}
return instance_.get();
}
} // namespace OHOS::Ace

View File

@ -293,8 +293,7 @@ void ButtonModelImpl::SetSize(const std::optional<Dimension>& width, const std::
{
if (width.has_value()) {
SetWidth(width.value());
}
if (height.has_value()) {
} else {
SetHeight(height.value());
}
}