mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
!48689 修复option打开2次text文本长度发生变化的问题
Merge pull request !48689 from FredTT/temp1116
This commit is contained in:
commit
3e1a891f33
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OPTION_OPTION_ROW_PATTERN_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OPTION_OPTION_ROW_PATTERN_H
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
class ACE_EXPORT OptionRowLayoutAlgorithm : public LinearLayoutAlgorithm {
|
||||
DECLARE_ACE_TYPE(OptionRowLayoutAlgorithm, LinearLayoutAlgorithm);
|
||||
|
||||
public:
|
||||
OptionRowLayoutAlgorithm() = default;
|
||||
~OptionRowLayoutAlgorithm() override = default;
|
||||
|
||||
void Measure(LayoutWrapper* layoutWrapper) override {};
|
||||
|
||||
ACE_DISALLOW_COPY_AND_MOVE(OptionRowLayoutAlgorithm);
|
||||
};
|
||||
|
||||
class OptionRowPattern : public LinearLayoutPattern {
|
||||
DECLARE_ACE_TYPE(OptionRowPattern, LinearLayoutPattern);
|
||||
|
||||
public:
|
||||
OptionRowPattern() : LinearLayoutPattern(false) {};
|
||||
~OptionRowPattern() override = default;
|
||||
|
||||
RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override
|
||||
{
|
||||
return MakeRefPtr<OptionRowLayoutAlgorithm>();
|
||||
}
|
||||
|
||||
ACE_DISALLOW_COPY_AND_MOVE(OptionRowPattern);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OPTION_OPTION_PATTERN_H
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "base/i18n/localization.h"
|
||||
#include "core/components_ng/pattern/menu/menu_item/menu_item_pattern.h"
|
||||
#include "core/components_ng/pattern/option/option_row_pattern.h"
|
||||
#include "core/components_ng/pattern/security_component/paste_button/paste_button_common.h"
|
||||
#include "core/components_ng/pattern/security_component/paste_button/paste_button_model_ng.h"
|
||||
#include "core/components_ng/pattern/security_component/security_component_pattern.h"
|
||||
@ -248,7 +249,7 @@ RefPtr<FrameNode> OptionView::CreateMenuOption(bool optionsHasIcon, std::vector<
|
||||
auto option = Create(index);
|
||||
CHECK_NULL_RETURN(option, nullptr);
|
||||
auto row = FrameNode::CreateFrameNode(V2::ROW_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
AceType::MakeRefPtr<LinearLayoutPattern>(false));
|
||||
AceType::MakeRefPtr<OptionRowPattern>());
|
||||
|
||||
#ifdef OHOS_PLATFORM
|
||||
constexpr char BUTTON_PASTE[] = "textoverlay.paste";
|
||||
@ -269,7 +270,7 @@ RefPtr<FrameNode> OptionView::CreateMenuOption(bool optionsHasIcon, const Option
|
||||
auto option = Create(index);
|
||||
CHECK_NULL_RETURN(option, nullptr);
|
||||
auto row = FrameNode::CreateFrameNode(V2::ROW_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
AceType::MakeRefPtr<LinearLayoutPattern>(false));
|
||||
AceType::MakeRefPtr<OptionRowPattern>());
|
||||
|
||||
#ifdef OHOS_PLATFORM
|
||||
constexpr char BUTTON_PASTE[] = "textoverlay.paste";
|
||||
@ -289,7 +290,7 @@ RefPtr<FrameNode> OptionView::CreateSelectOption(const SelectParam& param, int32
|
||||
LOGI("create option value = %s", param.text.c_str());
|
||||
auto option = Create(index);
|
||||
auto row = FrameNode::CreateFrameNode(V2::ROW_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
AceType::MakeRefPtr<LinearLayoutPattern>(false));
|
||||
AceType::MakeRefPtr<OptionRowPattern>());
|
||||
row->MountToParent(option);
|
||||
|
||||
auto pattern = option->GetPattern<MenuItemPattern>();
|
||||
|
Loading…
Reference in New Issue
Block a user