文本dump挑单5.0

Signed-off-by: yujiadong <yujiadong3@huawei.com>
Change-Id: I222a5fbac17b22b0d799becfbbf7733b3b408786
This commit is contained in:
yujiadong 2024-08-25 08:44:37 +00:00
parent 60211b061b
commit 9915ca2bb1
5 changed files with 129 additions and 55 deletions

View File

@ -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;

View File

@ -2043,7 +2043,9 @@ void TextPattern::OnModifyDone()
CHECK_NULL_VOID(host);
auto renderContext = host->GetRenderContext();
CHECK_NULL_VOID(renderContext);
auto nowTime = static_cast<unsigned long long>(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<UINode>& 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<int32_t>(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<TextLayoutProperty>();
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<int32_t>(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<SpanNode>& child) const
{
CHECK_NULL_VOID(child);

View File

@ -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<uint64_t>(
std::chrono::duration_cast<std::chrono::milliseconds>(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> textStyle_;
std::list<RefPtr<SpanItem>> spans_;
mutable std::list<RefPtr<UINode>> childNodes_;

View File

@ -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<TextFieldLayoutProperty>();
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> viewDataWrap, bool needsRecordData)
{
CHECK_NULL_VOID(viewDataWrap);

View File

@ -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> viewDataWrap, bool needsRecordData = false) override;
void NotifyFillRequestSuccess(RefPtr<ViewDataWrap> viewDataWrap,
RefPtr<PageNodeInfoWrap> nodeWrap, AceAutoFillType autoFillType) override;