From 32c61628c4c899bb7166a1c55d4d0b5706345971 Mon Sep 17 00:00:00 2001 From: wuliubao Date: Sat, 16 Sep 2023 14:46:31 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:#I81VNM=20Description:=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E5=9C=BA=E6=99=AFweb=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=BA=95=E9=83=A8=E5=87=BA=E7=8E=B0=E9=BB=91=E7=BA=BF?= =?UTF-8?q?=20Sig:=20SIG=5FApplicationFramework=20Feature=20or=20Bugfix:?= =?UTF-8?q?=20Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuliubao --- ohos_nweb/src/cef_delegate/nweb_render_handler.cc | 5 +++-- ohos_nweb/src/nweb_impl.cc | 10 ---------- ohos_nweb/src/nweb_impl.h | 1 - 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/ohos_nweb/src/cef_delegate/nweb_render_handler.cc b/ohos_nweb/src/cef_delegate/nweb_render_handler.cc index 14e543c1fd..568c200173 100755 --- a/ohos_nweb/src/cef_delegate/nweb_render_handler.cc +++ b/ohos_nweb/src/cef_delegate/nweb_render_handler.cc @@ -124,8 +124,9 @@ void NWebRenderHandler::GetViewRect(CefRefPtr browser, rect.width = width_; rect.height = height_; } else { - rect.width = width_ / screen_info_.display_ratio; - rect.height = height_ / screen_info_.display_ratio; + // Surface greater than Web Compoment in case show black line. + rect.width = std::ceil(width_ / screen_info_.display_ratio); + rect.height = std::ceil(height_ / screen_info_.display_ratio); } if (rect.width <= 0) { diff --git a/ohos_nweb/src/nweb_impl.cc b/ohos_nweb/src/nweb_impl.cc index b38953a4b1..f140a95868 100755 --- a/ohos_nweb/src/nweb_impl.cc +++ b/ohos_nweb/src/nweb_impl.cc @@ -263,12 +263,6 @@ bool NWebImpl::SetVirtualDeviceRatio() { return true; } -uint32_t NWebImpl::NormalizeVirtualDeviceRatio(uint32_t length) { - float ratio = - static_cast(length / device_pixel_ratio_) * device_pixel_ratio_; - return std::ceil(ratio); -} - bool NWebImpl::InitWebEngine(const NWebCreateInfo& create_info) { if (output_handler_ == nullptr) { WVLOG_E("fail to init web engine, NWeb output handler is not ready"); @@ -323,8 +317,6 @@ bool NWebImpl::InitWebEngine(const NWebCreateInfo& create_info) { uint32_t width, height; output_handler_->GetWindowInfo(width, height); - width = NormalizeVirtualDeviceRatio(width); - height = NormalizeVirtualDeviceRatio(height); nweb_delegate_->Resize(width, height); nweb_delegate_->RegisterRenderCb(render_update_cb); @@ -373,8 +365,6 @@ void NWebImpl::Resize(uint32_t width, uint32_t height) { if (input_handler_ == nullptr || output_handler_ == nullptr) { return; } - width = NormalizeVirtualDeviceRatio(width); - height = NormalizeVirtualDeviceRatio(height); if (width > kSurfaceMaxWidth || height > kSurfaceMaxHeight) { return; } diff --git a/ohos_nweb/src/nweb_impl.h b/ohos_nweb/src/nweb_impl.h index 19ebbd1bea..b35c493ece 100755 --- a/ohos_nweb/src/nweb_impl.h +++ b/ohos_nweb/src/nweb_impl.h @@ -215,7 +215,6 @@ class NWebImpl : public NWeb { void InitWebEngineArgs(const NWebInitArgs& init_args); bool InitWebEngine(const NWebCreateInfo& create_info); bool SetVirtualDeviceRatio(); - uint32_t NormalizeVirtualDeviceRatio(uint32_t length); void StopCameraSession() const; void RestartCameraSession() const; -- Gitee