diff --git a/ohos_interface/include/ohos_nweb/nweb.h b/ohos_interface/include/ohos_nweb/nweb.h index 1c904e8f5a4e317456c379ea1c035cf5f13042f9..e2da22cd59e3e5f1ca48a48f0b583e2c6701cf15 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 59832df9e12b6aa30f7c09f737ca46d03f3ecd04..f9709da8a59c30cc2b03aae273438589a669cc68 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 93e4e225b734962d4426c9c57593264a08c0c96f..9a4505545b52f6646ce1e740cafb4693a0635f05 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 b907f9690674a88770ea3046f5362eb76c6ee1aa..e44db392dc1a63fc9def4f09574c9bae1f5b762c 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 b1666ea9a9def9a512af6e3586a5f9f22919cc48..71807d2bedc97a3086c5b488b2610336ef220c46 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 c160b3e496cbd785789a942aff242fb7ea4ede16..a5d1305459b35b06fcf35a91d11f6f9f9e4e3e88 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 e48c5c199d9837e59bbfdb1c03e6b5c7d2b51314..76518eeec32b91062442897cbd05d0be4f89e9c1 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 bd471997bcbe22ea79d6c5579497d490ea31562e..7d75c50464aae19c79fa95fe0eae73508ef06f16 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 bfdfecba317c4700168c868bad57af851e6b656f..cbb03fda0c09120fc66c5acee1c8da83cfb2ff80 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 c5e593afc6d819c282ef08b40e811ef4cdb0adaf..1104510327ce8277d02135184d3abc3fd72aeb15 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 eb9199b79432f5a91871b878b7ddb9475d23f797..6799938e249a68780bedcb2594e07dcf06de3378 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 f2d1123e60b62466757b0b55fbda941e382136ec..a32f1b0522218fb4eb109ef1159a959d58b7ec0e 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