mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-02-18 19:59:56 +00:00
commit
725a05c9bd
@ -1243,7 +1243,7 @@ void JSParagraphStyleSpan::ParseJsWordBreak(const JSRef<JSObject>& obj, SpanPara
|
||||
JSRef<JSVal> args = obj->GetProperty("wordBreak");
|
||||
int32_t index = WORD_BREAK_TYPES_DEFAULT;
|
||||
if (args->IsNumber()) {
|
||||
index = args->ToNumber<int32_t>();
|
||||
index = static_cast<uint32_t>(args->ToNumber<int32_t>());
|
||||
}
|
||||
if (index < 0 || index >= WORD_BREAK_TYPES.size()) {
|
||||
index = 0;
|
||||
|
@ -461,6 +461,9 @@ RefPtr<SpanBase> JSSpanString::ParseJsCustomSpan(int32_t start, int32_t length,
|
||||
if (paramObj->IsUndefined()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!paramObj->IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto styleStringValue = JSRef<JSObject>::Cast(JSRef<JSObject>::Cast(paramObj)->GetProperty("styledValue"));
|
||||
if (styleStringValue->IsUndefined()) {
|
||||
return nullptr;
|
||||
@ -582,6 +585,9 @@ void JSMutableSpanString::Constructor(const JSCallbackInfo& args)
|
||||
spanString->BindWithSpans(spanBases);
|
||||
}
|
||||
} else {
|
||||
if (!args[0]->IsObject()) {
|
||||
return;
|
||||
}
|
||||
auto* base = JSRef<JSObject>::Cast(args[0])->Unwrap<AceType>();
|
||||
auto* imageAttachment = AceType::DynamicCast<JSImageAttachment>(base);
|
||||
if (imageAttachment) {
|
||||
@ -748,6 +754,9 @@ void JSMutableSpanString::ReplaceSpan(const JSCallbackInfo& info)
|
||||
if (type == SpanType::CustomSpan && !VerifyCustomSpanParameters(start, length)) {
|
||||
return;
|
||||
}
|
||||
if (!styleValueObj->IsObject()) {
|
||||
return;
|
||||
}
|
||||
auto spanBase = ParseJsSpanBaseWithoutSpecialSpan(start, length, type, JSRef<JSObject>::Cast(styleValueObj), info);
|
||||
if (!spanBase) {
|
||||
JSException::Throw(ERROR_CODE_PARAM_INVALID, "%s", "Input parameter check failed.");
|
||||
@ -789,6 +798,9 @@ void JSMutableSpanString::AddSpan(const JSCallbackInfo& info)
|
||||
if (type == SpanType::CustomSpan && !VerifyCustomSpanParameters(start, length)) {
|
||||
return;
|
||||
}
|
||||
if (!styleValueObj->IsObject()) {
|
||||
return;
|
||||
}
|
||||
auto spanBase = ParseJsSpanBaseWithoutSpecialSpan(start, length, type, JSRef<JSObject>::Cast(styleValueObj), info);
|
||||
if (!spanBase) {
|
||||
JSException::Throw(ERROR_CODE_PARAM_INVALID, "%s", "Input parameter check failed.");
|
||||
|
@ -241,7 +241,7 @@ void EventManager::RecordHitEmptyMessage(
|
||||
windowId = NG::WindowSceneHelper::GetWindowIdForWindowScene(frameNode);
|
||||
#endif
|
||||
if (windowId == 0) {
|
||||
windowId = container->GetWindowId();
|
||||
windowId = static_cast<int32_t>(container->GetWindowId());
|
||||
}
|
||||
hitEmptyMessage->Put("windowId", static_cast<int32_t>(windowId));
|
||||
auto pipelineContext = container->GetPipelineContext();
|
||||
@ -1367,7 +1367,7 @@ bool EventManager::IsSystemKeyboardShortcut(const std::string& value, uint8_t ke
|
||||
}
|
||||
|
||||
const std::set<char> forbidValue{'X', 'Y', 'Z', 'A', 'C', 'V'};
|
||||
char c = std::toupper(value.front());
|
||||
auto c = std::toupper(value.front());
|
||||
if (forbidValue.count(c) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -22,14 +22,17 @@
|
||||
namespace OHOS::Ace {
|
||||
|
||||
std::map<int32_t, std::shared_ptr<std::vector<uint8_t>>> ShareData::shareDataMap_;
|
||||
std::mutex ShareData::shareDataMapMutex_;
|
||||
|
||||
void ShareData::InsertBuffer(int32_t bufferId, std::shared_ptr<std::vector<uint8_t>> dataArray)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(shareDataMapMutex_);
|
||||
shareDataMap_[bufferId] = dataArray;
|
||||
}
|
||||
|
||||
std::shared_ptr<std::vector<uint8_t>> ShareData::GetShareBufferById(int32_t id)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(shareDataMapMutex_);
|
||||
auto data = ShareData::shareDataMap_.find(id);
|
||||
if (data != ShareData::shareDataMap_.end()) {
|
||||
return data->second;
|
||||
@ -39,6 +42,7 @@ std::shared_ptr<std::vector<uint8_t>> ShareData::GetShareBufferById(int32_t id)
|
||||
|
||||
void ShareData::ReleaseShareBufferById(int32_t id)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(shareDataMapMutex_);
|
||||
auto data = ShareData::shareDataMap_.find(id);
|
||||
if (data != ShareData::shareDataMap_.end()) {
|
||||
ShareData::shareDataMap_.erase(data);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define FRAMEWORKS_CORE_COMMON_SHARE_DATA_SHARE_DATA_H
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
#include "base/memory/ace_type.h"
|
||||
|
||||
@ -36,6 +37,7 @@ public:
|
||||
|
||||
private:
|
||||
static std::map<int32_t, std::shared_ptr<std::vector<uint8_t>>> shareDataMap_;
|
||||
static std::mutex shareDataMapMutex_;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -2121,7 +2121,7 @@ void DragEventActuator::ShowPreviewBadgeAnimation(
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
auto dragPreviewOptions = frameNode->GetDragPreviewOption();
|
||||
auto badgeNumber = dragPreviewOptions.GetCustomerBadgeNumber();
|
||||
auto childSize = badgeNumber.has_value() ? badgeNumber.value()
|
||||
int32_t childSize = badgeNumber.has_value() ? badgeNumber.value()
|
||||
: static_cast<int32_t>(manager->GetGatherNodeChildrenInfo().size()) + 1;
|
||||
auto textNode = CreateBadgeTextNode(frameNode, childSize, PIXELMAP_DRAG_SCALE_MULTIPLE, true);
|
||||
CHECK_NULL_VOID(textNode);
|
||||
|
@ -1712,7 +1712,7 @@ void DragDropManager::UpdateGatherNodeAttr(const RefPtr<OverlayManager>& overlay
|
||||
if (cnt > 1) {
|
||||
props[cnt - SECOND_GATHER_PIXEL_MAP] = { SECOND_PIXELMAP_ANGLE, SECOND_PIXELMAP_OPACITY };
|
||||
}
|
||||
for (uint32_t i = 0; i < cnt; ++i) {
|
||||
for (int32_t i = 0; i < cnt; ++i) {
|
||||
auto imageNode = gatherNodeChildrenInfo[i].imageNode.Upgrade();
|
||||
CHECK_NULL_VOID(imageNode);
|
||||
auto imageContext = imageNode->GetRenderContext();
|
||||
|
@ -57,6 +57,9 @@ void FormRendererDispatcherProxy::DispatchPointerEvent(
|
||||
HILOG_ERROR("Serialized gesture size is not valid!");
|
||||
} else {
|
||||
auto buffer = static_cast<const char*>(reply.ReadRawData(size));
|
||||
if (buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
serializedGesture.data = std::vector<char>(buffer, buffer + size);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user