mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-21 01:45:30 -04:00
ace coding style check
Change-Id: I5e7a2059bb7935145c064b5a98b5799f51ffe64c Signed-off-by: zhangxiao72 <zhangxiao72@huawei.com>
This commit is contained in:
@@ -439,9 +439,9 @@ void AceAbility::OnKeyUp(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
|
||||
LOGI("flutterAceView is null, keyboard event does not take effect");
|
||||
return;
|
||||
}
|
||||
int32_t repeatTime = 0; // TODO:repeatTime need to be rebuild
|
||||
int32_t repeatTime = 0; // TODO:repeatTime need to be rebuild
|
||||
auto result = flutterAceView->DispatchKeyEvent(flutterAceView, keyEvent->GetKeyCode(), keyEvent->GetKeyAction(),
|
||||
repeatTime, keyEvent->GetActionTime(), keyEvent->GetActionStartTime());
|
||||
repeatTime, keyEvent->GetActionTime(), keyEvent->GetActionStartTime());
|
||||
if (!result) {
|
||||
LOGI("AceAbility::OnKeyUp: passed to Ability to process");
|
||||
Ability::OnKeyUp(keyEvent);
|
||||
@@ -456,9 +456,9 @@ void AceAbility::OnKeyDown(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
|
||||
LOGI("flutterAceView is null, keyboard event does not take effect");
|
||||
return;
|
||||
}
|
||||
int32_t repeatTime = 0; // TODO:repeatTime need to be rebuild
|
||||
int32_t repeatTime = 0; // TODO:repeatTime need to be rebuild
|
||||
auto result = flutterAceView->DispatchKeyEvent(flutterAceView, keyEvent->GetKeyCode(), keyEvent->GetKeyAction(),
|
||||
repeatTime, keyEvent->GetActionTime(), keyEvent->GetActionStartTime());
|
||||
repeatTime, keyEvent->GetActionTime(), keyEvent->GetActionStartTime());
|
||||
if (!result) {
|
||||
LOGI("AceAbility::OnKeyDown: passed to Ability to process");
|
||||
Ability::OnKeyDown(keyEvent);
|
||||
|
||||
@@ -873,7 +873,8 @@ void AceContainer::AttachView(
|
||||
callback(context);
|
||||
}
|
||||
context->SetupRootElement();
|
||||
}, TaskExecutor::TaskType::UI);
|
||||
},
|
||||
TaskExecutor::TaskType::UI);
|
||||
aceView_->Launch();
|
||||
frontend_->AttachPipelineContext(pipelineContext_);
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ void ClipboardImpl::SetData(const std::string& data)
|
||||
LOGE("cteate SystemKeyboardData fail from MiscServices");
|
||||
return;
|
||||
}
|
||||
taskExecutor_->PostTask([pasteData] () {
|
||||
OHOS::MiscServices::PasteboardClient::GetInstance()->SetPasteData(*pasteData);
|
||||
}, TaskExecutor::TaskType::IO);
|
||||
taskExecutor_->PostTask(
|
||||
[pasteData]() { OHOS::MiscServices::PasteboardClient::GetInstance()->SetPasteData(*pasteData); },
|
||||
TaskExecutor::TaskType::IO);
|
||||
}
|
||||
#else
|
||||
LOGI("Current device doesn't support system clipboard");
|
||||
@@ -57,10 +57,9 @@ void ClipboardImpl::GetData(const std::function<void(const std::string&)>& callb
|
||||
LOGE("Get SystemKeyboardTextData fail from MiscServices");
|
||||
return;
|
||||
}
|
||||
taskExecutor_->PostTask([callback, taskExecutor = WeakClaim(RawPtr(
|
||||
taskExecutor_)), textData] () {
|
||||
callback(*textData);
|
||||
}, TaskExecutor::TaskType::IO);
|
||||
taskExecutor_->PostTask(
|
||||
[callback, taskExecutor = WeakClaim(RawPtr(taskExecutor_)), textData]() { callback(*textData); },
|
||||
TaskExecutor::TaskType::IO);
|
||||
}
|
||||
#else
|
||||
LOGI("Current device doesn't support system clipboard");
|
||||
|
||||
@@ -333,11 +333,13 @@ int UIMgrService::CancelDialog(int id)
|
||||
}
|
||||
#ifdef ENABLE_ROSEN_BACKEND
|
||||
auto taskExecutor = Platform::AceContainer::GetContainer(id)->GetTaskExecutor();
|
||||
taskExecutor->PostTask([id]() {
|
||||
if (auto context = Ace::Platform::AceContainer::GetContainer(id)->GetPipelineContext()) {
|
||||
context->SetRSUIDirector(nullptr);
|
||||
}
|
||||
}, TaskExecutor::TaskType::UI);
|
||||
taskExecutor->PostTask(
|
||||
[id]() {
|
||||
if (auto context = Ace::Platform::AceContainer::GetContainer(id)->GetPipelineContext()) {
|
||||
context->SetRSUIDirector(nullptr);
|
||||
}
|
||||
},
|
||||
TaskExecutor::TaskType::UI);
|
||||
#endif
|
||||
Platform::AceContainer::DestroyContainer(id);
|
||||
};
|
||||
@@ -413,8 +415,7 @@ int UIMgrService::RegisterCallBack(const AAFwk::Want& want, const sptr<IUIServic
|
||||
HILOG_ERROR("UIMgrService::RegisterCallBack failed!. handler is nullptr");
|
||||
return UI_SERVICE_HANDLER_IS_NULL;
|
||||
}
|
||||
std::function <void()> registerFunc =
|
||||
std::bind(&UIMgrService::HandleRegister, shared_from_this(), want, uiService);
|
||||
std::function<void()> registerFunc = std::bind(&UIMgrService::HandleRegister, shared_from_this(), want, uiService);
|
||||
bool ret = handler_->PostTask(registerFunc);
|
||||
if (!ret) {
|
||||
HILOG_ERROR("DataObsMgrService::RegisterCallBack PostTask error");
|
||||
@@ -431,8 +432,7 @@ int UIMgrService::UnregisterCallBack(const AAFwk::Want& want)
|
||||
HILOG_ERROR("UIMgrService::UnregisterCallBack failed!. handler is nullptr");
|
||||
return UI_SERVICE_HANDLER_IS_NULL;
|
||||
}
|
||||
std::function <void()> unregisterFunc =
|
||||
std::bind(&UIMgrService::HandleUnregister, shared_from_this(), want);
|
||||
std::function<void()> unregisterFunc = std::bind(&UIMgrService::HandleUnregister, shared_from_this(), want);
|
||||
bool ret = handler_->PostTask(unregisterFunc);
|
||||
if (!ret) {
|
||||
HILOG_ERROR("DataObsMgrService::UnregisterCallBack PostTask error");
|
||||
|
||||
@@ -269,8 +269,8 @@ const std::string UIServiceMgrClient::GetPickerDialogParam(
|
||||
param += "\", \"size\": ";
|
||||
param += std::to_string(fileSizes[i]);
|
||||
param += "}";
|
||||
if (i != (int)fileNames.size() -1 && i != (int)fileSizes.size() -1) {
|
||||
param+=",";
|
||||
if (i != (int)fileNames.size() - 1 && i != (int)fileSizes.size() - 1) {
|
||||
param += ",";
|
||||
}
|
||||
}
|
||||
param += "]},";
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ std::shared_ptr<UIServiceMgrClient> MockUIServiceMgrClient::GetInstance()
|
||||
{
|
||||
if (instance_ == nullptr) {
|
||||
if (instance_ == nullptr) {
|
||||
std::shared_ptr<UIServiceMgrClient> client =std::make_shared<MockUIServiceMgrClient>();
|
||||
std::shared_ptr<UIServiceMgrClient> client = std::make_shared<MockUIServiceMgrClient>();
|
||||
if (client != nullptr) {
|
||||
((MockUIServiceMgrClient *)client.get())->Connect();
|
||||
}
|
||||
@@ -54,7 +54,7 @@ std::shared_ptr<UIServiceMgrClient> MockUIServiceMgrClient::GetInstance()
|
||||
ErrCode MockUIServiceMgrClient::Connect()
|
||||
{
|
||||
if (remoteObject_ == nullptr) {
|
||||
sptr<IRemoteObject> mockUIServiceManager =(new (std::nothrow) MockUIMgrService());
|
||||
sptr<IRemoteObject> mockUIServiceManager = (new (std::nothrow) MockUIMgrService());
|
||||
if (mockUIServiceManager != nullptr) {
|
||||
((MockUIMgrService *)mockUIServiceManager.GetRefPtr())->OnStart();
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ public:
|
||||
static AceApplicationInfoImpl& GetInstance();
|
||||
|
||||
void SetLocale(const std::string& language, const std::string& countryOrRegion, const std::string& script,
|
||||
const std::string& keywordsAndValues) override;
|
||||
const std::string& keywordsAndValues) override;
|
||||
void ChangeLocale(const std::string& language, const std::string& countryOrRegion) override;
|
||||
|
||||
bool GetBundleInfo(const std::string& packageName, AceBundleInfo& bundleInfo) override;
|
||||
double GetLifeTime() const override;
|
||||
|
||||
|
||||
void SetResourceManager(std::shared_ptr<Global::Resource::ResourceManager>& resourceManager)
|
||||
{
|
||||
resourceManager_ = resourceManager;
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
std::string GetJsEngineParam(const std::string& key) const override;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::shared_ptr<Global::Resource::ResourceManager> resourceManager_;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#ifdef ACE_INSTANCE_LOG
|
||||
#define ACE_FMT_PREFIX "[%{private}s(%{private}s)-(%{public}d)] "
|
||||
#define ACE_LOG_ID ,OHOS::Ace::LogWrapper::GetId()
|
||||
#define ACE_LOG_ID , OHOS::Ace::LogWrapper::GetId()
|
||||
#else
|
||||
#define ACE_FMT_PREFIX "[%{private}s(%{private}s)] "
|
||||
#define ACE_LOG_ID
|
||||
|
||||
@@ -144,21 +144,20 @@ void DOMMenu::BindIdNode(const RefPtr<DOMNode>& idNode)
|
||||
{
|
||||
if (SystemProperties::GetDeviceType() == DeviceType::TV) {
|
||||
focusMarkerId_ = BackEndEventManager<void()>::GetInstance().GetAvailableMarker();
|
||||
BackEndEventManager<void()>::GetInstance().BindBackendEvent(
|
||||
focusMarkerId_, [weak = WeakClaim(this), idNode]() {
|
||||
if (!idNode || idNode->IsNodeDisabled()) {
|
||||
return;
|
||||
}
|
||||
auto domMenu = weak.Upgrade();
|
||||
if (!domMenu) {
|
||||
return;
|
||||
}
|
||||
const auto& targetCallback = domMenu->menuChild_->GetTargetCallback();
|
||||
const auto& targetId = idNode->GetRootComponent()->GetId();
|
||||
if (targetCallback) {
|
||||
targetCallback(targetId, Offset(0, 0));
|
||||
}
|
||||
});
|
||||
BackEndEventManager<void()>::GetInstance().BindBackendEvent(focusMarkerId_, [weak = WeakClaim(this), idNode]() {
|
||||
if (!idNode || idNode->IsNodeDisabled()) {
|
||||
return;
|
||||
}
|
||||
auto domMenu = weak.Upgrade();
|
||||
if (!domMenu) {
|
||||
return;
|
||||
}
|
||||
const auto& targetCallback = domMenu->menuChild_->GetTargetCallback();
|
||||
const auto& targetId = idNode->GetRootComponent()->GetId();
|
||||
if (targetCallback) {
|
||||
targetCallback(targetId, Offset(0, 0));
|
||||
}
|
||||
});
|
||||
idNode->SetOnFocusClick(focusMarkerId_);
|
||||
}
|
||||
if (isClickType_) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
|
||||
class JSCheckboxGroup : public JSViewAbstract{
|
||||
class JSCheckboxGroup : public JSViewAbstract {
|
||||
public:
|
||||
static void JSBind(BindingTarget globalObj);
|
||||
static void Create(const JSCallbackInfo& info);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
|
||||
namespace{
|
||||
namespace {
|
||||
const std::vector<FontStyle> FONT_STYLES = { FontStyle::NORMAL, FontStyle::ITALIC };
|
||||
const int32_t TWENTY_FOUR_HOUR_BASE = 24;
|
||||
constexpr int32_t HOURS_WEST_LOWER_LIMIT = -14;
|
||||
@@ -54,7 +54,7 @@ double GetSystemTimeZone()
|
||||
double hoursWest = minutesWest / TOTAL_MINUTE_OF_HOUR;
|
||||
return hoursWest;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void JSTextClock::Create(const JSCallbackInfo& info)
|
||||
{
|
||||
|
||||
@@ -672,8 +672,8 @@ void JSViewAbstract::JsOpacity(const JSCallbackInfo& info)
|
||||
void JSViewAbstract::JsTranslate(const JSCallbackInfo& info)
|
||||
{
|
||||
LOGD("JsTranslate");
|
||||
std::vector<JSCallbackInfoType> checkList {JSCallbackInfoType::STRING, JSCallbackInfoType::NUMBER,
|
||||
JSCallbackInfoType::OBJECT};
|
||||
std::vector<JSCallbackInfoType> checkList { JSCallbackInfoType::STRING, JSCallbackInfoType::NUMBER,
|
||||
JSCallbackInfoType::OBJECT };
|
||||
if (!CheckJSCallbackInfo("JsTranslate", info, checkList)) {
|
||||
return;
|
||||
}
|
||||
@@ -1827,8 +1827,8 @@ void JSViewAbstract::JsMargin(const JSCallbackInfo& info)
|
||||
|
||||
void JSViewAbstract::ParseMarginOrPadding(const JSCallbackInfo& info, bool isMargin)
|
||||
{
|
||||
std::vector<JSCallbackInfoType> checkList {JSCallbackInfoType::STRING, JSCallbackInfoType::NUMBER,
|
||||
JSCallbackInfoType::OBJECT};
|
||||
std::vector<JSCallbackInfoType> checkList { JSCallbackInfoType::STRING, JSCallbackInfoType::NUMBER,
|
||||
JSCallbackInfoType::OBJECT };
|
||||
if (!CheckJSCallbackInfo("ParseMarginOrPadding", info, checkList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2130,7 +2130,7 @@ shared_ptr<JsValue> JsCallComponent(const shared_ptr<JsRuntime>& runtime, const
|
||||
auto domDocument = sPage->GetDomDocument();
|
||||
if (domDocument) {
|
||||
RefPtr<DOMNode> node = domDocument->GetDOMNodeById(childNodeId);
|
||||
if(node == nullptr) {
|
||||
if (node == nullptr) {
|
||||
LOGE("node is nullptr");
|
||||
}
|
||||
auto command = Referenced::MakeRefPtr<JsCommandAppendElement>(node ? node->GetTag() : "", childNodeId,
|
||||
@@ -2874,7 +2874,7 @@ void JsiEngineInstance::RegisterDocumentModule()
|
||||
LOGD("JsiEngineInstance RegisterDocumentModule");
|
||||
shared_ptr<JsValue> global = runtime_->GetGlobal();
|
||||
shared_ptr<JsValue> domObj = runtime_->NewObject();
|
||||
domObj->SetProperty(runtime_, "createElement",runtime_->NewFunction(JsCreateElement));
|
||||
domObj->SetProperty(runtime_, "createElement", runtime_->NewFunction(JsCreateElement));
|
||||
global->SetProperty(runtime_, "dom", domObj);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,8 @@ void FlutterTaskExecutor::InitOtherThreads(const flutter::TaskRunners& taskRunne
|
||||
bool FlutterTaskExecutor::OnPostTask(Task&& task, TaskType type, uint32_t delayTime) const
|
||||
{
|
||||
int32_t currentId = Container::CurrentId();
|
||||
TaskExecutor::Task wrappedTask = currentId >= 0 ? WrapTaskWithContainer(std::move(task), currentId) : std::move(task);
|
||||
TaskExecutor::Task wrappedTask =
|
||||
currentId >= 0 ? WrapTaskWithContainer(std::move(task), currentId) : std::move(task);
|
||||
|
||||
switch (type) {
|
||||
case TaskType::PLATFORM:
|
||||
|
||||
@@ -431,7 +431,7 @@ public:
|
||||
|
||||
void SetMember(bool isAllSelect)
|
||||
{
|
||||
for(auto& item : checkboxList_) {
|
||||
for (auto& item : checkboxList_) {
|
||||
if (item->GetValue() == isAllSelect) {
|
||||
continue;
|
||||
}
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
void SetGroupStatus()
|
||||
{
|
||||
size_t count = 0;
|
||||
for(auto& item : checkboxList_) {
|
||||
for (auto& item : checkboxList_) {
|
||||
if (item->GetValue()) {
|
||||
++count;
|
||||
}
|
||||
@@ -475,7 +475,7 @@ public:
|
||||
|
||||
void GetSelectedCheckBoxName(std::vector<std::string>& result)
|
||||
{
|
||||
for(auto& item : checkboxList_) {
|
||||
for (auto& item : checkboxList_) {
|
||||
if (item->GetValue()) {
|
||||
result.push_back(item->GetCheckboxName());
|
||||
}
|
||||
|
||||
@@ -174,7 +174,8 @@ void FlutterRenderCheckbox::DrawSquare(
|
||||
double borderRadius = 0;
|
||||
rrect.sk_rrect = SkRRect::MakeRectXY(
|
||||
{ originX + start.GetX(), originY + start.GetY(), paintSize.Width() + originX + start.GetX(),
|
||||
paintSize.Height() + originY + start.GetY() }, borderRadius, borderRadius);
|
||||
paintSize.Height() + originY + start.GetY() },
|
||||
borderRadius, borderRadius);
|
||||
canvas->drawRRect(rrect, paint, paintData);
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ void RenderCheckbox::UpdateGroupStatus()
|
||||
int count = 0;
|
||||
isGroup_ = !checkboxList.empty();
|
||||
if (isGroup_) {
|
||||
for(auto& item : checkboxList) {
|
||||
for (auto& item : checkboxList) {
|
||||
if (item->GetValue()) {
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
uiStatus_ = isCheck ? UIStatus::SELECTED :
|
||||
((onFocus_ && needFocus_) ? UIStatus::FOCUS : UIStatus::UNSELECTED);
|
||||
} else {
|
||||
uiStatus_ = checked_? UIStatus::SELECTED : UIStatus::UNSELECTED;
|
||||
uiStatus_ = checked_ ? UIStatus::SELECTED : UIStatus::UNSELECTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,8 @@ void RosenRenderCheckbox::DrawSquare(
|
||||
double borderRadius = 0;
|
||||
rrect = SkRRect::MakeRectXY(
|
||||
{ originX + start.GetX(), originY + start.GetY(), paintSize.Width() + originX + start.GetX(),
|
||||
paintSize.Height() + originY + start.GetY() }, borderRadius, borderRadius);
|
||||
paintSize.Height() + originY + start.GetY() },
|
||||
borderRadius, borderRadius);
|
||||
canvas->drawRRect(rrect, paint);
|
||||
}
|
||||
|
||||
|
||||
@@ -314,11 +314,11 @@ void FlutterRenderCustomPaint::Mesh(SkBitmap& bitmap, int column, int row,
|
||||
const SkScalar height = SkIntToScalar(bitmap.height());
|
||||
const SkScalar width = SkIntToScalar(bitmap.width());
|
||||
|
||||
if (row==0) {
|
||||
if (row == 0) {
|
||||
LOGE("row is zero");
|
||||
return;
|
||||
}
|
||||
if (column==0) {
|
||||
if (column == 0) {
|
||||
LOGE("column is zero");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1392,7 +1392,7 @@ void RosenRenderCustomPaint::DrawBitmapMesh(const RefPtr<OffscreenCanvas>& offsc
|
||||
}
|
||||
SkBitmap skBitmap;
|
||||
auto imageInfo = SkImageInfo::Make(imageData->dirtyWidth, imageData->dirtyHeight,
|
||||
SkColorType::kBGRA_8888_SkColorType, SkAlphaType::kOpaque_SkAlphaType);
|
||||
SkColorType::kBGRA_8888_SkColorType, SkAlphaType::kOpaque_SkAlphaType);
|
||||
skBitmap.allocPixels(imageInfo);
|
||||
skBitmap.setPixels(data);
|
||||
int32_t size = mesh.size();
|
||||
@@ -1429,11 +1429,11 @@ void RosenRenderCustomPaint::Mesh(SkBitmap& bitmap, int column, int row,
|
||||
uint16_t* indices = builder.indices();
|
||||
const SkScalar height = SkIntToScalar(bitmap.height());
|
||||
const SkScalar width = SkIntToScalar(bitmap.width());
|
||||
if (row==0) {
|
||||
if (row == 0) {
|
||||
LOGE("row is zero");
|
||||
return;
|
||||
}
|
||||
if (column==0) {
|
||||
if (column == 0) {
|
||||
LOGE("column is zero");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2277,7 +2277,7 @@ void RenderGridLayout::AddNodeAnimationToControllerForDrop(
|
||||
item->SetNeedRender(true);
|
||||
item->MarkNeedPredictLayout();
|
||||
|
||||
if (curInsertRowIndex_ >= 0 && curInsertColumnIndex_ >=0) {
|
||||
if (curInsertRowIndex_ >= 0 && curInsertColumnIndex_ >= 0) {
|
||||
item->Layout(MakeInnerLayoutParam(curInsertRowIndex_, curInsertColumnIndex_, 1, 1));
|
||||
}
|
||||
auto animationRef = AceType::MakeRefPtr<CurveAnimation<Point>>(startPoint, endPoint, Curves::FRICTION);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "base/log/log.h"
|
||||
|
||||
namespace OHOS::Ace::Plugin {
|
||||
constexpr long FOO_MAX_LEN = 20*1024*1024;
|
||||
constexpr long FOO_MAX_LEN = 20 * 1024 * 1024;
|
||||
bool FileAssetProvider::Initialize(const std::string& packagePath, const std::vector<std::string>& assetBasePaths)
|
||||
{
|
||||
ACE_SCOPED_TRACE("Initialize");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
constexpr long FOO_MAX_LEN = 20*1024*1024;
|
||||
constexpr long FOO_MAX_LEN = 20 * 1024 * 1024;
|
||||
std::shared_ptr<PluginComponentManager> PluginComponentManager::instance_ = nullptr;
|
||||
std::mutex PluginComponentManager::mutex_;
|
||||
|
||||
@@ -63,7 +63,7 @@ int PluginComponentManager::Request(
|
||||
pluginTemplate.SetAbility(want.GetElement().GetBundleName() + "/" + want.GetElement().GetAbilityName());
|
||||
|
||||
for (auto iter = listener_->GetPluginComponentCallBack().begin();
|
||||
iter != listener_->GetPluginComponentCallBack().end();) {
|
||||
iter != listener_->GetPluginComponentCallBack().end();) {
|
||||
if (iter->second == CallBackType::RequestCallBack && iter->first != nullptr) {
|
||||
iter->first->OnRequestCallBack(pluginTemplate, data, "");
|
||||
listener_->GetPluginComponentCallBack().erase(iter++);
|
||||
|
||||
@@ -296,7 +296,8 @@ std::string PluginElement::GetPackagePathByAbsolutePath(
|
||||
packagePathStr = info.pluginName.substr(0, posAssets);
|
||||
size_t posModule = info.pluginName.find("/", posAssets + assets.size());
|
||||
if (posModule != std::string::npos) {
|
||||
info.moduleName = info.pluginName.substr(posAssets + assets.size(), posModule-(posAssets + assets.size()));
|
||||
info.moduleName =
|
||||
info.pluginName.substr(posAssets + assets.size(), posModule - (posAssets + assets.size()));
|
||||
info.source = info.pluginName.substr(posModule);
|
||||
} else {
|
||||
info.moduleName = "/";
|
||||
@@ -304,8 +305,8 @@ std::string PluginElement::GetPackagePathByAbsolutePath(
|
||||
}
|
||||
} else {
|
||||
size_t pos = info.pluginName.rfind("/");
|
||||
packagePathStr = info.pluginName.substr(0, pos+1);
|
||||
info.source = info.pluginName.substr(pos+1);
|
||||
packagePathStr = info.pluginName.substr(0, pos + 1);
|
||||
info.source = info.pluginName.substr(pos + 1);
|
||||
info.moduleName = "/";
|
||||
}
|
||||
return packagePathStr;
|
||||
|
||||
@@ -26,10 +26,10 @@ void RosenRenderPositioned::Update(const RefPtr<Component>& component)
|
||||
auto rsNode = GetRSNode();
|
||||
if (context && rsNode) {
|
||||
auto dipScale = context->GetDipScale();
|
||||
if(hasLeft_){
|
||||
if (hasLeft_) {
|
||||
rsNode->SetFramePositionX(left_.ConvertToPx(dipScale));
|
||||
}
|
||||
if(hasTop_){
|
||||
if (hasTop_) {
|
||||
rsNode->SetFramePositionY(top_.ConvertToPx(dipScale));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,11 +154,11 @@ void FlutterRenderShapeContainer::DrawBitmapMesh(SkBitmap& bitmap, int column, i
|
||||
const SkScalar height = SkIntToScalar(bitmap.height());
|
||||
const SkScalar width = SkIntToScalar(bitmap.width());
|
||||
|
||||
if (row==0) {
|
||||
if (row == 0) {
|
||||
LOGE("row is zero");
|
||||
return;
|
||||
}
|
||||
if (column==0) {
|
||||
if (column == 0) {
|
||||
LOGE("column is zero");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -155,11 +155,11 @@ void RosenRenderShapeContainer::DrawBitmapMesh(SkBitmap& bitmap, int column, int
|
||||
const SkScalar height = SkIntToScalar(bitmap.height());
|
||||
const SkScalar width = SkIntToScalar(bitmap.width());
|
||||
|
||||
if (row==0) {
|
||||
if (row == 0) {
|
||||
LOGE("row is zero");
|
||||
return;
|
||||
}
|
||||
if (column==0) {
|
||||
if (column == 0) {
|
||||
LOGE("column is zero");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -220,8 +220,9 @@ void FlutterRenderSlider::SetTipPosition(double blockOffset)
|
||||
if (direction_ == Axis::VERTICAL) {
|
||||
double tipLayoutWidth = renderTip->GetLayoutSize().Width();
|
||||
double childHalfHeight = renderTip->GetChildSize().Height() * HALF;
|
||||
renderTip->SetPosition(Offset(-tipLayoutWidth - HALF * (NormalizeToPx(blockHotWidth_) -
|
||||
NormalizeToPx(hotWidth_)), blockOffset - childHalfHeight));
|
||||
renderTip->SetPosition(
|
||||
Offset(-tipLayoutWidth - HALF * (NormalizeToPx(blockHotWidth_) - NormalizeToPx(hotWidth_)),
|
||||
blockOffset - childHalfHeight));
|
||||
} else {
|
||||
double childHalfWidth = renderTip->GetChildSize().Width() * HALF;
|
||||
double tipLayoutHeight = renderTip->GetLayoutSize().Height();
|
||||
|
||||
@@ -207,8 +207,9 @@ void RosenRenderSlider::SetTipPosition(double blockOffset)
|
||||
if (direction_ == Axis::VERTICAL) {
|
||||
double tipLayoutWidth = renderTip->GetLayoutSize().Width();
|
||||
double childHalfHeight = renderTip->GetChildSize().Height() * HALF;
|
||||
renderTip->SetPosition(Offset(-tipLayoutWidth - HALF * (NormalizeToPx(blockHotWidth_) -
|
||||
NormalizeToPx(hotWidth_)), blockOffset - childHalfHeight));
|
||||
renderTip->SetPosition(
|
||||
Offset(-tipLayoutWidth - HALF * (NormalizeToPx(blockHotWidth_) - NormalizeToPx(hotWidth_)),
|
||||
blockOffset - childHalfHeight));
|
||||
} else {
|
||||
double childHalfWidth = renderTip->GetChildSize().Width() * HALF;
|
||||
double tipLayoutHeight = renderTip->GetLayoutSize().Height();
|
||||
|
||||
@@ -165,7 +165,7 @@ bool RenderText::TouchTest(const Point& globalPoint, const Point& parentLocalPoi
|
||||
const auto localPoint = parentLocalPoint - GetPaintRect().GetOffset();
|
||||
Offset localOffset = Offset(localPoint.GetX(), localPoint.GetY());
|
||||
// If span of touch position has click event, need add click detector.
|
||||
if (!GetEventMarker(GetTouchPosition(localOffset), GestureType::CLICK).IsEmpty()||
|
||||
if (!GetEventMarker(GetTouchPosition(localOffset), GestureType::CLICK).IsEmpty() ||
|
||||
!GetEventMarker(GetTouchPosition(localOffset), GestureType::REMOTE_MESSAGE).IsEmpty()) {
|
||||
needClickDetector_ = true;
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#include "flutter/common/task_runners.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
namespace{
|
||||
namespace {
|
||||
constexpr int32_t INTERVAL_OF_USECOND = 1000000;
|
||||
constexpr int32_t MICROSECONDS_OF_MILLISECOND = 1000;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void FlutterRenderTextClock::Paint(RenderContext& context, const Offset& offset)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "core/event/ace_event_helper.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
namespace{
|
||||
namespace {
|
||||
constexpr int32_t BASE_YEAR = 1900;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#include "flutter/common/task_runners.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
namespace{
|
||||
namespace {
|
||||
constexpr int32_t INTERVAL_OF_USECOND = 1000000;
|
||||
constexpr int32_t MICROSECONDS_OF_MILLISECOND = 1000;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void RosenRenderTextClock::Paint(RenderContext& context, const Offset& offset)
|
||||
{
|
||||
|
||||
@@ -40,10 +40,7 @@ void FlutterRenderCapsuleTrack::DrawShape(RenderContext& context, const Offset&
|
||||
flutter::RRect rRect;
|
||||
flutter::PaintData paintData;
|
||||
|
||||
rRect.sk_rrect.setRectXY(SkRect::MakeIWH(progressSize.Width(),
|
||||
progressSize.Height()),
|
||||
rrectRadius,
|
||||
rrectRadius);
|
||||
rRect.sk_rrect.setRectXY(SkRect::MakeIWH(progressSize.Width(), progressSize.Height()), rrectRadius, rrectRadius);
|
||||
|
||||
rRect.sk_rrect.offset(offset.GetX(), offset.GetY());
|
||||
canvas->drawRRect(rRect, paint, paintData);
|
||||
|
||||
@@ -42,10 +42,7 @@ void RosenRenderCapsuleTrack::DrawShape(RenderContext& context, const Offset& of
|
||||
paint.setAntiAlias(true);
|
||||
SkRRect rRect;
|
||||
|
||||
rRect.setRectXY(SkRect::MakeIWH(progressSize.Width(),
|
||||
progressSize.Height()),
|
||||
rrectRadius,
|
||||
rrectRadius);
|
||||
rRect.setRectXY(SkRect::MakeIWH(progressSize.Width(), progressSize.Height()), rrectRadius, rrectRadius);
|
||||
|
||||
rRect.offset(offset.GetX(), offset.GetY());
|
||||
canvas->drawRRect(rRect, paint);
|
||||
@@ -73,40 +70,19 @@ void RosenRenderCapsuleTrack::DrawCapsuleProgressAnimation(RenderContext& contex
|
||||
double progressWidth = progressSize.Width()*GetTotalRatio();
|
||||
|
||||
SkPath path;
|
||||
path.addArc({
|
||||
offsetX, offsetY, progressSize.Height() + offsetX,
|
||||
progressSize.Height() + offsetY
|
||||
},
|
||||
90,
|
||||
180);
|
||||
path.addArc({ offsetX, offsetY, progressSize.Height() + offsetX, progressSize.Height() + offsetY }, 90, 180);
|
||||
if (LessNotEqual(progressWidth, radius)) {
|
||||
path.addArc({
|
||||
progressWidth + offsetX, offsetY,
|
||||
progressSize.Height() - progressWidth + offsetX,
|
||||
progressSize.Height() + offsetY
|
||||
},
|
||||
270,
|
||||
-180);
|
||||
path.addArc({ progressWidth + offsetX, offsetY, progressSize.Height() - progressWidth + offsetX,
|
||||
progressSize.Height() + offsetY },
|
||||
270, -180);
|
||||
} else if (GreatNotEqual(progressWidth, progressSize.Width() - radius)) {
|
||||
path.addRect({
|
||||
radius + offsetX, offsetY,
|
||||
progressSize.Width() - radius + offsetX,
|
||||
progressSize.Height() + offsetY
|
||||
});
|
||||
path.addArc({
|
||||
(progressSize.Width() - radius) * 2.0 - progressWidth + offsetX,
|
||||
offsetY,
|
||||
progressWidth + offsetX, progressSize.Height() + offsetY
|
||||
},
|
||||
270,
|
||||
180);
|
||||
path.addRect(
|
||||
{ radius + offsetX, offsetY, progressSize.Width() - radius + offsetX, progressSize.Height() + offsetY });
|
||||
path.addArc({ (progressSize.Width() - radius) * 2.0 - progressWidth + offsetX, offsetY, progressWidth + offsetX,
|
||||
progressSize.Height() + offsetY },
|
||||
270, 180);
|
||||
} else {
|
||||
path.addRect({
|
||||
radius + offsetX,
|
||||
offsetY,
|
||||
progressWidth + offsetX,
|
||||
progressSize.Height() + offsetY
|
||||
});
|
||||
path.addRect({ radius + offsetX, offsetY, progressWidth + offsetX, progressSize.Height() + offsetY });
|
||||
}
|
||||
|
||||
SkPaint paint;
|
||||
@@ -136,39 +112,19 @@ void RosenRenderCapsuleTrack::DrawCapsuleProgressVerticalAnimation(RenderContext
|
||||
double progressWidth = progressSize.Height()*GetTotalRatio();
|
||||
|
||||
SkPath path;
|
||||
path.addArc({
|
||||
offsetX, offsetY, progressSize.Width() + offsetX,
|
||||
progressSize.Width() + offsetY
|
||||
},
|
||||
0,
|
||||
-180);
|
||||
path.addArc({ offsetX, offsetY, progressSize.Width() + offsetX, progressSize.Width() + offsetY }, 0, -180);
|
||||
if (LessNotEqual(progressWidth, radius)) {
|
||||
path.addArc({
|
||||
offsetX, offsetY + progressWidth,
|
||||
progressSize.Width() + offsetX,
|
||||
progressSize.Width() - progressWidth + offsetY
|
||||
},
|
||||
180,
|
||||
180);
|
||||
path.addArc({ offsetX, offsetY + progressWidth, progressSize.Width() + offsetX,
|
||||
progressSize.Width() - progressWidth + offsetY },
|
||||
180, 180);
|
||||
} else if (GreatNotEqual(progressWidth, progressSize.Height() - radius)) {
|
||||
path.addRect({
|
||||
offsetX, offsetY + radius,
|
||||
progressSize.Width() + offsetX,
|
||||
progressSize.Height() - radius + offsetY
|
||||
});
|
||||
path.addArc({
|
||||
offsetX, offsetY + (progressSize.Height() - radius) * 2.0 - progressWidth,
|
||||
progressSize.Width() + offsetX,
|
||||
progressWidth + offsetY
|
||||
},
|
||||
180,
|
||||
-180);
|
||||
path.addRect(
|
||||
{ offsetX, offsetY + radius, progressSize.Width() + offsetX, progressSize.Height() - radius + offsetY });
|
||||
path.addArc({ offsetX, offsetY + (progressSize.Height() - radius) * 2.0 - progressWidth,
|
||||
progressSize.Width() + offsetX, progressWidth + offsetY },
|
||||
180, -180);
|
||||
} else {
|
||||
path.addRect({
|
||||
offsetX, radius + offsetY,
|
||||
offsetX + progressSize.Width(),
|
||||
progressWidth + offsetY
|
||||
});
|
||||
path.addRect({ offsetX, radius + offsetY, offsetX + progressSize.Width(), progressWidth + offsetY });
|
||||
}
|
||||
|
||||
SkPaint paint;
|
||||
|
||||
@@ -47,26 +47,30 @@ void RosenRenderWatchSlider::Paint(RenderContext& context, const Offset& offset)
|
||||
canvas->clipRRect(bottomClipLayer, SkClipOp::kIntersect, true);
|
||||
SkPaint paint;
|
||||
paint.setColor(backgroundColor_.GetValue());
|
||||
canvas->drawRect({topX, topY, topX + NormalizeToPx(THICKNESS),
|
||||
topY + GetLayoutSize().Height() - 2.0 * NormalizeToPx(DEFAULT_PADDING)},paint);
|
||||
canvas->drawRect({ topX, topY, topX + NormalizeToPx(THICKNESS),
|
||||
topY + GetLayoutSize().Height() - 2.0 * NormalizeToPx(DEFAULT_PADDING) },
|
||||
paint);
|
||||
paint.setColor(selectColor_.GetValue());
|
||||
double maxRegion = 0.0;
|
||||
if (!NearEqual(max_, min_)) {
|
||||
maxRegion =
|
||||
(GetLayoutSize().Height() - 2.0 * NormalizeToPx(DEFAULT_PADDING)) * ((max_ - value_) / (max_ - min_));
|
||||
}
|
||||
canvas->drawRect({topX, topY + maxRegion, topX + NormalizeToPx(THICKNESS),
|
||||
topY + GetLayoutSize().Height() - 2.0 * NormalizeToPx(DEFAULT_PADDING)}, paint);
|
||||
canvas->drawRect({ topX, topY + maxRegion, topX + NormalizeToPx(THICKNESS),
|
||||
topY + GetLayoutSize().Height() - 2.0 * NormalizeToPx(DEFAULT_PADDING) },
|
||||
paint);
|
||||
double trackLength = GetLayoutSize().Height() - 2.0 * NormalizeToPx(DEFAULT_PADDING);
|
||||
if (!isContinuous_) {
|
||||
paint.setColor(Color::BLACK.GetValue());
|
||||
// equally divided track into three pieces. each block takes 1/4
|
||||
canvas->drawRect({topX, topY + trackLength * 0.25, topX + NormalizeToPx(THICKNESS),
|
||||
topY + trackLength * 0.25 + 2.0}, paint);
|
||||
canvas->drawRect({topX, topY + trackLength * 0.5, topX + NormalizeToPx(THICKNESS),
|
||||
topY + trackLength * 0.5 + 2.0}, paint);
|
||||
canvas->drawRect({topX, topY + trackLength * 0.75, topX + NormalizeToPx(THICKNESS),
|
||||
topY + trackLength * 0.75 + 2.0}, paint);
|
||||
canvas->drawRect(
|
||||
{ topX, topY + trackLength * 0.25, topX + NormalizeToPx(THICKNESS), topY + trackLength * 0.25 + 2.0 },
|
||||
paint);
|
||||
canvas->drawRect(
|
||||
{ topX, topY + trackLength * 0.5, topX + NormalizeToPx(THICKNESS), topY + trackLength * 0.5 + 2.0 }, paint);
|
||||
canvas->drawRect(
|
||||
{ topX, topY + trackLength * 0.75, topX + NormalizeToPx(THICKNESS), topY + trackLength * 0.75 + 2.0 },
|
||||
paint);
|
||||
}
|
||||
bottomIcon_->RenderWithContext(context, bottomIconPosition_);
|
||||
topIcon_->RenderWithContext(context, topIconPosition_);
|
||||
|
||||
@@ -547,8 +547,8 @@ void RenderIndexer::HandleFocusAnimation(const Size& size, const Offset& offset)
|
||||
}
|
||||
|
||||
double focusPadding = NormalizeToPx(FOCUS_PADDING);
|
||||
context->ShowFocusAnimation(RRect::MakeRRect(Rect(Offset(),
|
||||
size - Size(focusPadding, focusPadding) * PADDIN_SIZE), focusPadding, focusPadding),
|
||||
context->ShowFocusAnimation(RRect::MakeRRect(Rect(Offset(), size - Size(focusPadding, focusPadding) * PADDIN_SIZE),
|
||||
focusPadding, focusPadding),
|
||||
Color::BLUE, offset + Offset(focusPadding, focusPadding));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ std::unique_ptr<JsonValue> PickerTextDialogComposedElement::GetRange() const
|
||||
auto jsonRange = JsonUtil::CreateArray(false);
|
||||
if (render) {
|
||||
auto range = render->GetRange();
|
||||
for (size_t i = 0 ; i < range.size() ; i++) {
|
||||
for (size_t i = 0; i < range.size(); i++) {
|
||||
auto index = std::to_string(i);
|
||||
jsonRange->Put(index.c_str(), range[i].c_str());
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ std::string SelectComposedElement::GetOptions() const
|
||||
if (popup) {
|
||||
auto vectorValue = popup->GetSelectOptions();
|
||||
auto jsonOptions = JsonUtil::CreateArray(false);
|
||||
for (size_t i = 0 ; i < vectorValue.size() ; i++) {
|
||||
for (size_t i = 0; i < vectorValue.size(); i++) {
|
||||
if (vectorValue[i] && vectorValue[i]->GetIcon()) {
|
||||
auto temp = JsonUtil::Create(false);
|
||||
temp->Put("value", vectorValue[i]->GetValue().c_str());
|
||||
|
||||
@@ -45,7 +45,7 @@ constexpr int32_t MAX_TAP_FINGERS = 10;
|
||||
|
||||
void ClickRecognizer::InitGlobalValue(SourceType sourceType)
|
||||
{
|
||||
switch(sourceType) {
|
||||
switch (sourceType) {
|
||||
case SourceType::TOUCH:
|
||||
MULTI_FINGER_TIMEOUT = MULTI_FINGER_TIMEOUT_TOUCH;
|
||||
MULTI_TAP_TIMEOUT = MULTI_TAP_TIMEOUT_TOUCH;
|
||||
|
||||
@@ -110,16 +110,16 @@ void FlutterRenderContext::SetOffSet(
|
||||
if (context) {
|
||||
auto density = context->GetDensity();
|
||||
auto parent = child->GetParent();
|
||||
Offset pluginOffset = {0, 0};
|
||||
Offset pluginOffset = { 0, 0 };
|
||||
if (!NearZero(density)) {
|
||||
if (parent.Upgrade() && parent.Upgrade()->GetRenderLayer()) {
|
||||
layer->SetOffset(renderPost.GetX() / density - renderPost.GetX(),
|
||||
renderPost.GetY() / density - renderPost.GetY());
|
||||
pluginOffset = {renderPost.GetX() / density - renderPost.GetX(),
|
||||
renderPost.GetY() / density - renderPost.GetY()};
|
||||
layer->SetOffset(
|
||||
renderPost.GetX() / density - renderPost.GetX(), renderPost.GetY() / density - renderPost.GetY());
|
||||
pluginOffset = { renderPost.GetX() / density - renderPost.GetX(),
|
||||
renderPost.GetY() / density - renderPost.GetY() };
|
||||
} else {
|
||||
layer->SetOffset(pos.GetX() / density, pos.GetY() / density);
|
||||
pluginOffset = {pos.GetX() / density, pos.GetY() / density};
|
||||
pluginOffset = { pos.GetX() / density, pos.GetY() / density };
|
||||
}
|
||||
}
|
||||
// plugin offset
|
||||
@@ -147,8 +147,8 @@ void FlutterRenderContext::StartRecording()
|
||||
if (clipHole_.IsValid()) {
|
||||
canvas_->save();
|
||||
needRestoreHole_ = true;
|
||||
canvas_->clipRect(clipHole_.Left(), clipHole_.Top(),
|
||||
clipHole_.Right(), clipHole_.Bottom(), SkClipOp::kDifference);
|
||||
canvas_->clipRect(
|
||||
clipHole_.Left(), clipHole_.Top(), clipHole_.Right(), clipHole_.Bottom(), SkClipOp::kDifference);
|
||||
}
|
||||
containerLayer_->AddChildren(currentLayer_);
|
||||
}
|
||||
|
||||
@@ -119,8 +119,9 @@ void RosenRenderContext::StartRecording()
|
||||
if (clipHole_.IsValid()) {
|
||||
recordingCanvas_->save();
|
||||
needRestoreHole_ = true;
|
||||
recordingCanvas_->clipRect(SkRect::MakeXYWH(clipHole_.Left(), clipHole_.Top(),
|
||||
clipHole_.Right(), clipHole_.Bottom()), SkClipOp::kDifference, true);
|
||||
recordingCanvas_->clipRect(
|
||||
SkRect::MakeXYWH(clipHole_.Left(), clipHole_.Top(), clipHole_.Right(), clipHole_.Bottom()),
|
||||
SkClipOp::kDifference, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user