diff --git a/frameworks/core/interfaces/arkoala/arkoala_api.h b/frameworks/core/interfaces/arkoala/arkoala_api.h index 1637c85c21ff84aaea487d53cff625369a8d11ee..2f4f4444cb0accbacc2cd2dafcf52d72eaf9d74e 100644 --- a/frameworks/core/interfaces/arkoala/arkoala_api.h +++ b/frameworks/core/interfaces/arkoala/arkoala_api.h @@ -32,7 +32,7 @@ extern "C" { #define ARKUI_NODE_API_VERSION 112 #define ARKUI_BASIC_API_VERSION 8 -#define ARKUI_EXTENDED_API_VERSION 7 +#define ARKUI_EXTENDED_API_VERSION 8 #define ARKUI_NODE_GRAPHICS_API_VERSION 5 #define ARKUI_NODE_MODIFIERS_API_VERSION 7 #define ARKUI_AUTO_GENERATE_NODE_ID (-2) @@ -55,6 +55,7 @@ typedef const char* ArkUI_CharPtr; // Several opaque struct declarations. struct _ArkUIVMContext; +struct _ArkUIPipelineContext; struct _ArkUIVMObject; struct _ArkUINode; struct _ArkUICanvas; @@ -70,6 +71,7 @@ struct ArkUI_ListChildrenMainSize; typedef _ArkUINode* ArkUINodeHandle; typedef _ArkUIVMContext* ArkUIVMContext; +typedef _ArkUIPipelineContext* ArkUIPipelineContext; typedef _ArkUIVMObject* ArkUIVMObject; typedef _ArkUICanvas* ArkUICanvasHandle; typedef _ArkUIPaint* ArkUIPaintHandle; @@ -4543,8 +4545,9 @@ struct ArkUIExtendedNodeAPI { void (*setRangeUpdater)(ArkUINodeHandle node, ArkUI_Int32 updaterId); void (*setLazyItemIndexer)(ArkUIVMContext vmContext, ArkUINodeHandle node, ArkUI_Int32 indexerId); /// Vsync support. - ArkUI_Int32 (*setVsyncCallback)(ArkUIVMContext vmContext, ArkUI_Int32 device, ArkUI_Int32 callbackId); - void (*unblockVsyncWait)(ArkUIVMContext vmContext, ArkUI_Int32 device); + ArkUIPipelineContext (*getPipelineContext)(ArkUINodeHandle node); + void (*setVsyncCallback)(ArkUIVMContext vmContext, ArkUIPipelineContext pipelineContext, ArkUI_Int32 callbackId); + void (*unblockVsyncWait)(ArkUIVMContext vmContext, ArkUIPipelineContext pipelineContext); /// Events. /** * Returns != 0 if an event was received, diff --git a/frameworks/core/interfaces/native/node/node_api.cpp b/frameworks/core/interfaces/native/node/node_api.cpp index be286088c5d74c4ecfd3898f66bbf04a315bf15d..44449da9d2b08ff773e0f42fea279bd34c33876a 100644 --- a/frameworks/core/interfaces/native/node/node_api.cpp +++ b/frameworks/core/interfaces/native/node/node_api.cpp @@ -721,23 +721,29 @@ ArkUIAPICallbackMethod* GetArkUIAPICallbackMethod() return ViewModel::GetCallbackMethod(); } -int SetVsyncCallback(ArkUIVMContext vmContext, ArkUI_Int32 device, ArkUI_Int32 callbackId) +ArkUIPipelineContext GetPipelineContext(ArkUINodeHandle node) +{ + auto frameNode = reinterpret_cast(node); + return reinterpret_cast(frameNode->GetContext()); +} + +void SetVsyncCallback(ArkUIVMContext vmContext, ArkUIPipelineContext pipelineContext, ArkUI_Int32 callbackId) { static int vsyncCount = 1; auto vsync = [vmContext, callbackId]() { - ArkUIEventCallbackArg args[] = { { vsyncCount++ } }; + ArkUIEventCallbackArg args[] = { {.i32 =vsyncCount++ } }; ArkUIAPICallbackMethod* cbs = GetArkUIAPICallbackMethod(); CHECK_NULL_VOID(vmContext); CHECK_NULL_VOID(cbs); cbs->CallInt(vmContext, callbackId, 1, &args[0]); }; - PipelineContext::GetCurrentContext()->SetVsyncListener(vsync); - return 0; + + reinterpret_cast(pipelineContext)->SetVsyncListener(vsync); } -void UnblockVsyncWait(ArkUIVMContext vmContext, ArkUI_Int32 device) +void UnblockVsyncWait(ArkUIVMContext vmContext, ArkUIPipelineContext pipelineContext) { - PipelineContext::GetCurrentContext()->RequestFrame(); + reinterpret_cast(pipelineContext)->RequestFrame(); } ArkUI_Int32 MeasureNode(ArkUIVMContext vmContext, ArkUINodeHandle node, ArkUI_Float32* data) @@ -1130,6 +1136,7 @@ ArkUIExtendedNodeAPI impl_extended = { nullptr, // indexerChecker nullptr, // setRangeUpdater nullptr, // setLazyItemIndexer + GetPipelineContext, SetVsyncCallback, UnblockVsyncWait, NodeEvent::CheckEvent, diff --git a/frameworks/core/interfaces/native/node/view_model.cpp b/frameworks/core/interfaces/native/node/view_model.cpp index bdebc00371ff362b49c2ece25740cefb1c2047f3..23c58a5b05f0d05f23c1d7362142adde20685a5f 100644 --- a/frameworks/core/interfaces/native/node/view_model.cpp +++ b/frameworks/core/interfaces/native/node/view_model.cpp @@ -259,6 +259,7 @@ void* createComponentRootNode(ArkUI_Int32 nodeId) { auto frameNode = CommonViewModelNG::CreateFrameNode(nodeId); CHECK_NULL_RETURN(frameNode, nullptr); + frameNode->GetLayoutProperty()->UpdateAlignment(Alignment::TOP_LEFT); frameNode->IncRefCount(); TAG_LOGD(AceLogTag::ACE_NATIVE_NODE, "createComponentRootNode: frameNode %{public}p", AceType::RawPtr(frameNode)); return AceType::RawPtr(frameNode); diff --git a/frameworks/core/pipeline_ng/pipeline_context.cpp b/frameworks/core/pipeline_ng/pipeline_context.cpp index 587e90fa86a7a5b7cea2a566b10cb7f4ab6a2439..9c31e14d21d60919ce747f7e49ea6d6107ba4024 100644 --- a/frameworks/core/pipeline_ng/pipeline_context.cpp +++ b/frameworks/core/pipeline_ng/pipeline_context.cpp @@ -1443,10 +1443,16 @@ void PipelineContext::SyncSafeArea(SafeAreaSyncType syncType) syncType == SafeAreaSyncType::SYNC_TYPE_KEYBOARD && !safeAreaManager_->KeyboardSafeAreaEnabled() ? PROPERTY_UPDATE_LAYOUT : PROPERTY_UPDATE_MEASURE); - lastPage->GetPattern()->MarkDirtyOverlay(); + auto overlay = lastPage->GetPattern(); + if (overlay) { + overlay->MarkDirtyOverlay(); + } } if (prevPage) { - prevPage->GetPattern()->MarkDirtyOverlay(); + auto overlay = prevPage->GetPattern(); + if (overlay) { + overlay->MarkDirtyOverlay(); + } } SubwindowManager::GetInstance()->MarkDirtyDialogSafeArea(); if (overlayManager_) {