[web]check drawsize to avoid INFINITE_SIZE

Signed-off-by: liwenzhen <liwenzhen3@huawei.com>
Change-Id: I0140d73fea5836ab80897e608efdf6e8f3cbd974
This commit is contained in:
liwenzhen
2022-03-26 17:34:03 +08:00
parent f992eeb69c
commit 89400d67c0
2 changed files with 3 additions and 5 deletions
@@ -83,10 +83,8 @@ void RenderWeb::PerformLayout()
}
// render web do not support child.
drawSize_ = Size(GetLayoutParam().GetMaxSize().Width(),
(GetLayoutParam().GetMaxSize().Height() == Size::INFINITE_SIZE) ?
Size::INFINITE_SIZE :
(GetLayoutParam().GetMaxSize().Height()));
drawSize_ = Size(GetLayoutParam().GetMaxSize().Width(), GetLayoutParam().GetMaxSize().Height());
SetLayoutSize(drawSize_);
SetNeedLayout(false);
MarkNeedRender();
@@ -62,7 +62,7 @@ void RosenRenderWeb::Paint(RenderContext& context, const Offset& offset)
if (pipelineContext->GetIsDragStart()) {
drawSize_ = Size(1.0, 1.0);
}
if (drawSize_.Width() > pipelineContext->GetRootWidth() || drawSize_.Height() > pipelineContext->GetRootHeight()) {
if (drawSize_.Width() == Size::INFINITE_SIZE || drawSize_.Height() == Size::INFINITE_SIZE) {
LOGE("Web drawSize height or width is invalid");
return;
}