!22117 修复blank的constraintSize的单位问题

Merge pull request !22117 from liyujie/master
This commit is contained in:
openharmony_ci 2023-11-21 10:01:06 +00:00 committed by Gitee
commit ce82536bdd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 9 additions and 7 deletions

View File

@ -15,6 +15,7 @@
#include "frameworks/bridge/declarative_frontend/jsview/js_blank.h"
#include "base/geometry/dimension.h"
#include "core/components/common/properties/color.h"
#include "core/components_ng/pattern/blank/blank_model_ng.h"
#include "frameworks/bridge/declarative_frontend/jsview/models/blank_model_impl.h"
@ -47,7 +48,7 @@ BlankModel* BlankModel::GetInstance()
namespace OHOS::Ace::Framework {
void JSBlank::Create(const JSCallbackInfo& info)
{
CalcDimension blankMin;
CalcDimension blankMin(0.0, DimensionUnit::VP);
BlankModel::GetInstance()->Create();
if (info[0]->IsUndefined()) {
BlankModel::GetInstance()->SetBlankMin(blankMin);

View File

@ -15,6 +15,7 @@
#include "core/components_ng/pattern/blank/blank_model_ng.h"
#include "base/geometry/dimension.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "core/common/container.h"
@ -55,7 +56,7 @@ void BlankModelNG::SetBlankMin(const Dimension& blankMin)
CHECK_NULL_VOID(layoutProperty);
auto result = blankMin;
if (blankMin.IsNegative()) {
result = Dimension();
result = Dimension(0.0, DimensionUnit::VP);
}
ACE_UPDATE_LAYOUT_PROPERTY(BlankLayoutProperty, MinSize, result);
if (Container::LessThanAPIVersion(PlatformVersion::VERSION_TEN)) {

View File

@ -85,7 +85,7 @@ void BlankPattern::BeforeCreateLayoutWrapper()
if (Container::LessThanAPIVersion(PlatformVersion::VERSION_TEN)) {
return;
}
auto& calcConstraint = layoutProp->GetCalcLayoutConstraint();
const auto& calcConstraint = layoutProp->GetCalcLayoutConstraint();
auto isParentRow = GetFlexDirection(parent) == FlexDirection::ROW;
layoutProp->ResetAlignSelf();
layoutProp->ResetFlexGrow();
@ -108,7 +108,7 @@ void BlankPattern::BeforeCreateLayoutWrapper()
layoutProp->UpdateFlexShrink(1.0f);
}
CHECK_NULL_VOID(layoutProp->GetMinSize().has_value());
auto blankMin = layoutProp->GetMinSize().value_or(Dimension());
auto blankMin = layoutProp->GetMinSize().value_or(Dimension(0.0, DimensionUnit::VP));
if (isParentRow) {
if (!(calcConstraint && calcConstraint->minSize.has_value() &&
calcConstraint->minSize.value().Width().has_value())) {

View File

@ -47,10 +47,10 @@
#include "core/components_ng/event/focus_hub.h"
#include "core/components_ng/image_provider/image_loading_context.h"
#include "core/components_ng/pattern/overlay/modal_style.h"
#include "core/components_ng/pattern/stage/page_pattern.h"
#include "core/components_ng/pattern/search/search_event_hub.h"
#include "core/components_ng/pattern/search/search_pattern.h"
#include "core/components_ng/pattern/select_overlay/select_overlay_property.h"
#include "core/components_ng/pattern/stage/page_pattern.h"
#include "core/components_ng/pattern/text/text_base.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "core/components_ng/pattern/text/text_styles.h"
@ -1877,8 +1877,8 @@ void TextFieldPattern::FilterInitializeText()
if (!contentController_->IsEmpty()) {
contentController_->FilterValue();
}
if (GetWideText().length() < GetCaretIndex()) {
selectController_->UpdateCaretIndex(GetWideText().length());
if (static_cast<int32_t>(GetWideText().length()) < GetCaretIndex()) {
selectController_->UpdateCaretIndex(static_cast<int32_t>(GetWideText().length()));
}
}