From 8e8711a1c8e2f927901fd93d809e93392d5a7628 Mon Sep 17 00:00:00 2001 From: justwe <952806070@qq.com> Date: Sat, 13 Sep 2025 17:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=84=E8=93=9D=E5=8C=BA=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: justwe <952806070@qq.com> --- ohos_interface/include/ohos_nweb/nweb.h | 8 ++++++++ ohos_interface/include/ohos_nweb/nweb_handler.h | 9 +++++++++ .../bridge/webcore/ark_web_handler_wrapper.cpp | 9 +++++++++ .../bridge/webcore/ark_web_handler_wrapper.h | 11 +++++++++++ .../ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp | 4 ++++ .../ohos_nweb/bridge/webcore/ark_web_nweb_impl.h | 8 ++++++++ .../bridge/webview/ark_web_handler_impl.cpp | 7 +++++++ .../ohos_nweb/bridge/webview/ark_web_handler_impl.h | 11 +++++++++++ .../bridge/webview/ark_web_nweb_wrapper.cpp | 5 +++++ .../ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h | 7 +++++++ .../ohos_glue/ohos_nweb/include/ark_web_handler.h | 12 ++++++++++++ .../ohos_glue/ohos_nweb/include/ark_web_nweb.h | 9 +++++++++ 12 files changed, 100 insertions(+) diff --git a/ohos_interface/include/ohos_nweb/nweb.h b/ohos_interface/include/ohos_nweb/nweb.h index 1c904e8f5..e2da22cd5 100644 --- a/ohos_interface/include/ohos_nweb/nweb.h +++ b/ohos_interface/include/ohos_nweb/nweb.h @@ -2061,6 +2061,14 @@ public: { return WebDestroyMode::NORMAL_MODE; } + + /** + * @brief Record the blankless frame size of the web. + * + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + virtual void RecordBlanklessFrameSize(uint32_t width, uint32_t height) {} }; } // namespace OHOS::NWeb diff --git a/ohos_interface/include/ohos_nweb/nweb_handler.h b/ohos_interface/include/ohos_nweb/nweb_handler.h index 59832df9e..f9709da8a 100644 --- a/ohos_interface/include/ohos_nweb/nweb_handler.h +++ b/ohos_interface/include/ohos_nweb/nweb_handler.h @@ -1255,6 +1255,15 @@ public: virtual void OnPdfLoadEvent(int32_t result, const std::string& url) {} virtual void OnTakeFocus(std::shared_ptr event) {} + + /** + * @brief Notify the web client to insert blankless frame with size. + * + * @param pathToFrame The file used to insert frame. + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + virtual void OnInsertBlanklessFrameWithSize(const std::string& pathToFrame, uint32_t width, uint32_t height) {} }; } // namespace OHOS::NWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.cpp index 93e4e225b..9a4505545 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.cpp @@ -1262,4 +1262,13 @@ void ArkWebHandlerWrapper::OnTakeFocus(std::shared_ptr ark_web_handler_->OnTakeFocus(new ArkWebKeyEventImpl(event)); } + +void ArkWebHandlerWrapper::OnInsertBlanklessFrameWithSize(const std::string& pathToFrame, + uint32_t width, + uint32_t height) +{ + ArkWebString pathToFrame_ = ArkWebStringClassToStruct(pathToFrame); + ark_web_handler_->OnInsertBlanklessFrameWithSize(pathToFrame_, width, height); + ArkWebStringStructRelease(pathToFrame_); +} } // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.h index b907f9690..e44db392d 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_handler_wrapper.h @@ -734,6 +734,17 @@ public: void OnPdfLoadEvent(int32_t result, const std::string& url) override; void OnTakeFocus(std::shared_ptr event) override; + + /** + * @brief Notify the web client to insert blankless frame with size. + * + * @param pathToFrame The file used to insert frame. If empty, means remove frame. + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + void OnInsertBlanklessFrameWithSize(const std::string& pathToFrame, + uint32_t width, + uint32_t height) override; private: ArkWebRefPtr ark_web_handler_; }; diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp index b1666ea9a..71807d2be 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.cpp @@ -1548,4 +1548,8 @@ void ArkWebNWebImpl::FillAutofillDataV2(ArkWebRefPtr data) nweb_nweb_->FillAutofillDataV2(std::make_shared(data)); } +void ArkWebNWebImpl::RecordBlanklessFrameSize(uint32_t width, uint32_t height) +{ + nweb_nweb_->RecordBlanklessFrameSize(width, height); +} } // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h index c160b3e49..a5d130545 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webcore/ark_web_nweb_impl.h @@ -1758,6 +1758,14 @@ public: ArkWebRefPtr CreateWebPrintDocumentAdapterV2( const ArkWebString& job_name) override; + /** + * @brief Record the blankless frame size of the web. + * + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + /*--ark web()--*/ + void RecordBlanklessFrameSize(uint32_t width, uint32_t height) override; private: std::shared_ptr nweb_nweb_; }; diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp index e48c5c199..76518eeec 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp @@ -1100,4 +1100,11 @@ void ArkWebHandlerImpl::OnTakeFocus(ArkWebRefPtr event) nweb_handler_->OnTakeFocus(std::make_shared(event)); } + +void ArkWebHandlerImpl::OnInsertBlanklessFrameWithSize(const ArkWebString& pathToFrame, + uint32_t width, + uint32_t height) +{ + nweb_handler_->OnInsertBlanklessFrameWithSize(ArkWebStringStructToClass(pathToFrame), width, height); +} } // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h index bd471997b..7d75c5046 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h @@ -697,6 +697,17 @@ public: void OnPdfLoadEvent(int32_t result, const ArkWebString& url) override; void OnTakeFocus(ArkWebRefPtr event) override; + + /** + * @brief Notify the web client to do something for blankless. + * + * @param pathToFrame The file used to insert frame. + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + void OnInsertBlanklessFrameWithSize(const ArkWebString& pathToFrame, + uint32_t width, + uint32_t height) override; private: std::shared_ptr nweb_handler_; }; diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp index bfdfecba3..cbb03fda0 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp @@ -1819,4 +1819,9 @@ void ArkWebNWebWrapper::FillAutofillDataV2(std::shared_ptrFillAutofillDataV2(new ArkWebRomValueImpl(data)); } + +void ArkWebNWebWrapper::RecordBlanklessFrameSize(uint32_t width, uint32_t height) +{ + ark_web_nweb_->RecordBlanklessFrameSize(width, height); +} } // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h index c5e593afc..110451032 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h @@ -1771,6 +1771,13 @@ public: std::unique_ptr CreateWebPrintDocumentAdapterV2( const std::string& job_name) override; + /** + * @brief Record the blankless frame size of the web. + * + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + void RecordBlanklessFrameSize(uint32_t width, uint32_t height) override; private: ArkWebRefPtr ark_web_nweb_; }; diff --git a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h index eb9199b79..6799938e2 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h +++ b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h @@ -1024,6 +1024,18 @@ public: /*--ark web()--*/ virtual void OnTakeFocus(ArkWebRefPtr event) = 0; + + /** + * @brief Notify the web client to insert blankless frame with size. + * + * @param pathToFrame The file used to insert frame. + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + /*--ark web()--*/ + virtual void OnInsertBlanklessFrameWithSize(const ArkWebString& pathToFrame, + uint32_t width, + uint32_t height) = 0; }; } // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h index f2d1123e6..a32f1b052 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h +++ b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_nweb.h @@ -1994,6 +1994,15 @@ public: /*--ark web()--*/ virtual ArkWebRefPtr CreateWebPrintDocumentAdapterV2( const ArkWebString& job_name) = 0; + + /** + * @brief Record the blankless frame size of the web. + * + * @param width The width of the blankless frame. + * @param height The height of the blankless frame. + */ + /*--ark web()--*/ + virtual void RecordBlanklessFrameSize(uint32_t width, uint32_t height) = 0; }; } // namespace OHOS::ArkWeb -- Gitee