mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
Merge branch 'master' into button_height
Change-Id: I193a526b1d30dc02b75bcbc259991c09d3b8066e
This commit is contained in:
commit
837c00ca1d
@ -2701,6 +2701,8 @@ frameworks/core/interfaces/native/node/node_content_modifier.cpp @arkuiframework
|
||||
frameworks/core/interfaces/native/node/node_content_modifier.h @arkuiframework
|
||||
frameworks/core/interfaces/native/node/node_date_picker_modifier.cpp @arkuipopupwindow
|
||||
frameworks/core/interfaces/native/node/node_date_picker_modifier.h @arkuipopupwindow
|
||||
frameworks/core/interfaces/native/node/node_drag_modifier.cpp @arkuievent
|
||||
frameworks/core/interfaces/native/node/node_drag_modifier.h @arkuievent
|
||||
frameworks/core/interfaces/native/node/node_folder_stack_modifier.cpp @arkuilayout
|
||||
frameworks/core/interfaces/native/node/node_folder_stack_modifier.h @arkuilayout
|
||||
frameworks/core/interfaces/native/node/node_gesture_modifier.cpp @arkuievent
|
||||
@ -2815,7 +2817,9 @@ frameworks/core/interfaces/native/node/view_model.h @arkuiframework
|
||||
frameworks/core/interfaces/native/node/water_flow_modifier.cpp @arkuiscroll
|
||||
frameworks/core/interfaces/native/node/water_flow_modifier.h @arkuiscroll
|
||||
interfaces/native/BUILD.gn @arkui_architecture
|
||||
interfaces/native/drag_and_drop.h @arkuievent
|
||||
interfaces/native/drawable_descriptor.h @arkui_image
|
||||
interfaces/native/event/drag_and_drop_impl.cpp @arkuievent
|
||||
interfaces/native/event/ui_input_event.cpp @arkuievent
|
||||
interfaces/native/event/ui_input_event_impl.h @arkuievent
|
||||
interfaces/native/libace.ndk.json @arkui_architecture
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "base/image/file_uri_helper.h"
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/common/udmf/unified_data.h"
|
||||
#include "ndk_data_conversion.h"
|
||||
namespace OHOS::Ace {
|
||||
UdmfClient* UdmfClient::GetInstance()
|
||||
{
|
||||
@ -84,6 +85,31 @@ napi_value UdmfClientImpl::TransformUdmfUnifiedData(RefPtr<UnifiedData>& Unified
|
||||
return dataVal;
|
||||
}
|
||||
|
||||
void* UdmfClientImpl::TransformUnifiedDataPtr(RefPtr<UnifiedData>& unifiedDataImpl)
|
||||
{
|
||||
CHECK_NULL_RETURN(unifiedDataImpl, nullptr);
|
||||
std::shared_ptr<UDMF::UnifiedData> unifiedData =
|
||||
AceType::DynamicCast<UnifiedDataImpl>(unifiedDataImpl)->GetUnifiedData();
|
||||
CHECK_NULL_RETURN(unifiedData, nullptr);
|
||||
return unifiedData.get();
|
||||
}
|
||||
|
||||
RefPtr<UnifiedData> UdmfClientImpl::TransformUnifiedDataForNative(void* rawData)
|
||||
{
|
||||
CHECK_NULL_RETURN(rawData, nullptr);
|
||||
auto udData = AceType::MakeRefPtr<UnifiedDataImpl>();
|
||||
auto udmfData = static_cast<OH_UdmfData*>(rawData);
|
||||
CHECK_NULL_RETURN(udmfData, nullptr);
|
||||
auto unifiedData = std::make_shared<UDMF::UnifiedData>();
|
||||
auto status = OHOS::UDMF::NdkDataConversion::GetNativeUnifiedData(udmfData, unifiedData);
|
||||
if (status) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
udData->SetUnifiedData(unifiedData);
|
||||
return udData;
|
||||
}
|
||||
|
||||
napi_value UdmfClientImpl::TransformSummary(std::map<std::string, int64_t>& summary)
|
||||
{
|
||||
auto engine = EngineHelper::GetCurrentEngine();
|
||||
|
@ -31,6 +31,8 @@ class UdmfClientImpl : public UdmfClient {
|
||||
public:
|
||||
RefPtr<UnifiedData> CreateUnifiedData() override;
|
||||
RefPtr<UnifiedData> TransformUnifiedData(napi_value napiValue) override;
|
||||
RefPtr<UnifiedData> TransformUnifiedDataForNative(void* rawData) override;
|
||||
void* TransformUnifiedDataPtr(RefPtr<UnifiedData>& unifiedData) override;
|
||||
napi_value TransformUdmfUnifiedData(RefPtr<UnifiedData>& UnifiedData) override;
|
||||
napi_value TransformSummary(std::map<std::string, int64_t>& summary) override;
|
||||
int32_t SetData(const RefPtr<UnifiedData>& unifiedData, std::string& key) override;
|
||||
|
@ -894,7 +894,7 @@ void AceContainer::InitializeCallback()
|
||||
ContainerScope scope(id);
|
||||
result = context->OnKeyEvent(event);
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUIAceContainerKeyEvent");
|
||||
TaskExecutor::TaskType::UI, "ArkUIAceContainerKeyEvent", PriorityType::VIP);
|
||||
return result;
|
||||
};
|
||||
aceView_->RegisterKeyEventCallback(keyEventCallback);
|
||||
|
@ -115,6 +115,20 @@ Offset GetTouchEventOriginOffset(const TouchEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateMouseEventForPen(const MMI::PointerEvent::PointerItem& pointerItem, MouseEvent& mouseEvent)
|
||||
{
|
||||
if (mouseEvent.sourceType != SourceType::TOUCH || mouseEvent.sourceTool != SourceTool::PEN) {
|
||||
return;
|
||||
}
|
||||
mouseEvent.id = TOUCH_TOOL_BASE_ID + static_cast<int32_t>(mouseEvent.sourceTool);
|
||||
// Pen use type double XY position.
|
||||
mouseEvent.x = pointerItem.GetWindowXPos();
|
||||
mouseEvent.y = pointerItem.GetWindowYPos();
|
||||
mouseEvent.screenX = pointerItem.GetDisplayXPos();
|
||||
mouseEvent.screenY = pointerItem.GetDisplayYPos();
|
||||
mouseEvent.originalId = mouseEvent.id;
|
||||
}
|
||||
|
||||
TouchEvent ConvertTouchEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
|
||||
{
|
||||
int32_t pointerID = pointerEvent->GetPointerId();
|
||||
@ -152,6 +166,7 @@ TouchEvent ConvertTouchEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEv
|
||||
GetEventDevice(orgDevice, event);
|
||||
int32_t orgAction = pointerEvent->GetPointerAction();
|
||||
SetTouchEventType(orgAction, event);
|
||||
event.isPrivacyMode = pointerEvent->HasFlag(OHOS::MMI::InputEvent::EVENT_FLAG_PRIVACY_MODE);
|
||||
UpdateTouchEvent(pointerEvent, event);
|
||||
if (event.sourceType == SourceType::TOUCH && event.sourceTool == SourceTool::PEN) {
|
||||
// Pen use type double XY position.
|
||||
@ -309,6 +324,7 @@ void ConvertMouseEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
|
||||
GetMouseEventButton(orgButton, events);
|
||||
int32_t orgDevice = pointerEvent->GetSourceType();
|
||||
GetEventDevice(orgDevice, events);
|
||||
events.isPrivacyMode = pointerEvent->HasFlag(OHOS::MMI::InputEvent::EVENT_FLAG_PRIVACY_MODE);
|
||||
events.targetDisplayId = pointerEvent->GetTargetDisplayId();
|
||||
events.originalId = item.GetOriginPointerId();
|
||||
events.deviceId = pointerEvent->GetDeviceId();
|
||||
@ -330,15 +346,7 @@ void ConvertMouseEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
|
||||
events.time = TimeStamp(microseconds);
|
||||
events.pointerEvent = pointerEvent;
|
||||
events.sourceTool = GetSourceTool(item.GetToolType());
|
||||
if (events.sourceType == SourceType::TOUCH && events.sourceTool == SourceTool::PEN) {
|
||||
events.id = TOUCH_TOOL_BASE_ID + static_cast<int32_t>(events.sourceTool);
|
||||
// Pen use type double XY position.
|
||||
events.x = item.GetWindowXPos();
|
||||
events.y = item.GetWindowYPos();
|
||||
events.screenX = item.GetDisplayXPos();
|
||||
events.screenY = item.GetDisplayYPos();
|
||||
events.originalId = events.id;
|
||||
}
|
||||
UpdateMouseEventForPen(item, events);
|
||||
events.touchEventId = pointerEvent->GetId();
|
||||
events.pressedKeyCodes_.clear();
|
||||
for (const auto& curCode : pointerEvent->GetPressedKeys()) {
|
||||
|
@ -1993,6 +1993,7 @@ void UIContentImpl::SetBackgroundColor(uint32_t color)
|
||||
auto pipelineContext = container->GetPipelineContext();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
pipelineContext->SetAppBgColor(Color(bgColor));
|
||||
pipelineContext->ChangeDarkModeBrightness();
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUISetAppBackgroundColor");
|
||||
}
|
||||
@ -2207,13 +2208,16 @@ void UIContentImpl::UpdateViewportConfig(const ViewportConfig& config, OHOS::Ros
|
||||
Platform::AceViewOhos::SurfacePositionChanged(aceView, config.Left(), config.Top());
|
||||
if (pipelineContext) {
|
||||
pipelineContext->CheckAndUpdateKeyboardInset();
|
||||
pipelineContext->ChangeDarkModeBrightness();
|
||||
}
|
||||
SubwindowManager::GetInstance()->OnWindowSizeChanged(container->GetInstanceId(),
|
||||
Rect(Offset(config.Left(), config.Top()), Size(config.Width(), config.Height())),
|
||||
static_cast<WindowSizeChangeReason>(reason));
|
||||
};
|
||||
|
||||
auto pipelineContext = container->GetPipelineContext();
|
||||
if (pipelineContext) {
|
||||
pipelineContext->ChangeDarkModeBrightness();
|
||||
}
|
||||
AceViewportConfig aceViewportConfig(modifyConfig, reason, rsTransaction);
|
||||
if (container->IsUseStageModel() && (reason == OHOS::Rosen::WindowSizeChangeReason::ROTATION ||
|
||||
reason == OHOS::Rosen::WindowSizeChangeReason::UPDATE_DPI_SYNC)) {
|
||||
|
@ -22,11 +22,11 @@
|
||||
#define UISERVICE_LOG_TAG "AceUISession"
|
||||
|
||||
#define UISERVICE_FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
#define ACE_FMT_PREFIX "[%{public}s(%{public}s:%{public}d)]"
|
||||
#define ACE_FMT_PREFIX "[%{public}s:%{public}d]"
|
||||
|
||||
#define PRINT_LOG(level, fmt, ...) \
|
||||
HILOG_IMPL(LOG_CORE, LOG_##level, UISERVICE_LOG_DOMAIN, UISERVICE_LOG_TAG, ACE_FMT_PREFIX fmt, UISERVICE_FILENAME, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
__LINE__, ##__VA_ARGS__)
|
||||
|
||||
#define LOGE(fmt, ...) PRINT_LOG(ERROR, fmt, ##__VA_ARGS__)
|
||||
#define LOGW(fmt, ...) PRINT_LOG(WARN, fmt, ##__VA_ARGS__)
|
||||
|
@ -93,7 +93,7 @@ void UiSessionManager::ReportWebUnfocusEvent(int64_t accessibilityId, const std:
|
||||
|
||||
void UiSessionManager::SaveReportStub(sptr<IRemoteObject> reportStub, int32_t processId)
|
||||
{
|
||||
reportObjectMap_.emplace(processId, reportStub);
|
||||
reportObjectMap_[processId] = reportStub;
|
||||
}
|
||||
|
||||
void UiSessionManager::SetClickEventRegistered(bool status)
|
||||
|
@ -25,6 +25,7 @@
|
||||
namespace OHOS::Ace {
|
||||
namespace {
|
||||
static constexpr uint64_t ACE_TRACE_COMMERCIAL = HITRACE_TAG_ACE | HITRACE_TAG_COMMERCIAL;
|
||||
static constexpr uint64_t ANIMATION_TRACE_COMMERCIAL = HITRACE_TAG_ANIMATION | HITRACE_TAG_COMMERCIAL;
|
||||
}
|
||||
|
||||
void AceTraceBegin(const char* name)
|
||||
@ -71,6 +72,28 @@ void AceAsyncTraceEnd(int32_t taskId, const char* name, bool isAnimationTrace)
|
||||
}
|
||||
}
|
||||
|
||||
void AceAsyncTraceBeginCommercial(int32_t taskId, const char* name, bool isAnimationTrace)
|
||||
{
|
||||
CHECK_NULL_VOID(name);
|
||||
std::string nameStr(name);
|
||||
if (isAnimationTrace) {
|
||||
StartAsyncTrace(ANIMATION_TRACE_COMMERCIAL, nameStr, taskId);
|
||||
} else {
|
||||
StartAsyncTrace(ACE_TRACE_COMMERCIAL, nameStr, taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void AceAsyncTraceEndCommercial(int32_t taskId, const char* name, bool isAnimationTrace)
|
||||
{
|
||||
CHECK_NULL_VOID(name);
|
||||
std::string nameStr(name);
|
||||
if (isAnimationTrace) {
|
||||
FinishAsyncTrace(ANIMATION_TRACE_COMMERCIAL, nameStr, taskId);
|
||||
} else {
|
||||
FinishAsyncTrace(ACE_TRACE_COMMERCIAL, nameStr, taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void AceCountTrace(const char *key, int32_t count)
|
||||
{
|
||||
CHECK_NULL_VOID(key);
|
||||
|
@ -61,6 +61,9 @@ constexpr char EVENT_KEY_DURITION[] = "DURITION";
|
||||
constexpr char EVENT_KEY_TOTAL_FRAMES[] = "TOTAL_FRAMES";
|
||||
constexpr char EVENT_KEY_TOTAL_MISSED_FRAMES[] = "TOTAL_MISSED_FRAMES";
|
||||
constexpr char EVENT_KEY_MAX_FRAMETIME[] = "MAX_FRAMETIME";
|
||||
constexpr char EVENT_KEY_MAX_FRAMETIME_SINCE_START[] = "MAX_FRAMETIME_SINCE_START";
|
||||
constexpr char EVENT_KEY_MAX_HITCH_TIME[] = "MAX_HITCH_TIME";
|
||||
constexpr char EVENT_KEY_MAX_HITCH_TIME_SINCE_START[] = "MAX_HITCH_TIME_SINCE_START";
|
||||
constexpr char EVENT_KEY_MAX_SEQ_MISSED_FRAMES[] = "MAX_SEQ_MISSED_FRAMES";
|
||||
constexpr char EVENT_KEY_SOURCE_TYPE[] = "SOURCE_TYPE";
|
||||
constexpr char EVENT_KEY_NOTE[] = "NOTE";
|
||||
@ -409,6 +412,9 @@ void EventReport::ReportEventJankFrame(DataBase& data)
|
||||
const auto& totalFrames = data.totalFrames;
|
||||
const auto& totalMissedFrames = data.totalMissed;
|
||||
const auto& maxFrameTime = data.maxFrameTime / NS_TO_MS;
|
||||
const auto& maxFrameTimeSinceStart = data.maxFrameTimeSinceStart;
|
||||
const auto& maxHitchTime = data.maxHitchTime;
|
||||
const auto& maxHitchTimeSinceStart = data.maxHitchTimeSinceStart;
|
||||
const auto& maxSeqMissedFrames = data.maxSuccessiveFrames;
|
||||
const auto& note = data.baseInfo.note;
|
||||
const auto& isDisplayAnimator = data.isDisplayAnimator;
|
||||
@ -428,6 +434,9 @@ void EventReport::ReportEventJankFrame(DataBase& data)
|
||||
EVENT_KEY_TOTAL_FRAMES, totalFrames,
|
||||
EVENT_KEY_TOTAL_MISSED_FRAMES, totalMissedFrames,
|
||||
EVENT_KEY_MAX_FRAMETIME, static_cast<uint64_t>(maxFrameTime),
|
||||
EVENT_KEY_MAX_FRAMETIME_SINCE_START, static_cast<uint64_t>(maxFrameTimeSinceStart),
|
||||
EVENT_KEY_MAX_HITCH_TIME, static_cast<uint64_t>(maxHitchTime),
|
||||
EVENT_KEY_MAX_HITCH_TIME_SINCE_START, static_cast<uint64_t>(maxHitchTimeSinceStart),
|
||||
EVENT_KEY_MAX_SEQ_MISSED_FRAMES, maxSeqMissedFrames,
|
||||
EVENT_KEY_NOTE, note,
|
||||
EVENT_KEY_DISPLAY_ANIMATOR, isDisplayAnimator);
|
||||
|
@ -208,6 +208,7 @@ void InputMethodManager::HideKeyboardAcrossProcesses()
|
||||
void InputMethodManager::ProcessModalPageScene()
|
||||
{
|
||||
auto currentFocusNode = curFocusNode_.Upgrade();
|
||||
TAG_LOGI(AceLogTag::ACE_KEYBOARD, "ProcessModalPageScene");
|
||||
if (currentFocusNode && currentFocusNode->GetTag() == V2::UI_EXTENSION_COMPONENT_ETS_TAG) {
|
||||
HideKeyboardAcrossProcesses();
|
||||
} else {
|
||||
|
@ -74,6 +74,12 @@ struct ActionTable {
|
||||
ActionType action;
|
||||
};
|
||||
|
||||
struct FillEventInfoParam {
|
||||
int64_t elementId;
|
||||
int64_t stackNodeId;
|
||||
uint32_t windowId;
|
||||
};
|
||||
|
||||
struct AccessibilityActionParam {
|
||||
RefPtr<NG::AccessibilityProperty> accessibilityProperty;
|
||||
std::string setTextArgument = "";
|
||||
@ -199,6 +205,8 @@ Accessibility::EventType ConvertAceEventType(AccessibilityEventType type)
|
||||
{ AccessibilityEventType::HOVER_EXIT_EVENT, Accessibility::EventType::TYPE_VIEW_HOVER_EXIT_EVENT },
|
||||
{ AccessibilityEventType::CHANGE, Accessibility::EventType::TYPE_PAGE_CONTENT_UPDATE },
|
||||
{ AccessibilityEventType::COMPONENT_CHANGE, Accessibility::EventType::TYPE_VIEW_TEXT_UPDATE_EVENT },
|
||||
{ AccessibilityEventType::PAGE_OPEN, Accessibility::EventType::TYPE_PAGE_OPEN },
|
||||
{ AccessibilityEventType::PAGE_CLOSE, Accessibility::EventType::TYPE_PAGE_CLOSE },
|
||||
{ AccessibilityEventType::SCROLL_END, Accessibility::EventType::TYPE_VIEW_SCROLLED_EVENT },
|
||||
{ AccessibilityEventType::TEXT_SELECTION_UPDATE,
|
||||
Accessibility::EventType::TYPE_VIEW_TEXT_SELECTION_UPDATE_EVENT },
|
||||
@ -1032,8 +1040,8 @@ int64_t GetParentId(const RefPtr<NG::UINode>& uiNode)
|
||||
return INVALID_PARENT_ID;
|
||||
}
|
||||
|
||||
void FillElementInfo(int64_t elementId, AccessibilityElementInfo& elementInfo,
|
||||
const RefPtr<PipelineBase>& context, const RefPtr<JsAccessibilityManager>& jsAccessibilityManager)
|
||||
void FillElementInfo(int64_t elementId, AccessibilityElementInfo& elementInfo, const RefPtr<PipelineBase>& context,
|
||||
const RefPtr<JsAccessibilityManager>& jsAccessibilityManager, const FillEventInfoParam& param)
|
||||
{
|
||||
std::list<AccessibilityElementInfo> elementInfos;
|
||||
int32_t mode = 0;
|
||||
@ -1045,13 +1053,14 @@ void FillElementInfo(int64_t elementId, AccessibilityElementInfo& elementInfo,
|
||||
return;
|
||||
}
|
||||
elementInfo = elementInfos.front();
|
||||
elementInfo.SetWindowId(param.windowId);
|
||||
}
|
||||
|
||||
void FillEventInfo(const RefPtr<NG::FrameNode>& node,
|
||||
AccessibilityEventInfo& eventInfo,
|
||||
const RefPtr<PipelineBase>& context,
|
||||
int64_t elementId,
|
||||
const RefPtr<JsAccessibilityManager>& jsAccessibilityManager)
|
||||
const RefPtr<JsAccessibilityManager>& jsAccessibilityManager,
|
||||
const FillEventInfoParam& param)
|
||||
{
|
||||
CHECK_NULL_VOID(node);
|
||||
if (node->GetTag() == V2::WEB_CORE_TAG) {
|
||||
@ -1061,7 +1070,7 @@ void FillEventInfo(const RefPtr<NG::FrameNode>& node,
|
||||
eventInfo.SetPageId(webAccessibilityNode->GetPageId());
|
||||
eventInfo.AddContent(webAccessibilityNode->GetContent());
|
||||
AccessibilityElementInfo elementInfo;
|
||||
FillElementInfo(elementId, elementInfo, context, jsAccessibilityManager);
|
||||
FillElementInfo(param.elementId, elementInfo, context, jsAccessibilityManager, param);
|
||||
eventInfo.SetElementInfo(elementInfo);
|
||||
return;
|
||||
}
|
||||
@ -1074,7 +1083,8 @@ void FillEventInfo(const RefPtr<NG::FrameNode>& node,
|
||||
eventInfo.SetBeginIndex(accessibilityProperty->GetBeginIndex());
|
||||
eventInfo.SetEndIndex(accessibilityProperty->GetEndIndex());
|
||||
AccessibilityElementInfo elementInfo;
|
||||
FillElementInfo(elementId, elementInfo, context, jsAccessibilityManager);
|
||||
FillElementInfo(param.elementId, elementInfo, context, jsAccessibilityManager, param);
|
||||
elementInfo.SetNavDestinationId(param.stackNodeId);
|
||||
eventInfo.SetElementInfo(elementInfo);
|
||||
}
|
||||
|
||||
@ -2296,7 +2306,8 @@ bool JsAccessibilityManager::TransferAccessibilityAsyncEvent(
|
||||
AccessibilityEventInfo eventInfoNew = eventInfo;
|
||||
eventInfoNew.SetSource(uiExtensionOffset + eventInfo.GetViewId());
|
||||
AccessibilityElementInfo elementInfo;
|
||||
FillElementInfo(eventInfoNew.GetAccessibilityId(), elementInfo, pipeline, Claim(this));
|
||||
FillElementInfo(eventInfoNew.GetAccessibilityId(), elementInfo, pipeline, Claim(this),
|
||||
FillEventInfoParam { eventInfoNew.GetAccessibilityId(), -1, eventInfoNew.GetWindowId() });
|
||||
eventInfoNew.SetElementInfo(elementInfo);
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "send accessibility event:%{public}d accessibilityId:%{public}" PRId64,
|
||||
eventInfoNew.GetEventType(), eventInfoNew.GetAccessibilityId());
|
||||
@ -2319,7 +2330,8 @@ void JsAccessibilityManager::FillEventInfoWithNode(
|
||||
{
|
||||
CHECK_NULL_VOID(node);
|
||||
if (node->GetTag() == V2::WEB_CORE_TAG) {
|
||||
FillEventInfo(node, eventInfo, context, elementId, Claim(this));
|
||||
FillEventInfo(
|
||||
node, eventInfo, context, Claim(this), FillEventInfoParam { elementId, -1, eventInfo.GetWindowId() });
|
||||
return;
|
||||
}
|
||||
eventInfo.SetComponentType(node->GetTag());
|
||||
@ -2337,6 +2349,7 @@ void JsAccessibilityManager::FillEventInfoWithNode(
|
||||
CHECK_NULL_VOID(mainContext);
|
||||
GenerateCommonProperty(context, commonProperty, mainContext);
|
||||
UpdateAccessibilityElementInfo(node, commonProperty, elementInfo, context);
|
||||
elementInfo.SetWindowId(eventInfo.GetWindowId());
|
||||
eventInfo.SetElementInfo(elementInfo);
|
||||
}
|
||||
|
||||
@ -2365,13 +2378,13 @@ void JsAccessibilityManager::SendEventToAccessibilityWithNode(
|
||||
}
|
||||
|
||||
AccessibilityEventInfo eventInfo;
|
||||
FillEventInfoWithNode(frameNode, eventInfo, ngPipeline, accessibilityEvent.nodeId);
|
||||
|
||||
if (accessibilityEvent.type != AccessibilityEventType::PAGE_CHANGE || accessibilityEvent.windowId == 0) {
|
||||
eventInfo.SetWindowId(windowId);
|
||||
} else {
|
||||
eventInfo.SetWindowId(accessibilityEvent.windowId);
|
||||
}
|
||||
FillEventInfoWithNode(frameNode, eventInfo, ngPipeline, accessibilityEvent.nodeId);
|
||||
GenerateAccessibilityEventInfo(accessibilityEvent, eventInfo);
|
||||
|
||||
auto container = Container::GetContainer(context->GetInstanceId());
|
||||
@ -2404,7 +2417,9 @@ void JsAccessibilityManager::SendAccessibilityAsyncEvent(const AccessibilityEven
|
||||
ngPipeline = FindPipelineByElementId(accessibilityEvent.nodeId, node);
|
||||
CHECK_NULL_VOID(ngPipeline);
|
||||
CHECK_NULL_VOID(node);
|
||||
FillEventInfo(node, eventInfo, ngPipeline, accessibilityEvent.nodeId, Claim(this));
|
||||
FillEventInfo(node, eventInfo, ngPipeline, Claim(this),
|
||||
FillEventInfoParam {
|
||||
accessibilityEvent.nodeId, accessibilityEvent.stackNodeId, ngPipeline->GetFocusWindowId() });
|
||||
eventInfo.SetWindowId(ngPipeline->GetFocusWindowId());
|
||||
} else {
|
||||
ngPipeline = AceType::DynamicCast<NG::PipelineContext>(context);
|
||||
|
@ -264,6 +264,19 @@ void* PixelMapOhos::GetWritablePixels() const
|
||||
return pixmap_->GetWritablePixels();
|
||||
}
|
||||
|
||||
bool PixelMapOhos::GetPixelsVec(std::vector<uint8_t>& data) const
|
||||
{
|
||||
CHECK_NULL_RETURN(pixmap_, false);
|
||||
data.resize(pixmap_->GetByteCount());
|
||||
uint8_t* dst = data.data();
|
||||
uint32_t errCode = pixmap_->ReadPixels(pixmap_->GetByteCount(), dst);
|
||||
if (errCode) {
|
||||
TAG_LOGW(AceLogTag::ACE_IMAGE, "GetPixelsVec error, errCode=%{public}d", errCode);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<PixelMap> PixelMap::ConvertSkImageToPixmap(
|
||||
const uint32_t* colors, uint32_t colorLength, int32_t width, int32_t height)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
static AlphaType AlphaTypeConverter(Media::AlphaType alphaType);
|
||||
int32_t GetWidth() const override;
|
||||
int32_t GetHeight() const override;
|
||||
bool GetPixelsVec(std::vector<uint8_t>& data) const override;
|
||||
const uint8_t* GetPixels() const override;
|
||||
PixelFormat GetPixelFormat() const override;
|
||||
AlphaType GetAlphaType() const override;
|
||||
|
@ -22,11 +22,11 @@
|
||||
#define UISERVICE_LOG_TAG "AceUIService"
|
||||
|
||||
#define UISERVICE_FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
#define ACE_FMT_PREFIX "[%{public}s(%{public}s:%{public}d)]"
|
||||
#define ACE_FMT_PREFIX "[%{public}s:%{public}d]"
|
||||
|
||||
#define PRINT_LOG(level, fmt, ...) \
|
||||
HILOG_IMPL(LOG_CORE, LOG_##level, UISERVICE_LOG_DOMAIN, UISERVICE_LOG_TAG, \
|
||||
ACE_FMT_PREFIX fmt, UISERVICE_FILENAME, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
ACE_FMT_PREFIX fmt, UISERVICE_FILENAME, __LINE__, ##__VA_ARGS__)
|
||||
|
||||
#define LOGE(fmt, ...) PRINT_LOG(ERROR, fmt, ##__VA_ARGS__)
|
||||
#define LOGW(fmt, ...) PRINT_LOG(WARN, fmt, ##__VA_ARGS__)
|
||||
|
@ -29,6 +29,16 @@ UdmfClient* UdmfClient::GetInstance()
|
||||
return &instance;
|
||||
}
|
||||
|
||||
RefPtr<UnifiedData> UdmfClientImpl::TransformUnifiedDataForNative(void* rawData)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* UdmfClientImpl::TransformUnifiedDataPtr(RefPtr<UnifiedData>& unifiedData)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<UnifiedData> UdmfClientImpl::TransformUnifiedData(napi_value napiValue)
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -28,6 +28,8 @@ class UdmfClientImpl : public UdmfClient {
|
||||
|
||||
public:
|
||||
RefPtr<UnifiedData> TransformUnifiedData(napi_value napiValue) override;
|
||||
RefPtr<UnifiedData> TransformUnifiedDataForNative(void* rawData) override;
|
||||
void* TransformUnifiedDataPtr(RefPtr<UnifiedData>& unifiedData) override;
|
||||
napi_value TransformUdmfUnifiedData(RefPtr<UnifiedData>& UnifiedData) override;
|
||||
napi_value TransformSummary(std::map<std::string, int64_t>& summary) override;
|
||||
RefPtr<UnifiedData> CreateUnifiedData() override;
|
||||
|
@ -22,5 +22,7 @@ void AceTraceBeginCommercial(const char* name) {}
|
||||
void AceTraceEndCommercial() {}
|
||||
void AceAsyncTraceBegin(int32_t taskId, const char* name, bool isAnimationTrace) {}
|
||||
void AceAsyncTraceEnd(int32_t taskId, const char* name, bool isAnimationTrace) {}
|
||||
void AceAsyncTraceBeginCommercial(int32_t taskId, const char* name, bool isAnimationTrace) {}
|
||||
void AceAsyncTraceEndCommercial(int32_t taskId, const char* name, bool isAnimationTrace) {}
|
||||
void AceCountTrace(const char *key, int32_t count) {}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -67,6 +67,11 @@ const uint8_t* PixelMapPreview::GetPixels() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PixelMapPreview::GetPixelsVec(std::vector<uint8_t>& data) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PixelFormat PixelMapPreview::GetPixelFormat() const
|
||||
{
|
||||
return PixelFormat::UNKNOWN;
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
const uint32_t* colors, uint32_t colorLength, int32_t width, int32_t height);
|
||||
int32_t GetWidth() const override;
|
||||
int32_t GetHeight() const override;
|
||||
bool GetPixelsVec(std::vector<uint8_t>& data) const override;
|
||||
const uint8_t* GetPixels() const override;
|
||||
PixelFormat GetPixelFormat() const override;
|
||||
AlphaType GetAlphaType() const override;
|
||||
|
@ -3624,7 +3624,8 @@ class CustomDialogContentComponent extends ViewPU {
|
||||
ForEach.create();
|
||||
const forEachItemGenFunction = (_item, index) => {
|
||||
const item = _item;
|
||||
this.buildButtonWithDivider.bind(this)(index, parent ? parent : this);
|
||||
this.buildButtonWithDivider.bind(this)(this.buttons.length === HORIZON_BUTTON_MAX_COUNT ?
|
||||
HORIZON_BUTTON_MAX_COUNT - index - 1 : index, parent ? parent : this);
|
||||
};
|
||||
this.forEachUpdateFunction(elmtId, this.buttons.slice(0, VERTICAL_BUTTON_MAX_COUNT),
|
||||
forEachItemGenFunction, (item) => item.value.toString(), true, false);
|
||||
@ -3685,7 +3686,8 @@ class CustomDialogContentComponent extends ViewPU {
|
||||
Row.pop();
|
||||
this.observeComponentCreation2((elmtId, isInitialRender) => {
|
||||
If.create();
|
||||
if (index < Math.min(this.buttons.length, VERTICAL_BUTTON_MAX_COUNT) - 1) {
|
||||
if ((this.buttons.length === HORIZON_BUTTON_MAX_COUNT ? HORIZON_BUTTON_MAX_COUNT - index - 1 :
|
||||
index) < Math.min(this.buttons.length, VERTICAL_BUTTON_MAX_COUNT) - 1) {
|
||||
this.ifElseBranchUpdateFunction(0, () => {
|
||||
this.observeComponentCreation2((elmtId, isInitialRender) => {
|
||||
Row.create();
|
||||
@ -3962,7 +3964,7 @@ export class LoadingDialog extends ViewPU {
|
||||
fontSizeScale: this.__fontSizeScale,
|
||||
minContentHeight: this.__minContentHeight,
|
||||
}, undefined, elmtId, () => {
|
||||
}, { page: 'library/src/main/ets/components/mainpage/dialog.ets', line: 1569 });
|
||||
}, { page: 'library/src/main/ets/components/mainpage/dialog.ets', line: 1573 });
|
||||
ViewPU.create(componentCall);
|
||||
let paramsLambda = () => {
|
||||
return {
|
||||
|
@ -1348,7 +1348,8 @@ struct CustomDialogContentComponent {
|
||||
if (this.buttons) {
|
||||
Column() {
|
||||
ForEach(this.buttons.slice(0, VERTICAL_BUTTON_MAX_COUNT), (item: ButtonOptions, index: number) => {
|
||||
this.buildButtonWithDivider(index);
|
||||
this.buildButtonWithDivider(this.buttons.length === HORIZON_BUTTON_MAX_COUNT ?
|
||||
HORIZON_BUTTON_MAX_COUNT - index - 1 : index);
|
||||
}, (item: ButtonOptions) => item.value.toString());
|
||||
}
|
||||
}
|
||||
@ -1400,7 +1401,8 @@ struct CustomDialogContentComponent {
|
||||
this.buildSingleButton(this.buttons[index]);
|
||||
}
|
||||
|
||||
if (index < Math.min(this.buttons.length, VERTICAL_BUTTON_MAX_COUNT) - 1) {
|
||||
if ((this.buttons.length === HORIZON_BUTTON_MAX_COUNT ? HORIZON_BUTTON_MAX_COUNT - index - 1 : index) <
|
||||
Math.min(this.buttons.length, VERTICAL_BUTTON_MAX_COUNT) - 1) {
|
||||
Row() {
|
||||
}
|
||||
.height($r('sys.float.alert_button_vertical_space'))
|
||||
|
@ -699,7 +699,7 @@ export class PopupComponent extends ViewPU {
|
||||
}
|
||||
|
||||
getButtonTextMargin() {
|
||||
return { top: LengthMetrics.vp(this.theme.button.textMargin.bottom.value / 2) };
|
||||
return { top: LengthMetrics.vp(this.theme.button.textMargin.bottom.value ) };
|
||||
}
|
||||
|
||||
getButtonTextPadding() {
|
||||
@ -1080,7 +1080,6 @@ export class PopupComponent extends ViewPU {
|
||||
Row.create();
|
||||
Row.direction(this.popupDirection);
|
||||
Row.alignItems(VerticalAlign.Top);
|
||||
Row.margin(this.getTitleMargin());
|
||||
}, Row);
|
||||
this.observeComponentCreation2((u24, v24) => {
|
||||
Scroll.create();
|
||||
|
@ -391,7 +391,7 @@ export struct PopupComponent {
|
||||
}
|
||||
|
||||
private getButtonTextMargin(): LocalizedMargin {
|
||||
return { top: LengthMetrics.vp(this.theme.button.textMargin.bottom.value / 2) }
|
||||
return { top: LengthMetrics.vp(this.theme.button.textMargin.bottom.value) }
|
||||
}
|
||||
|
||||
private getButtonTextPadding(): LocalizedPadding {
|
||||
@ -728,7 +728,6 @@ export struct PopupComponent {
|
||||
}
|
||||
.direction(this.popupDirection)
|
||||
.alignItems(VerticalAlign.Top)
|
||||
.margin(this.getTitleMargin())
|
||||
|
||||
Flex({ wrap: FlexWrap.Wrap }) {
|
||||
if (this.buttons?.[0]?.text !== '' && this.buttons?.[0]?.text !== void (0)) {
|
||||
|
@ -246,6 +246,11 @@
|
||||
"OHOS::Ace::NG::CustomNode::FlushReload()";
|
||||
"OHOS::Ace::CanvasModel::GetInstance()";
|
||||
|
||||
OHOS::Ace::NG::InspectorFilter::*;
|
||||
OHOS::Ace::NG::ServiceCollaborationMenuAceHelper::*;
|
||||
OHOS::Ace::NG::ServiceCollaborationAceCallback::*;
|
||||
OHOS::Ace::DumpLog::*;
|
||||
|
||||
virtual?thunk?to?OHOS::Ace::Animator::~Animator??;
|
||||
virtual?thunk?to?OHOS::Ace::Frontend::MaybeRelease*;
|
||||
virtual?thunk?to?OHOS::Ace::Frontend::~Frontend*;
|
||||
|
@ -95,7 +95,8 @@
|
||||
"skia",
|
||||
"libuv",
|
||||
"background_task_mgr",
|
||||
"atomicservice_basic_engine"
|
||||
"atomicservice_basic_engine",
|
||||
"egl"
|
||||
],
|
||||
"third_party": []
|
||||
},
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/geometry/dimension.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
@ -154,6 +155,7 @@ public:
|
||||
const uint32_t* colors, uint32_t colorLength, int32_t width, int32_t height);
|
||||
virtual int32_t GetWidth() const = 0;
|
||||
virtual int32_t GetHeight() const = 0;
|
||||
virtual bool GetPixelsVec(std::vector<uint8_t>& data) const = 0;
|
||||
virtual const uint8_t* GetPixels() const = 0;
|
||||
virtual PixelFormat GetPixelFormat() const = 0;
|
||||
virtual AlphaType GetAlphaType() const = 0;
|
||||
|
@ -94,6 +94,8 @@ void ACE_EXPORT AceCountTraceWidthArgs(int32_t count, const char* format, ...);
|
||||
// for commercial trace
|
||||
void ACE_EXPORT AceTraceBeginCommercial(const char* name);
|
||||
void ACE_EXPORT AceTraceEndCommercial();
|
||||
void ACE_EXPORT AceAsyncTraceBeginCommercial(int32_t taskId, const char* name, bool isAnimationTrace = false);
|
||||
void ACE_EXPORT AceAsyncTraceEndCommercial(int32_t taskId, const char* name, bool isAnimationTrace = false);
|
||||
|
||||
class ACE_FORCE_EXPORT AceScopedTrace final {
|
||||
public:
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
class DumpLog : public Singleton<DumpLog> {
|
||||
class ACE_FORCE_EXPORT DumpLog : public Singleton<DumpLog> {
|
||||
DECLARE_SINGLETON(DumpLog);
|
||||
|
||||
public:
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include "base/utils/system_properties.h"
|
||||
|
||||
#ifdef ACE_INSTANCE_LOG
|
||||
#define ACE_FMT_PREFIX "[%{public}s(%{public}s)-(%{public}s)] "
|
||||
#define ACE_FMT_PREFIX "[%{public}s(%{public}d)-(%{public}s)] "
|
||||
#define ACE_LOG_ID_WITH_REASON , OHOS::Ace::LogWrapper::GetIdWithReason().c_str()
|
||||
#else
|
||||
#define ACE_FMT_PREFIX "[%{private}s(%{private}s)] "
|
||||
#define ACE_FMT_PREFIX "[%{private}s(%{private}d)] "
|
||||
#define ACE_LOG_ID_WITH_REASON
|
||||
#endif
|
||||
|
||||
@ -40,7 +40,7 @@ constexpr uint32_t APP_DOMAIN = 0xC0D0;
|
||||
#define PRINT_LOG(level, tag, fmt, ...) \
|
||||
HILOG_IMPL(LOG_CORE, LOG_##level, (tag + ACE_DOMAIN), (OHOS::Ace::g_DOMAIN_CONTENTS_MAP.at(tag)), \
|
||||
ACE_FMT_PREFIX fmt, OHOS::Ace::LogWrapper::GetBriefFileName(__FILE__), \
|
||||
__FUNCTION__ ACE_LOG_ID_WITH_REASON, ##__VA_ARGS__)
|
||||
__LINE__ ACE_LOG_ID_WITH_REASON, ##__VA_ARGS__)
|
||||
|
||||
#define PRINT_APP_LOG(level, fmt, ...) HILOG_IMPL(LOG_APP, LOG_##level, APP_DOMAIN, "JSAPP", fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
@ -49,7 +49,7 @@ constexpr uint32_t APP_DOMAIN = 0xC0D0;
|
||||
if (OHOS::Ace::LogWrapper::JudgeLevel(OHOS::Ace::LogLevel::level)) { \
|
||||
OHOS::Ace::LogWrapper::PrintLog(OHOS::Ace::LogDomain::FRAMEWORK, OHOS::Ace::LogLevel::level, tag, \
|
||||
ACE_FMT_PREFIX fmt, OHOS::Ace::LogWrapper::GetBriefFileName(__FILE__), \
|
||||
__FUNCTION__ ACE_LOG_ID_WITH_REASON, ##__VA_ARGS__); \
|
||||
__LINE__ ACE_LOG_ID_WITH_REASON, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -189,12 +189,10 @@ enum AceLogTag : uint8_t {
|
||||
ACE_MOVING_PHOTO, // C0394C
|
||||
ACE_ARK_COMPONENT, // C0394D
|
||||
ACE_WINDOW, // C0394E
|
||||
ACE_LIBUV, // C0394F
|
||||
ACE_SECURITYUIEXTENSION, // C03950
|
||||
ACE_INPUTKEYFLOW, // C03951
|
||||
ACE_SECURITYUIEXTENSION, // C0394F
|
||||
ACE_INPUTKEYFLOW, // C03950
|
||||
|
||||
FORM_RENDER = 255, // C039FF FormRenderer
|
||||
END = 256, // Last one, do not use
|
||||
FORM_RENDER = 255, // C039FF FormRenderer, last domain, do not add
|
||||
};
|
||||
|
||||
ACE_FORCE_EXPORT extern const std::unordered_map<AceLogTag, const char*> g_DOMAIN_CONTENTS_MAP;
|
||||
|
@ -45,8 +45,7 @@ namespace {
|
||||
constexpr int32_t MAXIMUM_WAITING_PERIOD = 2800;
|
||||
|
||||
#define PRINT_LOG(level, fmt, ...) \
|
||||
HILOG_IMPL(LOG_CORE, LOG_##level, 0xD00393A, "DownloadManager", "[%{public}s:%{public}d]" fmt, __FUNCTION__, \
|
||||
__LINE__, ##__VA_ARGS__)
|
||||
HILOG_IMPL(LOG_CORE, LOG_##level, 0xD00393A, "DownloadManager", "[%{public}d]" fmt, __LINE__, ##__VA_ARGS__) \
|
||||
|
||||
#define LOGE(fmt, ...) PRINT_LOG(ERROR, fmt, ##__VA_ARGS__)
|
||||
#define LOGW(fmt, ...) PRINT_LOG(WARN, fmt, ##__VA_ARGS__)
|
||||
|
@ -182,8 +182,9 @@ bool SceneRecord::IsTimeOut(int64_t nowTime)
|
||||
|
||||
void SceneRecord::RecordFrame(int64_t vsyncTime, int64_t duration, int32_t skippedFrames)
|
||||
{
|
||||
int64_t currentTimeNs = GetCurrentRealTimeNs();
|
||||
if (totalFrames == 0) {
|
||||
beginVsyncTime = GetCurrentRealTimeNs();
|
||||
beginVsyncTime = currentTimeNs;
|
||||
isFirstFrame = true;
|
||||
} else {
|
||||
isFirstFrame = false;
|
||||
@ -206,6 +207,7 @@ void SceneRecord::RecordFrame(int64_t vsyncTime, int64_t duration, int32_t skipp
|
||||
}
|
||||
if (!isFirstFrame && duration > maxFrameTime) {
|
||||
maxFrameTime = duration;
|
||||
maxFrameTimeSinceStart = (currentTimeNs - beginVsyncTime) / NS_TO_MS;
|
||||
}
|
||||
totalFrames++;
|
||||
}
|
||||
@ -242,6 +244,9 @@ void SceneRecord::Reset()
|
||||
beginVsyncTime = 0;
|
||||
endVsyncTime = 0;
|
||||
maxFrameTime = 0;
|
||||
maxFrameTimeSinceStart = 0;
|
||||
maxHitchTime = 0;
|
||||
maxHitchTimeSinceStart = 0;
|
||||
maxSuccessiveFrames = 0;
|
||||
seqMissFrames = 0;
|
||||
totalMissed = 0;
|
||||
@ -481,6 +486,9 @@ void PerfMonitor::FlushDataBase(SceneRecord* record, DataBase& data)
|
||||
data.endVsyncTime = data.beginVsyncTime;
|
||||
}
|
||||
data.maxFrameTime = record->maxFrameTime;
|
||||
data.maxFrameTimeSinceStart = record->maxFrameTimeSinceStart;
|
||||
data.maxHitchTime = record->maxHitchTime;
|
||||
data.maxHitchTimeSinceStart = record->maxHitchTimeSinceStart;
|
||||
data.maxSuccessiveFrames = record->maxSuccessiveFrames;
|
||||
data.totalMissed = record->totalMissed;
|
||||
data.totalFrames = record->totalFrames;
|
||||
|
@ -71,6 +71,9 @@ struct DataBase {
|
||||
int64_t beginVsyncTime {0};
|
||||
int64_t endVsyncTime {0};
|
||||
int64_t maxFrameTime {0};
|
||||
int64_t maxFrameTimeSinceStart {0};
|
||||
int64_t maxHitchTime {0};
|
||||
int64_t maxHitchTimeSinceStart {0};
|
||||
bool needReportRs {false};
|
||||
bool isDisplayAnimator {false};
|
||||
PerfSourceType sourceType {UNKNOWN_SOURCE};
|
||||
@ -103,6 +106,9 @@ public:
|
||||
int64_t beginVsyncTime {0};
|
||||
int64_t endVsyncTime {0};
|
||||
int64_t maxFrameTime {0};
|
||||
int64_t maxFrameTimeSinceStart {0};
|
||||
int64_t maxHitchTime {0};
|
||||
int64_t maxHitchTimeSinceStart {0};
|
||||
int32_t maxSuccessiveFrames {0};
|
||||
int32_t totalMissed {0};
|
||||
int32_t totalFrames {0};
|
||||
|
@ -2199,6 +2199,9 @@
|
||||
"window":{
|
||||
"leftSide":"視窗顯示在屏幕左側",
|
||||
"rightSide":"視窗顯示在屏幕右側"
|
||||
},
|
||||
"datepicker":{
|
||||
"lunarSwitch":"顯示農曆"
|
||||
}
|
||||
},
|
||||
"zh-TW":{
|
||||
@ -2232,6 +2235,9 @@
|
||||
"window":{
|
||||
"leftSide":"視窗顯示在螢幕左側",
|
||||
"rightSide":"視窗顯示在螢幕右側"
|
||||
},
|
||||
"datepicker":{
|
||||
"lunarSwitch":"顯示農曆"
|
||||
}
|
||||
},
|
||||
"hr":{
|
||||
|
@ -549,6 +549,7 @@ void SubwindowManager::HideDialogSubWindow(int32_t instanceId)
|
||||
auto subwindow = GetSubwindow(instanceId >= MIN_SUBCONTAINER_ID ? GetParentContainerId(instanceId) : instanceId);
|
||||
CHECK_NULL_VOID(subwindow);
|
||||
auto overlay = subwindow->GetOverlayManager();
|
||||
CHECK_NULL_VOID(overlay);
|
||||
if (overlay->GetDialogMap().size() == 0) {
|
||||
subwindow->HideSubWindowNG();
|
||||
}
|
||||
@ -962,4 +963,19 @@ void SubwindowManager::OnWindowSizeChanged(int32_t instanceId, Rect windowRect,
|
||||
overlayManager->OnUIExtensionWindowSizeChange();
|
||||
uiExtensionWindowRect_ = windowRect;
|
||||
}
|
||||
|
||||
RefPtr<NG::FrameNode> SubwindowManager::GetSubwindowDialogNodeWithExistContent(const RefPtr<NG::UINode>& node)
|
||||
{
|
||||
auto iter = subwindowMap_.begin();
|
||||
while (iter != subwindowMap_.end()) {
|
||||
auto overlay = iter->second->GetOverlayManager();
|
||||
CHECK_NULL_RETURN(overlay, nullptr);
|
||||
auto dialogNode = overlay->GetDialogNodeWithExistContent(node);
|
||||
if (dialogNode) {
|
||||
return dialogNode;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -141,6 +141,8 @@ public:
|
||||
void ClearToastInSystemSubwindow();
|
||||
void OnWindowSizeChanged(int32_t instanceId, Rect windowRect, WindowSizeChangeReason reason);
|
||||
|
||||
RefPtr<NG::FrameNode> GetSubwindowDialogNodeWithExistContent(const RefPtr<NG::UINode>& node);
|
||||
|
||||
private:
|
||||
RefPtr<Subwindow> GetOrCreateSubWindow(bool isDialog = false);
|
||||
RefPtr<Subwindow> GetOrCreateSystemSubWindow();
|
||||
|
@ -164,7 +164,8 @@ public:
|
||||
* @param name Name of the task.
|
||||
* @return Returns 'true' whether task has been executed.
|
||||
*/
|
||||
bool PostSyncTask(Task&& task, TaskType type, const std::string& name) const
|
||||
bool PostSyncTask(
|
||||
Task&& task, TaskType type, const std::string& name, PriorityType priorityType = PriorityType::IMMEDIATE) const
|
||||
{
|
||||
if (!task || type == TaskType::BACKGROUND) {
|
||||
return false;
|
||||
@ -172,7 +173,7 @@ public:
|
||||
task();
|
||||
return true;
|
||||
}
|
||||
return PostTaskAndWait(CancelableTask(std::move(task)), type, name, 0ms);
|
||||
return PostTaskAndWait(CancelableTask(std::move(task)), type, name, 0ms, priorityType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -300,19 +301,18 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool PostTaskAndWait(
|
||||
CancelableTask&& task, TaskType type, const std::string& name, std::chrono::milliseconds timeoutMs = 0ms) const
|
||||
bool PostTaskAndWait(CancelableTask&& task, TaskType type, const std::string& name,
|
||||
std::chrono::milliseconds timeoutMs = 0ms, PriorityType priorityType = PriorityType::IMMEDIATE) const
|
||||
{
|
||||
#ifdef ACE_DEBUG
|
||||
bool result = false;
|
||||
if (OnPreSyncTask(type)) {
|
||||
result =
|
||||
OnPostTask(Task(task), type, 0, name, PriorityType::IMMEDIATE) && task.WaitUntilComplete(timeoutMs);
|
||||
result = OnPostTask(Task(task), type, 0, name, priorityType) && task.WaitUntilComplete(timeoutMs);
|
||||
OnPostSyncTask();
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return OnPostTask(Task(task), type, 0, name, PriorityType::IMMEDIATE) && task.WaitUntilComplete(timeoutMs);
|
||||
return OnPostTask(Task(task), type, 0, name, priorityType) && task.WaitUntilComplete(timeoutMs);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
@ -28,6 +28,7 @@ struct MeasureContext {
|
||||
std::string fontWeight;
|
||||
std::string fontFamily;
|
||||
bool isFontSizeUseDefaultUnit = false;
|
||||
bool isReturnActualWidth = false;
|
||||
std::optional<Dimension> constraintWidth = std::nullopt;
|
||||
std::optional<Dimension> fontSize = std::nullopt;
|
||||
std::optional<Dimension> lineHeight = std::nullopt;
|
||||
|
@ -77,6 +77,7 @@ UIContentErrorCode FormFrontendDeclarative::RunDynamicPage(
|
||||
void FormFrontendDeclarative::UpdateData(const std::string& dataList)
|
||||
{
|
||||
CHECK_NULL_VOID(taskExecutor_);
|
||||
// eTSCard UI == Main JS/UI/PLATFORM
|
||||
taskExecutor_->PostTask(
|
||||
[weak = AceType::WeakClaim(this), dataList] {
|
||||
auto frontend = weak.Upgrade();
|
||||
@ -84,7 +85,7 @@ void FormFrontendDeclarative::UpdateData(const std::string& dataList)
|
||||
frontend->UpdatePageData(dataList);
|
||||
}
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUIFormFrontendUpdatePageData"); // eTSCard UI == Main JS/UI/PLATFORM
|
||||
TaskExecutor::TaskType::UI, "ArkUIFormFrontendUpdatePageData", PriorityType::HIGH);
|
||||
}
|
||||
|
||||
void FormFrontendDeclarative::UpdatePageData(const std::string& dataList)
|
||||
|
@ -267,6 +267,15 @@ class ButtonTypeModifier extends ModifierWithKey<number> {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('buttonType');
|
||||
applyStage(node: KNode, component?: ArkComponent): boolean {
|
||||
if (this.stageValue === undefined || this.stageValue === null) {
|
||||
this.value = this.stageValue;
|
||||
this.applyPeer(node, true, component);
|
||||
return true;
|
||||
}
|
||||
this.applyPeer(node, false, component);
|
||||
return false;
|
||||
}
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().button.resetType(node);
|
||||
|
@ -3023,6 +3023,21 @@ class FocusScopePriorityModifier extends ModifierWithKey<ArkFocusScopePriority>
|
||||
}
|
||||
}
|
||||
|
||||
class FocusBoxModifier extends ModifierWithKey<FocusBoxStyle> {
|
||||
constructor(value: FocusBoxStyle) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('focusBox');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().common.resetFocusBox(node);
|
||||
} else {
|
||||
getUINativeModule().common.setFocusBox(node, this.value?.margin,
|
||||
this.value?.strokeWidth, this.value?.strokeColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const JSCallbackInfoType = { STRING: 0, NUMBER: 1, OBJECT: 2, BOOLEAN: 3, FUNCTION: 4 };
|
||||
type basicType = string | number | bigint | boolean | symbol | undefined | object | null;
|
||||
const isString = (val: basicType): boolean => typeof val === 'string';
|
||||
@ -3106,9 +3121,7 @@ class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
} else {
|
||||
this._modifiersWithKeys = new Map();
|
||||
}
|
||||
if (classType === ModifierType.STATE) {
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
}
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
this._nativePtrChanged = false;
|
||||
}
|
||||
|
||||
@ -3141,7 +3154,7 @@ class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
if (this.nativePtr !== instance.nativePtr) {
|
||||
this.nativePtr = instance.nativePtr;
|
||||
this._nativePtrChanged = true;
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(instance.nativePtr);
|
||||
this._weakPtr = instance._weakPtr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4389,6 +4402,9 @@ class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
pixelRound(value:PixelRoundPolicy):this {
|
||||
modifierWithKey(this._modifiersWithKeys, PixelRoundModifier.identity, PixelRoundModifier, value);
|
||||
}
|
||||
focusBox(value:FocusBoxStyle):this {
|
||||
modifierWithKey(this._modifiersWithKeys, FocusBoxModifier.identity, FocusBoxModifier, value);
|
||||
}
|
||||
}
|
||||
|
||||
const isNull = (val: any) => typeof val === 'object' && val === null;
|
||||
|
@ -311,9 +311,7 @@ class ArkSpanComponent implements CommonMethod<SpanAttribute> {
|
||||
this.nativePtr = nativePtr;
|
||||
this._changed = false;
|
||||
this._classType = classType;
|
||||
if (classType === ModifierType.STATE) {
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
}
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
this._nativePtrChanged = false;
|
||||
}
|
||||
initialize(value: Object[]) {
|
||||
@ -333,7 +331,7 @@ class ArkSpanComponent implements CommonMethod<SpanAttribute> {
|
||||
if (this.nativePtr !== instance.nativePtr) {
|
||||
this.nativePtr = instance.nativePtr;
|
||||
this._nativePtrChanged = true;
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(instance.nativePtr);
|
||||
this._weakPtr = instance._weakPtr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ abstract class ViewPU {
|
||||
aboutToRecycleInternal(): void {}
|
||||
updateDirtyElements(): void {}
|
||||
}
|
||||
(globalThis as any).ViewPU = ViewPU;
|
||||
globalThis.ViewPU = ViewPU;
|
||||
|
||||
class __JSBaseNode__ {
|
||||
constructor(options?: RenderOptions) {}
|
||||
@ -35,13 +35,13 @@ class __JSBaseNode__ {
|
||||
updateStart(): void {}
|
||||
updateEnd(): void {}
|
||||
}
|
||||
(globalThis as any).__JSBaseNode__ = __JSBaseNode__;
|
||||
globalThis.__JSBaseNode__ = __JSBaseNode__;
|
||||
|
||||
class __JSScopeUtil__ {
|
||||
static syncInstanceId(instanceId: number): void {}
|
||||
static restoreInstanceId(): void {}
|
||||
}
|
||||
(globalThis as any).__JSScopeUtil__ = __JSScopeUtil__;
|
||||
globalThis.__JSScopeUtil__ = __JSScopeUtil__;
|
||||
|
||||
interface CustomDialogControllerConstructorArg {
|
||||
builder: () => void;
|
||||
@ -53,14 +53,14 @@ class CustomDialogController {
|
||||
private view_: ViewPU;
|
||||
|
||||
constructor(arg: CustomDialogControllerConstructorArg, view: ViewPU) {}
|
||||
open() {}
|
||||
close() {}
|
||||
open(): void {}
|
||||
close(): void {}
|
||||
}
|
||||
(globalThis as any).CustomDialogController = CustomDialogController;
|
||||
globalThis.CustomDialogController = CustomDialogController;
|
||||
|
||||
class TextModifier {
|
||||
constructor(nativePtr: KNode, classType: ModifierType) {}
|
||||
applyNormalAttribute(instance: TextAttribute) {}
|
||||
applyNormalAttribute(instance: TextAttribute): void {}
|
||||
}
|
||||
|
||||
export default { ViewPU, __JSBaseNode__, __JSScopeUtil__, CustomDialogController, TextModifier };
|
@ -59,6 +59,9 @@ class BuilderNode {
|
||||
public recycle(): void {
|
||||
this._JSBuilderNode.recycle();
|
||||
}
|
||||
public updateConfiguration(): void {
|
||||
this._JSBuilderNode.updateConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
class JSBuilderNode extends BaseNode {
|
||||
@ -171,13 +174,19 @@ class JSBuilderNode extends BaseNode {
|
||||
this.updateEnd();
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
}
|
||||
private updateConfiguration() {
|
||||
public updateConfiguration(): void {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
this.updateStart();
|
||||
this.purgeDeletedElmtIds();
|
||||
Array.from(this.updateFuncByElmtId.keys()).sort((a: number, b: number): number => {
|
||||
return (a < b) ? -1 : (a > b) ? 1 : 0;
|
||||
}).forEach(elmtId => this.UpdateElement(elmtId));
|
||||
for (const child of this.childrenWeakrefMap_.values()) {
|
||||
const childView = child.deref();
|
||||
if (childView) {
|
||||
childView.forceCompleteRerender(true);
|
||||
}
|
||||
}
|
||||
this.updateEnd();
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
}
|
||||
|
@ -74,4 +74,8 @@ class ComponentContent extends Content {
|
||||
}
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
public updateConfiguration(): void {
|
||||
this.builderNode_.updateConfiguration();
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ declare abstract class ViewPU {
|
||||
aboutToReuseInternal(param?: Object): void;
|
||||
aboutToRecycleInternal(): void;
|
||||
updateDirtyElements(): void;
|
||||
forceCompleteRerender(deep?: boolean): void
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -931,7 +931,7 @@ class RenderNode {
|
||||
}
|
||||
get shapeClip(): ShapeClip {
|
||||
this.shapeClipValue = this.shapeClipValue ? this.shapeClipValue : new ShapeClip();
|
||||
return this.shapeMask;
|
||||
return this.shapeClipValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2858,6 +2858,21 @@ class PixelRoundModifier extends ModifierWithKey {
|
||||
}
|
||||
}
|
||||
PixelRoundModifier.identity = Symbol('pixelRound');
|
||||
class FocusBoxModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().common.resetFocusBox(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().common.setFocusBox(node, this.value?.margin,
|
||||
this.value?.strokeWidth, this.value?.strokeColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
FocusBoxModifier.identity = Symbol('focusBox');
|
||||
const JSCallbackInfoType = { STRING: 0, NUMBER: 1, OBJECT: 2, BOOLEAN: 3, FUNCTION: 4 };
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isNumber = (val) => typeof val === 'number';
|
||||
@ -3007,9 +3022,7 @@ class ArkComponent {
|
||||
} else {
|
||||
this._modifiersWithKeys = new Map();
|
||||
}
|
||||
if (classType === ModifierType.STATE) {
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
}
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
this._nativePtrChanged = false;
|
||||
}
|
||||
setNodePtr(nodePtr) {
|
||||
@ -3038,7 +3051,7 @@ class ArkComponent {
|
||||
ArkLogConsole.info("modifier pointer changed");
|
||||
this.nativePtr = instance.nativePtr;
|
||||
this._nativePtrChanged = true;
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(instance.nativePtr);
|
||||
this._weakPtr = instance._weakPtr;
|
||||
}
|
||||
}
|
||||
applyModifierPatch() {
|
||||
@ -4170,6 +4183,10 @@ class ArkComponent {
|
||||
modifierWithKey(this._modifiersWithKeys, PixelRoundModifier.identity, PixelRoundModifier, value);
|
||||
return this;
|
||||
}
|
||||
focusBox(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, FocusBoxModifier.identity, FocusBoxModifier, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
const isNull = (val) => typeof val === 'object' && val === null;
|
||||
const isArray = (val) => Array.isArray(val);
|
||||
@ -9234,9 +9251,7 @@ class ArkSpanComponent {
|
||||
this.nativePtr = nativePtr;
|
||||
this._changed = false;
|
||||
this._classType = classType;
|
||||
if (classType === ModifierType.STATE) {
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
}
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(nativePtr);
|
||||
this._nativePtrChanged = false;
|
||||
}
|
||||
initialize(value) {
|
||||
@ -9266,7 +9281,7 @@ class ArkSpanComponent {
|
||||
if (this.nativePtr !== instance.nativePtr) {
|
||||
this.nativePtr = instance.nativePtr;
|
||||
this._nativePtrChanged = true;
|
||||
this._weakPtr = getUINativeModule().nativeUtils.createNativeWeakRef(instance.nativePtr);
|
||||
this._weakPtr = instance._weakPtr;
|
||||
}
|
||||
}
|
||||
onGestureJudgeBegin(callback) {
|
||||
@ -15559,6 +15574,15 @@ class ButtonTypeModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyStage(node, component) {
|
||||
if (this.stageValue === undefined || this.stageValue === null) {
|
||||
this.value = this.stageValue;
|
||||
this.applyPeer(node, true, component);
|
||||
return true;
|
||||
}
|
||||
this.applyPeer(node, false, component);
|
||||
return false;
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().button.resetType(node);
|
||||
|
@ -3297,6 +3297,12 @@ var GestureRecognizerState;
|
||||
GestureRecognizerState[GestureRecognizerState["FAILED"] = 5] = "FAILED";
|
||||
})(GestureRecognizerState || (GestureRecognizerState = {}));
|
||||
|
||||
let GridItemAlignment;
|
||||
(function (GridItemAlignment) {
|
||||
GridItemAlignment[GridItemAlignment['DEFAULT'] = 0] = 'DEFAULT';
|
||||
GridItemAlignment[GridItemAlignment['STRETCH'] = 1] = 'STRETCH';
|
||||
})(GridItemAlignment || (GridItemAlignment = {}));
|
||||
|
||||
class ImageAnalyzerController {
|
||||
constructor() {
|
||||
}
|
||||
|
@ -148,8 +148,43 @@ PersistenceV2.persistenceV2Impl_ = PersistenceV2Impl.instance();
|
||||
|
||||
const Type = __Type__;
|
||||
|
||||
/**
|
||||
* UIUtils is a state management tool class for operating the observed data.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
class UIUtils {
|
||||
/**
|
||||
* Get raw object from the Object wrapped with Proxy added by statemanagement framework.
|
||||
* If input parameter is a regular Object without Proxy, return Object itself.
|
||||
*
|
||||
* 1. For StateManagement V1, when source is a @Observed decorated object,
|
||||
* or a Object/Array/Map/Set/Date decorated by state decorators like @State,
|
||||
* getTarget will return its raw object without Proxy.
|
||||
* 2. For StateManagement V2, when source is a Array/Map/Set/Date decorated by state decorators
|
||||
* like @Trace or @Local, getTarget will return its raw object without Proxy.
|
||||
* 3. For other situation, getTarget will return the source directly.
|
||||
*
|
||||
* @param { T } source input source Object data.
|
||||
* @returns { T } raw object from the Object wrapped with an ObservedObject.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
static getTarget(source) {
|
||||
return UIUtils.uiUtilsImpl_.getTarget(source);
|
||||
}
|
||||
}
|
||||
|
||||
UIUtils.uiUtilsImpl_ = UIUtilsImpl.instance();
|
||||
|
||||
export default {
|
||||
AppStorageV2,
|
||||
PersistenceV2,
|
||||
Type
|
||||
Type,
|
||||
UIUtils
|
||||
};
|
||||
|
@ -95,6 +95,9 @@ class BuilderNode {
|
||||
recycle() {
|
||||
this._JSBuilderNode.recycle();
|
||||
}
|
||||
updateConfiguration() {
|
||||
this._JSBuilderNode.updateConfiguration();
|
||||
}
|
||||
}
|
||||
class JSBuilderNode extends BaseNode {
|
||||
constructor(uiContext, options) {
|
||||
@ -206,6 +209,12 @@ class JSBuilderNode extends BaseNode {
|
||||
Array.from(this.updateFuncByElmtId.keys()).sort((a, b) => {
|
||||
return (a < b) ? -1 : (a > b) ? 1 : 0;
|
||||
}).forEach(elmtId => this.UpdateElement(elmtId));
|
||||
for (const child of this.childrenWeakrefMap_.values()) {
|
||||
const childView = child.deref();
|
||||
if (childView) {
|
||||
childView.forceCompleteRerender(true);
|
||||
}
|
||||
}
|
||||
this.updateEnd();
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
}
|
||||
@ -2276,6 +2285,9 @@ class ComponentContent extends Content {
|
||||
}
|
||||
return node;
|
||||
}
|
||||
updateConfiguration() {
|
||||
this.builderNode_.updateConfiguration();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
|
@ -1628,7 +1628,12 @@ void JsRegisterViews(BindingTarget globalObj, void* nativeEngine)
|
||||
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "MainAxisAlign"), *mainAxisAlign);
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "CrossAxisAlign"), *crossAxisAlign);
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "Direction"), *direction);
|
||||
|
||||
auto container = Container::Current();
|
||||
if (container == nullptr || !container->IsDynamicRender()) {
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "Direction"), *direction);
|
||||
}
|
||||
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "StackFit"), *stackFit);
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "Align"), *alignment);
|
||||
globalObj->Set(vm, panda::StringRef::NewFromUtf8(vm, "Overflow"), *overflow);
|
||||
|
@ -947,6 +947,10 @@ ArkUINativeModuleValue ArkUINativeModule::GetArkUINativeModule(ArkUIRuntimeCallI
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), CommonBridge::GetApiTargetVersion));
|
||||
common->Set(vm, panda::StringRef::NewFromUtf8(vm, "setBorderWithDashParams"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), CommonBridge::SetBorderWithDashParams));
|
||||
common->Set(vm, panda::StringRef::NewFromUtf8(vm, "setFocusBox"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), CommonBridge::SetFocusBox));
|
||||
common->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetFocusBox"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), CommonBridge::ResetFocusBox));
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "common"), common);
|
||||
|
||||
auto nativeUtils = panda::ObjectRef::New(vm);
|
||||
|
@ -1393,6 +1393,22 @@ std::function<void(bool)> ParseTransitionCallback(
|
||||
};
|
||||
return finishCallback;
|
||||
}
|
||||
|
||||
bool ParseColorMetricsToColor(const EcmaVM *vm, const Local<JSValueRef> &jsValue, Color& result)
|
||||
{
|
||||
if (!jsValue->IsObject(vm)) {
|
||||
return false;
|
||||
}
|
||||
auto obj = jsValue->ToObject(vm);
|
||||
auto toNumericProp = obj->Get(vm, "toNumeric");
|
||||
if (toNumericProp->IsFunction(vm)) {
|
||||
panda::Local<panda::FunctionRef> func = toNumericProp;
|
||||
auto colorVal = func->Call(vm, obj, nullptr, 0);
|
||||
result.SetValue(colorVal->Uint32Value(vm));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ArkUINativeModuleValue CommonBridge::SetBackgroundColor(ArkUIRuntimeCallInfo *runtimeCallInfo)
|
||||
@ -7352,4 +7368,52 @@ ArkUINativeModuleValue CommonBridge::GetApiTargetVersion(ArkUIRuntimeCallInfo* r
|
||||
int32_t apiTargetVersion = container->GetApiTargetVersion();
|
||||
return panda::NumberRef::New(vm, apiTargetVersion);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue CommonBridge::SetFocusBox(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
CHECK_NULL_RETURN(nativeNode, panda::JSValueRef::Undefined(vm));
|
||||
auto marginArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
auto widthArg = runtimeCallInfo->GetCallArgRef(NUM_2);
|
||||
auto colorArg = runtimeCallInfo->GetCallArgRef(NUM_3);
|
||||
int32_t hasValue = 0;
|
||||
CalcDimension margin;
|
||||
if (!marginArg->IsUndefined() && !marginArg->IsNull()) {
|
||||
if (ArkTSUtils::ParseJsDimensionVpNG(vm, marginArg, margin, true)) {
|
||||
hasValue = 1;
|
||||
} else if (ArkTSUtils::ParseJsLengthMetrics(vm, marginArg, margin)) {
|
||||
hasValue = 1;
|
||||
}
|
||||
}
|
||||
hasValue = hasValue << 1;
|
||||
CalcDimension width;
|
||||
if (!widthArg->IsUndefined() && !widthArg->IsNull()) {
|
||||
if (ArkTSUtils::ParseJsDimensionVpNG(vm, widthArg, width, true) && GreatOrEqual(width.Value(), 0.0f)) {
|
||||
hasValue += 1;
|
||||
} else if (ArkTSUtils::ParseJsLengthMetrics(vm, widthArg, width) && GreatOrEqual(width.Value(), 0.0f)) {
|
||||
hasValue += 1;
|
||||
}
|
||||
}
|
||||
hasValue = hasValue << 1;
|
||||
Color strokeColor;
|
||||
if (!colorArg->IsUndefined() && !colorArg->IsNull() && ParseColorMetricsToColor(vm, colorArg, strokeColor)) {
|
||||
hasValue += 1;
|
||||
}
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setFocusBoxStyle(
|
||||
nativeNode, margin.Value(), width.Value(), strokeColor.GetValue(), hasValue);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue CommonBridge::ResetFocusBox(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getCommonModifier()->resetFocusBoxStyle(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -343,6 +343,8 @@ public:
|
||||
static ArkUINativeModuleValue GreatOrEqualAPITargetVersion(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue LessThanAPITargetVersion(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue GetApiTargetVersion(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetFocusBox(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetFocusBox(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
|
@ -542,7 +542,7 @@ ArkUINativeModuleValue ListBridge::ResetScrollSnapAlign(ArkUIRuntimeCallInfo* ru
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getListModifier()->resetAlignListItem(nativeNode);
|
||||
GetArkUINodeModifiers()->getListModifier()->resetScrollSnapAlign(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ uint32_t ArkTSUtils::ColorAlphaAdapt(uint32_t origin)
|
||||
|
||||
bool ArkTSUtils::ParseJsColor(const EcmaVM* vm, const Local<JSValueRef>& value, Color& result)
|
||||
{
|
||||
if (value->IsNumber() && value->IntegerValue(vm) >= 0) {
|
||||
if (value->IsNumber()) {
|
||||
result = Color(value->Uint32Value(vm));
|
||||
return true;
|
||||
}
|
||||
@ -102,7 +102,7 @@ bool ArkTSUtils::ParseJsSymbolColorAlpha(const EcmaVM* vm, const Local<JSValueRe
|
||||
if (!value->IsNumber() && !value->IsString(vm) && !value->IsObject(vm)) {
|
||||
return false;
|
||||
}
|
||||
if (value->IsNumber() && value->IntegerValue(vm) >= 0) {
|
||||
if (value->IsNumber()) {
|
||||
result = Color(ColorAlphaAdapt(value->Uint32Value(vm)));
|
||||
} else if (value->IsString(vm)) {
|
||||
Color::ParseColorString(value->ToString(vm)->ToString(vm), result);
|
||||
@ -114,7 +114,7 @@ bool ArkTSUtils::ParseJsSymbolColorAlpha(const EcmaVM* vm, const Local<JSValueRe
|
||||
|
||||
bool ArkTSUtils::ParseJsColorAlpha(const EcmaVM* vm, const Local<JSValueRef>& value, Color& result)
|
||||
{
|
||||
if (value->IsNumber() && value->IntegerValue(vm) >= 0) {
|
||||
if (value->IsNumber()) {
|
||||
result = Color(ColorAlphaAdapt(value->Uint32Value(vm)));
|
||||
return true;
|
||||
}
|
||||
@ -134,8 +134,7 @@ bool ArkTSUtils::ParseJsColorAlpha(
|
||||
return false;
|
||||
}
|
||||
if (value->IsNumber()) {
|
||||
result = value->IntegerValue(vm) >= 0 ? Color(ColorAlphaAdapt(value->Uint32Value(vm))) :
|
||||
defaultColor;
|
||||
result = Color(ColorAlphaAdapt(value->Uint32Value(vm)));
|
||||
return true;
|
||||
}
|
||||
if (value->IsString(vm)) {
|
||||
|
@ -6698,6 +6698,9 @@ class ViewPU extends PUV2ViewBase {
|
||||
return;
|
||||
}
|
||||
const _componentName = (classObject && ('name' in classObject)) ? Reflect.get(classObject, 'name') : 'unspecified UINode';
|
||||
if (_componentName === "__Recycle__") {
|
||||
return;
|
||||
}
|
||||
const _popFunc = (classObject && 'pop' in classObject) ? classObject.pop : () => { };
|
||||
const updateFunc = (elmtId, isFirstRender) => {
|
||||
var _a, _b;
|
||||
@ -10631,6 +10634,47 @@ PersistenceV2Impl.KEYS_ARR_ = '___keys_arr';
|
||||
PersistenceV2Impl.MAX_DATA_LENGTH_ = 8000;
|
||||
PersistenceV2Impl.NOT_SUPPORT_TYPES_ = [Array, Set, Map, WeakSet, WeakMap, Date, Boolean, Number, String, Symbol, BigInt, RegExp, Function, Promise, ArrayBuffer];
|
||||
PersistenceV2Impl.instance_ = undefined;
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
class UIUtilsImpl {
|
||||
getTarget(source) {
|
||||
if (!source || typeof source !== 'object') {
|
||||
return source;
|
||||
}
|
||||
if (ObservedObject.IsObservedObject(source)) {
|
||||
// V1 Proxy object
|
||||
return ObservedObject.GetRawObject(source);
|
||||
}
|
||||
else if (source[ObserveV2.SYMBOL_PROXY_GET_TARGET]) {
|
||||
// V2 Proxy object
|
||||
return source[ObserveV2.SYMBOL_PROXY_GET_TARGET];
|
||||
}
|
||||
else {
|
||||
// other situation, not handle
|
||||
return source;
|
||||
}
|
||||
}
|
||||
static instance() {
|
||||
if (UIUtilsImpl.instance_) {
|
||||
return UIUtilsImpl.instance_;
|
||||
}
|
||||
UIUtilsImpl.instance_ = new UIUtilsImpl();
|
||||
return UIUtilsImpl.instance_;
|
||||
}
|
||||
}
|
||||
UIUtilsImpl.instance_ = undefined;
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -1697,6 +1697,7 @@ void FrontendDelegateDeclarative::ShowDialog(const std::string& title, const std
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = title,
|
||||
.content = message,
|
||||
.autoCancel = autoCancel,
|
||||
@ -1711,6 +1712,7 @@ void FrontendDelegateDeclarative::ShowDialog(const std::string& title, const std
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter with status changed");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = title,
|
||||
.content = message,
|
||||
.autoCancel = autoCancel,
|
||||
@ -1725,6 +1727,7 @@ void FrontendDelegateDeclarative::ShowDialog(const PromptDialogAttr& dialogAttr,
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter with attr");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = dialogAttr.title,
|
||||
.content = dialogAttr.message,
|
||||
.autoCancel = dialogAttr.autoCancel,
|
||||
@ -1765,6 +1768,7 @@ void FrontendDelegateDeclarative::ShowDialog(const PromptDialogAttr& dialogAttr,
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter with attr for status changed");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = dialogAttr.title,
|
||||
.content = dialogAttr.message,
|
||||
.autoCancel = dialogAttr.autoCancel,
|
||||
@ -1887,7 +1891,6 @@ void FrontendDelegateDeclarative::CloseCustomDialog(const WeakPtr<NG::UINode>& n
|
||||
CHECK_NULL_VOID(overlayManager);
|
||||
TAG_LOGI(AceLogTag::ACE_OVERLAY, "begin to close custom dialog.");
|
||||
overlayManager->CloseCustomDialog(node, std::move(callback));
|
||||
SubwindowManager::GetInstance()->CloseCustomDialogNG(node, std::move(callback));
|
||||
};
|
||||
MainWindowOverlay(std::move(task), "ArkUIOverlayCloseCustomDialog");
|
||||
return;
|
||||
@ -1907,12 +1910,11 @@ void FrontendDelegateDeclarative::UpdateCustomDialog(
|
||||
if (dialogAttr.offset.has_value()) {
|
||||
dialogProperties.offset = dialogAttr.offset.value();
|
||||
}
|
||||
auto task = [dialogAttr, dialogProperties, node, callback]
|
||||
auto task = [dialogProperties, node, callback]
|
||||
(const RefPtr<NG::OverlayManager>& overlayManager) mutable {
|
||||
CHECK_NULL_VOID(overlayManager);
|
||||
LOGI("begin to update custom dialog.");
|
||||
overlayManager->UpdateCustomDialog(node, dialogProperties, std::move(callback));
|
||||
SubwindowManager::GetInstance()->UpdateCustomDialogNG(node, dialogAttr, std::move(callback));
|
||||
};
|
||||
MainWindowOverlay(std::move(task), "ArkUIOverlayUpdateCustomDialog");
|
||||
return;
|
||||
|
@ -660,7 +660,7 @@ void JSCanvasRenderer::JsPutImageData(const JSCallbackInfo& info)
|
||||
imageData.data = std::vector<Color>();
|
||||
for (int32_t i = std::max(imageData.dirtyY, 0); i < imageData.dirtyY + imageData.dirtyHeight; ++i) {
|
||||
for (int32_t j = std::max(imageData.dirtyX, 0); j < imageData.dirtyX + imageData.dirtyWidth; ++j) {
|
||||
uint32_t idx = 4 * (j + imgWidth * i);
|
||||
uint32_t idx = static_cast<uint32_t>(4 * (j + imgWidth * i));
|
||||
if (bufferLength > static_cast<int32_t>(idx + 3)) {
|
||||
imageData.data.emplace_back(
|
||||
Color::FromARGB(buffer[idx + 3], buffer[idx], buffer[idx + 1], buffer[idx + 2]));
|
||||
|
@ -63,7 +63,7 @@ napi_value AttachImageBitmap(napi_env env, void* value, void*)
|
||||
LOGW("Invalid parameter.");
|
||||
return nullptr;
|
||||
}
|
||||
auto image = (JSRenderImage*)value;
|
||||
auto* image = (JSRenderImage*)value;
|
||||
if (image == nullptr) {
|
||||
LOGW("Invalid context.");
|
||||
return nullptr;
|
||||
@ -83,6 +83,7 @@ napi_value AttachImageBitmap(napi_env env, void* value, void*)
|
||||
|
||||
napi_coerce_to_native_binding_object(env, imageBitmap, DetachImageBitmap, AttachImageBitmap, value, nullptr);
|
||||
napi_wrap_with_size(env, imageBitmap, value, JSRenderImage::Finalizer, nullptr, nullptr, image->GetBindingSize());
|
||||
image->AddNativeRef();
|
||||
return imageBitmap;
|
||||
}
|
||||
|
||||
@ -92,8 +93,7 @@ void JSRenderImage::Finalizer(napi_env env, void* data, void* hint)
|
||||
{
|
||||
auto wrapper = reinterpret_cast<JSRenderImage*>(data);
|
||||
if (wrapper) {
|
||||
delete wrapper;
|
||||
wrapper = nullptr;
|
||||
wrapper->Release();
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ napi_value JSRenderImage::Constructor(napi_env env, napi_callback_info info)
|
||||
if (argc <= 0) {
|
||||
napi_coerce_to_native_binding_object(env, thisVar, DetachImageBitmap, AttachImageBitmap, wrapper, nullptr);
|
||||
napi_wrap(env, thisVar, wrapper, Finalizer, nullptr, nullptr);
|
||||
wrapper->AddNativeRef();
|
||||
return thisVar;
|
||||
}
|
||||
napi_value argv[2] = { nullptr };
|
||||
@ -145,6 +146,7 @@ napi_value JSRenderImage::Constructor(napi_env env, napi_callback_info info)
|
||||
}
|
||||
napi_coerce_to_native_binding_object(env, thisVar, DetachImageBitmap, AttachImageBitmap, wrapper, nullptr);
|
||||
napi_wrap_with_size(env, thisVar, wrapper, Finalizer, nullptr, nullptr, wrapper->GetBindingSize());
|
||||
wrapper->AddNativeRef();
|
||||
return thisVar;
|
||||
}
|
||||
|
||||
@ -306,7 +308,7 @@ void JSRenderImage::OnImageLoadSuccess()
|
||||
svgDom_ = imageObj_->GetSVGDom();
|
||||
imageFit_ = loadingCtx_->GetImageFit();
|
||||
imageSize_ = loadingCtx_->GetImageSize();
|
||||
bindingSize_ = pixelMap_ ? pixelMap_->GetByteCount() : 0;
|
||||
bindingSize_ = pixelMap_ ? static_cast<size_t>(pixelMap_->GetByteCount()) : 0;
|
||||
}
|
||||
|
||||
void JSRenderImage::OnImageLoadFail(const std::string& errorMsg)
|
||||
|
@ -131,6 +131,19 @@ public:
|
||||
return bindingSize_;
|
||||
}
|
||||
|
||||
void AddNativeRef()
|
||||
{
|
||||
++nativeRefCount_;
|
||||
}
|
||||
|
||||
void Release()
|
||||
{
|
||||
--nativeRefCount_;
|
||||
if (nativeRefCount_ == 0) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
ACE_DISALLOW_COPY_AND_MOVE(JSRenderImage);
|
||||
private:
|
||||
napi_value OnClose();
|
||||
@ -168,6 +181,7 @@ private:
|
||||
int32_t instanceId_ = 0;
|
||||
CanvasUnit unit_ = CanvasUnit::DEFAULT;
|
||||
size_t bindingSize_ = 0;
|
||||
uint32_t nativeRefCount_ = 0;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
|
||||
constexpr int32_t REVERSE_OFFSET_ZOOM = 2;
|
||||
void JSFlexImpl::Create(const JSCallbackInfo& info)
|
||||
{
|
||||
if (info.Length() < 1) {
|
||||
@ -141,9 +142,9 @@ void JSFlexImpl::WrapComponent(const JSRef<JSObject>& obj, int32_t wrapVal)
|
||||
FlexModel::GetInstance()->SetDirection(static_cast<FlexDirection>(direction));
|
||||
// WrapReverse means wrapVal = 2. Wrap means wrapVal = 1.
|
||||
if (direction <= 1) {
|
||||
direction += 2 * (wrapVal - 1);
|
||||
direction += REVERSE_OFFSET_ZOOM * (wrapVal - 1);
|
||||
} else {
|
||||
direction -= 2 * (wrapVal - 1);
|
||||
direction -= REVERSE_OFFSET_ZOOM * (wrapVal - 1);
|
||||
}
|
||||
FlexModel::GetInstance()->SetWrapDirection(static_cast<WrapDirection>(direction));
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ void JSGrid::SetFriction(const JSCallbackInfo& info)
|
||||
|
||||
void JSGrid::SetAlignItems(const JSCallbackInfo& info)
|
||||
{
|
||||
if (info.Length() > 0) {
|
||||
if (info.Length() < 1) {
|
||||
GridModel::GetInstance()->SetAlignItems(GridItemAlignment::DEFAULT);
|
||||
return;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void JSImageSpan::SetObjectFit(const JSCallbackInfo& info)
|
||||
JSRef<JSVal> args = info[0];
|
||||
if (args->IsNumber()) {
|
||||
auto fit = static_cast<ImageFit>(args->ToNumber<int32_t>());
|
||||
if (fit < ImageFit::FILL || fit > ImageFit::SCALE_DOWN) {
|
||||
if (fit < ImageFit::FILL || fit > ImageFit::BOTTOM_END) {
|
||||
fit = ImageFit::COVER;
|
||||
}
|
||||
ImageModel::GetInstance()->SetImageFit(fit);
|
||||
|
@ -412,11 +412,12 @@ JSRef<JSVal> JSNavigationStack::GetOnPopByIndex(int32_t index) const
|
||||
}
|
||||
|
||||
bool JSNavigationStack::GetNavDestinationNodeInUINode(
|
||||
RefPtr<NG::UINode> node, RefPtr<NG::NavDestinationGroupNode>& desNode)
|
||||
RefPtr<NG::UINode>& node, RefPtr<NG::NavDestinationGroupNode>& desNode)
|
||||
{
|
||||
RefPtr<NG::CustomNode> customNode;
|
||||
while (node) {
|
||||
if (node->GetTag() == V2::JS_VIEW_ETS_TAG) {
|
||||
auto customNode = AceType::DynamicCast<NG::CustomNode>(node);
|
||||
customNode = AceType::DynamicCast<NG::CustomNode>(node);
|
||||
TAG_LOGI(AceLogTag::ACE_NAVIGATION, "render current custom node: %{public}s",
|
||||
customNode->GetCustomTag().c_str());
|
||||
// record parent navigationNode before customNode is rendered in case of navDestinationNode
|
||||
@ -426,6 +427,9 @@ bool JSNavigationStack::GetNavDestinationNodeInUINode(
|
||||
customNode->Render();
|
||||
} else if (node->GetTag() == V2::NAVDESTINATION_VIEW_ETS_TAG) {
|
||||
desNode = AceType::DynamicCast<NG::NavDestinationGroupNode>(node);
|
||||
if (customNode) {
|
||||
node = customNode;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
auto children = node->GetChildren();
|
||||
|
@ -125,7 +125,7 @@ private:
|
||||
JSRef<JSObject> GetJsPathInfo(int32_t index);
|
||||
std::string GetNameByIndex(int32_t index);
|
||||
JSRef<JSVal> GetOnPopByIndex(int32_t index) const;
|
||||
bool GetNavDestinationNodeInUINode(RefPtr<NG::UINode> node, RefPtr<NG::NavDestinationGroupNode>& desNode);
|
||||
bool GetNavDestinationNodeInUINode(RefPtr<NG::UINode>& node, RefPtr<NG::NavDestinationGroupNode>& desNode);
|
||||
int32_t GetSize() const;
|
||||
void SetJSParentStack(JSRef<JSVal> parent);
|
||||
static std::string ConvertParamToString(const JSRef<JSVal>& param);
|
||||
|
@ -178,7 +178,8 @@ void JSRefresh::Create(const JSCallbackInfo& info)
|
||||
}
|
||||
ParsFrictionData(friction);
|
||||
if (!ParseRefreshingContent(paramObject)) {
|
||||
ParseCustomBuilder(info);
|
||||
bool isCustomBuilderExist = ParseCustomBuilder(info);
|
||||
RefreshModel::GetInstance()->SetIsCustomBuilderExist(isCustomBuilderExist);
|
||||
}
|
||||
|
||||
std::string loadingStr = "";
|
||||
@ -209,6 +210,7 @@ bool JSRefresh::ParseRefreshingContent(const JSRef<JSObject>& paramObject)
|
||||
CHECK_NULL_RETURN(frameNode, false);
|
||||
RefPtr<NG::FrameNode> refPtrFrameNode = AceType::Claim(frameNode);
|
||||
RefreshModel::GetInstance()->SetCustomBuilder(refPtrFrameNode);
|
||||
RefreshModel::GetInstance()->SetIsCustomBuilderExist(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -214,8 +214,13 @@ void JSSpan::SetDecoration(const JSCallbackInfo& info)
|
||||
if (ParseJsColor(colorValue, result)) {
|
||||
colorVal = result;
|
||||
} else {
|
||||
// default color
|
||||
colorVal = Color::BLACK;
|
||||
auto theme = GetTheme<TextTheme>();
|
||||
CHECK_NULL_VOID(theme);
|
||||
if (SystemProperties::GetColorMode() == ColorMode::DARK) {
|
||||
colorVal = theme->GetTextStyle().GetTextColor();
|
||||
} else {
|
||||
colorVal = Color::BLACK;
|
||||
}
|
||||
}
|
||||
SpanModel::GetInstance()->SetTextDecoration(textDecoration.value());
|
||||
SpanModel::GetInstance()->SetTextDecorationColor(colorVal.value());
|
||||
|
@ -562,7 +562,11 @@ void JSText::SetDecoration(const JSCallbackInfo& info)
|
||||
if (!ParseJsColor(colorValue, result)) {
|
||||
auto theme = GetTheme<TextTheme>();
|
||||
CHECK_NULL_VOID(theme);
|
||||
result = theme->GetTextStyle().GetTextDecorationColor();
|
||||
if (SystemProperties::GetColorMode() == ColorMode::DARK) {
|
||||
result = theme->GetTextStyle().GetTextColor();
|
||||
} else {
|
||||
result = theme->GetTextStyle().GetTextDecorationColor();
|
||||
}
|
||||
}
|
||||
std::optional<TextDecorationStyle> textDecorationStyle;
|
||||
if (styleValue->IsNumber()) {
|
||||
|
@ -5522,7 +5522,7 @@ bool JSViewAbstract::ParseJsObjColorFromResource(const JSRef<JSObject> &jsObj, C
|
||||
|
||||
bool JSViewAbstract::ParseJsColor(const JSRef<JSVal>& jsValue, Color& result)
|
||||
{
|
||||
if (jsValue->IsNumber() && jsValue->ToNumber<int64_t>() >= 0) {
|
||||
if (jsValue->IsNumber()) {
|
||||
result = Color(ColorAlphaAdapt(jsValue->ToNumber<uint32_t>()));
|
||||
return true;
|
||||
}
|
||||
@ -5538,8 +5538,7 @@ bool JSViewAbstract::ParseJsColor(const JSRef<JSVal>& jsValue, Color& result)
|
||||
bool JSViewAbstract::ParseJsColor(const JSRef<JSVal>& jsValue, Color& result, const Color& defaultColor)
|
||||
{
|
||||
if (jsValue->IsNumber()) {
|
||||
result = jsValue->ToNumber<int64_t>() >= 0 ? Color(ColorAlphaAdapt(jsValue->ToNumber<uint32_t>())) :
|
||||
defaultColor;
|
||||
result = Color(ColorAlphaAdapt(jsValue->ToNumber<uint32_t>()));
|
||||
return true;
|
||||
}
|
||||
if (jsValue->IsString()) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
|
||||
#include "base/log/ace_trace.h"
|
||||
@ -77,6 +78,7 @@ constexpr int32_t INDEX_TWO = 2;
|
||||
constexpr int32_t LENGTH_ONE = 1;
|
||||
constexpr int32_t LENGTH_TWO = 2;
|
||||
constexpr int32_t LENGTH_THREE = 3;
|
||||
int32_t g_animationCount = 0;
|
||||
enum class AnimationInterface : int32_t {
|
||||
ANIMATION = 0,
|
||||
ANIMATE_TO,
|
||||
@ -103,7 +105,7 @@ std::unordered_map<int32_t, std::string> BIND_SHEET_ERROR_MAP = {
|
||||
"2. Incorrect parameter types; 3. Parameter verification failed." }
|
||||
};
|
||||
|
||||
void PrintInfiniteAnimation(const AnimationOption& option, AnimationInterface interface)
|
||||
void PrintAnimationInfo(const AnimationOption& option, AnimationInterface interface, const std::optional<int32_t>& cnt)
|
||||
{
|
||||
if (option.GetIteration() == ANIMATION_REPEAT_INFINITE) {
|
||||
if (interface == AnimationInterface::KEYFRAME_ANIMATE_TO) {
|
||||
@ -116,6 +118,11 @@ void PrintInfiniteAnimation(const AnimationOption& option, AnimationInterface in
|
||||
g_animationInterfaceNames[static_cast<int>(interface)], option.GetDuration(),
|
||||
option.GetCurve()->ToString().c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (cnt) {
|
||||
TAG_LOGI(AceLogTag::ACE_ANIMATION, "%{public}s starts, [%{public}s], finish cnt:%{public}d",
|
||||
g_animationInterfaceNames[static_cast<int>(interface)], option.ToString().c_str(), cnt.value());
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,11 +165,12 @@ bool GetAnyContextIsLayouting(const RefPtr<PipelineBase>& currentPipeline)
|
||||
}
|
||||
|
||||
void AnimateToForStageMode(const RefPtr<PipelineBase>& pipelineContext, AnimationOption& option,
|
||||
JSRef<JSFunc> jsAnimateToFunc, std::function<void()>& onFinishEvent, bool immediately)
|
||||
JSRef<JSFunc> jsAnimateToFunc, const std::optional<int32_t>& count, bool immediately)
|
||||
{
|
||||
auto triggerId = pipelineContext->GetInstanceId();
|
||||
ACE_SCOPED_TRACE("duration:%d, curve:%s, iteration:%d, delay:%d, instanceId:%d", option.GetDuration(),
|
||||
option.GetCurve()->ToString().c_str(), option.GetIteration(), option.GetDelay(), triggerId);
|
||||
ACE_SCOPED_TRACE("%s, instanceId:%d, finish cnt:%d", option.ToString().c_str(), triggerId, count.value_or(-1));
|
||||
PrintAnimationInfo(
|
||||
option, immediately ? AnimationInterface::ANIMATE_TO_IMMEDIATELY : AnimationInterface::ANIMATE_TO, count);
|
||||
if (!ViewStackModel::GetInstance()->IsEmptyStack()) {
|
||||
TAG_LOGW(AceLogTag::ACE_ANIMATION,
|
||||
"when call animateTo, node stack is not empty, not suitable for animateTo. param is [duration:%{public}d, "
|
||||
@ -170,20 +178,19 @@ void AnimateToForStageMode(const RefPtr<PipelineBase>& pipelineContext, Animatio
|
||||
option.GetDuration(), option.GetCurve()->ToString().c_str(), option.GetIteration());
|
||||
}
|
||||
NG::ScopedViewStackProcessor scopedProcessor;
|
||||
AceEngine::Get().NotifyContainers([triggerId, option](const RefPtr<Container>& container) {
|
||||
AceEngine::Get().NotifyContainers([triggerId](const RefPtr<Container>& container) {
|
||||
if (!CheckContainer(container)) {
|
||||
return;
|
||||
}
|
||||
auto context = container->GetPipelineContext();
|
||||
ContainerScope scope(container->GetInstanceId());
|
||||
context->FlushBuild();
|
||||
if (context->GetInstanceId() == triggerId) {
|
||||
return;
|
||||
}
|
||||
ContainerScope scope(container->GetInstanceId());
|
||||
context->FlushBuild();
|
||||
context->PrepareOpenImplicitAnimation();
|
||||
});
|
||||
pipelineContext->FlushBuild();
|
||||
pipelineContext->OpenImplicitAnimation(option, option.GetCurve(), onFinishEvent);
|
||||
pipelineContext->OpenImplicitAnimation(option, option.GetCurve(), option.GetOnFinishEvent());
|
||||
pipelineContext->SetSyncAnimationOption(option);
|
||||
// Execute the function.
|
||||
jsAnimateToFunc->Call(jsAnimateToFunc);
|
||||
@ -193,14 +200,13 @@ void AnimateToForStageMode(const RefPtr<PipelineBase>& pipelineContext, Animatio
|
||||
return;
|
||||
}
|
||||
auto context = container->GetPipelineContext();
|
||||
ContainerScope scope(container->GetInstanceId());
|
||||
context->FlushBuild();
|
||||
if (context->GetInstanceId() == triggerId) {
|
||||
return;
|
||||
}
|
||||
ContainerScope scope(container->GetInstanceId());
|
||||
context->FlushBuild();
|
||||
context->PrepareCloseImplicitAnimation();
|
||||
});
|
||||
pipelineContext->FlushBuild();
|
||||
pipelineContext->CloseImplicitAnimation();
|
||||
pipelineContext->SetSyncAnimationOption(AnimationOption());
|
||||
pipelineContext->FlushAfterLayoutCallbackInImplicitAnimationTask();
|
||||
@ -213,11 +219,12 @@ void AnimateToForStageMode(const RefPtr<PipelineBase>& pipelineContext, Animatio
|
||||
}
|
||||
|
||||
void AnimateToForFaMode(const RefPtr<PipelineBase>& pipelineContext, AnimationOption& option,
|
||||
JSRef<JSFunc> jsAnimateToFunc, std::function<void()>& onFinishEvent, bool immediately)
|
||||
JSRef<JSFunc> jsAnimateToFunc, const std::optional<int32_t>& count, bool immediately)
|
||||
{
|
||||
ACE_SCOPED_TRACE("duration:%d, curve:%s, iteration:%d, delay:%d, instanceId:%d", option.GetDuration(),
|
||||
option.GetCurve()->ToString().c_str(), option.GetIteration(), option.GetDelay(),
|
||||
pipelineContext->GetInstanceId());
|
||||
ACE_SCOPED_TRACE("%s, instanceId:%d, finish cnt:%d", option.ToString().c_str(), pipelineContext->GetInstanceId(),
|
||||
count.value_or(-1));
|
||||
PrintAnimationInfo(
|
||||
option, immediately ? AnimationInterface::ANIMATE_TO_IMMEDIATELY : AnimationInterface::ANIMATE_TO, count);
|
||||
if (!ViewStackModel::GetInstance()->IsEmptyStack()) {
|
||||
TAG_LOGW(AceLogTag::ACE_ANIMATION,
|
||||
"when call animateTo, node stack is not empty, not suitable for animateTo. param is [duration:%{public}d, "
|
||||
@ -226,7 +233,7 @@ void AnimateToForFaMode(const RefPtr<PipelineBase>& pipelineContext, AnimationOp
|
||||
}
|
||||
NG::ScopedViewStackProcessor scopedProcessor;
|
||||
pipelineContext->FlushBuild();
|
||||
pipelineContext->OpenImplicitAnimation(option, option.GetCurve(), onFinishEvent);
|
||||
pipelineContext->OpenImplicitAnimation(option, option.GetCurve(), option.GetOnFinishEvent());
|
||||
pipelineContext->SetSyncAnimationOption(option);
|
||||
jsAnimateToFunc->Call(jsAnimateToFunc);
|
||||
pipelineContext->FlushBuild();
|
||||
@ -534,7 +541,7 @@ void JSViewContext::JSAnimation(const JSCallbackInfo& info)
|
||||
if (SystemProperties::GetRosenBackendEnabled()) {
|
||||
option.SetAllowRunningAsynchronously(true);
|
||||
}
|
||||
PrintInfiniteAnimation(option, AnimationInterface::ANIMATION);
|
||||
PrintAnimationInfo(option, AnimationInterface::ANIMATION, std::nullopt);
|
||||
AceScopedTrace paramTrace("duration:%d, curve:%s, iteration:%d", option.GetDuration(),
|
||||
option.GetCurve()->ToString().c_str(), option.GetIteration());
|
||||
ViewContextModel::GetInstance()->openAnimation(option);
|
||||
@ -593,18 +600,22 @@ void JSViewContext::AnimateToInner(const JSCallbackInfo& info, bool immediately)
|
||||
JSRef<JSObject> obj = JSRef<JSObject>::Cast(info[0]);
|
||||
JSRef<JSVal> onFinish = obj->GetProperty("onFinish");
|
||||
std::function<void()> onFinishEvent;
|
||||
std::optional<int32_t> count;
|
||||
auto traceStreamPtr = std::make_shared<std::stringstream>();
|
||||
if (onFinish->IsFunction()) {
|
||||
count = g_animationCount++;
|
||||
auto frameNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
|
||||
RefPtr<JsFunction> jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(onFinish));
|
||||
onFinishEvent = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc),
|
||||
id = Container::CurrentIdSafely(), traceStreamPtr, node = frameNode]() mutable {
|
||||
id = Container::CurrentIdSafely(), traceStreamPtr, node = frameNode, count]() mutable {
|
||||
CHECK_NULL_VOID(func);
|
||||
ContainerScope scope(id);
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
ACE_SCOPED_TRACE("onFinish[cnt:%d]", count.value());
|
||||
auto pipelineContext = PipelineContext::GetCurrentContextSafely();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
pipelineContext->UpdateCurrentActiveNode(node);
|
||||
TAG_LOGI(AceLogTag::ACE_ANIMATION, "animateTo finish, cnt:%{public}d", count.value());
|
||||
func->Execute();
|
||||
func = nullptr;
|
||||
AceAsyncTraceEnd(0, traceStreamPtr->str().c_str(), true);
|
||||
@ -616,6 +627,7 @@ void JSViewContext::AnimateToInner(const JSCallbackInfo& info, bool immediately)
|
||||
}
|
||||
|
||||
AnimationOption option = CreateAnimation(obj, pipelineContext->IsFormRender());
|
||||
option.SetOnFinishEvent(onFinishEvent);
|
||||
*traceStreamPtr << "AnimateTo, Options"
|
||||
<< " duration:" << option.GetDuration()
|
||||
<< ",iteration:" << option.GetIteration()
|
||||
@ -623,8 +635,6 @@ void JSViewContext::AnimateToInner(const JSCallbackInfo& info, bool immediately)
|
||||
<< ",tempo:" << option.GetTempo()
|
||||
<< ",direction:" << (uint32_t) option.GetAnimationDirection()
|
||||
<< ",curve:" << (option.GetCurve() ? option.GetCurve()->ToString().c_str() : "");
|
||||
PrintInfiniteAnimation(
|
||||
option, immediately ? AnimationInterface::ANIMATE_TO_IMMEDIATELY : AnimationInterface::ANIMATE_TO);
|
||||
AceAsyncTraceBegin(0, traceStreamPtr->str().c_str(), true);
|
||||
if (CheckIfSetFormAnimationDuration(pipelineContext, option)) {
|
||||
option.SetDuration(DEFAULT_DURATION - GetFormAnimationTimeInterval(pipelineContext));
|
||||
@ -639,21 +649,21 @@ void JSViewContext::AnimateToInner(const JSCallbackInfo& info, bool immediately)
|
||||
"pipeline is layouting, post animateTo, duration:%{public}d, curve:%{public}s",
|
||||
option.GetDuration(), option.GetCurve() ? option.GetCurve()->ToString().c_str() : "");
|
||||
pipelineContext->GetTaskExecutor()->PostTask(
|
||||
[id = Container::CurrentIdSafely(), option, func = JSRef<JSFunc>::Cast(info[1]),
|
||||
onFinishEvent, immediately]() mutable {
|
||||
[id = Container::CurrentIdSafely(), option, func = JSRef<JSFunc>::Cast(info[1]), count,
|
||||
immediately]() mutable {
|
||||
ContainerScope scope(id);
|
||||
auto container = Container::CurrentSafely();
|
||||
CHECK_NULL_VOID(container);
|
||||
auto pipelineContext = container->GetPipelineContext();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
AnimateToForStageMode(pipelineContext, option, func, onFinishEvent, immediately);
|
||||
AnimateToForStageMode(pipelineContext, option, func, count, immediately);
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUIAnimateToForStageMode", PriorityType::IMMEDIATE);
|
||||
return;
|
||||
}
|
||||
AnimateToForStageMode(pipelineContext, option, JSRef<JSFunc>::Cast(info[1]), onFinishEvent, immediately);
|
||||
AnimateToForStageMode(pipelineContext, option, JSRef<JSFunc>::Cast(info[1]), count, immediately);
|
||||
} else {
|
||||
AnimateToForFaMode(pipelineContext, option, JSRef<JSFunc>::Cast(info[1]), onFinishEvent, immediately);
|
||||
AnimateToForFaMode(pipelineContext, option, JSRef<JSFunc>::Cast(info[1]), count, immediately);
|
||||
}
|
||||
} else {
|
||||
pipelineContext->FlushBuild();
|
||||
@ -703,7 +713,8 @@ void JSViewContext::JSKeyframeAnimateTo(const JSCallbackInfo& info)
|
||||
overallAnimationOption.SetDuration(duration);
|
||||
// actual curve is in keyframe, this curve will not be effective
|
||||
overallAnimationOption.SetCurve(Curves::EASE_IN_OUT);
|
||||
PrintInfiniteAnimation(overallAnimationOption, AnimationInterface::KEYFRAME_ANIMATE_TO);
|
||||
PrintAnimationInfo(overallAnimationOption, AnimationInterface::KEYFRAME_ANIMATE_TO, std::nullopt);
|
||||
NG::ScopedViewStackProcessor scopedProcessor;
|
||||
pipelineContext->FlushBuild();
|
||||
pipelineContext->OpenImplicitAnimation(
|
||||
overallAnimationOption, overallAnimationOption.GetCurve(), overallAnimationOption.GetOnFinishEvent());
|
||||
|
@ -650,6 +650,7 @@ void FrontendDelegateDeclarativeNG::ShowDialog(const std::string& title, const s
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = title,
|
||||
.content = message,
|
||||
.autoCancel = autoCancel,
|
||||
@ -664,6 +665,7 @@ void FrontendDelegateDeclarativeNG::ShowDialog(const std::string& title, const s
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = title,
|
||||
.content = message,
|
||||
.autoCancel = autoCancel,
|
||||
@ -679,6 +681,7 @@ void FrontendDelegateDeclarativeNG::ShowDialog(const PromptDialogAttr& dialogAtt
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = dialogAttr.title,
|
||||
.content = dialogAttr.message,
|
||||
.autoCancel = dialogAttr.autoCancel,
|
||||
@ -711,6 +714,7 @@ void FrontendDelegateDeclarativeNG::ShowDialog(const PromptDialogAttr& dialogAtt
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show dialog enter");
|
||||
DialogProperties dialogProperties = {
|
||||
.type = DialogType::ALERT_DIALOG,
|
||||
.title = dialogAttr.title,
|
||||
.content = dialogAttr.message,
|
||||
.autoCancel = dialogAttr.autoCancel,
|
||||
|
@ -674,6 +674,9 @@ abstract class ViewPU extends PUV2ViewBase
|
||||
return;
|
||||
}
|
||||
const _componentName: string = (classObject && ('name' in classObject)) ? Reflect.get(classObject, 'name') as string : 'unspecified UINode';
|
||||
if (_componentName === "__Recycle__") {
|
||||
return;
|
||||
}
|
||||
const _popFunc: () => void = (classObject && 'pop' in classObject) ? classObject.pop! : (): void => { };
|
||||
const updateFunc = (elmtId: number, isFirstRender: boolean): void => {
|
||||
this.syncInstanceId();
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class UIUtilsImpl {
|
||||
private static instance_: UIUtilsImpl = undefined;
|
||||
|
||||
public getTarget<T extends Object>(source: T): T {
|
||||
if (!source || typeof source !== 'object') {
|
||||
return source;
|
||||
}
|
||||
if (ObservedObject.IsObservedObject(source)) {
|
||||
// V1 Proxy object
|
||||
return ObservedObject.GetRawObject(source);
|
||||
} else if (source[ObserveV2.SYMBOL_PROXY_GET_TARGET]) {
|
||||
// V2 Proxy object
|
||||
return source[ObserveV2.SYMBOL_PROXY_GET_TARGET];
|
||||
} else {
|
||||
// other situation, not handle
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
||||
public static instance(): UIUtilsImpl {
|
||||
if (UIUtilsImpl.instance_) {
|
||||
return UIUtilsImpl.instance_;
|
||||
}
|
||||
UIUtilsImpl.instance_ = new UIUtilsImpl();
|
||||
return UIUtilsImpl.instance_;
|
||||
}
|
||||
}
|
@ -69,7 +69,7 @@ class ObserveV2 {
|
||||
public static readonly MONITOR_REFS = Symbol('___monitor_refs_');
|
||||
public static readonly COMPUTED_REFS = Symbol('___computed_refs_');
|
||||
|
||||
private static readonly SYMBOL_PROXY_GET_TARGET = Symbol('__proxy_get_target');
|
||||
public static readonly SYMBOL_PROXY_GET_TARGET = Symbol('__proxy_get_target');
|
||||
|
||||
public static readonly OB_PREFIX = '__ob_'; // OB_PREFIX + attrName => backing store attribute name
|
||||
public static readonly OB_PREFIX_LEN = 5;
|
||||
|
@ -93,6 +93,7 @@
|
||||
|
||||
// sdk
|
||||
"src/lib/sdk/v2_persistence.ts",
|
||||
"src/lib/sdk/ui_utils.ts",
|
||||
|
||||
// init
|
||||
"src/index.ts",
|
||||
|
@ -93,6 +93,7 @@
|
||||
|
||||
// sdk
|
||||
"src/lib/sdk/v2_persistence.ts",
|
||||
"src/lib/sdk/ui_utils.ts",
|
||||
|
||||
// init
|
||||
"src/index.ts",
|
||||
|
@ -93,6 +93,7 @@
|
||||
|
||||
// sdk
|
||||
"src/lib/sdk/v2_persistence.ts",
|
||||
"src/lib/sdk/ui_utils.ts",
|
||||
|
||||
// init
|
||||
"src/index.ts",
|
||||
|
@ -81,6 +81,7 @@
|
||||
|
||||
// sdk
|
||||
"src/lib/sdk/v2_persistence.ts",
|
||||
"src/lib/sdk/ui_utils.ts",
|
||||
|
||||
// unit testing
|
||||
"src/utest/common/helpers_for_test.ts",
|
||||
|
@ -459,7 +459,7 @@ Local<JSValueRef> PandaFunctionData::Callback(panda::JsiRuntimeCallInfo* info) c
|
||||
std::vector<shared_ptr<JsValue>> argv;
|
||||
uint32_t length = info->GetArgsNumber();
|
||||
argv.reserve(length);
|
||||
for (int32_t i = 0; i < length; ++i) {
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
argv.emplace_back(
|
||||
std::static_pointer_cast<JsValue>(std::make_shared<ArkJSValue>(runtime, info->GetCallArgRef(i))));
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace OHOS::Ace {
|
||||
|
||||
struct AccessibilityEvent {
|
||||
int64_t nodeId = 0;
|
||||
int64_t stackNodeId = -1;
|
||||
uint32_t windowId = 0;
|
||||
WindowsContentChangeTypes windowContentChangeTypes = CONTENT_CHANGE_TYPE_INVALID;
|
||||
WindowUpdateType windowChangeTypes = WINDOW_UPDATE_INVALID;
|
||||
|
@ -107,6 +107,8 @@ enum class AccessibilityEventType : size_t {
|
||||
ACCESSIBILITY_FOCUS_CLEARED = 0x00010000,
|
||||
TEXT_MOVE_UNIT = 0x00020000,
|
||||
SCROLL_START = 0x01000000,
|
||||
PAGE_OPEN = 0x20000000,
|
||||
PAGE_CLOSE = 0x08000000,
|
||||
UNKNOWN,
|
||||
};
|
||||
|
||||
|
@ -176,7 +176,7 @@ void AceEngine::DefusingBomb(int32_t instanceId)
|
||||
|
||||
void AceEngine::TriggerGarbageCollection()
|
||||
{
|
||||
std::unordered_map<int32_t, RefPtr<Container>> copied;
|
||||
decltype(containerMap_) copied;
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(mutex_);
|
||||
if (containerMap_.empty()) {
|
||||
@ -208,7 +208,7 @@ void AceEngine::TriggerGarbageCollection()
|
||||
void AceEngine::NotifyContainers(const std::function<void(const RefPtr<Container>&)>& callback)
|
||||
{
|
||||
CHECK_NULL_VOID(callback);
|
||||
std::unordered_map<int32_t, RefPtr<Container>> copied;
|
||||
decltype(containerMap_) copied;
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(mutex_);
|
||||
copied = containerMap_;
|
||||
@ -222,7 +222,7 @@ void AceEngine::NotifyContainers(const std::function<void(const RefPtr<Container
|
||||
|
||||
void AceEngine::DumpJsHeap(bool isPrivate) const
|
||||
{
|
||||
std::unordered_map<int32_t, RefPtr<Container>> copied;
|
||||
decltype(containerMap_) copied;
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(mutex_);
|
||||
copied = containerMap_;
|
||||
@ -234,7 +234,7 @@ void AceEngine::DumpJsHeap(bool isPrivate) const
|
||||
|
||||
void AceEngine::DestroyHeapProfiler() const
|
||||
{
|
||||
std::unordered_map<int32_t, RefPtr<Container>> copied;
|
||||
decltype(containerMap_) copied;
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(mutex_);
|
||||
copied = containerMap_;
|
||||
@ -246,7 +246,7 @@ void AceEngine::DestroyHeapProfiler() const
|
||||
|
||||
void AceEngine::ForceFullGC() const
|
||||
{
|
||||
std::unordered_map<int32_t, RefPtr<Container>> copied;
|
||||
decltype(containerMap_) copied;
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(mutex_);
|
||||
copied = containerMap_;
|
||||
|
@ -59,7 +59,8 @@ private:
|
||||
AceEngine();
|
||||
|
||||
mutable std::shared_mutex mutex_;
|
||||
std::unordered_map<int32_t, RefPtr<Container>> containerMap_;
|
||||
// ordered container
|
||||
std::map<int32_t, RefPtr<Container>> containerMap_;
|
||||
RefPtr<WatchDog> watchDog_;
|
||||
ACE_DISALLOW_COPY_AND_MOVE(AceEngine);
|
||||
};
|
||||
|
@ -40,6 +40,8 @@ class ACE_FORCE_EXPORT UdmfClient : public AceType {
|
||||
public:
|
||||
static UdmfClient* GetInstance();
|
||||
virtual RefPtr<UnifiedData> TransformUnifiedData(napi_value napiValue) = 0;
|
||||
virtual RefPtr<UnifiedData> TransformUnifiedDataForNative(void* rawData) = 0;
|
||||
virtual void* TransformUnifiedDataPtr(RefPtr<UnifiedData>& unifiedData) = 0;
|
||||
virtual napi_value TransformUdmfUnifiedData(RefPtr<UnifiedData>& UnifiedData) = 0;
|
||||
virtual napi_value TransformSummary(std::map<std::string, int64_t>& summary) = 0;
|
||||
virtual RefPtr<UnifiedData> CreateUnifiedData() = 0;
|
||||
|
@ -37,12 +37,14 @@ public:
|
||||
|
||||
void UpdateConfigSync(const T& config, std::function<void()> &&task)
|
||||
{
|
||||
task();
|
||||
|
||||
// Update current state
|
||||
std::lock_guard<std::mutex> taskLock(updateTaskMutex_);
|
||||
currentTask_.updateTask.Cancel();
|
||||
currentTask_.target = config;
|
||||
{
|
||||
std::lock_guard<std::mutex> taskLock(updateTaskMutex_);
|
||||
currentTask_.updateTask.Cancel();
|
||||
currentTask_.target = config;
|
||||
}
|
||||
|
||||
task();
|
||||
}
|
||||
|
||||
void UpdateConfig(const T& config, std::function<void()> &&task, const RefPtr<Container>& container,
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
|
||||
virtual void FlushModifier() {}
|
||||
|
||||
virtual bool HasUIAnimation()
|
||||
virtual bool HasUIRunningAnimation()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ bool RenderBox::HandleMouseEvent(const MouseEvent& event)
|
||||
#else
|
||||
LOGI("RenderBox::HandleMouseEvent: Do mouse callback with mouse event{ Global(%{public}f,%{public}f), "
|
||||
"Local(%{public}f,%{public}f)}, Button(%{public}d), Action(%{public}d), Time(%{public}lld), "
|
||||
"DeviceId(%{public}" PRId64 ", SourceType(%{public}d) }. Return: %{public}d",
|
||||
"DeviceId(%{private}" PRId64 ", SourceType(%{public}d) }. Return: %{public}d",
|
||||
info.GetGlobalLocation().GetX(), info.GetGlobalLocation().GetY(), info.GetLocalLocation().GetX(),
|
||||
info.GetLocalLocation().GetY(), info.GetButton(), info.GetAction(),
|
||||
info.GetTimeStamp().time_since_epoch().count(), info.GetDeviceId(), info.GetSourceDevice(),
|
||||
|
@ -53,6 +53,8 @@ void SwitchTheme::Builder::ParsePattern(const RefPtr<ThemeConstants>& themeConst
|
||||
theme->touchDuration_ = switchPattern->GetAttr<double>("touch_animation_duration", 0.0);
|
||||
theme->colorAnimationDuration_ = switchPattern->GetAttr<double>("color_animation_duration", 0.0);
|
||||
theme->pointAnimationDuration_ = switchPattern->GetAttr<double>("point_animation_duration", 0.0);
|
||||
theme->interactiveHoverColor_ = switchPattern->GetAttr<Color>("interactive_hover", Color::RED);
|
||||
theme->interactivePressedColor_ = switchPattern->GetAttr<Color>("interactive_pressed", Color::RED);
|
||||
if (SystemProperties::GetDeviceType() != DeviceType::CAR) {
|
||||
return;
|
||||
}
|
||||
|
@ -418,10 +418,22 @@ public:
|
||||
return pointAnimationDuration_;
|
||||
}
|
||||
|
||||
const Color& GetInteractiveHoverColor() const
|
||||
{
|
||||
return interactiveHoverColor_;
|
||||
}
|
||||
|
||||
const Color& GetInteractivePressedColor() const
|
||||
{
|
||||
return interactivePressedColor_;
|
||||
}
|
||||
|
||||
private:
|
||||
double colorAnimationDuration_ = 0.0;
|
||||
double pointAnimationDuration_ = 0.0;
|
||||
Color focusedPointColorUnselected_;
|
||||
Color interactiveHoverColor_;
|
||||
Color interactivePressedColor_;
|
||||
Dimension focusBoardWidth_;
|
||||
Dimension focusBoardHeight_;
|
||||
Dimension focusBoardRadius_;
|
||||
|
@ -36,50 +36,50 @@ public:
|
||||
}
|
||||
void SetXsSizeColumn(uint32_t xsSizeColumn, const Dimension& offset = UNDEFINED_DIMENSION)
|
||||
{
|
||||
columnInfo_->columns_[ScreenSizeType::XS] = xsSizeColumn;
|
||||
columnInfo_->columns_[ScreenSizeType::XS] = static_cast<int32_t>(xsSizeColumn);
|
||||
columnInfo_->dimOffsets_[ScreenSizeType::XS] = offset;
|
||||
}
|
||||
|
||||
void SetSmSizeColumn(uint32_t smSizeColumn, const Dimension& offset = UNDEFINED_DIMENSION)
|
||||
{
|
||||
columnInfo_->columns_[ScreenSizeType::SM] = smSizeColumn;
|
||||
columnInfo_->columns_[ScreenSizeType::SM] = static_cast<int32_t>(smSizeColumn);
|
||||
columnInfo_->dimOffsets_[ScreenSizeType::SM] = offset;
|
||||
}
|
||||
|
||||
void SetMdSizeColumn(uint32_t mdSizeColumn, const Dimension& offset = UNDEFINED_DIMENSION)
|
||||
{
|
||||
columnInfo_->columns_[ScreenSizeType::MD] = mdSizeColumn;
|
||||
columnInfo_->columns_[ScreenSizeType::MD] = static_cast<int32_t>(mdSizeColumn);
|
||||
columnInfo_->dimOffsets_[ScreenSizeType::MD] = offset;
|
||||
}
|
||||
|
||||
void SetLgSizeColumn(uint32_t lgSizeColumn, const Dimension& offset = UNDEFINED_DIMENSION)
|
||||
{
|
||||
columnInfo_->columns_[ScreenSizeType::LG] = lgSizeColumn;
|
||||
columnInfo_->columns_[ScreenSizeType::LG] = static_cast<int32_t>(lgSizeColumn);
|
||||
columnInfo_->dimOffsets_[ScreenSizeType::LG] = offset;
|
||||
}
|
||||
|
||||
void SetSizeColumn(GridSizeType type, uint32_t column, const Dimension& offset = UNDEFINED_DIMENSION)
|
||||
{
|
||||
columnInfo_->columns_[type] = column;
|
||||
columnInfo_->columns_[type] = static_cast<int32_t>(column);
|
||||
columnInfo_->dimOffsets_[type] = offset;
|
||||
}
|
||||
|
||||
void SetSmSizeMaxColumn(uint32_t smSizeMaxColumn)
|
||||
{
|
||||
columnInfo_->maxColumns_[ScreenSizeType::SM] = smSizeMaxColumn;
|
||||
columnInfo_->maxColumns_[ScreenSizeType::SM] = static_cast<int32_t>(smSizeMaxColumn);
|
||||
}
|
||||
void SetMdSizeMaxColumn(uint32_t mdSizeMaxColumn)
|
||||
{
|
||||
columnInfo_->maxColumns_[ScreenSizeType::MD] = mdSizeMaxColumn;
|
||||
columnInfo_->maxColumns_[ScreenSizeType::MD] = static_cast<int32_t>(mdSizeMaxColumn);
|
||||
}
|
||||
void SetLgSizeMaxColumn(uint32_t lgSizeMaxColumn)
|
||||
{
|
||||
columnInfo_->maxColumns_[ScreenSizeType::LG] = lgSizeMaxColumn;
|
||||
columnInfo_->maxColumns_[ScreenSizeType::LG] = static_cast<int32_t>(lgSizeMaxColumn);
|
||||
}
|
||||
|
||||
void SetColumns(uint32_t columns)
|
||||
{
|
||||
columnInfo_->columns_[ScreenSizeType::UNDEFINED] = columns;
|
||||
columnInfo_->columns_[ScreenSizeType::UNDEFINED] = static_cast<int32_t>(columns);
|
||||
}
|
||||
|
||||
void ACE_EXPORT SetOffset(int32_t offset, GridSizeType type = GridSizeType::UNDEFINED);
|
||||
|
@ -157,6 +157,22 @@ public:
|
||||
return rateRange_;
|
||||
}
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
std::string result = std::string("duration:").append(std::to_string(duration_))
|
||||
.append(", curve:").append(curve_ ? curve_->ToString() : "");
|
||||
if (iteration_ != 1) {
|
||||
result.append(", iteration:").append(std::to_string(iteration_));
|
||||
}
|
||||
if (delay_) {
|
||||
result.append(", delay:").append(std::to_string(delay_));
|
||||
}
|
||||
if (!NearEqual(tempo_, 1.0f)) {
|
||||
result.append(", tempo:").append(std::to_string(tempo_));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t duration_ = 0;
|
||||
int32_t delay_ = 0;
|
||||
|
@ -860,7 +860,7 @@ Size RosenRenderCustomPaint::MeasureTextSizeInner(const MeasureContext& context)
|
||||
#else
|
||||
auto* paragraphTxt = static_cast<Rosen::Typography*>(paragraph.get());
|
||||
#endif
|
||||
if (paragraphTxt->GetLineCount() == 1) {
|
||||
if (paragraphTxt->GetLineCount() == 1 && !context.isReturnActualWidth) {
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
textWidth = std::max(paragraph->GetLongestLine(), paragraph->GetMaxIntrinsicWidth());
|
||||
#else
|
||||
|
@ -37,8 +37,8 @@ namespace OHOS::Ace::Constants {
|
||||
namespace {
|
||||
const std::string FONTWEIGHT = "wght";
|
||||
constexpr float DEFAULT_MULTIPLE = 100.0f;
|
||||
constexpr uint32_t SCALE_EFFECT = 2;
|
||||
constexpr uint32_t NONE_EFFECT = 0;
|
||||
constexpr int32_t SCALE_EFFECT = 2;
|
||||
constexpr int32_t NONE_EFFECT = 0;
|
||||
constexpr float ORIGINAL_LINE_HEIGHT_SCALE = 1.0f;
|
||||
} // namespace
|
||||
|
||||
|
@ -156,6 +156,7 @@ void RosenFontCollection::LoadThemeFont(const char* fontFamily, std::unique_ptr<
|
||||
#endif
|
||||
#else
|
||||
fontCollection_->LoadThemeFont("", nullptr, 0);
|
||||
LOGD("LoadThemeFont [%{public}s:%{public}d]", familyName.c_str(), static_cast<int32_t>(size));
|
||||
fontCollection_->LoadThemeFont(familyName, data, size);
|
||||
#endif
|
||||
}
|
||||
@ -171,38 +172,38 @@ void RosenFontCollection::LoadFontFamily(const char* fontFamily, const char* fam
|
||||
InitializeFontCollection();
|
||||
auto ret = StdFilesystemExists(path);
|
||||
if (!ret) {
|
||||
LOGE("font is not exist");
|
||||
LOGW("FontFamily %{public}s not exist", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream ifs(path, std::ios_base::in);
|
||||
if (!ifs.is_open()) {
|
||||
LOGE("path file open fail");
|
||||
LOGW("FontFamily file open fail, %{public}s", path.c_str());
|
||||
return;
|
||||
}
|
||||
ifs.seekg(0, ifs.end);
|
||||
if (!ifs.good()) {
|
||||
ifs.close();
|
||||
LOGE("font file is bad");
|
||||
LOGW("font file is bad");
|
||||
return;
|
||||
}
|
||||
auto size = ifs.tellg();
|
||||
if (ifs.fail()) {
|
||||
ifs.close();
|
||||
LOGE("get size failed");
|
||||
LOGW("get size failed");
|
||||
return;
|
||||
}
|
||||
ifs.seekg(ifs.beg);
|
||||
if (!ifs.good()) {
|
||||
ifs.close();
|
||||
LOGE("file seek failed");
|
||||
LOGW("file seek failed");
|
||||
return;
|
||||
}
|
||||
std::unique_ptr<char[]> buffer = std::make_unique<char[]>(size);
|
||||
ifs.read(buffer.get(), size);
|
||||
if (!ifs.good()) {
|
||||
ifs.close();
|
||||
LOGE("read file failed");
|
||||
LOGW("read file failed");
|
||||
return;
|
||||
}
|
||||
ifs.close();
|
||||
|
@ -214,9 +214,12 @@ void FormManagerDelegate::OnSurfaceCreate(const AppExecFwk::FormJsInfo& formInfo
|
||||
newWant.SetParam(OHOS::AppExecFwk::Constants::FORM_IS_RECOVER_FORM_TO_HANDLE_CLICK_EVENT, needHandleCachedClick);
|
||||
|
||||
onFormSurfaceNodeCallback_(rsSurfaceNode, newWant);
|
||||
if (!formRendererDispatcher_) {
|
||||
sptr<IRemoteObject> proxy = want.GetRemoteObject(FORM_RENDERER_DISPATCHER);
|
||||
|
||||
sptr<IRemoteObject> proxy = want.GetRemoteObject(FORM_RENDERER_DISPATCHER);
|
||||
if (proxy != nullptr) {
|
||||
formRendererDispatcher_ = iface_cast<IFormRendererDispatcher>(proxy);
|
||||
} else {
|
||||
TAG_LOGE(AceLogTag::ACE_FORM, "want renderer dispatcher null");
|
||||
}
|
||||
|
||||
isDynamic_ = formInfo.isDynamic;
|
||||
|
@ -292,6 +292,12 @@ public:
|
||||
theme->optionTextStyle_.SetTextDecoration(TextDecoration::NONE);
|
||||
theme->menuLargeMargin_ = pattern->GetAttr<Dimension>("menu_large_margin", theme->menuLargeMargin_);
|
||||
theme->menuMediumMargin_ = pattern->GetAttr<Dimension>("menu_medium_margin", theme->menuMediumMargin_);
|
||||
theme->menuItemChildMinHeight_ = pattern->GetAttr<Dimension>("menu_item_child_min_height", 32.0_vp);
|
||||
theme->menuItemVerticalPadding_ = pattern->GetAttr<Dimension>("menu_item_vertical_padding", 8.0_vp);
|
||||
theme->menuItemGroupTitleTextFontSize_ =
|
||||
pattern->GetAttr<Dimension>("menu_item_group_title_text_font_size", 18.0_vp);
|
||||
theme->menuDefaultRadius_ = pattern->GetAttr<Dimension>("menu_default_radius", 20.0_vp);
|
||||
theme->menuTextColor_= pattern->GetAttr<Color>("menu_text_color", Color(0xe5000000));
|
||||
}
|
||||
};
|
||||
|
||||
@ -410,6 +416,11 @@ public:
|
||||
theme->maxPaddingEnd_ = maxPaddingEnd_;
|
||||
theme->menuLargeMargin_ = menuLargeMargin_;
|
||||
theme->menuMediumMargin_ = menuMediumMargin_;
|
||||
theme->menuItemChildMinHeight_ = menuItemChildMinHeight_;
|
||||
theme->menuItemVerticalPadding_ = menuItemVerticalPadding_;
|
||||
theme->menuItemGroupTitleTextFontSize_ = menuItemGroupTitleTextFontSize_;
|
||||
theme->menuDefaultRadius_ = menuDefaultRadius_;
|
||||
theme->menuTextColor_ = menuTextColor_;
|
||||
}
|
||||
|
||||
const Color& GetSelectedColorText() const
|
||||
@ -1064,6 +1075,31 @@ public:
|
||||
return menuMediumMargin_;
|
||||
}
|
||||
|
||||
const Dimension& GetMenuChildMinHeight() const
|
||||
{
|
||||
return menuItemChildMinHeight_;
|
||||
}
|
||||
|
||||
const Dimension& GetMenuItemVerticalPadding() const
|
||||
{
|
||||
return menuItemVerticalPadding_;
|
||||
}
|
||||
|
||||
const Dimension& GetMenuItemGroupTitleTextFontSize() const
|
||||
{
|
||||
return menuItemGroupTitleTextFontSize_;
|
||||
}
|
||||
|
||||
const Dimension& GetMenuDefaultRadius() const
|
||||
{
|
||||
return menuDefaultRadius_;
|
||||
}
|
||||
|
||||
const Color& GetMenuTextColor() const
|
||||
{
|
||||
return menuTextColor_;
|
||||
}
|
||||
|
||||
const uint32_t& GetMenuItemContentAlign() const
|
||||
{
|
||||
return menuItemContentAlign_;
|
||||
@ -1183,6 +1219,11 @@ private:
|
||||
std::unordered_map<ControlSize, Dimension> selectFontSizeMap_;
|
||||
Dimension menuLargeMargin_;
|
||||
Dimension menuMediumMargin_;
|
||||
Dimension menuItemChildMinHeight_;
|
||||
Dimension menuItemVerticalPadding_;
|
||||
Dimension menuItemGroupTitleTextFontSize_;
|
||||
Dimension menuDefaultRadius_;
|
||||
Color menuTextColor_;
|
||||
uint32_t menuItemContentAlign_ = CONTENT_ALIGN_LEFT;
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "core/components/theme/theme_constants_defines.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
constexpr float DRAG_BACKGROUND_OPACITY = 0.95f;
|
||||
/**
|
||||
* TextTheme defines color and styles of ThemeComponent. TextTheme should be built
|
||||
* using TextTheme::Builder.
|
||||
@ -63,6 +63,11 @@ public:
|
||||
theme->selectedColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_SELECTED, Color(0x33007dff));
|
||||
auto draggable = pattern->GetAttr<std::string>("draggable", "0");
|
||||
theme->draggable_ = StringUtils::StringToInt(draggable);
|
||||
auto dragBackgroundColor = pattern->GetAttr<Color>("drag_background_color", Color::WHITE);
|
||||
if (SystemProperties::GetColorMode() == ColorMode::DARK) {
|
||||
dragBackgroundColor = dragBackgroundColor.ChangeOpacity(DRAG_BACKGROUND_OPACITY);
|
||||
}
|
||||
theme->dragBackgroundColor_ = dragBackgroundColor;
|
||||
constexpr double childMinSize = 20.0;
|
||||
theme->linearSplitChildMinSize_ = pattern->GetAttr<double>(LINEAR_SPLIT_CHILD_MIN_SIZE, childMinSize);
|
||||
theme->isTextFadeout_ = pattern->GetAttr<std::string>("text_fadeout_enable", "") == "true";
|
||||
@ -109,12 +114,18 @@ public:
|
||||
return isShowHandle_;
|
||||
}
|
||||
|
||||
const Color& GetDragBackgroundColor() const
|
||||
{
|
||||
return dragBackgroundColor_;
|
||||
}
|
||||
|
||||
protected:
|
||||
TextTheme() = default;
|
||||
|
||||
private:
|
||||
TextStyle textStyle_;
|
||||
Color selectedColor_;
|
||||
Color dragBackgroundColor_ = Color::WHITE;
|
||||
bool draggable_ = false;
|
||||
double linearSplitChildMinSize_ = 20.0;
|
||||
bool isTextFadeout_ = false;
|
||||
|
@ -61,6 +61,7 @@ const char PLAYER_ERROR_CODE_CREATEFAIL[] = "error_video_000001";
|
||||
const char PLAYER_ERROR_MSG_CREATEFAIL[] = "Create player failed.";
|
||||
const char PLAYER_ERROR_CODE_FILEINVALID[] = "error_video_000002";
|
||||
const char PLAYER_ERROR_MSG_FILEINVALID[] = "File invalid.";
|
||||
const int32_t DURATION_THOUSAND = 1000;
|
||||
|
||||
void Player::Create(const std::function<void(int64_t)>& onCreate)
|
||||
{
|
||||
@ -201,9 +202,9 @@ void Player::SetSurfaceId(int64_t id, bool isTexture)
|
||||
void Player::OnPrepared(const std::string& param)
|
||||
{
|
||||
currentPos_ = 0;
|
||||
width_ = GetIntParam(param, PLAYER_PARAM_WIDTH);
|
||||
height_ = GetIntParam(param, PLAYER_PARAM_HEIGHT);
|
||||
duration_ = GetIntParam(param, PLAYER_PARAM_DURATION) / 1000;
|
||||
width_ = static_cast<uint32_t>(GetIntParam(param, PLAYER_PARAM_WIDTH));
|
||||
height_ = static_cast<uint32_t>(GetIntParam(param, PLAYER_PARAM_HEIGHT));
|
||||
duration_ = static_cast<uint32_t>(GetIntParam(param, PLAYER_PARAM_DURATION) / DURATION_THOUSAND);
|
||||
isPlaying_ = GetIntParam(param, PLAYER_PARAM_ISPLAYING) == 1;
|
||||
isNeedFreshForce_ = GetIntParam(param, PLAYER_PARAM_NEEDFRESHFORCE) == 1;
|
||||
isPrepared_ = true;
|
||||
@ -246,7 +247,7 @@ void Player::OnCompletion(const std::string& param)
|
||||
|
||||
void Player::OnSeekComplete(const std::string& param)
|
||||
{
|
||||
currentPos_ = GetIntParam(param, PLAYER_PARAM_CURRENTPOS);
|
||||
currentPos_ = static_cast<uint32_t>(GetIntParam(param, PLAYER_PARAM_CURRENTPOS));
|
||||
if (!onCurrentPosListener_.empty()) {
|
||||
onCurrentPosListener_.back()(currentPos_);
|
||||
}
|
||||
@ -304,7 +305,7 @@ void Player::GetCurrentTime()
|
||||
|
||||
void Player::OnTimeGetted(const std::string& result)
|
||||
{
|
||||
currentPos_ = GetIntParam(result, PLAYER_PARAM_CURRENTPOS);
|
||||
currentPos_ = static_cast<uint32_t>(GetIntParam(result, PLAYER_PARAM_CURRENTPOS));
|
||||
if (!onCurrentPosListener_.empty()) {
|
||||
onCurrentPosListener_.back()(currentPos_);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user