[web]check drawsize height and width before paint to prevent invalid input

Signed-off-by: liwenzhen <liwenzhen3@huawei.com>
Change-Id: Id3699ce90170e2e9cbf17f4d04428d2fdbc8d21a
This commit is contained in:
liwenzhen
2022-03-19 19:18:39 +08:00
parent 07f488ab8b
commit 70ec28d945
@@ -45,7 +45,16 @@ void RosenRenderWeb::OnAttachContext()
void RosenRenderWeb::Paint(RenderContext& context, const Offset& offset)
{
auto pipelineContext = context_.Upgrade();
if (!pipelineContext) {
LOGE("OnAttachContext context null");
return;
}
if (drawSize_.Width() > pipelineContext->GetRootWidth() || drawSize_.Height() > pipelineContext->GetRootHeight()) {
LOGE("Web drawSize height or width is invalid");
}
if (delegate_) {
LOGI("Web paint drawSize width = %{public}f, height = %{public}f", drawSize_.Width(), drawSize_.Height());
delegate_->Resize(drawSize_.Width(), drawSize_.Height());
if (!isUrlLoaded_) {
delegate_->LoadUrl();