已合并
arkweb 拖入适配多entry拖出新增Tag #60197
zhufenghao创建于 2025年4月7日
arkweb 拖入适配多entry拖出新增Tag #60197
已合并
从refs/pull/60197/head合入到OpenHarmony-5.1.0-Release
共 8 个文件变更+215-15
| @@ -439,4 +439,150 @@ std::vector<uint8_t> UdmfClientImpl::GetSpanStringRecord(const RefPtr<UnifiedDat | |||
| 439 | } | 439 | } |
| 440 | return arr; | 440 | return arr; |
| 441 | } | 441 | } |
| 442 | + | ||
| 443 | +void UdmfClientImpl::SetTagProperty(const RefPtr<UnifiedData>& unifiedData, const std::string& tag) | ||
| 444 | +{ | ||
| 445 | + auto properties = std::make_shared<UDMF::UnifiedDataProperties>(); | ||
| 446 | + properties->tag = tag; | ||
| 447 | + auto udData = AceType::DynamicCast<UnifiedDataImpl>(unifiedData); | ||
| 448 | + CHECK_NULL_VOID(udData); | ||
| 449 | + CHECK_NULL_VOID(udData->GetUnifiedData()); | ||
| 450 | + udData->GetUnifiedData()->SetProperties(properties); | ||
| 451 | +} | ||
| 452 | + | ||
| 453 | +std::string UdmfClientImpl::GetPlainTextEntry(const RefPtr<UnifiedData>& unifiedData) | ||
| 454 | +{ | ||
| 455 | + auto udData = AceType::DynamicCast<UnifiedDataImpl>(unifiedData); | ||
| 456 | + CHECK_NULL_RETURN(udData, std::string()); | ||
| 457 | + CHECK_NULL_RETURN(udData->GetUnifiedData(), std::string()); | ||
| 458 | + auto utdId = UDMF::UtdUtils::GetUtdIdFromUtdEnum(UDMF::PLAIN_TEXT); | ||
| 459 | + CHECK_NULL_RETURN(udData->GetUnifiedData()->HasType(utdId), std::string()); | ||
| 460 | + std::string plainTextSum; | ||
| 461 | + auto records = udData->GetUnifiedData()->GetRecords(); | ||
| 462 | + for (const auto& record : records) { | ||
| 463 | + std::string plainText; | ||
| 464 | + auto value = record->GetEntry(utdId); | ||
| 465 | + if (std::holds_alternative<std::shared_ptr<UDMF::Object>>(value)) { | ||
| 466 | + auto object = std::get<std::shared_ptr<UDMF::Object>>(value); | ||
| 467 | + object->GetValue(UDMF::CONTENT, plainText); | ||
| 468 | + } else if (std::holds_alternative<std::string>(value)) { | ||
| 469 | + plainText = std::get<std::string>(value); | ||
| 470 | + } | ||
| 471 | + plainTextSum += plainText; | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + if (plainTextSum.empty()) { | ||
| 475 | + std::vector<std::string> plains = GetPlainTextRecords(unifiedData); | ||
| 476 | + if (!plains.empty()) { | ||
| 477 | + plainTextSum = plains[0]; | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + return plainTextSum; | ||
| 481 | +} | ||
| 482 | + | ||
| 483 | +void UdmfClientImpl::GetHtmlEntry( | ||
| 484 | + const RefPtr<UnifiedData>& unifiedData, std::string& htmlContent, std::string& plainContent) | ||
| 485 | +{ | ||
| 486 | + CHECK_NULL_VOID(htmlContent.empty() && plainContent.empty()); | ||
| 487 | + auto udData = AceType::DynamicCast<UnifiedDataImpl>(unifiedData); | ||
| 488 | + CHECK_NULL_VOID(udData); | ||
| 489 | + CHECK_NULL_VOID(udData->GetUnifiedData()); | ||
| 490 | + auto utdId = UDMF::UtdUtils::GetUtdIdFromUtdEnum(UDMF::HTML); | ||
| 491 | + CHECK_NULL_VOID(udData->GetUnifiedData()->HasType(utdId)); | ||
| 492 | + auto records = udData->GetUnifiedData()->GetRecords(); | ||
| 493 | + for (auto record : records) { | ||
| 494 | + std::string htmlText; | ||
| 495 | + std::string plainText; | ||
| 496 | + auto value = record->GetEntry(utdId); | ||
| 497 | + if (std::holds_alternative<std::shared_ptr<UDMF::Object>>(value)) { | ||
| 498 | + auto object = std::get<std::shared_ptr<UDMF::Object>>(value); | ||
| 499 | + object->GetValue(UDMF::HTML_CONTENT, htmlText); | ||
| 500 | + object->GetValue(UDMF::PLAIN_CONTENT, plainText); | ||
| 501 | + } | ||
| 502 | + htmlContent += htmlText; | ||
| 503 | + plainContent += plainText; | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + if (htmlContent.empty() && plainContent.empty()) { | ||
| 507 | + GetHtmlRecord(unifiedData, htmlContent, plainContent); | ||
| 508 | + } | ||
| 509 | +} | ||
| 510 | + | ||
| 511 | +void UdmfClientImpl::GetLinkEntry(const RefPtr<UnifiedData>& unifiedData, std::string& url, std::string& description) | ||
| 512 | +{ | ||
| 513 | + CHECK_NULL_VOID(url.empty() && description.empty()); | ||
| 514 | + auto udData = AceType::DynamicCast<UnifiedDataImpl>(unifiedData); | ||
| 515 | + CHECK_NULL_VOID(udData); | ||
| 516 | + CHECK_NULL_VOID(udData->GetUnifiedData()); | ||
| 517 | + auto utdId = UDMF::UtdUtils::GetUtdIdFromUtdEnum(UDMF::HYPERLINK); | ||
| 518 | + CHECK_NULL_VOID(udData->GetUnifiedData()->HasType(utdId)); | ||
| 519 | + auto records = udData->GetUnifiedData()->GetRecords(); | ||
| 520 | + for (auto record : records) { | ||
| 521 | + std::string currentUrl; | ||
| 522 | + std::string currentDes; | ||
| 523 | + auto value = record->GetEntry(utdId); | ||
| 524 | + if (std::holds_alternative<std::shared_ptr<UDMF::Object>>(value)) { | ||
| 525 | + auto object = std::get<std::shared_ptr<UDMF::Object>>(value); | ||
| 526 | + object->GetValue(UDMF::URL, currentUrl); | ||
| 527 | + object->GetValue(UDMF::DESCRIPTION, currentDes); | ||
| 528 | + } | ||
| 529 | + url += currentUrl; | ||
| 530 | + description += currentDes; | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + if (url.empty() && description.empty()) { | ||
| 534 | + GetLinkRecord(unifiedData, url, description); | ||
| 535 | + } | ||
| 536 | +} | ||
| 537 | + | ||
| 538 | +bool UdmfClientImpl::GetFileUriEntry(const RefPtr<UnifiedData>& unifiedData, std::vector<std::string>& uri) | ||
| 539 | +{ | ||
| 540 | + CHECK_NULL_RETURN(uri.empty(), false); | ||
| 541 | + auto udData = AceType::DynamicCast<UnifiedDataImpl>(unifiedData); | ||
| 542 | + CHECK_NULL_RETURN(udData, false); | ||
| 543 | + CHECK_NULL_RETURN(udData->GetUnifiedData(), false); | ||
| 544 | + auto records = udData->GetUnifiedData()->GetRecords(); | ||
| 545 | + auto typeList = { UDMF::UDType::IMAGE, UDMF::UDType::AUDIO, UDMF::UDType::VIDEO, UDMF::UDType::FILE, | ||
| 546 | + UDMF::UDType::FILE_URI }; | ||
| 547 | + for (auto record : records) { | ||
| 548 | + std::string currentUri; | ||
| 549 | + for (auto type : typeList) { | ||
| 550 | + auto value = record->GetEntry(UDMF::UtdUtils::GetUtdIdFromUtdEnum(type)); | ||
| 551 | + if (std::holds_alternative<std::shared_ptr<UDMF::Object>>(value)) { | ||
| 552 | + auto object = std::get<std::shared_ptr<UDMF::Object>>(value); | ||
| 553 | + std::string currentEntryUri; | ||
| 554 | + object->GetValue(UDMF::ORI_URI, currentEntryUri); | ||
| 555 | + uri.emplace_back(currentEntryUri); | ||
| 556 | + } | ||
| 557 | + } | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + if (uri.empty()) { | ||
| 561 | + GetFileUriRecord(unifiedData, uri); | ||
| 562 | + } | ||
| 563 | + return true; | ||
| 564 | +} | ||
| 565 | + | ||
| 566 | +std::vector<uint8_t> UdmfClientImpl::GetSpanStringEntry(const RefPtr<UnifiedData>& unifiedData) | ||
| 567 | +{ | ||
| 568 | + std::vector<uint8_t> arr; | ||
| 569 | + auto udData = AceType::DynamicCast<UnifiedDataImpl>(unifiedData); | ||
| 570 | + CHECK_NULL_RETURN(udData, arr); | ||
| 571 | + CHECK_NULL_RETURN(udData->GetUnifiedData(), arr); | ||
| 572 | + auto utdId = UDMF::UtdUtils::GetUtdIdFromUtdEnum(UDMF::APPLICATION_DEFINED_RECORD); | ||
| 573 | + CHECK_NULL_RETURN(udData->GetUnifiedData()->HasType(utdId), GetSpanStringRecord(unifiedData)); | ||
| 574 | + auto records = udData->GetUnifiedData()->GetRecords(); | ||
| 575 | + for (auto record : records) { | ||
| 576 | + auto value = record->GetEntry(utdId); | ||
| 577 | + if (std::holds_alternative<std::shared_ptr<UDMF::Object>>(value)) { | ||
| 578 | + auto object = std::get<std::shared_ptr<UDMF::Object>>(value); | ||
| 579 | + UDMF::ApplicationDefinedRecord* app = reinterpret_cast<UDMF::ApplicationDefinedRecord*>(object.get()); | ||
| 580 | + if (app && app->GetApplicationDefinedType() == "OPENHARMONY_STYLED_STRING_UDMF") { | ||
| 581 | + arr = app->GetRawData(); | ||
| 582 | + return arr; | ||
| 583 | + } | ||
| 584 | + } | ||
| 585 | + } | ||
| 586 | + return GetSpanStringRecord(unifiedData); | ||
| 587 | +} | ||
| 442 | } // namespace OHOS::Ace | 588 | } // namespace OHOS::Ace |
| @@ -64,6 +64,14 @@ public: | |||
| 64 | std::vector<uint8_t> GetSpanStringRecord(const RefPtr<UnifiedData>& unifiedData) override; | 64 | std::vector<uint8_t> GetSpanStringRecord(const RefPtr<UnifiedData>& unifiedData) override; |
| 65 | int32_t StartAsyncDataRetrieval(napi_env env, napi_value napiValue, const std::string& key) override; | 65 | int32_t StartAsyncDataRetrieval(napi_env env, napi_value napiValue, const std::string& key) override; |
| 66 | int32_t Cancel(const std::string& key) override; | 66 | int32_t Cancel(const std::string& key) override; |
| 67 | + | ||
| 68 | + void SetTagProperty(const RefPtr<UnifiedData>& unifiedData, const std::string& tag) override; | ||
| 69 | + std::string GetPlainTextEntry(const RefPtr<UnifiedData>& unifiedData) override; | ||
| 70 | + void GetHtmlEntry( | ||
| 71 | + const RefPtr<UnifiedData>& unifiedData, std::string& htmlContent, std::string& plainContent) override; | ||
| 72 | + void GetLinkEntry(const RefPtr<UnifiedData>& unifiedData, std::string& url, std::string& description) override; | ||
| 73 | + bool GetFileUriEntry(const RefPtr<UnifiedData>& unifiedData, std::vector<std::string>& uri) override; | ||
| 74 | + std::vector<uint8_t> GetSpanStringEntry(const RefPtr<UnifiedData>& unifiedData) override; | ||
| 67 | }; | 75 | }; |
| 68 | 76 | ||
| 69 | class UnifiedDataImpl : public UnifiedData { | 77 | class UnifiedDataImpl : public UnifiedData { |
| @@ -166,4 +166,26 @@ int32_t UdmfClientImpl::Cancel(const std::string& key) | |||
| 166 | return -1; | 166 | return -1; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | +void UdmfClientImpl::SetTagProperty(const RefPtr<UnifiedData>& unifiedData, const std::string& tag) {} | ||
| 170 | + | ||
| 171 | +std::string UdmfClientImpl::GetPlainTextEntry(const RefPtr<UnifiedData>& unifiedData) | ||
| 172 | +{ | ||
| 173 | + return ""; | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +void UdmfClientImpl::GetHtmlEntry( | ||
| 177 | + const RefPtr<UnifiedData>& unifiedData, std::string& htmlContent, std::string& plainContent) | ||
| 178 | +{} | ||
| 179 | + | ||
| 180 | +void UdmfClientImpl::GetLinkEntry(const RefPtr<UnifiedData>& unifiedData, std::string& url, std::string& description) {} | ||
| 181 | + | ||
| 182 | +bool UdmfClientImpl::GetFileUriEntry(const RefPtr<UnifiedData>& unifiedData, std::vector<std::string>& uri) | ||
| 183 | +{ | ||
| 184 | + return false; | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +std::vector<uint8_t> UdmfClientImpl::GetSpanStringEntry(const RefPtr<UnifiedData>& unifiedData) | ||
| 188 | +{ | ||
| 189 | + return {}; | ||
| 190 | +} | ||
| 169 | } // namespace OHOS::Ace | 191 | } // namespace OHOS::Ace |
| @@ -61,6 +61,14 @@ public: | |||
| 61 | std::vector<uint8_t> GetSpanStringRecord(const RefPtr<UnifiedData>& unifiedData) override; | 61 | std::vector<uint8_t> GetSpanStringRecord(const RefPtr<UnifiedData>& unifiedData) override; |
| 62 | int32_t StartAsyncDataRetrieval(napi_env env, napi_value napiValue, const std::string& key) override; | 62 | int32_t StartAsyncDataRetrieval(napi_env env, napi_value napiValue, const std::string& key) override; |
| 63 | int32_t Cancel(const std::string& key) override; | 63 | int32_t Cancel(const std::string& key) override; |
| 64 | + | ||
| 65 | + void SetTagProperty(const RefPtr<UnifiedData>& unifiedData, const std::string& tag) override; | ||
| 66 | + std::string GetPlainTextEntry(const RefPtr<UnifiedData>& unifiedData) override; | ||
| 67 | + void GetHtmlEntry( | ||
| 68 | + const RefPtr<UnifiedData>& unifiedData, std::string& htmlContent, std::string& plainContent) override; | ||
| 69 | + void GetLinkEntry(const RefPtr<UnifiedData>& unifiedData, std::string& url, std::string& description) override; | ||
| 70 | + bool GetFileUriEntry(const RefPtr<UnifiedData>& unifiedData, std::vector<std::string>& uri) override; | ||
| 71 | + std::vector<uint8_t> GetSpanStringEntry(const RefPtr<UnifiedData>& unifiedData) override; | ||
| 64 | }; | 72 | }; |
| 65 | 73 | ||
| 66 | class UnifiedDataImpl : public UnifiedData { | 74 | class UnifiedDataImpl : public UnifiedData { |
| @@ -74,6 +74,14 @@ public: | |||
| 74 | virtual std::vector<uint8_t> GetSpanStringRecord(const RefPtr<UnifiedData>& unifiedData) = 0; | 74 | virtual std::vector<uint8_t> GetSpanStringRecord(const RefPtr<UnifiedData>& unifiedData) = 0; |
| 75 | virtual int32_t StartAsyncDataRetrieval(napi_env env, napi_value napiValue, const std::string& key) = 0; | 75 | virtual int32_t StartAsyncDataRetrieval(napi_env env, napi_value napiValue, const std::string& key) = 0; |
| 76 | virtual int32_t Cancel(const std::string& key) = 0; | 76 | virtual int32_t Cancel(const std::string& key) = 0; |
| 77 | + | ||
| 78 | + virtual void SetTagProperty(const RefPtr<UnifiedData>& unifiedData, const std::string& tag) = 0; | ||
| 79 | + virtual std::string GetPlainTextEntry(const RefPtr<UnifiedData>& unifiedData) = 0; | ||
| 80 | + virtual void GetHtmlEntry( | ||
| 81 | + const RefPtr<UnifiedData>& unifiedData, std::string& htmlContent, std::string& plainContent) = 0; | ||
| 82 | + virtual void GetLinkEntry(const RefPtr<UnifiedData>& unifiedData, std::string& url, std::string& description) = 0; | ||
| 83 | + virtual bool GetFileUriEntry(const RefPtr<UnifiedData>& unifiedData, std::vector<std::string>& uri) = 0; | ||
| 84 | + virtual std::vector<uint8_t> GetSpanStringEntry(const RefPtr<UnifiedData>& unifiedData) = 0; | ||
| 77 | }; | 85 | }; |
| 78 | } // namespace OHOS::Ace | 86 | } // namespace OHOS::Ace |
| 79 | 87 | ||
| @@ -2374,25 +2374,23 @@ std::function<void(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)> Tex | |||
| 2374 | auto data = event->GetData(); | 2374 | auto data = event->GetData(); |
| 2375 | CHECK_NULL_VOID(data); | 2375 | CHECK_NULL_VOID(data); |
| 2376 | std::u16string str; | 2376 | std::u16string str; |
| 2377 | - auto arr = UdmfClient::GetInstance()->GetSpanStringRecord(data); | 2377 | + auto arr = UdmfClient::GetInstance()->GetSpanStringEntry(data); |
| 2378 | if (arr.size() > 0) { | 2378 | if (arr.size() > 0) { |
| 2379 | auto spanStr = SpanString::DecodeTlv(arr); | 2379 | auto spanStr = SpanString::DecodeTlv(arr); |
| 2380 | str += spanStr->GetU16string(); | 2380 | str += spanStr->GetU16string(); |
| 2381 | } else { | 2381 | } else { |
| 2382 | - auto records = UdmfClient::GetInstance()->GetPlainTextRecords(data); | 2382 | + auto plainText = UdmfClient::GetInstance()->GetPlainTextEntry(data); |
| 2383 | - if (records.empty()) { | 2383 | + if (plainText.empty()) { |
| 2384 | std::string linkUrl; | 2384 | std::string linkUrl; |
| 2385 | std::string linkTitle; | 2385 | std::string linkTitle; |
| 2386 | - UdmfClient::GetInstance()->GetLinkRecord(data, linkUrl, linkTitle); | 2386 | + UdmfClient::GetInstance()->GetLinkEntry(data, linkUrl, linkTitle); |
| 2387 | if (!linkTitle.empty()) { | 2387 | if (!linkTitle.empty()) { |
| 2388 | str += UtfUtils::Str8DebugToStr16(linkTitle); | 2388 | str += UtfUtils::Str8DebugToStr16(linkTitle); |
| 2389 | } else if (!linkUrl.empty()) { | 2389 | } else if (!linkUrl.empty()) { |
| 2390 | str += UtfUtils::Str8DebugToStr16(linkUrl); | 2390 | str += UtfUtils::Str8DebugToStr16(linkUrl); |
| 2391 | } | 2391 | } |
| 2392 | } | 2392 | } |
| 2393 | - for (const auto& record : records) { | 2393 | + str += UtfUtils::Str8DebugToStr16(plainText); |
| 2394 | - str += UtfUtils::Str8DebugToStr16(record); | ||
| 2395 | - } | ||
| 2396 | } | 2394 | } |
| 2397 | pattern->dragRecipientStatus_ = DragStatus::NONE; | 2395 | pattern->dragRecipientStatus_ = DragStatus::NONE; |
| 2398 | if (str.empty()) { | 2396 | if (str.empty()) { |
| @@ -1687,6 +1687,7 @@ NG::DragDropInfo WebPattern::HandleOnDragStart(const RefPtr<OHOS::Ace::DragEvent | |||
| 1687 | UdmfClient::GetInstance()->AddLinkRecord(aceUnifiedData, linkUrl, linkTitle); | 1687 | UdmfClient::GetInstance()->AddLinkRecord(aceUnifiedData, linkUrl, linkTitle); |
| 1688 | TAG_LOGI(AceLogTag::ACE_WEB, "web DragDrop event Start, linkUrl size:%{public}zu", linkUrl.size()); | 1688 | TAG_LOGI(AceLogTag::ACE_WEB, "web DragDrop event Start, linkUrl size:%{public}zu", linkUrl.size()); |
| 1689 | } | 1689 | } |
| 1690 | + UdmfClient::GetInstance()->SetTagProperty(aceUnifiedData, "records_to_entries_data_format"); | ||
| 1690 | info->SetData(aceUnifiedData); | 1691 | info->SetData(aceUnifiedData); |
| 1691 | HandleOnDragEnter(info); | 1692 | HandleOnDragEnter(info); |
| 1692 | return dragDropInfo; | 1693 | return dragDropInfo; |
| @@ -2058,7 +2059,7 @@ void WebPattern::HandleOnDragDropLink(RefPtr<UnifiedData> aceData) | |||
| 2058 | // hyperlink | 2059 | // hyperlink |
| 2059 | std::string linkUrl; | 2060 | std::string linkUrl; |
| 2060 | std::string linkTitle; | 2061 | std::string linkTitle; |
| 2061 | - UdmfClient::GetInstance()->GetLinkRecord(aceData, linkUrl, linkTitle); | 2062 | + UdmfClient::GetInstance()->GetLinkEntry(aceData, linkUrl, linkTitle); |
| 2062 | if (!linkUrl.empty()) { | 2063 | if (!linkUrl.empty()) { |
| 2063 | delegate_->dragData_->SetLinkURL(linkUrl); | 2064 | delegate_->dragData_->SetLinkURL(linkUrl); |
| 2064 | delegate_->dragData_->SetLinkTitle(linkTitle); | 2065 | delegate_->dragData_->SetLinkTitle(linkTitle); |
| @@ -2077,7 +2078,7 @@ void WebPattern::HandleOnDragDropFile(RefPtr<UnifiedData> aceData) | |||
| 2077 | CHECK_NULL_VOID(delegate_->dragData_); | 2078 | CHECK_NULL_VOID(delegate_->dragData_); |
| 2078 | // file | 2079 | // file |
| 2079 | std::vector<std::string> urlVec; | 2080 | std::vector<std::string> urlVec; |
| 2080 | - UdmfClient::GetInstance()->GetFileUriRecord(aceData, urlVec); | 2081 | + UdmfClient::GetInstance()->GetFileUriEntry(aceData, urlVec); |
| 2081 | TAG_LOGI(AceLogTag::ACE_WEB, "DragDrop event WebEventHub onDragDropId," | 2082 | TAG_LOGI(AceLogTag::ACE_WEB, "DragDrop event WebEventHub onDragDropId," |
| 2082 | "url array size is:%{public}zu", urlVec.size()); | 2083 | "url array size is:%{public}zu", urlVec.size()); |
| 2083 | delegate_->dragData_->ClearImageFileNames(); | 2084 | delegate_->dragData_->ClearImageFileNames(); |
| @@ -2127,9 +2128,8 @@ void WebPattern::HandleOnDragDrop(const RefPtr<OHOS::Ace::DragEvent>& info) | |||
| 2127 | "DragDrop event WebEventHub onDragDropId, size:%{public}" PRId64 "", aceData->GetSize()); | 2128 | "DragDrop event WebEventHub onDragDropId, size:%{public}" PRId64 "", aceData->GetSize()); |
| 2128 | CHECK_NULL_VOID(delegate_->dragData_); | 2129 | CHECK_NULL_VOID(delegate_->dragData_); |
| 2129 | // plain text | 2130 | // plain text |
| 2130 | - std::vector<std::string> plains = UdmfClient::GetInstance()->GetPlainTextRecords(aceData); | 2131 | + std::string plain = UdmfClient::GetInstance()->GetPlainTextEntry(aceData); |
| 2131 | - if (!plains.empty() && !plains[0].empty()) { | 2132 | + if (!plain.empty()) { |
| 2132 | - std::string plain = plains[0]; | ||
| 2133 | delegate_->dragData_->SetFragmentText(plain); | 2133 | delegate_->dragData_->SetFragmentText(plain); |
| 2134 | TAG_LOGI(AceLogTag::ACE_WEB, | 2134 | TAG_LOGI(AceLogTag::ACE_WEB, |
| 2135 | "DragDrop event WebEventHub onDragDropId, plain size:%{public}zu", plain.size()); | 2135 | "DragDrop event WebEventHub onDragDropId, plain size:%{public}zu", plain.size()); |
| @@ -2137,14 +2137,14 @@ void WebPattern::HandleOnDragDrop(const RefPtr<OHOS::Ace::DragEvent>& info) | |||
| 2137 | // html | 2137 | // html |
| 2138 | std::string htmlContent; | 2138 | std::string htmlContent; |
| 2139 | std::string plainContent; | 2139 | std::string plainContent; |
| 2140 | - UdmfClient::GetInstance()->GetHtmlRecord(aceData, htmlContent, plainContent); | 2140 | + UdmfClient::GetInstance()->GetHtmlEntry(aceData, htmlContent, plainContent); |
| 2141 | if (!htmlContent.empty()) { | 2141 | if (!htmlContent.empty()) { |
| 2142 | delegate_->dragData_->SetFragmentHtml(htmlContent); | 2142 | delegate_->dragData_->SetFragmentHtml(htmlContent); |
| 2143 | TAG_LOGI(AceLogTag::ACE_WEB, | 2143 | TAG_LOGI(AceLogTag::ACE_WEB, |
| 2144 | "DragDrop event WebEventHub onDragDropId, htmlContent size:%{public}zu", htmlContent.size()); | 2144 | "DragDrop event WebEventHub onDragDropId, htmlContent size:%{public}zu", htmlContent.size()); |
| 2145 | } | 2145 | } |
| 2146 | // spanstring | 2146 | // spanstring |
| 2147 | - std::vector<uint8_t> spanString = UdmfClient::GetInstance()->GetSpanStringRecord(aceData); | 2147 | + std::vector<uint8_t> spanString = UdmfClient::GetInstance()->GetSpanStringEntry(aceData); |
| 2148 | if (!spanString.empty()) { | 2148 | if (!spanString.empty()) { |
| 2149 | std::string htmlStr = OHOS::Ace::SpanToHtml::ToHtml(spanString); | 2149 | std::string htmlStr = OHOS::Ace::SpanToHtml::ToHtml(spanString); |
| 2150 | delegate_->dragData_->SetFragmentHtml(htmlStr); | 2150 | delegate_->dragData_->SetFragmentHtml(htmlStr); |
| @@ -6612,7 +6612,7 @@ void WebPattern::RemoveDataListNode() | |||
| 6612 | auto overlayManager = context->GetOverlayManager(); | 6612 | auto overlayManager = context->GetOverlayManager(); |
| 6613 | CHECK_NULL_VOID(overlayManager); | 6613 | CHECK_NULL_VOID(overlayManager); |
| 6614 | overlayManager->DeleteMenu(dataListNode->GetId()); | 6614 | overlayManager->DeleteMenu(dataListNode->GetId()); |
| 6615 | - | 6615 | + |
| 6616 | auto parent = dataListNode->GetParent(); | 6616 | auto parent = dataListNode->GetParent(); |
| 6617 | CHECK_NULL_VOID(parent); | 6617 | CHECK_NULL_VOID(parent); |
| 6618 | parent->RemoveChild(dataListNode); | 6618 | parent->RemoveChild(dataListNode); |
| @@ -66,6 +66,16 @@ public: | |||
| 66 | MOCK_METHOD( | 66 | MOCK_METHOD( |
| 67 | int32_t, StartAsyncDataRetrieval, (napi_env env, napi_value napiValue, const std::string& key), (override)); | 67 | int32_t, StartAsyncDataRetrieval, (napi_env env, napi_value napiValue, const std::string& key), (override)); |
| 68 | MOCK_METHOD(int32_t, Cancel, (const std::string& key), (override)); | 68 | MOCK_METHOD(int32_t, Cancel, (const std::string& key), (override)); |
| 69 | + | ||
| 70 | + MOCK_METHOD(void, SetTagProperty, (const RefPtr<UnifiedData>& unifiedData, const std::string& tag), (override)); | ||
| 71 | + MOCK_METHOD(std::string, GetPlainTextEntry, (const RefPtr<UnifiedData>& unifiedData), (override)); | ||
| 72 | + MOCK_METHOD(void, GetHtmlEntry, | ||
| 73 | + (const RefPtr<UnifiedData>& unifiedData, std::string& htmlContent, std::string& plainContent), (override)); | ||
| 74 | + MOCK_METHOD(void, GetLinkEntry, | ||
| 75 | + (const RefPtr<UnifiedData>& unifiedData, std::string& url, std::string& description), (override)); | ||
| 76 | + MOCK_METHOD( | ||
| 77 | + bool, GetFileUriEntry, (const RefPtr<UnifiedData>& unifiedData, std::vector<std::string>& uri), (override)); | ||
| 78 | + MOCK_METHOD(std::vector<uint8_t>, GetSpanStringEntry, (const RefPtr<UnifiedData>& unifiedData), (override)); | ||
| 69 | }; | 79 | }; |
| 70 | class MockUnifiedData : public UnifiedData { | 80 | class MockUnifiedData : public UnifiedData { |
| 71 | DECLARE_ACE_TYPE(MockUnifiedData, UnifiedData); | 81 | DECLARE_ACE_TYPE(MockUnifiedData, UnifiedData); |