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

View File

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

View File

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

View File

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

View File

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