diff --git a/frameworks/core/components_ng/pattern/text/text_content_modifier.cpp b/frameworks/core/components_ng/pattern/text/text_content_modifier.cpp index c168d7f93e6..0bdbb0a2c33 100644 --- a/frameworks/core/components_ng/pattern/text/text_content_modifier.cpp +++ b/frameworks/core/components_ng/pattern/text/text_content_modifier.cpp @@ -348,7 +348,10 @@ void TextContentModifier::onDraw(DrawingContext& drawingContext) CHECK_NULL_VOID(textPattern); auto pManager = textPattern->GetParagraphManager(); CHECK_NULL_VOID(pManager); - CHECK_NULL_VOID(!pManager->GetParagraphs().empty()); + if (pManager->GetParagraphs().empty()) { + textPattern->DumpRecord(",onDraw GetParagraphs empty:"); + return; + } auto host = textPattern->GetHost(); CHECK_NULL_VOID(host); ACE_SCOPED_TRACE("[Text][id:%d] paint[offset:%f,%f]", host->GetId(), paintOffset_.GetX(), paintOffset_.GetY()); @@ -367,6 +370,7 @@ void TextContentModifier::onDraw(DrawingContext& drawingContext) } if (!CheckMarqueeState(MarqueeState::RUNNING)) { auto paintOffsetY = paintOffset_.GetY(); + textPattern->DumpRecord(",Paint id:" + std::to_string(host->GetId())); auto paragraphs = pManager->GetParagraphs(); for (auto&& info : paragraphs) { auto paragraph = info.paragraph; diff --git a/frameworks/core/components_ng/pattern/text/text_pattern.cpp b/frameworks/core/components_ng/pattern/text/text_pattern.cpp index c8c6f1857c1..fb5503c1025 100644 --- a/frameworks/core/components_ng/pattern/text/text_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text/text_pattern.cpp @@ -2043,7 +2043,9 @@ void TextPattern::OnModifyDone() CHECK_NULL_VOID(host); auto renderContext = host->GetRenderContext(); CHECK_NULL_VOID(renderContext); - + auto nowTime = static_cast(GetSystemTimestamp()); + ACE_LAYOUT_SCOPED_TRACE("OnModifyDone[Text][id:%d][time:%llu]", host->GetId(), nowTime); + DumpRecord(std::to_string(nowTime)); if (!(PipelineContext::GetCurrentContextSafely() && PipelineContext::GetCurrentContextSafely()->GetMinPlatformVersion() > API_PROTEXTION_GREATER_NINE)) { bool shouldClipToContent = @@ -2671,34 +2673,8 @@ void TextPattern::AddImageToSpanItem(const RefPtr& child) void TextPattern::DumpAdvanceInfo() { DumpLog::GetInstance().AddDesc(std::string("-----DumpAdvanceInfo-----")); - DumpLog::GetInstance().AddDesc(std::string("contentRect :").append(contentRect_.ToString())); - if (SystemProperties::GetDebugEnabled() && pManager_) { - DumpLog::GetInstance().AddDesc(std::string("from TextEngine paragraphs_ info :")); - DumpLog::GetInstance().AddDesc( - std::string("DidExceedMaxLines:").append(std::to_string(pManager_->DidExceedMaxLines()))); - - DumpLog::GetInstance().AddDesc(std::string("GetTextWidth:") - .append(std::to_string(pManager_->GetTextWidth())) - .append(" GetHeight:") - .append(std::to_string(pManager_->GetHeight())) - .append(" GetMaxWidth:") - .append(std::to_string(pManager_->GetMaxWidth())) - .append(" GetMaxIntrinsicWidth:") - .append(std::to_string(pManager_->GetMaxIntrinsicWidth()))); - DumpLog::GetInstance().AddDesc(std::string("GetLineCount:") - .append(std::to_string(pManager_->GetLineCount())) - .append(" GetLongestLine:") - .append(std::to_string(pManager_->GetLongestLine()))); - } - DumpLog::GetInstance().AddDesc( std::string("BindSelectionMenu: ").append(std::to_string(selectionMenuMap_.empty()))); - auto pipeline = PipelineContext::GetCurrentContextSafely(); - CHECK_NULL_VOID(pipeline); - auto fontScale = pipeline->GetFontScale(); - auto fontWeightScale = pipeline->GetFontWeightScale(); - DumpLog::GetInstance().AddDesc(std::string("fontScale: ").append(std::to_string(fontScale))); - DumpLog::GetInstance().AddDesc(std::string("fontWeightScale: ").append(std::to_string(fontWeightScale))); auto host = GetHost(); CHECK_NULL_VOID(host); auto renderContext = host->GetRenderContext(); @@ -2711,6 +2687,7 @@ void TextPattern::DumpAdvanceInfo() auto strategy = static_cast(renderContext->GetForegroundColorStrategyValue()); DumpLog::GetInstance().AddDesc(std::string("ForegroundColorStrategy: ").append(std::to_string(strategy))); } + DumpLog::GetInstance().AddDesc(std::string("Selection: ").append("(").append(textSelector_.ToString()).append(")")); } void TextPattern::DumpInfo() @@ -2718,6 +2695,9 @@ void TextPattern::DumpInfo() auto textLayoutProp = GetLayoutProperty(); CHECK_NULL_VOID(textLayoutProp); auto& dumpLog = DumpLog::GetInstance(); + auto nowTime = GetSystemTimestamp(); + dumpLog.AddDesc(std::string("frameRecord: ").append(frameRecord_)); + dumpLog.AddDesc(std::string("time: ").append(std::to_string(nowTime))); if (!IsSetObscured()) { dumpLog.AddDesc(std::string("Content: ").append(textLayoutProp->GetContent().value_or(" "))); } @@ -2749,17 +2729,60 @@ void TextPattern::DumpInfo() std::string("HeightAdaptivePolicy: ") .append(V2::ConvertWrapTextHeightAdaptivePolicyToString( textLayoutProp->GetHeightAdaptivePolicy().value_or(TextHeightAdaptivePolicy::MAX_LINES_FIRST)))); - dumpLog.AddDesc(std::string("Selection: ").append("(").append(textSelector_.ToString()).append(")")); - if (pManager_ && !pManager_->GetParagraphs().empty()) { + if (pManager_) { auto num = static_cast(pManager_->GetParagraphs().size()); dumpLog.AddDesc(std::string("Paragraphs num: ").append(std::to_string(num))); dumpLog.AddDesc(std::string("PaintInfo: ").append(paintInfo_)); } + DumpScaleInfo(); + DumpTextEngineInfo(); if (SystemProperties::GetDebugEnabled()) { DumpAdvanceInfo(); } } +void TextPattern::DumpScaleInfo() +{ + auto& dumpLog = DumpLog::GetInstance(); + dumpLog.AddDesc(std::string("-----DumpScaleInfo-----")); + auto pipeline = PipelineContext::GetCurrentContext(); + CHECK_NULL_VOID(pipeline); + auto fontScale = pipeline->GetFontScale(); + auto fontWeightScale = pipeline->GetFontWeightScale(); + auto followSystem = pipeline->IsFollowSystem(); + float maxFontScale = pipeline->GetMaxAppFontScale(); + auto halfLeading = pipeline->GetHalfLeading(); + dumpLog.AddDesc(std::string("fontScale: ").append(std::to_string(fontScale))); + dumpLog.AddDesc(std::string("fontWeightScale: ").append(std::to_string(fontWeightScale))); + dumpLog.AddDesc(std::string("IsFollowSystem: ").append(std::to_string(followSystem))); + dumpLog.AddDesc(std::string("maxFontScale: ").append(std::to_string(maxFontScale))); + dumpLog.AddDesc(std::string("halfLeading: ").append(std::to_string(halfLeading))); +} + +void TextPattern::DumpTextEngineInfo() +{ + auto& dumpLog = DumpLog::GetInstance(); + dumpLog.AddDesc(std::string("-----TextEngine paragraphs_ info-----")); + dumpLog.AddDesc(std::string("contentRect :").append(contentRect_.ToString())); + if (pManager_) { + dumpLog.AddDesc(std::string("from TextEngine paragraphs_ info :")); + dumpLog.AddDesc(std::string("DidExceedMaxLines:").append(std::to_string(pManager_->DidExceedMaxLines()))); + dumpLog.AddDesc(std::string("GetTextWidth:") + .append(std::to_string(pManager_->GetTextWidth())) + .append(" GetHeight:") + .append(std::to_string(pManager_->GetHeight())) + .append(" GetMaxWidth:") + .append(std::to_string(pManager_->GetMaxWidth())) + .append(" GetMaxIntrinsicWidth:") + .append(std::to_string(pManager_->GetMaxIntrinsicWidth()))); + dumpLog.AddDesc(std::string("GetLineCount:") + .append(std::to_string(pManager_->GetLineCount())) + .append(" GetLongestLine:") + .append(std::to_string(pManager_->GetLongestLine()))); + } + dumpLog.AddDesc(std::string("spans size :").append(std::to_string(spans_.size()))); +} + void TextPattern::UpdateChildProperty(const RefPtr& child) const { CHECK_NULL_VOID(child); diff --git a/frameworks/core/components_ng/pattern/text/text_pattern.h b/frameworks/core/components_ng/pattern/text/text_pattern.h index 133cf0c0190..719a7d95a16 100644 --- a/frameworks/core/components_ng/pattern/text/text_pattern.h +++ b/frameworks/core/components_ng/pattern/text/text_pattern.h @@ -148,6 +148,8 @@ public: void DumpAdvanceInfo() override; void DumpInfo() override; + void DumpScaleInfo(); + void DumpTextEngineInfo(); TextSelector GetTextSelector() const { @@ -625,6 +627,11 @@ public: paintInfo_ = area + paintOffset.ToString(); } + void DumpRecord(const std::string& record) + { + frameRecord_.append(record); + } + void SetIsUserSetResponseRegion(bool isUserSetResponseRegion) { isUserSetResponseRegion_ = isUserSetResponseRegion; @@ -635,6 +642,13 @@ public: void OnTextOverflowChanged(); + uint64_t GetSystemTimestamp() + { + return static_cast( + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count()); + } + protected: void OnAttachToFrameNode() override; void OnDetachFromFrameNode(FrameNode* node) override; @@ -720,6 +734,7 @@ protected: std::string textForDisplay_; std::string paintInfo_ = "NA"; + std::string frameRecord_ = "NA"; std::optional textStyle_; std::list> spans_; mutable std::list> childNodes_; diff --git a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp index c0c5a32ba3f..11f7da8d66a 100644 --- a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp @@ -6400,13 +6400,30 @@ void TextFieldPattern::DumpInfo() std::string("HeightAdaptivePolicy: ") .append(V2::ConvertWrapTextHeightAdaptivePolicyToString( layoutProperty->GetHeightAdaptivePolicy().value_or(TextHeightAdaptivePolicy::MAX_LINES_FIRST)))); - auto pipeline = PipelineContext::GetCurrentContext(); - CHECK_NULL_VOID(pipeline); - auto fontScale = pipeline->GetFontScale(); - auto fontWeightScale = pipeline->GetFontWeightScale(); - dumpLog.AddDesc(std::string("fontScale: ").append(std::to_string(fontScale))); - dumpLog.AddDesc(std::string("fontWeightScale: ").append(std::to_string(fontWeightScale))); DumpPlaceHolderInfo(); + DumpScaleInfo(); + DumpTextEngineInfo(); + DumpAdvanceInfo(); +} + +void TextFieldPattern::DumpTextEngineInfo() +{ + auto& dumpLog = DumpLog::GetInstance(); + dumpLog.AddDesc(std::string("-----TextEngine paragraphs_ info-----")); + dumpLog.AddDesc(std::string("GetTextWidth:") + .append(std::to_string(paragraph_->GetTextWidth())) + .append(" GetHeight:") + .append(std::to_string(paragraph_->GetHeight())) + .append(" GetMaxWidth:") + .append(std::to_string(paragraph_->GetMaxWidth())) + .append(" GetMaxIntrinsicWidth:") + .append(std::to_string(paragraph_->GetMaxIntrinsicWidth()))); + dumpLog.AddDesc(std::string("GetLineCount:") + .append(std::to_string(paragraph_->GetLineCount())) + .append(" GetLongestLine:") + .append(std::to_string(paragraph_->GetLongestLine())) + .append(" GetLongestLineWithIndent:") + .append(std::to_string(paragraph_->GetLongestLineWithIndent()))); } void TextFieldPattern::DumpAdvanceInfo() @@ -6415,26 +6432,7 @@ void TextFieldPattern::DumpAdvanceInfo() DumpLog::GetInstance().AddDesc( std::string("CustomKeyboard: true, Attached:").append(std::to_string(isCustomKeyboardAttached_))); } - auto host = GetHost(); - CHECK_NULL_VOID(host); - auto layoutProperty = host->GetLayoutProperty(); - CHECK_NULL_VOID(layoutProperty); DumpLog::GetInstance().AddDesc(std::string("FontColor: ").append(GetTextColor())); - DumpLog::GetInstance().AddDesc(std::string("MinFontSize:").append(GetMinFontSize())); - DumpLog::GetInstance().AddDesc(std::string("MaxFontSize:").append(GetMaxFontSize())); - DumpLog::GetInstance().AddDesc(std::string("from TextEngine paragraphs_ info :")); - DumpLog::GetInstance().AddDesc(std::string("GetTextWidth:") - .append(std::to_string(paragraph_->GetTextWidth())) - .append(" GetHeight:") - .append(std::to_string(paragraph_->GetHeight())) - .append(" GetMaxWidth:") - .append(std::to_string(paragraph_->GetMaxWidth())) - .append(" GetMaxIntrinsicWidth:") - .append(std::to_string(paragraph_->GetMaxIntrinsicWidth()))); - DumpLog::GetInstance().AddDesc(std::string("GetLineCount:") - .append(std::to_string(paragraph_->GetLineCount())) - .append(" GetLongestLine:") - .append(std::to_string(paragraph_->GetLongestLine()))); #if defined(ENABLE_STANDARD_INPUT) auto miscTextConfig = GetMiscTextConfig(); CHECK_NULL_VOID(miscTextConfig.has_value()); @@ -6462,6 +6460,37 @@ void TextFieldPattern::DumpPlaceHolderInfo() DumpLog::GetInstance().AddDesc(std::string("placeholderFont: ").append(GetPlaceholderFont())); } +void TextFieldPattern::DumpScaleInfo() +{ + auto& dumpLog = DumpLog::GetInstance(); + dumpLog.AddDesc(std::string("-----DumpScaleInfo-----")); + dumpLog.AddDesc(std::string("MinFontSize:").append(GetMinFontSize())); + dumpLog.AddDesc(std::string("MaxFontSize:").append(GetMaxFontSize())); + auto pipeline = PipelineContext::GetCurrentContext(); + CHECK_NULL_VOID(pipeline); + auto fontScale = pipeline->GetFontScale(); + auto fontWeightScale = pipeline->GetFontWeightScale(); + auto followSystem = pipeline->IsFollowSystem(); + float maxFontScale = pipeline->GetMaxAppFontScale(); + auto halfLeading = pipeline->GetHalfLeading(); + dumpLog.AddDesc(std::string("fontScale: ").append(std::to_string(fontScale))); + dumpLog.AddDesc(std::string("fontWeightScale: ").append(std::to_string(fontWeightScale))); + dumpLog.AddDesc(std::string("IsFollowSystem: ").append(std::to_string(followSystem))); + dumpLog.AddDesc(std::string("maxFontScale: ").append(std::to_string(maxFontScale))); + dumpLog.AddDesc(std::string("halfLeading: ").append(std::to_string(halfLeading))); +} + +std::string TextFieldPattern::GetDumpTextValue() const +{ + if (IsInPasswordMode()) { + auto len = GetTextValue().length(); + auto passwordLen = "passwordLen:" + std::to_string(len); + return passwordLen; + } else { + return GetTextValue(); + } +} + void TextFieldPattern::DumpViewDataPageNode(RefPtr viewDataWrap, bool needsRecordData) { CHECK_NULL_VOID(viewDataWrap); diff --git a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h index c00bdaa212c..2a474aad2c0 100644 --- a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h +++ b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h @@ -1109,6 +1109,9 @@ public: void DumpInfo() override; void DumpAdvanceInfo() override; void DumpPlaceHolderInfo(); + void DumpTextEngineInfo(); + void DumpScaleInfo(); + std::string GetDumpTextValue() const; void DumpViewDataPageNode(RefPtr viewDataWrap, bool needsRecordData = false) override; void NotifyFillRequestSuccess(RefPtr viewDataWrap, RefPtr nodeWrap, AceAutoFillType autoFillType) override;