mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
!5413 [UI组件重构]添加CommonView节点
Merge pull request !5413 from yangfan229/common1009
This commit is contained in:
commit
626d1ffba4
@ -16,11 +16,16 @@
|
||||
#include "frameworks/bridge/declarative_frontend/jsview/js_common_view.h"
|
||||
|
||||
#include "core/components/proxy/proxy_component.h"
|
||||
#include "core/components_ng/pattern/common_view/common_view.h"
|
||||
#include "frameworks/bridge/declarative_frontend/view_stack_processor.h"
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
void JSCommonView::Create(const JSCallbackInfo& info)
|
||||
{
|
||||
if (Container::IsCurrentUseNewPipeline()) {
|
||||
NG::CommonView::Create();
|
||||
return;
|
||||
}
|
||||
auto specializedBox = AceType::MakeRefPtr<OHOS::Ace::ProxyComponent>();
|
||||
specializedBox->SetPassMinSize(false);
|
||||
ViewStackProcessor::GetInstance()->Push(specializedBox);
|
||||
|
@ -45,6 +45,7 @@ build_component_ng("pattern_ng") {
|
||||
"checkboxgroup/checkboxgroup_paint_method.cpp",
|
||||
"checkboxgroup/checkboxgroup_pattern.cpp",
|
||||
"checkboxgroup/checkboxgroup_view.cpp",
|
||||
"common_view/common_view.cpp",
|
||||
"container_modal/container_modal_pattern.cpp",
|
||||
"container_modal/container_modal_view.cpp",
|
||||
"counter/counter_node.cpp",
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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.
|
||||
*/
|
||||
|
||||
#include "core/components_ng/pattern/common_view/common_view.h"
|
||||
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/memory/referenced.h"
|
||||
#include "core/components/common/layout/constants.h"
|
||||
#include "core/components_ng/base/frame_node.h"
|
||||
#include "core/components_ng/base/view_stack_processor.h"
|
||||
#include "core/components_ng/layout/box_layout_algorithm.h"
|
||||
#include "core/components_ng/pattern/blank/blank_view.h"
|
||||
#include "core/components_ng/pattern/common_view/common_view_pattern.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/pipeline/base/element_register.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
void CommonView::Create()
|
||||
{
|
||||
auto* stack = ViewStackProcessor::GetInstance();
|
||||
int32_t nodeId = stack->ClaimNodeId();
|
||||
auto blankNode = FrameNode::GetOrCreateFrameNode(
|
||||
V2::COMMON_VIEW_ETS_TAG, nodeId, []() { return AceType::MakeRefPtr<CommonViewPattern>(); });
|
||||
stack->Push(blankNode);
|
||||
}
|
||||
|
||||
} // namespace OHOS::Ace::NG
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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_COMMON_VIEW_COMMON_VIEW_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_COMMON_VIEW_COMMON_VIEW_H
|
||||
|
||||
#include "base/memory/referenced.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
class ACE_EXPORT CommonView {
|
||||
public:
|
||||
static void Create();
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_COMMON_VIEW_COMMON_VIEW_H
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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_COMMON_VIEW_COMMON_VIEW_PATTERN_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_COMMON_VIEW_COMMON_VIEW_PATTERN_H
|
||||
|
||||
#include "base/memory/referenced.h"
|
||||
#include "core/components_ng/base/ui_node.h"
|
||||
#include "core/components_ng/pattern/pattern.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
class CommonViewPattern : public Pattern {
|
||||
DECLARE_ACE_TYPE(CommonViewPattern, Pattern);
|
||||
|
||||
public:
|
||||
CommonViewPattern() = default;
|
||||
~CommonViewPattern() override = default;
|
||||
bool IsAtomicNode() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_COMMON_VIEW_COMMON_VIEW_PATTERN_H
|
@ -635,7 +635,7 @@ void FlexLayoutAlgorithm::AdjustTotalAllocatedSize(LayoutWrapper* layoutWrapper)
|
||||
{
|
||||
const auto& children = layoutWrapper->GetAllChildrenWithBuild();
|
||||
if (children.empty()) {
|
||||
LOGE("FlexLayoutAlgorithm::GetTotalAllocatedSize, children is empty");
|
||||
LOGD("FlexLayoutAlgorithm::GetTotalAllocatedSize, children is empty");
|
||||
allocatedSize_ = 0.0f;
|
||||
return;
|
||||
}
|
||||
@ -659,7 +659,7 @@ void FlexLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
|
||||
{
|
||||
const auto& children = layoutWrapper->GetAllChildrenWithBuild();
|
||||
if (children.empty()) {
|
||||
LOGE("FlexLayoutAlgorithm::Layout, children is empty");
|
||||
LOGD("FlexLayoutAlgorithm::Layout, children is empty");
|
||||
return;
|
||||
}
|
||||
auto contentSize = layoutWrapper->GetGeometryNode()->GetFrameSize();
|
||||
|
@ -220,6 +220,8 @@ const char BLANK_ETS_TAG[] = "Blank";
|
||||
ACE_EXPORT extern const char BUTTON_COMPONENT_TAG[] = "ButtonComponent";
|
||||
ACE_EXPORT extern const char BUTTON_ETS_TAG[] = "Button";
|
||||
|
||||
// common view
|
||||
const char COMMON_VIEW_ETS_TAG[] = "__Common__";
|
||||
// option
|
||||
ACE_EXPORT extern const char OPTION_COMPONENT_TAG[] = "OptionComponent";
|
||||
ACE_EXPORT extern const char OPTION_ETS_TAG[] = "Option";
|
||||
|
@ -228,6 +228,8 @@ ACE_EXPORT extern const char BLANK_ETS_TAG[];
|
||||
ACE_EXPORT extern const char BUTTON_COMPONENT_TAG[];
|
||||
ACE_EXPORT extern const char BUTTON_ETS_TAG[];
|
||||
|
||||
// common
|
||||
ACE_EXPORT extern const char COMMON_VIEW_ETS_TAG[];
|
||||
// option
|
||||
ACE_EXPORT extern const char OPTION_COMPONENT_TAG[];
|
||||
ACE_EXPORT extern const char OPTION_ETS_TAG[];
|
||||
|
Loading…
Reference in New Issue
Block a user