mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
commit
d0c23b003f
@ -39,7 +39,7 @@ constexpr int PARAM_ARR_LENGTH_1 = 1;
|
||||
constexpr int PARAM_ARR_LENGTH_2 = 2;
|
||||
constexpr uint32_t KEY_BOARD_FOCUS_DEFAULT = 1;
|
||||
constexpr uint32_t ILLEGAL_VALUE = 0;
|
||||
constexpr uint32_t DEFAULT_MODE = -1;
|
||||
constexpr int32_t DEFAULT_MODE = -1;
|
||||
constexpr uint32_t COLOR_ALPHA_VALUE = 0xFF000000;
|
||||
const int32_t MINI_VALID_VALUE = 1;
|
||||
const int32_t MAX_VALID_VALUE = 100;
|
||||
|
@ -39,7 +39,6 @@ constexpr int PARAM_ARR_LENGTH_2 = 2;
|
||||
constexpr int32_t ARG_GROUP_LENGTH = 4;
|
||||
constexpr TextDecorationStyle DEFAULT_DECORATION_STYLE = TextDecorationStyle::SOLID;
|
||||
constexpr uint32_t ILLEGAL_VALUE = 0;
|
||||
constexpr uint32_t DEFAULT_MODE = -1;
|
||||
const int32_t MINI_VALID_VALUE = 1;
|
||||
const int32_t MAX_VALID_VALUE = 100;
|
||||
constexpr uint32_t DEFAULT_OVERFLOW = 4;
|
||||
@ -1408,7 +1407,7 @@ ArkUINativeModuleValue TextInputBridge::SetShowCounter(ArkUIRuntimeCallInfo* run
|
||||
if (highlightBorderArg->IsBoolean()) {
|
||||
highlightBorder = highlightBorderArg->BooleaValue();
|
||||
}
|
||||
auto thresholdValue = DEFAULT_MODE;
|
||||
int32_t thresholdValue = -1;
|
||||
if (thresholdArg->IsNumber()) {
|
||||
thresholdValue = thresholdArg->Int32Value(vm);
|
||||
if (thresholdValue < MINI_VALID_VALUE || thresholdValue > MAX_VALID_VALUE) {
|
||||
@ -1416,6 +1415,9 @@ ArkUINativeModuleValue TextInputBridge::SetShowCounter(ArkUIRuntimeCallInfo* run
|
||||
showCounter = false;
|
||||
}
|
||||
}
|
||||
if (thresholdValue == -1) {
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
GetArkUINodeModifiers()->getTextInputModifier()->setTextInputShowCounter(
|
||||
nativeNode, static_cast<uint32_t>(showCounter), thresholdValue, static_cast<uint32_t>(highlightBorder));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
|
@ -351,11 +351,23 @@ void JSImage::JsImageResizable(const JSCallbackInfo& info)
|
||||
return;
|
||||
}
|
||||
auto sliceValue = resizableObject->GetProperty("slice");
|
||||
if (!sliceValue->IsObject()) {
|
||||
ImageModel::GetInstance()->SetResizableSlice(sliceResult);
|
||||
return;
|
||||
}
|
||||
JSRef<JSObject> sliceObj = JSRef<JSObject>::Cast(sliceValue);
|
||||
if (sliceObj->IsEmpty()) {
|
||||
ImageModel::GetInstance()->SetResizableSlice(sliceResult);
|
||||
return;
|
||||
}
|
||||
UpdateSliceResult(sliceObj, sliceResult);
|
||||
|
||||
ImageModel::GetInstance()->SetResizableSlice(sliceResult);
|
||||
}
|
||||
|
||||
void JSImage::UpdateSliceResult(const JSRef<JSObject>& sliceObj, ImageResizableSlice& sliceResult)
|
||||
{
|
||||
// creatge a array has 4 elements for paresing sliceSize
|
||||
static std::array<std::string, 4> keys = { "left", "right", "top", "bottom" };
|
||||
for (uint32_t i = 0; i < keys.size(); i++) {
|
||||
auto sliceSize = sliceObj->GetProperty(keys.at(i).c_str());
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
protected:
|
||||
static void SetBorder(const Border& border);
|
||||
static void SetAutoResize(bool autoResize);
|
||||
static void UpdateSliceResult(const JSRef<JSObject>& sliceObj, ImageResizableSlice& sliceResult);
|
||||
};
|
||||
|
||||
class JSColorFilter : public AceType {
|
||||
|
@ -206,6 +206,10 @@ bool ParseSceneOpt(const JSCallbackInfo& info, std::string& srcPath, std::shared
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info[0]->IsObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JSRef<JSObject> jsObj = JSRef<JSObject>::Cast(info[0]);
|
||||
auto type = jsObj->GetProperty("modelType");
|
||||
if (!type->IsNull()) {
|
||||
@ -249,7 +253,9 @@ void JSSceneView::Create(const JSCallbackInfo& info)
|
||||
bool isSceneApi = false;
|
||||
#endif
|
||||
if (length == 2) { // 2: info size
|
||||
surfaceData = info[1]->ToNumber<int32_t>();
|
||||
if (info[1]->IsNumber()) {
|
||||
surfaceData = info[1]->ToNumber<int32_t>();
|
||||
}
|
||||
ParseJsMedia(info[0], srcPath);
|
||||
GetJsMediaBundleInfo(info[0], bundleName, moduleName);
|
||||
} else if (length == 1) {
|
||||
|
@ -164,7 +164,7 @@ bool FontManager::GetSystemFont(const std::string& fontName, FontInfo& fontInfo)
|
||||
fontInfo.family = systemFontDesc->fontFamily;
|
||||
fontInfo.subfamily = systemFontDesc->fontSubfamily;
|
||||
fontInfo.weight = static_cast<uint32_t>(systemFontDesc->weight);
|
||||
fontInfo.width = systemFontDesc->width;
|
||||
fontInfo.width = static_cast<uint32_t>(systemFontDesc->width);
|
||||
fontInfo.italic = systemFontDesc->italic;
|
||||
fontInfo.monoSpace = systemFontDesc->monoSpace;
|
||||
fontInfo.symbolic = systemFontDesc->symbolic;
|
||||
|
@ -340,7 +340,8 @@ void DragAnimationHelper::CalcBadgeTextPosition(const RefPtr<MenuPattern>& menuP
|
||||
auto dragDropManager = pipelineContext->GetDragDropManager();
|
||||
CHECK_NULL_VOID(dragDropManager);
|
||||
auto badgeNumber = dragDropManager->GetBadgeNumber();
|
||||
auto childSize = badgeNumber > 0 ? badgeNumber : manager->GetGatherNodeChildrenInfo().size() + 1;
|
||||
auto childSize = badgeNumber > 0 ? static_cast<size_t>(badgeNumber) :
|
||||
manager->GetGatherNodeChildrenInfo().size() + 1;
|
||||
auto badgeLength = std::to_string(childSize).size();
|
||||
UpdateBadgeLayoutAndRenderContext(textNode, badgeLength, childSize);
|
||||
auto textRenderContext = textNode->GetRenderContext();
|
||||
|
@ -294,11 +294,11 @@ void SelectContentOverlayManager::UpdateHandleInfosWithFlag(int32_t updateFlag)
|
||||
auto pattern = GetSelectOverlayPattern(selectOverlayNode_);
|
||||
CHECK_NULL_VOID(pattern);
|
||||
std::optional<SelectHandleInfo> firstHandleInfo;
|
||||
if ((updateFlag & DIRTY_FIRST_HANDLE) == DIRTY_FIRST_HANDLE) {
|
||||
if ((static_cast<uint32_t>(updateFlag) & DIRTY_FIRST_HANDLE) == DIRTY_FIRST_HANDLE) {
|
||||
firstHandleInfo = selectOverlayHolder_->GetFirstHandleInfo();
|
||||
}
|
||||
std::optional<SelectHandleInfo> secondHandleInfo;
|
||||
if ((updateFlag & DIRTY_SECOND_HANDLE) == DIRTY_SECOND_HANDLE) {
|
||||
if ((static_cast<uint32_t>(updateFlag) & DIRTY_SECOND_HANDLE) == DIRTY_SECOND_HANDLE) {
|
||||
secondHandleInfo = selectOverlayHolder_->GetSecondHandleInfo();
|
||||
}
|
||||
if (!firstHandleInfo && !secondHandleInfo) {
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
int32_t targetId_ = -1;
|
||||
float keyboardHeight_ = 0.0f;
|
||||
bool supportAvoidance_;
|
||||
float safeHeight_;
|
||||
float safeHeight_ = 0.0f;
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "base/log/log_wrapper.h"
|
||||
#include "base/thread/background_task_executor.h"
|
||||
#include "base/utils/system_properties.h"
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/image/image_loader.h"
|
||||
#include "core/image/image_source_info.h"
|
||||
|
||||
@ -94,6 +95,10 @@ bool ImageFileCache::WriteFile(const std::string& url, const void* const data, s
|
||||
const std::string& fileCacheKey, const std::string& suffix)
|
||||
{
|
||||
std::string writeFilePath = ConstructCacheFilePath(fileCacheKey + suffix);
|
||||
char realPath[PATH_MAX] = { 0x00 };
|
||||
if (!RealPath(writeFilePath.c_str(), realPath)) {
|
||||
return false;
|
||||
}
|
||||
#ifdef WINDOWS_PLATFORM
|
||||
std::ofstream outFile(writeFilePath, std::ios::binary);
|
||||
#else
|
||||
@ -170,7 +175,7 @@ void ImageFileCache::SaveCacheInner(const std::string& cacheKey, const std::stri
|
||||
infoIter->fileName = cacheFileName;
|
||||
infoIter->fileSize = cacheSize;
|
||||
infoIter->accessTime = cacheTime;
|
||||
infoIter->accessCount = suffix == ASTC_SUFFIX ? convertAstcThreshold : 1;
|
||||
infoIter->accessCount = static_cast<uint32_t>(suffix == ASTC_SUFFIX ? convertAstcThreshold : 1);
|
||||
} else {
|
||||
cacheFileInfo_.emplace_front(cacheFileName, cacheSize, cacheTime,
|
||||
suffix == ASTC_SUFFIX ? convertAstcThreshold : 1);
|
||||
@ -303,7 +308,7 @@ void ImageFileCache::ConvertToAstcAndWriteToFile(const std::string& fileCacheKey
|
||||
auto infoIter = fileNameToFileInfoPos_[fileCacheKey];
|
||||
cacheFileSize_ = cacheFileSize_ + packedSize - infoIter->fileSize;
|
||||
infoIter->fileName = astcFileName;
|
||||
infoIter->fileSize = packedSize;
|
||||
infoIter->fileSize = static_cast<uint64_t>(packedSize);
|
||||
}
|
||||
// remove the old file before convert
|
||||
ClearCacheFile(removeVector);
|
||||
@ -340,7 +345,7 @@ std::string ImageFileCache::GetCacheFilePathInner(const std::string& url, const
|
||||
infoIter->accessCount++;
|
||||
auto filePath = ConstructCacheFilePath(infoIter->fileName);
|
||||
if (SystemProperties::IsImageFileCacheConvertAstcEnabled() &&
|
||||
infoIter->accessCount == SystemProperties::GetImageFileCacheConvertAstcThreshold()) {
|
||||
infoIter->accessCount == static_cast<uint32_t>(SystemProperties::GetImageFileCacheConvertAstcThreshold())) {
|
||||
BackgroundTaskExecutor::GetInstance().PostTask(
|
||||
[this, fileCacheKey, filePath, url] () {
|
||||
ConvertToAstcAndWriteToFile(fileCacheKey, filePath, url);
|
||||
@ -380,7 +385,7 @@ void ImageFileCache::SetCacheFileInfo()
|
||||
IsAstcFile(filePtr->d_name) ? SystemProperties::GetImageFileCacheConvertAstcThreshold() : 1);
|
||||
std::string fileCacheKey = GetImageCacheKey(std::string(filePtr->d_name));
|
||||
fileNameToFileInfoPos_[fileCacheKey] = cacheFileInfo_.begin();
|
||||
cacheFileSize += fileStatus.st_size;
|
||||
cacheFileSize += static_cast<size_t>(fileStatus.st_size);
|
||||
}
|
||||
filePtr = readdir(dir.get());
|
||||
}
|
||||
@ -400,7 +405,7 @@ void ImageFileCache::DumpCacheInfo()
|
||||
if (cacheFileInfoSize == 0) {
|
||||
return;
|
||||
}
|
||||
auto totalCount = 0;
|
||||
size_t totalCount = 0;
|
||||
for (const auto& item : cacheFileInfo_) {
|
||||
auto filePath = ConstructCacheFilePath(item.fileName);
|
||||
auto fileSize = item.fileSize;
|
||||
|
@ -781,9 +781,9 @@ ArkUI_Int32 UnregisterCustomNodeEvent(ArkUINodeHandle node, ArkUI_Int32 eventTyp
|
||||
{
|
||||
auto companion = ViewModel::GetCompanion(node);
|
||||
CHECK_NULL_RETURN(companion, -1);
|
||||
auto originEventType = companion->GetFlags();
|
||||
auto originEventType = static_cast<uint32_t>(companion->GetFlags());
|
||||
//check is Contains
|
||||
if ((originEventType & eventType) != eventType) {
|
||||
if ((originEventType & static_cast<uint32_t>(eventType)) != static_cast<uint32_t>(eventType)) {
|
||||
return -1;
|
||||
}
|
||||
companion->SetFlags(static_cast<uint32_t>(originEventType) ^ static_cast<uint32_t>(eventType));
|
||||
|
@ -3187,7 +3187,7 @@ void GetAlignRules(ArkUINodeHandle node, ArkUI_CharPtr* anchors, ArkUI_Int32* di
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
auto alignRules = ViewAbstract::GetAlignRules(frameNode);
|
||||
|
||||
std::size_t index = 0;
|
||||
ArkUI_Int32 index = 0;
|
||||
for (const AlignDirection alignDirection : { AlignDirection::LEFT, AlignDirection::MIDDLE, AlignDirection::RIGHT,
|
||||
AlignDirection::TOP, AlignDirection::CENTER, AlignDirection::BOTTOM }) {
|
||||
if (index >= length) {
|
||||
|
@ -393,7 +393,7 @@ void SetTextInputContentType(ArkUINodeHandle node, ArkUI_Uint32 contentType)
|
||||
{
|
||||
auto *frameNode = reinterpret_cast<FrameNode *>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
if (contentType < 0 || contentType > static_cast<ArkUI_Int32>(TextContentType::END)) {
|
||||
if (contentType < 0 || contentType > static_cast<ArkUI_Uint32>(TextContentType::END)) {
|
||||
contentType = -1;
|
||||
}
|
||||
TextFieldModelNG::SetContentType(frameNode, static_cast<NG::TextContentType>(contentType));
|
||||
@ -812,7 +812,7 @@ void GetTextInputPlaceholderFont(ArkUINodeHandle node, ArkUITextFont* font)
|
||||
}
|
||||
if (!value.fontFamilies.empty()) {
|
||||
std::string families;
|
||||
int index = 0;
|
||||
uint32_t index = 0;
|
||||
for (auto& family : value.fontFamilies) {
|
||||
families += family;
|
||||
if (index != value.fontFamilies.size() - 1) {
|
||||
|
@ -276,6 +276,9 @@ int32_t RegisterNodeEvent(ArkUI_NodeHandle nodePtr, ArkUI_NodeEventType eventTyp
|
||||
|
||||
int32_t RegisterNodeEvent(ArkUI_NodeHandle nodePtr, ArkUI_NodeEventType eventType, int32_t targetId, void* userData)
|
||||
{
|
||||
if (!nodePtr) {
|
||||
return ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
auto originEventType = ConvertOriginEventType(eventType, nodePtr->type);
|
||||
if (originEventType < 0) {
|
||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "event is not supported %{public}d", eventType);
|
||||
|
Loading…
Reference in New Issue
Block a user