Skip to content

Commit 94afa1f

Browse files
authored
fix(ohos): skip drawing when shadow is null or frame width is zero (#1496)
1 parent af1e5f3 commit 94afa1f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

core-render-ohos/src/main/cpp/libohos_render/expand/components/richtext/KRRichTextShadow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,12 @@ OH_Drawing_Typography *KRRichTextShadow::BuildTextTypography(double constraint_w
677677
std::fmax(0, std::fmin(std::ceil(OH_Drawing_TypographyGetLongestLine(typography_raw)), maxWidth));
678678
context_thread_text_align_ = text_align;
679679
auto ouput_measure_width_ = (longestLineWidth / dpi);
680+
#ifndef NDEBUG
680681
if (ouput_measure_width_ < 0.01) {
681682
KR_LOG_ERROR << "Measure size:" << ouput_measure_width_ << ", " << ouput_measure_height_
682683
<< ", content bytes:" << GetTextContent().size() << ", in shadow view:" << this;
683684
}
684-
685+
#endif
685686
context_measure_size_ = KRSize(ouput_measure_width_, ouput_measure_height_);
686687
if (handler != nullptr) {
687688
OH_Drawing_DestroyTypographyHandler(handler);

core-render-ohos/src/main/cpp/libohos_render/expand/components/richtext/KRRichTextView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void KRRichTextView::DidRemoveFromParentView() {
158158
}
159159

160160
void KRRichTextView::OnForegroundDraw(ArkUI_NodeCustomEvent *event) {
161-
if (shadow_ == nullptr && GetFrame().width == 0) {
161+
if (shadow_ == nullptr || GetFrame().width == 0) {
162162
KR_LOG_ERROR << "OnForegroundDraw, shadow or frame not ready, shadow:" << shadow_.get()
163163
<< ", frame width:" << GetFrame().width;
164164
return;

0 commit comments

Comments
 (0)