mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 09:12:41 +00:00
DFX维测加强
Signed-off-by: yujiadong <yujiadong3@huawei.com> Change-Id: Id0ce6544dfd02066c4740a07a694a87e331a47ec
This commit is contained in:
parent
73c36008f6
commit
d928d8d040
@ -104,6 +104,7 @@ void InputMethodManager::ProcessKeyboard(const RefPtr<NG::FrameNode>& curFocusNo
|
||||
}
|
||||
auto pipeline = curFocusNode->GetContextRefPtr();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
ACE_LAYOUT_SCOPED_TRACE("ProcessKeyboard [node:%s]", curFocusNode->GetTag().c_str());
|
||||
if (windowFocus_.has_value() && windowFocus_.value()) {
|
||||
TAG_LOGI(AceLogTag::ACE_KEYBOARD, "Normal Window focus first, set focus flag to window.");
|
||||
windowFocus_.reset();
|
||||
|
@ -277,9 +277,12 @@ void SelectContentOverlayManager::UpdateExistOverlay(const SelectOverlayInfo& in
|
||||
handlePattern->UpdateIsSingleHandle(info.isSingleHandle);
|
||||
handlePattern->UpdateIsShowHandleLine(info.isHandleLineShow);
|
||||
handlePattern->UpdateFirstAndSecondHandleInfo(info.firstHandle, info.secondHandle);
|
||||
CHECK_NULL_VOID(selectOverlayHolder_);
|
||||
auto callerNode = selectOverlayHolder_->GetOwner();
|
||||
CHECK_NULL_VOID(callerNode);
|
||||
TAG_LOGI(AceLogTag::ACE_SELECT_OVERLAY,
|
||||
"Update first %{public}s isShow %{public}d, second %{public}s isShow %{public}d",
|
||||
info.firstHandle.paintRect.ToString().c_str(), info.firstHandle.isShow,
|
||||
"Update id:%{public}d, first %{public}s isShow %{public}d, second %{public}s isShow %{public}d",
|
||||
callerNode->GetId(), info.firstHandle.paintRect.ToString().c_str(), info.firstHandle.isShow,
|
||||
info.secondHandle.paintRect.ToString().c_str(), info.secondHandle.isShow);
|
||||
if (info.isSingleHandle) {
|
||||
if (selectOverlayHolder_->CheckRestartHiddenHandleTask(requestCode)) {
|
||||
@ -446,9 +449,12 @@ void SelectContentOverlayManager::CreateNormalSelectOverlay(SelectOverlayInfo& i
|
||||
void SelectContentOverlayManager::CreateHandleLevelSelectOverlay(
|
||||
SelectOverlayInfo& info, bool animation, HandleLevelMode mode)
|
||||
{
|
||||
CHECK_NULL_VOID(selectOverlayHolder_);
|
||||
auto callerNode = selectOverlayHolder_->GetOwner();
|
||||
CHECK_NULL_VOID(callerNode);
|
||||
TAG_LOGI(AceLogTag::ACE_SELECT_OVERLAY,
|
||||
"Show SelectOverlay, first %{public}s isShow %{public}d, second %{public}s isShow %{public}d",
|
||||
info.firstHandle.paintRect.ToString().c_str(), info.firstHandle.isShow,
|
||||
"Show SelectOverlay by Id:%{public}d, first %{public}s isShow %{public}d, second %{public}s isShow %{public}d",
|
||||
callerNode->GetId(), info.firstHandle.paintRect.ToString().c_str(), info.firstHandle.isShow,
|
||||
info.secondHandle.paintRect.ToString().c_str(), info.secondHandle.isShow);
|
||||
shareOverlayInfo_ = std::make_shared<SelectOverlayInfo>(info);
|
||||
auto menuNode = SelectOverlayNode::CreateSelectOverlayNode(shareOverlayInfo_, SelectOverlayMode::MENU_ONLY);
|
||||
@ -623,8 +629,7 @@ bool SelectContentOverlayManager::CloseInternal(int32_t id, bool animation, Clos
|
||||
CHECK_NULL_RETURN(selectOverlayHolder_, false);
|
||||
CHECK_NULL_RETURN(selectOverlayHolder_->GetOwnerId() == id, false);
|
||||
CHECK_NULL_RETURN(shareOverlayInfo_, false);
|
||||
TAG_LOGI(AceLogTag::ACE_SELECT_OVERLAY, "Close selectoverlay, id:%{public}d, reason %{public}d",
|
||||
id, reason);
|
||||
TAG_LOGI(AceLogTag::ACE_SELECT_OVERLAY, "Close SelectOverlay, by id:%{public}d, reason %{public}d", id, reason);
|
||||
auto callback = selectOverlayHolder_->GetCallback();
|
||||
auto menuType = shareOverlayInfo_->menuInfo.menuType;
|
||||
auto pattern = GetSelectHandlePattern(WeakClaim(this));
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "core/text/text_emoji_processor.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
namespace {
|
||||
constexpr int32_t HUNDRED = 100;
|
||||
constexpr int32_t TWENTY = 20;
|
||||
}; // namespace
|
||||
|
||||
TextLayoutAlgorithm::TextLayoutAlgorithm(
|
||||
std::list<RefPtr<SpanItem>> spans, RefPtr<ParagraphManager> pManager, bool isSpanStringMode, bool isMarquee)
|
||||
@ -393,7 +397,8 @@ bool TextLayoutAlgorithm::AdaptMinTextSize(TextStyle& textStyle, const std::stri
|
||||
GetAdaptMaxMinFontSize(textStyle, maxFontSize, minFontSize, contentConstraint);
|
||||
if (!IsNeedAdaptFontSize(maxFontSize, minFontSize)) {
|
||||
if (!CreateParagraphAndLayout(textStyle, content, contentConstraint, layoutWrapper)) {
|
||||
TAG_LOGE(AceLogTag::ACE_TEXT, "create paragraph error");
|
||||
TAG_LOGW(AceLogTag::ACE_TEXT, "create paragraph fail, contentConstraint:%{public}s",
|
||||
contentConstraint.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -455,6 +460,7 @@ std::pair<bool, double> TextLayoutAlgorithm::GetSuitableSizeLD(TextStyle& textSt
|
||||
return {false, 0.0};
|
||||
}
|
||||
double suitableSize = maxFontSize;
|
||||
uint32_t suitCount = 0;
|
||||
while (GreatOrEqual(suitableSize, minFontSize)) {
|
||||
textStyle.SetFontSize(Dimension(suitableSize));
|
||||
if (!CreateParagraphAndLayout(textStyle, content, contentConstraint, layoutWrapper)) {
|
||||
@ -463,6 +469,15 @@ std::pair<bool, double> TextLayoutAlgorithm::GetSuitableSizeLD(TextStyle& textSt
|
||||
if (!DidExceedMaxLines(maxSize)) {
|
||||
return {true, suitableSize};
|
||||
}
|
||||
if (suitCount % HUNDRED == 0) {
|
||||
auto host = layoutWrapper->GetHostNode();
|
||||
CHECK_NULL_RETURN(host, {});
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT,
|
||||
"suit layout:%{public}d, [id:%{public}d, suitSize:%{public}f, minFontSize:%{public}f, "
|
||||
"stepSize:%{public}f]",
|
||||
suitCount, host->GetId(), suitableSize, minFontSize, stepSize);
|
||||
}
|
||||
suitCount++;
|
||||
suitableSize -= stepSize;
|
||||
}
|
||||
return {false, 0.0};
|
||||
@ -479,7 +494,7 @@ std::pair<bool, double> TextLayoutAlgorithm::GetSuitableSizeBS(TextStyle& textSt
|
||||
// Boundary check: for efficiency and to ensure the optimal size is within [minFontSize, maxFontSize].
|
||||
textStyle.SetFontSize(Dimension(maxFontSize));
|
||||
if (!CreateParagraphAndLayout(textStyle, content, contentConstraint, layoutWrapper)) {
|
||||
TAG_LOGE(AceLogTag::ACE_TEXT, "create paragraph error");
|
||||
TAG_LOGW(AceLogTag::ACE_TEXT, "GetSuitableSizeBS create paragraph fail");
|
||||
return {false, 0.0};
|
||||
}
|
||||
if (!DidExceedMaxLines(maxSize)) {
|
||||
@ -495,6 +510,7 @@ std::pair<bool, double> TextLayoutAlgorithm::GetSuitableSizeBS(TextStyle& textSt
|
||||
int32_t leftBound = 0;
|
||||
int32_t rightBound = stepCount;
|
||||
int32_t mid = (leftBound + rightBound) / 2;
|
||||
uint32_t suitCount = 0;
|
||||
while (leftBound < rightBound) {
|
||||
double suitSz = minFontSize + mid * stepSize;
|
||||
textStyle.SetFontSize(Dimension(suitSz));
|
||||
@ -506,6 +522,14 @@ std::pair<bool, double> TextLayoutAlgorithm::GetSuitableSizeBS(TextStyle& textSt
|
||||
} else {
|
||||
rightBound = mid - 1;
|
||||
}
|
||||
if (suitCount % TWENTY == 0) {
|
||||
auto host = layoutWrapper->GetHostNode();
|
||||
CHECK_NULL_RETURN(host, {});
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT,
|
||||
"suit layout:%{public}d, [id:%{public}d, suitSz:%{public}f, stepCount:%{public}d, stepSize:%{public}f]",
|
||||
suitCount, host->GetId(), suitSz, stepCount, stepSize);
|
||||
}
|
||||
suitCount++;
|
||||
mid = (leftBound + rightBound + 1) / 2;
|
||||
}
|
||||
return {true, minFontSize + leftBound * stepSize};
|
||||
@ -573,7 +597,8 @@ bool TextLayoutAlgorithm::BuildParagraph(TextStyle& textStyle, const RefPtr<Text
|
||||
if (!textStyle.GetAdaptTextSize() || !spans_.empty()) {
|
||||
if (!CreateParagraphAndLayout(
|
||||
textStyle, layoutProperty->GetContent().value_or(""), contentConstraint, layoutWrapper)) {
|
||||
TAG_LOGE(AceLogTag::ACE_TEXT, "create paragraph error");
|
||||
TAG_LOGW(AceLogTag::ACE_TEXT, "BuildParagraph fail, contentConstraint:%{public}s",
|
||||
contentConstraint.ToString().c_str());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -625,6 +650,7 @@ bool TextLayoutAlgorithm::BuildParagraphAdaptUseLayoutConstraint(TextStyle& text
|
||||
textStyle.DisableAdaptTextSize();
|
||||
|
||||
auto height = static_cast<float>(paragraph->GetHeight());
|
||||
uint32_t adaptCount = 0;
|
||||
while (GreatNotEqual(height, contentConstraint.maxSize.Height())) {
|
||||
auto maxLines = textStyle.GetMaxLines();
|
||||
if (maxLines == 0) {
|
||||
@ -637,6 +663,15 @@ bool TextLayoutAlgorithm::BuildParagraphAdaptUseLayoutConstraint(TextStyle& text
|
||||
return false;
|
||||
}
|
||||
paragraph = GetSingleParagraph();
|
||||
if (adaptCount % HUNDRED == 0) {
|
||||
auto host = layoutWrapper->GetHostNode();
|
||||
CHECK_NULL_RETURN(host, {});
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT,
|
||||
"AdaptLayout:%{public}d, [id:%{public}d, height:%{public}f, constraint:%{public}s, "
|
||||
"maxlines:%{public}d]",
|
||||
adaptCount, host->GetId(), height, contentConstraint.ToString().c_str(), maxLines);
|
||||
}
|
||||
adaptCount++;
|
||||
height = static_cast<float>(paragraph->GetHeight());
|
||||
}
|
||||
return true;
|
||||
|
@ -1012,7 +1012,8 @@ void TextFieldPattern::ProcessFocusStyle()
|
||||
|
||||
void TextFieldPattern::HandleSetSelection(int32_t start, int32_t end, bool showHandle)
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "HandleSetSelection %{public}d, %{public}d", start, end);
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "HandleSetSelection %{public}d, %{public}d, showOverlay:%{public}d", start, end,
|
||||
showHandle);
|
||||
StopTwinkling();
|
||||
UpdateSelection(start, end);
|
||||
if (showHandle) {
|
||||
@ -1152,7 +1153,7 @@ void TextFieldPattern::HandleSelect(CaretMoveIntent direction)
|
||||
}
|
||||
// SelectionParagraghBegin/SelectionParagraghEnd not supported yet
|
||||
default: {
|
||||
LOGW("Unsupported select operation for text field");
|
||||
TAG_LOGW(AceLogTag::ACE_TEXT_FIELD, "Unsupported select operation for text field");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2462,7 +2463,7 @@ bool TextFieldPattern::CheckAutoFillType(const AceAutoFillType& autoFillType, bo
|
||||
CHECK_NULL_RETURN(container, false);
|
||||
auto isTriggerPassword = IsTriggerAutoFillPassword();
|
||||
if (autoFillType == AceAutoFillType::ACE_UNSPECIFIED && !isTriggerPassword) {
|
||||
TAG_LOGE(AceLogTag::ACE_AUTO_FILL, "CheckAutoFillType :autoFillType is ACE_UNSPECIFIED.");
|
||||
TAG_LOGI(AceLogTag::ACE_AUTO_FILL, "CheckAutoFillType :autoFillType is ACE_UNSPECIFIED.");
|
||||
return false;
|
||||
} else if (isTriggerPassword) {
|
||||
auto tempAutoFillType = IsAutoFillUserName(autoFillType) ? AceAutoFillType::ACE_USER_NAME : autoFillType;
|
||||
@ -3494,13 +3495,13 @@ void TextFieldPattern::OnHover(bool isHover)
|
||||
{
|
||||
auto tmpHost = GetHost();
|
||||
CHECK_NULL_VOID(tmpHost);
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "Textfield %{public}d %{public}s", tmpHost->GetId(),
|
||||
isHover ? "on hover" : "exit hover");
|
||||
auto frameId = tmpHost->GetId();
|
||||
auto pipeline = PipelineContext::GetCurrentContextSafely();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto textFieldTheme = GetTheme();
|
||||
CHECK_NULL_VOID(textFieldTheme);
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "Textfield %{public}d %{public}s", tmpHost->GetId(),
|
||||
isHover ? "on hover" : "exit hover");
|
||||
if (isHover) {
|
||||
pipeline->SetMouseStyleHoldNode(frameId);
|
||||
} else {
|
||||
@ -3525,6 +3526,7 @@ void TextFieldPattern::RestoreDefaultMouseState()
|
||||
auto pipeline = host->GetContextRefPtr();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto id = host->GetId();
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "RestoreDefaultMouseState id:%{public}d, winId:%{public}d", id, windowId);
|
||||
pipeline->SetMouseStyleHoldNode(id);
|
||||
pipeline->ChangeMouseStyle(id, MouseFormat::DEFAULT, windowId);
|
||||
}
|
||||
@ -3545,6 +3547,7 @@ void TextFieldPattern::ChangeMouseState(
|
||||
if (GreatNotEqual(location.GetX(), frameRect_.Width() - responseAreaWidth)) {
|
||||
RestoreDefaultMouseState();
|
||||
} else {
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "ChangeMouseState Id:%{public}d, winId:%{public}d", frameId, windowId);
|
||||
pipeline->SetMouseStyleHoldNode(frameId);
|
||||
pipeline->ChangeMouseStyle(frameId, MouseFormat::TEXT_CURSOR, windowId, isByPass);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void TextFieldSelectOverlay::OnCloseOverlay(OptionMenuType menuType, CloseReason
|
||||
if (CloseReason::CLOSE_REASON_BACK_PRESSED == reason) {
|
||||
OnResetTextSelection();
|
||||
if (info && info->isSingleHandle) {
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "SingleHandle OnCloseOverlayv");
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "SingleHandle OnCloseOverlay");
|
||||
pattern->OnBackPressed();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user