getcurrentcontextsafely整改为WithCheck

Signed-off-by: zhoukechen <zhoukechen2@huawei.com>
Change-Id: Icb5f4f07fcc06d156f6ef980e5d216c6e983c00e
This commit is contained in:
zhoukechen 2024-11-07 19:48:39 +08:00
parent c29a6e6e4d
commit 1eaf38ffb7
33 changed files with 208 additions and 173 deletions

View File

@ -254,7 +254,7 @@ void JSSearch::SetSelectedBackgroundColor(const JSCallbackInfo& info)
} }
Color selectedColor; Color selectedColor;
if (!ParseJsColor(info[0], selectedColor)) { if (!ParseJsColor(info[0], selectedColor)) {
auto pipeline = PipelineBase::GetCurrentContext(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetThemeManager()->GetTheme<TextFieldTheme>(); auto theme = pipeline->GetThemeManager()->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -1255,7 +1255,7 @@ void JSSearch::SetDecoration(const JSCallbackInfo& info)
JSRef<JSVal> colorValue = obj->GetProperty("color"); JSRef<JSVal> colorValue = obj->GetProperty("color");
JSRef<JSVal> styleValue = obj->GetProperty("style"); JSRef<JSVal> styleValue = obj->GetProperty("style");
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<SearchTheme>(); auto theme = pipelineContext->GetTheme<SearchTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -1300,7 +1300,7 @@ void JSSearch::SetMaxFontSize(const JSCallbackInfo& info)
if (info.Length() < 1) { if (info.Length() < 1) {
return; return;
} }
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<SearchTheme>(); auto theme = pipelineContext->GetTheme<SearchTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);

View File

@ -109,7 +109,7 @@ void JSText::SetHeight(const JSCallbackInfo& info)
void JSText::SetFont(const JSCallbackInfo& info) void JSText::SetFont(const JSCallbackInfo& info)
{ {
Font font; Font font;
auto pipelineContext = PipelineContext::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -181,7 +181,7 @@ void JSText::SetFontSize(const JSCallbackInfo& info)
CalcDimension fontSize; CalcDimension fontSize;
JSRef<JSVal> args = info[0]; JSRef<JSVal> args = info[0];
if (!ParseJsDimensionFpNG(args, fontSize, false) || fontSize.IsNegative()) { if (!ParseJsDimensionFpNG(args, fontSize, false) || fontSize.IsNegative()) {
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -278,7 +278,7 @@ void JSText::SetTextColor(const JSCallbackInfo& info)
Color textColor; Color textColor;
JSRef<JSVal> args = info[0]; JSRef<JSVal> args = info[0];
if (!ParseJsColor(args, textColor)) { if (!ParseJsColor(args, textColor)) {
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -386,7 +386,7 @@ void JSText::SetTextCaretColor(const JSCallbackInfo& info)
} }
Color caretColor; Color caretColor;
if (!ParseJsColor(info[0], caretColor)) { if (!ParseJsColor(info[0], caretColor)) {
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -402,7 +402,7 @@ void JSText::SetSelectedBackgroundColor(const JSCallbackInfo& info)
} }
Color selectedColor; Color selectedColor;
if (!ParseJsColor(info[0], selectedColor)) { if (!ParseJsColor(info[0], selectedColor)) {
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -529,7 +529,7 @@ void JSText::SetMinFontSize(const JSCallbackInfo& info)
if (info.Length() < 1) { if (info.Length() < 1) {
return; return;
} }
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -551,7 +551,7 @@ void JSText::SetMaxFontSize(const JSCallbackInfo& info)
if (info.Length() < 1) { if (info.Length() < 1) {
return; return;
} }
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextTheme>(); auto theme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);

View File

@ -437,7 +437,7 @@ void JSTextField::SetCaretStyle(const JSCallbackInfo& info)
auto paramObject = JSRef<JSObject>::Cast(jsValue); auto paramObject = JSRef<JSObject>::Cast(jsValue);
auto caretWidth = paramObject->GetProperty("width"); auto caretWidth = paramObject->GetProperty("width");
auto pipeline = PipelineBase::GetCurrentContext(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetThemeManager()->GetTheme<TextFieldTheme>(); auto theme = pipeline->GetThemeManager()->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -500,7 +500,7 @@ void JSTextField::SetSelectedBackgroundColor(const JSCallbackInfo& info)
Color selectedColor; Color selectedColor;
if (!ParseJsColor(info[0], selectedColor)) { if (!ParseJsColor(info[0], selectedColor)) {
auto pipeline = PipelineBase::GetCurrentContext(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetThemeManager()->GetTheme<TextFieldTheme>(); auto theme = pipeline->GetThemeManager()->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -1689,7 +1689,7 @@ void JSTextField::SetDecoration(const JSCallbackInfo& info)
JSRef<JSVal> colorValue = obj->GetProperty("color"); JSRef<JSVal> colorValue = obj->GetProperty("color");
JSRef<JSVal> styleValue = obj->GetProperty("style"); JSRef<JSVal> styleValue = obj->GetProperty("style");
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextFieldTheme>(); auto theme = pipelineContext->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -1734,7 +1734,7 @@ void JSTextField::SetMaxFontSize(const JSCallbackInfo& info)
if (info.Length() < 1) { if (info.Length() < 1) {
return; return;
} }
auto pipelineContext = PipelineBase::GetCurrentContext(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto theme = pipelineContext->GetTheme<TextFieldTheme>(); auto theme = pipelineContext->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);

View File

@ -58,7 +58,7 @@ bool MagnifierController::UpdateMagnifierOffsetX(OffsetF& magnifierPaintOffset,
bool MagnifierController::UpdateMagnifierOffsetY(OffsetF& magnifierPaintOffset, VectorF& magnifierOffset, bool MagnifierController::UpdateMagnifierOffsetY(OffsetF& magnifierPaintOffset, VectorF& magnifierOffset,
const OffsetF& basePaintOffset, const RefPtr<FrameNode>& host) const OffsetF& basePaintOffset, const RefPtr<FrameNode>& host)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, false); CHECK_NULL_RETURN(pipeline, false);
float menuHeight = magnifierNodeHeight_.ConvertToPx(); float menuHeight = magnifierNodeHeight_.ConvertToPx();
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
@ -150,7 +150,7 @@ void MagnifierController::OpenMagnifier()
RefPtr<FrameNode> MagnifierController::GetRootNode() RefPtr<FrameNode> MagnifierController::GetRootNode()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, nullptr); CHECK_NULL_RETURN(pipeline, nullptr);
auto rootNode = pipeline->GetRootElement(); auto rootNode = pipeline->GetRootElement();
CHECK_NULL_RETURN(rootNode, nullptr); CHECK_NULL_RETURN(rootNode, nullptr);
@ -253,7 +253,7 @@ void MagnifierController::InitMagnifierParams()
params_.shadowSize_ = MAGNIFIER_SHADOWSIZE.ConvertToPx(); params_.shadowSize_ = MAGNIFIER_SHADOWSIZE.ConvertToPx();
params_.shadowStrength_ = MAGNIFIER_SHADOWSTRENGTH; params_.shadowStrength_ = MAGNIFIER_SHADOWSTRENGTH;
auto pipeline = PipelineBase::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>(); auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(textFieldTheme); CHECK_NULL_VOID(textFieldTheme);

View File

@ -61,7 +61,7 @@ void SelectOverlayLayoutAlgorithm::MeasureChild(LayoutWrapper* layoutWrapper)
auto layoutProperty = layoutWrapper->GetLayoutProperty(); auto layoutProperty = layoutWrapper->GetLayoutProperty();
CHECK_NULL_VOID(layoutProperty); CHECK_NULL_VOID(layoutProperty);
auto layoutConstraint = layoutProperty->CreateChildConstraint(); auto layoutConstraint = layoutProperty->CreateChildConstraint();
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_VOID(safeAreaManager); CHECK_NULL_VOID(safeAreaManager);
@ -95,7 +95,7 @@ void SelectOverlayLayoutAlgorithm::MeasureChild(LayoutWrapper* layoutWrapper)
void SelectOverlayLayoutAlgorithm::CalculateCustomMenuLayoutConstraint( void SelectOverlayLayoutAlgorithm::CalculateCustomMenuLayoutConstraint(
LayoutWrapper* layoutWrapper, LayoutConstraintF& layoutConstraint) LayoutWrapper* layoutWrapper, LayoutConstraintF& layoutConstraint)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -141,7 +141,7 @@ OffsetF SelectOverlayLayoutAlgorithm::CalculateCustomMenuByMouseOffset(LayoutWra
} }
} }
auto maxHeight = layoutConstraint->selfIdealSize.Height().value_or(0.0f); auto maxHeight = layoutConstraint->selfIdealSize.Height().value_or(0.0f);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, menuOffset); CHECK_NULL_RETURN(pipeline, menuOffset);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_RETURN(safeAreaManager, menuOffset); CHECK_NULL_RETURN(safeAreaManager, menuOffset);
@ -269,7 +269,7 @@ OffsetF SelectOverlayLayoutAlgorithm::ComputeSelectMenuPosition(LayoutWrapper* l
{ {
auto menuItem = layoutWrapper->GetOrCreateChildByIndex(0); auto menuItem = layoutWrapper->GetOrCreateChildByIndex(0);
CHECK_NULL_RETURN(menuItem, OffsetF()); CHECK_NULL_RETURN(menuItem, OffsetF());
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, OffsetF()); CHECK_NULL_RETURN(pipeline, OffsetF());
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(theme, OffsetF()); CHECK_NULL_RETURN(theme, OffsetF());
@ -432,7 +432,7 @@ OffsetF SelectOverlayLayoutAlgorithm::ComputeSelectMenuPosition(LayoutWrapper* l
void SelectOverlayLayoutAlgorithm::AdjustMenuInRootRect( void SelectOverlayLayoutAlgorithm::AdjustMenuInRootRect(
OffsetF& menuOffset, const SizeF& menuSize, const SizeF& rootSize) OffsetF& menuOffset, const SizeF& menuSize, const SizeF& rootSize)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -473,7 +473,7 @@ OffsetF SelectOverlayLayoutAlgorithm::AdjustSelectMenuOffset(
} }
// avoid soft keyboard and root bottom // avoid soft keyboard and root bottom
if ((!upHandle.isShow && downHandle.isShow) || info_->menuInfo.menuBuilder) { if ((!upHandle.isShow && downHandle.isShow) || info_->menuInfo.menuBuilder) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, menuOffset); CHECK_NULL_RETURN(pipeline, menuOffset);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_RETURN(safeAreaManager, menuOffset); CHECK_NULL_RETURN(safeAreaManager, menuOffset);
@ -504,7 +504,7 @@ void SelectOverlayLayoutAlgorithm::AdjustMenuOffsetAtSingleHandleBottom(const Re
OffsetF& menuOffset, double spaceBetweenText) OffsetF& menuOffset, double spaceBetweenText)
{ {
CHECK_NULL_VOID(info_->isSingleHandle); CHECK_NULL_VOID(info_->isSingleHandle);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_VOID(safeAreaManager); CHECK_NULL_VOID(safeAreaManager);
@ -521,7 +521,7 @@ OffsetF SelectOverlayLayoutAlgorithm::AdjustSelectMenuOffsetWhenHandlesUnshown(c
{ {
auto menuOffset = menuRect.GetOffset(); auto menuOffset = menuRect.GetOffset();
CHECK_NULL_RETURN(info_->isSingleHandle, menuOffset); CHECK_NULL_RETURN(info_->isSingleHandle, menuOffset);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, menuOffset); CHECK_NULL_RETURN(pipeline, menuOffset);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_RETURN(safeAreaManager, menuOffset); CHECK_NULL_RETURN(safeAreaManager, menuOffset);
@ -589,7 +589,7 @@ OffsetF SelectOverlayLayoutAlgorithm::ComputeExtensionMenuPosition(LayoutWrapper
defaultMenuEndOffset_ - OffsetF(extensionWidth, -menuHeight - MORE_MENU_INTERVAL.ConvertToPx()); defaultMenuEndOffset_ - OffsetF(extensionWidth, -menuHeight - MORE_MENU_INTERVAL.ConvertToPx());
auto extensionBottom = extensionOffset.GetY() + extensionHeight; auto extensionBottom = extensionOffset.GetY() + extensionHeight;
auto isCoveredBySoftKeyBoard = [extensionBottom]() -> bool { auto isCoveredBySoftKeyBoard = [extensionBottom]() -> bool {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, false); CHECK_NULL_RETURN(pipeline, false);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_RETURN(safeAreaManager, false); CHECK_NULL_RETURN(safeAreaManager, false);
@ -611,7 +611,7 @@ bool SelectOverlayLayoutAlgorithm::IsTextAreaSelectAll()
OffsetF SelectOverlayLayoutAlgorithm::NewMenuAvoidStrategy( OffsetF SelectOverlayLayoutAlgorithm::NewMenuAvoidStrategy(
LayoutWrapper* layoutWrapper, float menuWidth, float menuHeight) LayoutWrapper* layoutWrapper, float menuWidth, float menuHeight)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, OffsetF()); CHECK_NULL_RETURN(pipeline, OffsetF());
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(theme, OffsetF()); CHECK_NULL_RETURN(theme, OffsetF());
@ -662,7 +662,7 @@ OffsetF SelectOverlayLayoutAlgorithm::NewMenuAvoidStrategy(
void SelectOverlayLayoutAlgorithm::NewMenuAvoidStrategyGetY(const AvoidStrategyMember& avoidStrategyMember, void SelectOverlayLayoutAlgorithm::NewMenuAvoidStrategyGetY(const AvoidStrategyMember& avoidStrategyMember,
float& offsetY) float& offsetY)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto safeAreaManager = pipeline->GetSafeAreaManager(); auto safeAreaManager = pipeline->GetSafeAreaManager();
CHECK_NULL_VOID(safeAreaManager); CHECK_NULL_VOID(safeAreaManager);

View File

@ -271,7 +271,7 @@ void SelectOverlayModifier::onDraw(DrawingContext& drawingContext)
return; return;
} }
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(textOverlayTheme); CHECK_NULL_VOID(textOverlayTheme);

View File

@ -102,7 +102,7 @@ const std::unordered_map<std::string, std::function<bool(const SelectMenuInfo&)>
void SetResponseRegion(RefPtr<FrameNode>& node) void SetResponseRegion(RefPtr<FrameNode>& node)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
if (GreatOrEqual(pipeline->GetFontScale(), AGING_MIN_SCALE)) { if (GreatOrEqual(pipeline->GetFontScale(), AGING_MIN_SCALE)) {
return; return;
@ -146,7 +146,7 @@ RefPtr<FrameNode> BuildPasteButton(
static_cast<int32_t>(PasteButtonIconStyle::ICON_NULL), static_cast<int32_t>(ButtonType::CAPSULE), true); static_cast<int32_t>(PasteButtonIconStyle::ICON_NULL), static_cast<int32_t>(ButtonType::CAPSULE), true);
CHECK_NULL_RETURN(pasteButton, nullptr); CHECK_NULL_RETURN(pasteButton, nullptr);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, pasteButton); CHECK_NULL_RETURN(pipeline, pasteButton);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, pasteButton); CHECK_NULL_RETURN(textOverlayTheme, pasteButton);
@ -234,7 +234,7 @@ RefPtr<FrameNode> BuildButton(const std::string& data, const std::function<void(
CHECK_NULL_RETURN(textLayoutProperty, button); CHECK_NULL_RETURN(textLayoutProperty, button);
textLayoutProperty->UpdateContent(data); textLayoutProperty->UpdateContent(data);
text->MountToParent(button); text->MountToParent(button);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, button); CHECK_NULL_RETURN(pipeline, button);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, button); CHECK_NULL_RETURN(textOverlayTheme, button);
@ -273,7 +273,7 @@ RefPtr<FrameNode> BuildButton(const std::string& data, const std::function<void(
if (callback) { if (callback) {
button->GetOrCreateGestureEventHub()->SetUserOnClick( button->GetOrCreateGestureEventHub()->SetUserOnClick(
[callback, overlayId, isSelectAll](GestureEvent& /*info*/) { [callback, overlayId, isSelectAll](GestureEvent& /*info*/) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -301,7 +301,7 @@ void BindButtonClickEvent(const RefPtr<FrameNode>& button, const MenuOptionsPara
{ {
auto callback = menuOption.action; auto callback = menuOption.action;
button->GetOrCreateGestureEventHub()->SetUserOnClick([callback, overlayId](GestureEvent& /*info*/) { button->GetOrCreateGestureEventHub()->SetUserOnClick([callback, overlayId](GestureEvent& /*info*/) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -329,7 +329,7 @@ RefPtr<FrameNode> BuildButton(const MenuOptionsParam& menuOption, int32_t overla
auto data = menuOption.content.value_or(""); auto data = menuOption.content.value_or("");
textLayoutProperty->UpdateContent(data); textLayoutProperty->UpdateContent(data);
text->MountToParent(button); text->MountToParent(button);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, button); CHECK_NULL_RETURN(pipeline, button);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, button); CHECK_NULL_RETURN(textOverlayTheme, button);
@ -370,7 +370,7 @@ void BindCreateMenuItemClickEvent(const RefPtr<FrameNode>& button, const MenuOpt
{ {
button->GetOrCreateGestureEventHub()->SetUserOnClick( button->GetOrCreateGestureEventHub()->SetUserOnClick(
[menuOptionsParam, systemCallback, onCreateCallback, overlayId](GestureEvent& /*info*/) { [menuOptionsParam, systemCallback, onCreateCallback, overlayId](GestureEvent& /*info*/) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -411,7 +411,7 @@ RefPtr<FrameNode> BuildCreateMenuItemButton(const MenuOptionsParam& menuOptionsP
const std::function<void()>& systemCallback, const OnMenuItemCallback& menuItemCallback, int32_t overlayId, const std::function<void()>& systemCallback, const OnMenuItemCallback& menuItemCallback, int32_t overlayId,
float& remainderWidth) float& remainderWidth)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, nullptr); CHECK_NULL_RETURN(pipeline, nullptr);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, nullptr); CHECK_NULL_RETURN(textOverlayTheme, nullptr);
@ -468,7 +468,7 @@ RefPtr<FrameNode> BuildMoreOrBackButton(int32_t overlayId, bool isMoreButton)
{ {
auto button = FrameNode::GetOrCreateFrameNode("SelectMoreOrBackButton", auto button = FrameNode::GetOrCreateFrameNode("SelectMoreOrBackButton",
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<ButtonPattern>(); }); ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<ButtonPattern>(); });
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, button); CHECK_NULL_RETURN(pipeline, button);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, button); CHECK_NULL_RETURN(textOverlayTheme, button);
@ -506,7 +506,7 @@ RefPtr<FrameNode> BuildMoreOrBackButton(int32_t overlayId, bool isMoreButton)
buttonLayoutProperty->UpdatePadding({ left, right, top, bottom }); buttonLayoutProperty->UpdatePadding({ left, right, top, bottom });
} }
button->GetOrCreateGestureEventHub()->SetUserOnClick([overlayId, isMoreButton](GestureEvent& /*info*/) { button->GetOrCreateGestureEventHub()->SetUserOnClick([overlayId, isMoreButton](GestureEvent& /*info*/) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -523,7 +523,7 @@ RefPtr<FrameNode> BuildMoreOrBackButton(int32_t overlayId, bool isMoreButton)
OffsetF GetPageOffset() OffsetF GetPageOffset()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, OffsetF()); CHECK_NULL_RETURN(pipeline, OffsetF());
auto stageManager = pipeline->GetStageManager(); auto stageManager = pipeline->GetStageManager();
CHECK_NULL_RETURN(stageManager, OffsetF()); CHECK_NULL_RETURN(stageManager, OffsetF());
@ -562,7 +562,7 @@ bool IsSystemMenuItemEnabled(const std::shared_ptr<SelectOverlayInfo>& info, con
std::string GetSystemIconPath(const std::string& id, const std::string& iconPath) std::string GetSystemIconPath(const std::string& id, const std::string& iconPath)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, iconPath); CHECK_NULL_RETURN(pipeline, iconPath);
auto iconTheme = pipeline->GetTheme<IconTheme>(); auto iconTheme = pipeline->GetTheme<IconTheme>();
CHECK_NULL_RETURN(iconTheme, iconPath); CHECK_NULL_RETURN(iconTheme, iconPath);
@ -586,7 +586,7 @@ std::string GetSystemIconPath(const std::string& id, const std::string& iconPath
std::string GetItemContent(const std::string& id, const std::string& content) std::string GetItemContent(const std::string& id, const std::string& content)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, content); CHECK_NULL_RETURN(pipeline, content);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, content); CHECK_NULL_RETURN(textOverlayTheme, content);
@ -628,7 +628,7 @@ std::vector<OptionParam> GetCreateMenuOptionsParams(const std::vector<MenuOption
systemEvent = clickCallback->second; systemEvent = clickCallback->second;
} }
auto callback = [onCreateCallback = info->onCreateCallback, systemEvent, item]() { auto callback = [onCreateCallback = info->onCreateCallback, systemEvent, item]() {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -940,7 +940,7 @@ void SelectOverlayNode::MoreAnimation(bool noAnimation)
auto modifier = pattern->GetOverlayModifier(); auto modifier = pattern->GetOverlayModifier();
CHECK_NULL_VOID(modifier); CHECK_NULL_VOID(modifier);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
@ -1026,7 +1026,7 @@ void SelectOverlayNode::BackAnimation(bool noAnimation)
auto modifier = pattern->GetOverlayModifier(); auto modifier = pattern->GetOverlayModifier();
CHECK_NULL_VOID(modifier); CHECK_NULL_VOID(modifier);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
@ -1099,7 +1099,7 @@ std::function<void()> SelectOverlayNode::GetDefaultOptionCallback()
{ {
auto id = GetId(); auto id = GetId();
auto defaultOptionCallback = [overlayId = id]() { auto defaultOptionCallback = [overlayId = id]() {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -1112,7 +1112,7 @@ std::function<void()> SelectOverlayNode::GetDefaultOptionCallback()
std::vector<OptionParam> SelectOverlayNode::GetDefaultOptionsParams(const std::shared_ptr<SelectOverlayInfo>& info) std::vector<OptionParam> SelectOverlayNode::GetDefaultOptionsParams(const std::shared_ptr<SelectOverlayInfo>& info)
{ {
std::vector<OptionParam> params; std::vector<OptionParam> params;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, params); CHECK_NULL_RETURN(pipeline, params);
auto iconTheme = pipeline->GetTheme<IconTheme>(); auto iconTheme = pipeline->GetTheme<IconTheme>();
auto defaultOptionCallback = GetDefaultOptionCallback(); auto defaultOptionCallback = GetDefaultOptionCallback();
@ -1153,7 +1153,7 @@ std::vector<OptionParam> SelectOverlayNode::GetDefaultOptionsParams(const std::s
void SelectOverlayNode::GetFlexibleOptionsParams( void SelectOverlayNode::GetFlexibleOptionsParams(
const std::shared_ptr<SelectOverlayInfo>& info, std::vector<OptionParam>& params) const std::shared_ptr<SelectOverlayInfo>& info, std::vector<OptionParam>& params)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto iconTheme = pipeline->GetTheme<IconTheme>(); auto iconTheme = pipeline->GetTheme<IconTheme>();
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
@ -1177,7 +1177,7 @@ void SelectOverlayNode::addMenuOptionItemsParams(
for (auto item : info->menuOptionItems) { for (auto item : info->menuOptionItems) {
if (itemNum >= index) { if (itemNum >= index) {
auto callback = [overlayId = id, func = std::move(item.action)]() { auto callback = [overlayId = id, func = std::move(item.action)]() {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -1207,7 +1207,7 @@ void SelectOverlayNode::CreatExtensionMenu(std::vector<OptionParam>&& params)
{ {
CHECK_NULL_VOID(!params.empty()); CHECK_NULL_VOID(!params.empty());
CHECK_NULL_VOID(backButton_); CHECK_NULL_VOID(backButton_);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto buttonId = backButton_->GetId(); auto buttonId = backButton_->GetId();
MenuParam menuParam; MenuParam menuParam;
@ -1265,7 +1265,7 @@ std::function<void()> SelectOverlayNode::CreateExtensionMenuOptionCallback(int32
const OnMenuItemCallback& onCreateCallback, const std::function<void()>& systemEvent, const MenuOptionsParam& item) const OnMenuItemCallback& onCreateCallback, const std::function<void()>& systemEvent, const MenuOptionsParam& item)
{ {
auto callback = [overlayId = id, onCreateCallback = onCreateCallback, systemEvent, item]() { auto callback = [overlayId = id, onCreateCallback = onCreateCallback, systemEvent, item]() {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -1353,7 +1353,7 @@ void SelectOverlayNode::CreateToolBar()
void SelectOverlayNode::SelectMenuAndInnerInitProperty() void SelectOverlayNode::SelectMenuAndInnerInitProperty()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(textOverlayTheme); CHECK_NULL_VOID(textOverlayTheme);
@ -1424,7 +1424,7 @@ void SelectOverlayNode::InitSelectMenuStatus(
void SelectOverlayNode::GetDefaultButtonAndMenuWidth(float& maxWidth) void SelectOverlayNode::GetDefaultButtonAndMenuWidth(float& maxWidth)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(textOverlayTheme); CHECK_NULL_VOID(textOverlayTheme);
@ -1556,7 +1556,7 @@ void SelectOverlayNode::ShowAIWrite(float maxWidth, float& allocatedSize, std::s
if (info->menuInfo.showAIWrite) { if (info->menuInfo.showAIWrite) {
CHECK_EQUAL_VOID(isDefaultBtnOverMaxWidth_, true); CHECK_EQUAL_VOID(isDefaultBtnOverMaxWidth_, true);
float buttonWidth = 0.0f; float buttonWidth = 0.0f;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -1631,7 +1631,7 @@ void SelectOverlayNode::ShowCamera(float maxWidth, float& allocatedSize, std::sh
if (info->menuInfo.showCameraInput) { if (info->menuInfo.showCameraInput) {
CHECK_EQUAL_VOID(isDefaultBtnOverMaxWidth_, true); CHECK_EQUAL_VOID(isDefaultBtnOverMaxWidth_, true);
float buttonWidth = 0.0f; float buttonWidth = 0.0f;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -1758,7 +1758,7 @@ const std::vector<MenuItemParam> SelectOverlayNode::GetSystemMenuItemParams(
systemItemParams.emplace_back(param); systemItemParams.emplace_back(param);
} }
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, systemItemParams); CHECK_NULL_RETURN(pipeline, systemItemParams);
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(theme, systemItemParams); CHECK_NULL_RETURN(theme, systemItemParams);
@ -1908,7 +1908,7 @@ void SelectOverlayNode::UpdateMenuInner(const std::shared_ptr<SelectOverlayInfo>
void SelectOverlayNode::SetSelectMenuInnerSize() void SelectOverlayNode::SetSelectMenuInnerSize()
{ {
CHECK_NULL_VOID(selectMenuInner_); CHECK_NULL_VOID(selectMenuInner_);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(textOverlayTheme); CHECK_NULL_VOID(textOverlayTheme);
@ -1978,7 +1978,7 @@ RefPtr<FrameNode> SelectOverlayNode::CreateMenuNode(const std::shared_ptr<Select
auto props = menu->GetLayoutProperty<MenuLayoutProperty>(); auto props = menu->GetLayoutProperty<MenuLayoutProperty>();
CHECK_NULL_RETURN(props, nullptr); CHECK_NULL_RETURN(props, nullptr);
OffsetF pageOffset; OffsetF pageOffset;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, nullptr); CHECK_NULL_RETURN(pipeline, nullptr);
auto windowManager = pipeline->GetWindowManager(); auto windowManager = pipeline->GetWindowManager();
auto isContainerModal = pipeline->GetWindowModal() == WindowModal::CONTAINER_MODAL && windowManager && auto isContainerModal = pipeline->GetWindowModal() == WindowModal::CONTAINER_MODAL && windowManager &&
@ -2283,7 +2283,7 @@ void SelectOverlayNode::SetBackButtonOpacity(float value)
void SelectOverlayNode::NotifyUpdateToolBar(bool itemChanged) void SelectOverlayNode::NotifyUpdateToolBar(bool itemChanged)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);
@ -2294,7 +2294,7 @@ void SelectOverlayNode::NotifyUpdateToolBar(bool itemChanged)
void SelectOverlayNode::SwitchToOverlayMode() void SelectOverlayNode::SwitchToOverlayMode()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlayManager = pipeline->GetSelectOverlayManager(); auto overlayManager = pipeline->GetSelectOverlayManager();
CHECK_NULL_VOID(overlayManager); CHECK_NULL_VOID(overlayManager);

View File

@ -24,7 +24,7 @@ constexpr float HALF = 2.0f;
void SelectOverlayPaintMethod::UpdateOverlayModifier(PaintWrapper* paintWrapper) void SelectOverlayPaintMethod::UpdateOverlayModifier(PaintWrapper* paintWrapper)
{ {
CHECK_NULL_VOID(paintWrapper); CHECK_NULL_VOID(paintWrapper);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(textOverlayTheme); CHECK_NULL_VOID(textOverlayTheme);
@ -54,7 +54,7 @@ void SelectOverlayPaintMethod::UpdateOverlayModifier(PaintWrapper* paintWrapper)
void SelectOverlayPaintMethod::UpdateContentModifier(PaintWrapper* paintWrapper) void SelectOverlayPaintMethod::UpdateContentModifier(PaintWrapper* paintWrapper)
{ {
CHECK_NULL_VOID(paintWrapper); CHECK_NULL_VOID(paintWrapper);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_VOID(textOverlayTheme); CHECK_NULL_VOID(textOverlayTheme);

View File

@ -746,7 +746,7 @@ bool SelectOverlayPattern::CheckIfNeedHandle()
float SelectOverlayPattern::GetHandleDiameter() float SelectOverlayPattern::GetHandleDiameter()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, 0.0f); CHECK_NULL_RETURN(pipeline, 0.0f);
auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>(); auto textOverlayTheme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(textOverlayTheme, 0.0f); CHECK_NULL_RETURN(textOverlayTheme, 0.0f);

View File

@ -22,7 +22,7 @@ namespace OHOS::Ace::NG {
Dimension SelectHandleInfo::GetDefaultLineWidth() Dimension SelectHandleInfo::GetDefaultLineWidth()
{ {
const Dimension defaultLineWidth = 2.0_vp; const Dimension defaultLineWidth = 2.0_vp;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, defaultLineWidth); CHECK_NULL_RETURN(pipeline, defaultLineWidth);
auto theme = pipeline->GetTheme<TextOverlayTheme>(); auto theme = pipeline->GetTheme<TextOverlayTheme>();
CHECK_NULL_RETURN(theme, defaultLineWidth); CHECK_NULL_RETURN(theme, defaultLineWidth);

View File

@ -64,7 +64,7 @@ void ServiceCollaborationMenuAceHelper::CreateText(
const std::string& value, const RefPtr<FrameNode>& parent, const Color& color, bool needMargin, bool hasEndIncon) const std::string& value, const RefPtr<FrameNode>& parent, const Color& color, bool needMargin, bool hasEndIncon)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "text is %{public}s", value.c_str()); TAG_LOGI(AceLogTag::ACE_MENU, "text is %{public}s", value.c_str());
auto textPipeline = PipelineBase::GetCurrentContextSafely(); auto textPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(textPipeline); CHECK_NULL_VOID(textPipeline);
auto textTheme = textPipeline->GetTheme<SelectTheme>(); auto textTheme = textPipeline->GetTheme<SelectTheme>();
CHECK_NULL_VOID(textTheme); CHECK_NULL_VOID(textTheme);
@ -94,7 +94,7 @@ void ServiceCollaborationMenuAceHelper::CreateText(
void ServiceCollaborationMenuAceHelper::CreateHeaderText(const std::string& value, const RefPtr<FrameNode>& parent) void ServiceCollaborationMenuAceHelper::CreateHeaderText(const std::string& value, const RefPtr<FrameNode>& parent)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter, text is %{public}s", value.c_str()); TAG_LOGI(AceLogTag::ACE_MENU, "enter, text is %{public}s", value.c_str());
auto textPipeline = PipelineBase::GetCurrentContextSafely(); auto textPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(textPipeline); CHECK_NULL_VOID(textPipeline);
auto textTheme = textPipeline->GetTheme<SelectTheme>(); auto textTheme = textPipeline->GetTheme<SelectTheme>();
CHECK_NULL_VOID(textTheme); CHECK_NULL_VOID(textTheme);
@ -127,7 +127,7 @@ void ServiceCollaborationMenuAceHelper::CreateHeaderText(const std::string& valu
void ServiceCollaborationMenuAceHelper::CreateEndIcon(uint32_t iconId, const RefPtr<FrameNode>& parent) void ServiceCollaborationMenuAceHelper::CreateEndIcon(uint32_t iconId, const RefPtr<FrameNode>& parent)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter, icon is %{public}d", iconId); TAG_LOGI(AceLogTag::ACE_MENU, "enter, icon is %{public}d", iconId);
auto iconPipeline = PipelineBase::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(iconPipeline); CHECK_NULL_VOID(iconPipeline);
auto iconTheme = iconPipeline->GetTheme<SelectTheme>(); auto iconTheme = iconPipeline->GetTheme<SelectTheme>();
CHECK_NULL_VOID(iconTheme); CHECK_NULL_VOID(iconTheme);
@ -151,7 +151,7 @@ void ServiceCollaborationMenuAceHelper::CreateEndIcon(uint32_t iconId, const Ref
void ServiceCollaborationMenuAceHelper::CreateStartIcon(uint32_t iconId, const RefPtr<FrameNode>& parent) void ServiceCollaborationMenuAceHelper::CreateStartIcon(uint32_t iconId, const RefPtr<FrameNode>& parent)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter, icon is %{public}d", iconId); TAG_LOGI(AceLogTag::ACE_MENU, "enter, icon is %{public}d", iconId);
auto iconPipeline = PipelineBase::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(iconPipeline); CHECK_NULL_VOID(iconPipeline);
auto iconTheme = iconPipeline->GetTheme<SelectTheme>(); auto iconTheme = iconPipeline->GetTheme<SelectTheme>();
CHECK_NULL_VOID(iconTheme); CHECK_NULL_VOID(iconTheme);
@ -176,7 +176,7 @@ void ServiceCollaborationMenuAceHelper::CreateStartIcon(uint32_t iconId, const R
RefPtr<FrameNode> ServiceCollaborationMenuAceHelper::CreateMainMenuItem( RefPtr<FrameNode> ServiceCollaborationMenuAceHelper::CreateMainMenuItem(
const std::string& value, const std::string& iconType, const Color& color, bool needEndIcon) const std::string& value, const std::string& iconType, const Color& color, bool needEndIcon)
{ {
auto iconPipeline = PipelineContext::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(iconPipeline, nullptr); CHECK_NULL_RETURN(iconPipeline, nullptr);
auto iconTheme = iconPipeline->GetTheme<IconTheme>(); auto iconTheme = iconPipeline->GetTheme<IconTheme>();
CHECK_NULL_RETURN(iconTheme, nullptr); CHECK_NULL_RETURN(iconTheme, nullptr);
@ -189,7 +189,7 @@ RefPtr<FrameNode> ServiceCollaborationMenuAceHelper::CreateMainMenuItem(
const std::string& value, uint32_t iconId, const Color& color, bool needEndIcon) const std::string& value, uint32_t iconId, const Color& color, bool needEndIcon)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter"); TAG_LOGI(AceLogTag::ACE_MENU, "enter");
auto menuPipeline = PipelineBase::GetCurrentContextSafely(); auto menuPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(menuPipeline, nullptr); CHECK_NULL_RETURN(menuPipeline, nullptr);
auto menuTheme = menuPipeline->GetTheme<SelectTheme>(); auto menuTheme = menuPipeline->GetTheme<SelectTheme>();
CHECK_NULL_RETURN(menuTheme, nullptr); CHECK_NULL_RETURN(menuTheme, nullptr);
@ -241,7 +241,7 @@ RefPtr<FrameNode> ServiceCollaborationMenuAceHelper::CreateMainMenuItem(
} }
uint32_t ServiceCollaborationMenuAceHelper::GetSymbolId(const std::string& abilityType) uint32_t ServiceCollaborationMenuAceHelper::GetSymbolId(const std::string& abilityType)
{ {
auto iconPipeline = PipelineContext::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(iconPipeline, 0); CHECK_NULL_RETURN(iconPipeline, 0);
auto richTheme = iconPipeline->GetTheme<RichEditorTheme>(); auto richTheme = iconPipeline->GetTheme<RichEditorTheme>();
CHECK_NULL_RETURN(richTheme, 0); CHECK_NULL_RETURN(richTheme, 0);
@ -261,7 +261,7 @@ uint32_t ServiceCollaborationMenuAceHelper::GetSymbolId(const std::string& abili
} }
std::string ServiceCollaborationMenuAceHelper::GetIconPath(const std::string& abilityType) std::string ServiceCollaborationMenuAceHelper::GetIconPath(const std::string& abilityType)
{ {
auto iconPipeline = PipelineContext::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(iconPipeline, ""); CHECK_NULL_RETURN(iconPipeline, "");
auto iconTheme = iconPipeline->GetTheme<IconTheme>(); auto iconTheme = iconPipeline->GetTheme<IconTheme>();
CHECK_NULL_RETURN(iconTheme, ""); CHECK_NULL_RETURN(iconTheme, "");
@ -282,7 +282,7 @@ RefPtr<FrameNode> ServiceCollaborationMenuAceHelper::CreateDeviceMenuItem(
const std::string& value, uint32_t iconId) const std::string& value, uint32_t iconId)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter iconId is %{public}d, value is %{public}s", iconId, value.c_str()); TAG_LOGI(AceLogTag::ACE_MENU, "enter iconId is %{public}d, value is %{public}s", iconId, value.c_str());
auto menuPipeline = PipelineBase::GetCurrentContextSafely(); auto menuPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(menuPipeline, nullptr); CHECK_NULL_RETURN(menuPipeline, nullptr);
auto menuTheme = menuPipeline->GetTheme<SelectTheme>(); auto menuTheme = menuPipeline->GetTheme<SelectTheme>();
CHECK_NULL_RETURN(menuTheme, nullptr); CHECK_NULL_RETURN(menuTheme, nullptr);
@ -497,7 +497,7 @@ void ServiceCollaborationMenuAceHelper::SubMeunMountToMainMenu(
void ServiceCollaborationAceCallback::CreateText(const std::string& value, const RefPtr<FrameNode>& parent) void ServiceCollaborationAceCallback::CreateText(const std::string& value, const RefPtr<FrameNode>& parent)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter, text is %{public}s", value.c_str()); TAG_LOGI(AceLogTag::ACE_MENU, "enter, text is %{public}s", value.c_str());
auto textPipeline = PipelineBase::GetCurrentContextSafely(); auto textPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(textPipeline); CHECK_NULL_VOID(textPipeline);
auto textTheme = textPipeline->GetTheme<SelectTheme>(); auto textTheme = textPipeline->GetTheme<SelectTheme>();
CHECK_NULL_VOID(textTheme); CHECK_NULL_VOID(textTheme);
@ -577,7 +577,7 @@ void ServiceCollaborationAceCallback::AddMouseEventToEndIcon(const RefPtr<FrameN
void ServiceCollaborationAceCallback::CreateEndIcon(const std::string& icon, const RefPtr<FrameNode>& parent) void ServiceCollaborationAceCallback::CreateEndIcon(const std::string& icon, const RefPtr<FrameNode>& parent)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter, icon is %{public}s", icon.c_str()); TAG_LOGI(AceLogTag::ACE_MENU, "enter, icon is %{public}s", icon.c_str());
auto iconPipeline = PipelineBase::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(iconPipeline); CHECK_NULL_VOID(iconPipeline);
auto iconTheme = iconPipeline->GetTheme<RichEditorTheme>(); auto iconTheme = iconPipeline->GetTheme<RichEditorTheme>();
CHECK_NULL_VOID(iconTheme); CHECK_NULL_VOID(iconTheme);
@ -626,7 +626,7 @@ void ServiceCollaborationAceCallback::CreateEndIcon(const std::string& icon, con
void ServiceCollaborationAceCallback::CreateStartIcon(uint32_t iconId, const RefPtr<FrameNode>& parent) void ServiceCollaborationAceCallback::CreateStartIcon(uint32_t iconId, const RefPtr<FrameNode>& parent)
{ {
TAG_LOGI(AceLogTag::ACE_MENU, "enter, iconId is %{public}d", iconId); TAG_LOGI(AceLogTag::ACE_MENU, "enter, iconId is %{public}d", iconId);
auto iconPipeline = PipelineBase::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(iconPipeline); CHECK_NULL_VOID(iconPipeline);
auto iconTheme = iconPipeline->GetTheme<RichEditorTheme>(); auto iconTheme = iconPipeline->GetTheme<RichEditorTheme>();
CHECK_NULL_VOID(iconTheme); CHECK_NULL_VOID(iconTheme);
@ -651,7 +651,7 @@ void ServiceCollaborationAceCallback::CreateStartIcon(uint32_t iconId, const Ref
uint32_t ServiceCollaborationAceCallback::GetSymbolId(const std::string& abilityType) uint32_t ServiceCollaborationAceCallback::GetSymbolId(const std::string& abilityType)
{ {
auto iconPipeline = PipelineContext::GetCurrentContextSafely(); auto iconPipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(iconPipeline, 0); CHECK_NULL_RETURN(iconPipeline, 0);
auto richTheme = iconPipeline->GetTheme<RichEditorTheme>(); auto richTheme = iconPipeline->GetTheme<RichEditorTheme>();
CHECK_NULL_RETURN(richTheme, 0); CHECK_NULL_RETURN(richTheme, 0);
@ -697,7 +697,7 @@ RefPtr<FrameNode> ServiceCollaborationAceCallback::CreateCustomPopUpNode(
void ServiceCollaborationAceCallback::RemovePopupNode() void ServiceCollaborationAceCallback::RemovePopupNode()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto overlay = pipeline->GetOverlayManager(); auto overlay = pipeline->GetOverlayManager();
CHECK_NULL_VOID(overlay); CHECK_NULL_VOID(overlay);

View File

@ -529,7 +529,7 @@ RectF BaseTextSelectOverlay::GetPaintRectWithTransform()
OffsetF BaseTextSelectOverlay::GetPaintRectOffsetWithTransform() OffsetF BaseTextSelectOverlay::GetPaintRectOffsetWithTransform()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, OffsetF(0.0f, 0.0f)); CHECK_NULL_RETURN(pipeline, OffsetF(0.0f, 0.0f));
auto globalFrameRect = GetPaintRectWithTransform(); auto globalFrameRect = GetPaintRectWithTransform();
return globalFrameRect.GetOffset() - pipeline->GetRootRect().GetOffset(); return globalFrameRect.GetOffset() - pipeline->GetRootRect().GetOffset();
@ -818,7 +818,7 @@ void BaseTextSelectOverlay::OnAncestorNodeChanged(FrameNodeChangeInfoFlag flag)
isSwitchToEmbed = isSwitchToEmbed && (!isScrollEnd || HasUnsupportedTransform()); isSwitchToEmbed = isSwitchToEmbed && (!isScrollEnd || HasUnsupportedTransform());
UpdateMenuWhileAncestorNodeChanged( UpdateMenuWhileAncestorNodeChanged(
isStartScroll || isStartAnimation || isTransformChanged || isStartTransition, isScrollEnd); isStartScroll || isStartAnimation || isTransformChanged || isStartTransition, isScrollEnd);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto switchTask = [weak = WeakClaim(this), isSwitchToEmbed, isScrollEnd]() { auto switchTask = [weak = WeakClaim(this), isSwitchToEmbed, isScrollEnd]() {
auto overlay = weak.Upgrade(); auto overlay = weak.Upgrade();

View File

@ -36,7 +36,7 @@ void MultipleClickRecognizer::Start(const GestureEvent& event)
} }
lastClickTimeStamp_ = event.GetTimeStamp(); lastClickTimeStamp_ = event.GetTimeStamp();
lastClickPosition_ = event.GetGlobalLocation(); lastClickPosition_ = event.GetGlobalLocation();
auto context = PipelineContext::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
if (!context || !context->GetTaskExecutor()) { if (!context || !context->GetTaskExecutor()) {
Stop(); Stop();
return; return;

View File

@ -659,7 +659,7 @@ void MultipleParagraphLayoutAlgorithm::UpdateParagraphByCustomSpan(RefPtr<Custom
CHECK_NULL_VOID(layoutWrapper); CHECK_NULL_VOID(layoutWrapper);
auto layoutProperty = layoutWrapper->GetLayoutProperty(); auto layoutProperty = layoutWrapper->GetLayoutProperty();
CHECK_NULL_VOID(layoutProperty); CHECK_NULL_VOID(layoutProperty);
auto context = PipelineBase::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
auto theme = context->GetTheme<TextTheme>(); auto theme = context->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -704,7 +704,7 @@ void MultipleParagraphLayoutAlgorithm::ApplyIndent(
double value = 0.0; double value = 0.0;
if (GreatNotEqual(indentValue.Value(), 0.0)) { if (GreatNotEqual(indentValue.Value(), 0.0)) {
// first line indent // first line indent
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
if (indentValue.Unit() != DimensionUnit::PERCENT) { if (indentValue.Unit() != DimensionUnit::PERCENT) {
value = indentValue.ConvertToPxDistribute( value = indentValue.ConvertToPxDistribute(

View File

@ -958,7 +958,7 @@ void UrlSpan::AddUrlStyle(const RefPtr<NG::SpanItem>& spanItem) const
{ {
auto address = urlAddress_; auto address = urlAddress_;
auto urlOnRelease = [address]() { auto urlOnRelease = [address]() {
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
pipelineContext->HyperlinkStartAbility(address); pipelineContext->HyperlinkStartAbility(address);
}; };

View File

@ -488,7 +488,7 @@ Ace::TextDecorationStyle SpanModelNG::GetTextDecorationStyle(UINode* uiNode)
TextStyle SpanModelNG::GetDefaultTextStyle() TextStyle SpanModelNG::GetDefaultTextStyle()
{ {
TextStyle textStyle; TextStyle textStyle;
auto pipelineContext = PipelineBase::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipelineContext, textStyle); CHECK_NULL_RETURN(pipelineContext, textStyle);
auto textTheme = pipelineContext->GetTheme<TextTheme>(); auto textTheme = pipelineContext->GetTheme<TextTheme>();
CHECK_NULL_RETURN(textTheme, textStyle); CHECK_NULL_RETURN(textTheme, textStyle);

View File

@ -453,7 +453,7 @@ void SpanItem::UpdateTextStyle(const std::string& content, const RefPtr<Paragrap
finalSelEnd = contentLength; finalSelEnd = contentLength;
} }
if (finalSelStart < contentLength) { if (finalSelStart < contentLength) {
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
TextStyle selectedTextStyle = textStyle; TextStyle selectedTextStyle = textStyle;
Color color = selectedTextStyle.GetTextColor().ChangeAlpha(DRAGGED_TEXT_OPACITY); Color color = selectedTextStyle.GetTextColor().ChangeAlpha(DRAGGED_TEXT_OPACITY);
selectedTextStyle.SetTextColor(color); selectedTextStyle.SetTextColor(color);

View File

@ -24,7 +24,7 @@ const Dimension SELECTED_BLANK_LINE_WIDTH = 2.0_vp;
void TextBase::SetSelectionNode(const SelectedByMouseInfo& info) void TextBase::SetSelectionNode(const SelectedByMouseInfo& info)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto selectOverlayManager = pipeline->GetSelectOverlayManager(); auto selectOverlayManager = pipeline->GetSelectOverlayManager();
selectOverlayManager->SetSelectedNodeByMouse(info); selectOverlayManager->SetSelectedNodeByMouse(info);

View File

@ -144,7 +144,7 @@ void TextContentModifier::SetDefaultFontSize(const TextStyle& textStyle)
void TextContentModifier::SetDefaultAdaptMinFontSize(const TextStyle& textStyle) void TextContentModifier::SetDefaultAdaptMinFontSize(const TextStyle& textStyle)
{ {
float fontSizeValue = textStyle.GetFontSize().Value(); float fontSizeValue = textStyle.GetFontSize().Value();
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
if (pipelineContext) { if (pipelineContext) {
fontSizeValue = textStyle.GetAdaptMinFontSize().ConvertToPxDistribute( fontSizeValue = textStyle.GetAdaptMinFontSize().ConvertToPxDistribute(
textStyle.GetMinFontScale(), textStyle.GetMaxFontScale(), textStyle.IsAllowScale()); textStyle.GetMinFontScale(), textStyle.GetMaxFontScale(), textStyle.IsAllowScale());
@ -157,7 +157,7 @@ void TextContentModifier::SetDefaultAdaptMinFontSize(const TextStyle& textStyle)
void TextContentModifier::SetDefaultAdaptMaxFontSize(const TextStyle& textStyle) void TextContentModifier::SetDefaultAdaptMaxFontSize(const TextStyle& textStyle)
{ {
float fontSizeValue = textStyle.GetFontSize().Value(); float fontSizeValue = textStyle.GetFontSize().Value();
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
if (pipelineContext) { if (pipelineContext) {
fontSizeValue = textStyle.GetAdaptMaxFontSize().ConvertToPxDistribute( fontSizeValue = textStyle.GetAdaptMaxFontSize().ConvertToPxDistribute(
textStyle.GetMinFontScale(), textStyle.GetMaxFontScale(), textStyle.IsAllowScale()); textStyle.GetMinFontScale(), textStyle.GetMaxFontScale(), textStyle.IsAllowScale());
@ -226,7 +226,7 @@ void TextContentModifier::SetDefaultTextDecoration(const TextStyle& textStyle)
void TextContentModifier::SetDefaultBaselineOffset(const TextStyle& textStyle) void TextContentModifier::SetDefaultBaselineOffset(const TextStyle& textStyle)
{ {
float baselineOffset = textStyle.GetBaselineOffset().Value(); float baselineOffset = textStyle.GetBaselineOffset().Value();
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
if (pipelineContext) { if (pipelineContext) {
baselineOffset = textStyle.GetBaselineOffset().ConvertToPxDistribute( baselineOffset = textStyle.GetBaselineOffset().ConvertToPxDistribute(
textStyle.GetMinFontScale(), textStyle.GetMaxFontScale(), textStyle.IsAllowScale()); textStyle.GetMinFontScale(), textStyle.GetMaxFontScale(), textStyle.IsAllowScale());
@ -877,7 +877,7 @@ void TextContentModifier::StartTextRace()
} }
textRaceSpaceWidth_ = RACE_SPACE_WIDTH; textRaceSpaceWidth_ = RACE_SPACE_WIDTH;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
if (pipeline) { if (pipeline) {
textRaceSpaceWidth_ *= pipeline->GetDipScale(); textRaceSpaceWidth_ *= pipeline->GetDipScale();
} }

View File

@ -391,7 +391,7 @@ bool TextLayoutAlgorithm::AdaptMinTextSize(TextStyle& textStyle, const std::stri
// IsNeedAdaptFontSize // IsNeedAdaptFontSize
double maxFontSize = 0.0; double maxFontSize = 0.0;
double minFontSize = 0.0; double minFontSize = 0.0;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, false); CHECK_NULL_RETURN(pipeline, false);
GetAdaptMaxMinFontSize(textStyle, maxFontSize, minFontSize, contentConstraint); GetAdaptMaxMinFontSize(textStyle, maxFontSize, minFontSize, contentConstraint);
if (!IsNeedAdaptFontSize(maxFontSize, minFontSize)) { if (!IsNeedAdaptFontSize(maxFontSize, minFontSize)) {
@ -699,7 +699,7 @@ std::optional<SizeF> TextLayoutAlgorithm::BuildTextRaceParagraph(TextStyle& text
paragraphWidth = std::ceil(paragraphWidth); paragraphWidth = std::ceil(paragraphWidth);
paragraph->Layout(paragraphWidth); paragraph->Layout(paragraphWidth);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
// calculate the content size // calculate the content size
auto height = static_cast<float>(paragraph->GetHeight()); auto height = static_cast<float>(paragraph->GetHeight());
baselineOffset_ = static_cast<float>( baselineOffset_ = static_cast<float>(

View File

@ -47,7 +47,7 @@ struct TextDetectConfig {
TextDetectConfig() TextDetectConfig()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto hyperlinkTheme = pipeline->GetTheme<HyperlinkTheme>(); auto hyperlinkTheme = pipeline->GetTheme<HyperlinkTheme>();
CHECK_NULL_VOID(hyperlinkTheme); CHECK_NULL_VOID(hyperlinkTheme);

View File

@ -824,7 +824,7 @@ Ace::FontStyle TextModelNG::GetItalicFontStyle(FrameNode* frameNode)
Color TextModelNG::GetDefaultColor() Color TextModelNG::GetDefaultColor()
{ {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(context, Color::BLACK); CHECK_NULL_RETURN(context, Color::BLACK);
auto theme = context->GetTheme<TextTheme>(); auto theme = context->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, Color::BLACK); CHECK_NULL_RETURN(theme, Color::BLACK);
@ -940,7 +940,7 @@ void TextModelNG::SetCaretColor(FrameNode* frameNode, const Color& value)
Color TextModelNG::GetCaretColor(FrameNode* frameNode) Color TextModelNG::GetCaretColor(FrameNode* frameNode)
{ {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(context, Color::BLACK); CHECK_NULL_RETURN(context, Color::BLACK);
auto theme = context->GetTheme<TextTheme>(); auto theme = context->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, Color::BLACK); CHECK_NULL_RETURN(theme, Color::BLACK);
@ -970,7 +970,7 @@ void TextModelNG::SetSelectedBackgroundColor(FrameNode* frameNode, const Color&
Color TextModelNG::GetSelectedBackgroundColor(FrameNode* frameNode) Color TextModelNG::GetSelectedBackgroundColor(FrameNode* frameNode)
{ {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(context, Color::BLACK); CHECK_NULL_RETURN(context, Color::BLACK);
auto theme = context->GetTheme<TextTheme>(); auto theme = context->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, Color::BLACK); CHECK_NULL_RETURN(theme, Color::BLACK);

View File

@ -88,11 +88,11 @@ void TextPattern::OnWindowShow()
void TextPattern::OnAttachToFrameNode() void TextPattern::OnAttachToFrameNode()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely();
CHECK_NULL_VOID(pipeline);
pipeline_ = pipeline;
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline);
pipeline_ = pipeline;
auto fontManager = pipeline->GetFontManager(); auto fontManager = pipeline->GetFontManager();
if (fontManager) { if (fontManager) {
fontManager->AddFontNodeNG(host); fontManager->AddFontNodeNG(host);
@ -758,7 +758,7 @@ void TextPattern::SetTextSelection(int32_t selectionStart, int32_t selectionEnd)
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto eventHub = host->GetEventHub<EventHub>(); auto eventHub = host->GetEventHub<EventHub>();
CHECK_NULL_VOID(eventHub); CHECK_NULL_VOID(eventHub);
auto context = PipelineContext::GetCurrentContextSafely(); auto context = host->GetContext();
if (context) { if (context) {
context->AddAfterLayoutTask([weak = WeakClaim(this), selectionStart, selectionEnd, eventHub]() { context->AddAfterLayoutTask([weak = WeakClaim(this), selectionStart, selectionEnd, eventHub]() {
auto textPattern = weak.Upgrade(); auto textPattern = weak.Upgrade();
@ -1183,7 +1183,7 @@ void TextPattern::URLOnHover(bool isHover)
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto nodeId = host->GetId(); auto nodeId = host->GetId();
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = host->GetContext();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
pipelineContext->ChangeMouseStyle(nodeId, MouseFormat::DEFAULT); pipelineContext->ChangeMouseStyle(nodeId, MouseFormat::DEFAULT);
pipelineContext->FreeMouseStyleHoldNode(nodeId); pipelineContext->FreeMouseStyleHoldNode(nodeId);
@ -1212,7 +1212,7 @@ void TextPattern::HandleUrlMouseEvent(const MouseInfo& info)
PointF textOffset = { static_cast<float>(localLocation.GetX()) - textContentRect.GetX(), PointF textOffset = { static_cast<float>(localLocation.GetX()) - textContentRect.GetX(),
static_cast<float>(localLocation.GetY()) - textContentRect.GetY() }; static_cast<float>(localLocation.GetY()) - textContentRect.GetY() };
auto show = ShowShadow(textOffset, GetUrlHoverColor()); auto show = ShowShadow(textOffset, GetUrlHoverColor());
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = host->GetContext();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
if (show) { if (show) {
pipelineContext->SetMouseStyleHoldNode(hostId); pipelineContext->SetMouseStyleHoldNode(hostId);
@ -2507,7 +2507,7 @@ OffsetF TextPattern::GetParentGlobalOffset() const
selectOverlay_->UpdateHandleGlobalOffset(); selectOverlay_->UpdateHandleGlobalOffset();
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_RETURN(host, {}); CHECK_NULL_RETURN(host, {});
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, {}); CHECK_NULL_RETURN(pipeline, {});
auto rootOffset = pipeline->GetRootRect().GetOffset(); auto rootOffset = pipeline->GetRootRect().GetOffset();
return host->GetPaintRectOffset() - rootOffset; return host->GetPaintRectOffset() - rootOffset;
@ -2549,8 +2549,8 @@ void TextPattern::OnModifyDone()
auto nowTime = static_cast<unsigned long long>(GetSystemTimestamp()); auto nowTime = static_cast<unsigned long long>(GetSystemTimestamp());
ACE_TEXT_SCOPED_TRACE("OnModifyDone[Text][id:%d][time:%llu]", host->GetId(), nowTime); ACE_TEXT_SCOPED_TRACE("OnModifyDone[Text][id:%d][time:%llu]", host->GetId(), nowTime);
DumpRecord("OnModifyDone:" + std::to_string(nowTime)); DumpRecord("OnModifyDone:" + std::to_string(nowTime));
if (!(PipelineContext::GetCurrentContextSafely() && auto pipeline = host->GetContext();
PipelineContext::GetCurrentContextSafely()->GetMinPlatformVersion() > API_PROTEXTION_GREATER_NINE)) { if (!(pipeline && pipeline->GetMinPlatformVersion() > API_PROTEXTION_GREATER_NINE)) {
bool shouldClipToContent = bool shouldClipToContent =
textLayoutProperty->GetTextOverflow().value_or(TextOverflow::CLIP) == TextOverflow::CLIP; textLayoutProperty->GetTextOverflow().value_or(TextOverflow::CLIP) == TextOverflow::CLIP;
host->GetRenderContext()->SetClipToFrame(shouldClipToContent); host->GetRenderContext()->SetClipToFrame(shouldClipToContent);
@ -2600,7 +2600,7 @@ void TextPattern::OnModifyDone()
auto eventHub = host->GetEventHub<EventHub>(); auto eventHub = host->GetEventHub<EventHub>();
CHECK_NULL_VOID(eventHub); CHECK_NULL_VOID(eventHub);
if (IsSelectableAndCopy()) { if (IsSelectableAndCopy()) {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = host->GetContext();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
if (!clipboard_ && context) { if (!clipboard_ && context) {
clipboard_ = ClipboardProxy::GetInstance()->GetClipboard(context->GetTaskExecutor()); clipboard_ = ClipboardProxy::GetInstance()->GetClipboard(context->GetTaskExecutor());
@ -2629,7 +2629,7 @@ void TextPattern::OnModifyDone()
if (onClick_ || IsSelectableAndCopy() || CanStartAITask()) { if (onClick_ || IsSelectableAndCopy() || CanStartAITask()) {
InitClickEvent(gestureEventHub); InitClickEvent(gestureEventHub);
if (CanStartAITask()) { if (CanStartAITask()) {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = host->GetContext();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
if (!clipboard_ && context) { if (!clipboard_ && context) {
clipboard_ = ClipboardProxy::GetInstance()->GetClipboard(context->GetTaskExecutor()); clipboard_ = ClipboardProxy::GetInstance()->GetClipboard(context->GetTaskExecutor());
@ -2903,7 +2903,9 @@ void TextPattern::ActSetSelection(int32_t start, int32_t end)
bool TextPattern::IsShowHandle() bool TextPattern::IsShowHandle()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_RETURN(host, false);
auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, false); CHECK_NULL_RETURN(pipeline, false);
auto theme = pipeline->GetTheme<TextTheme>(); auto theme = pipeline->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, false); CHECK_NULL_RETURN(theme, false);
@ -2912,7 +2914,9 @@ bool TextPattern::IsShowHandle()
Color TextPattern::GetUrlHoverColor() Color TextPattern::GetUrlHoverColor()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_RETURN(host, Color());
auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, Color()); CHECK_NULL_RETURN(pipeline, Color());
auto theme = pipeline->GetTheme<TextTheme>(); auto theme = pipeline->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, Color()); CHECK_NULL_RETURN(theme, Color());
@ -2921,7 +2925,9 @@ Color TextPattern::GetUrlHoverColor()
Color TextPattern::GetUrlPressColor() Color TextPattern::GetUrlPressColor()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_RETURN(host, Color());
auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, Color()); CHECK_NULL_RETURN(pipeline, Color());
auto theme = pipeline->GetTheme<TextTheme>(); auto theme = pipeline->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, Color()); CHECK_NULL_RETURN(theme, Color());
@ -2930,13 +2936,13 @@ Color TextPattern::GetUrlPressColor()
Color TextPattern::GetUrlSpanColor() Color TextPattern::GetUrlSpanColor()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_RETURN(host, Color());
auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, Color()); CHECK_NULL_RETURN(pipeline, Color());
auto theme = pipeline->GetTheme<TextTheme>(); auto theme = pipeline->GetTheme<TextTheme>();
CHECK_NULL_RETURN(theme, Color()); CHECK_NULL_RETURN(theme, Color());
auto host = GetHost();
CHECK_NULL_RETURN(host, Color());
auto eventHub = host->GetEventHub<EventHub>(); auto eventHub = host->GetEventHub<EventHub>();
CHECK_NULL_RETURN(eventHub, Color()); CHECK_NULL_RETURN(eventHub, Color());
@ -2969,10 +2975,10 @@ void TextPattern::UpdateSelectOverlayOrCreate(SelectOverlayInfo& selectInfo, boo
selectOverlayProxy_->UpdateFirstAndSecondHandleInfo(firstHandleInfo, secondHandleInfo); selectOverlayProxy_->UpdateFirstAndSecondHandleInfo(firstHandleInfo, secondHandleInfo);
selectOverlayProxy_->ShowOrHiddenMenu(!firstHandleInfo.isShow && !secondHandleInfo.isShow); selectOverlayProxy_->ShowOrHiddenMenu(!firstHandleInfo.isShow && !secondHandleInfo.isShow);
} else { } else {
auto pipeline = PipelineContext::GetCurrentContextSafely();
CHECK_NULL_VOID(pipeline);
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline);
pipeline->AddOnAreaChangeNode(host->GetId()); pipeline->AddOnAreaChangeNode(host->GetId());
selectInfo.callerFrameNode = GetHost(); selectInfo.callerFrameNode = GetHost();
selectInfo.hitTestMode = HitTestMode::HTMDEFAULT; selectInfo.hitTestMode = HitTestMode::HTMDEFAULT;
@ -3231,7 +3237,7 @@ void TextPattern::GetGlobalOffset(Offset& offset)
{ {
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto rootOffset = pipeline->GetRootRect().GetOffset(); auto rootOffset = pipeline->GetRootRect().GetOffset();
auto globalOffset = host->GetPaintRectOffset() - rootOffset; auto globalOffset = host->GetPaintRectOffset() - rootOffset;
@ -3257,7 +3263,9 @@ void TextPattern::OnVisibleChange(bool isVisible)
void TextPattern::InitSurfaceChangedCallback() void TextPattern::InitSurfaceChangedCallback()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
if (!HasSurfaceChangedCallback()) { if (!HasSurfaceChangedCallback()) {
auto callbackId = pipeline->RegisterSurfaceChangedCallback( auto callbackId = pipeline->RegisterSurfaceChangedCallback(
@ -3281,7 +3289,9 @@ void TextPattern::HandleSurfaceChanged(int32_t newWidth, int32_t newHeight, int3
if (selectOverlay_->IsShowMouseMenu()) { if (selectOverlay_->IsShowMouseMenu()) {
CloseSelectOverlay(); CloseSelectOverlay();
} else { } else {
auto context = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto context = host->GetContext();
if (context) { if (context) {
context->AddAfterLayoutTask([weak = WeakClaim(this)]() { context->AddAfterLayoutTask([weak = WeakClaim(this)]() {
auto pattern = weak.Upgrade(); auto pattern = weak.Upgrade();
@ -3295,7 +3305,9 @@ void TextPattern::HandleSurfaceChanged(int32_t newWidth, int32_t newHeight, int3
void TextPattern::InitSurfacePositionChangedCallback() void TextPattern::InitSurfacePositionChangedCallback()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
if (!HasSurfacePositionChangedCallback()) { if (!HasSurfacePositionChangedCallback()) {
auto callbackId = auto callbackId =
@ -3600,7 +3612,7 @@ void TextPattern::OnColorConfigurationUpdate()
auto renderContext = host->GetRenderContext(); auto renderContext = host->GetRenderContext();
CHECK_NULL_VOID(renderContext); CHECK_NULL_VOID(renderContext);
CHECK_NULL_VOID(!renderContext->HasForegroundColor()); CHECK_NULL_VOID(!renderContext->HasForegroundColor());
auto context = PipelineContext::GetCurrentContextSafely(); auto context = host->GetContext();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
auto theme = context->GetTheme<TextTheme>(); auto theme = context->GetTheme<TextTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -3774,10 +3786,10 @@ void TextPattern::OnHandleAreaChanged()
void TextPattern::RemoveAreaChangeInner() void TextPattern::RemoveAreaChangeInner()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely();
CHECK_NULL_VOID(pipeline);
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline);
auto eventHub = host->GetEventHub<TextEventHub>(); auto eventHub = host->GetEventHub<TextEventHub>();
CHECK_NULL_VOID(eventHub); CHECK_NULL_VOID(eventHub);
if (eventHub->HasOnAreaChanged()) { if (eventHub->HasOnAreaChanged()) {
@ -3796,7 +3808,7 @@ void TextPattern::SetTextDetectEnable(bool enable)
} }
textDetectEnable_ = enable; textDetectEnable_ = enable;
if (textDetectEnable_) { if (textDetectEnable_) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto callback = [weak = WeakClaim(this)]() { auto callback = [weak = WeakClaim(this)]() {
auto pattern = weak.Upgrade(); auto pattern = weak.Upgrade();
@ -4505,14 +4517,14 @@ void TextPattern::DumpAdvanceInfo(std::unique_ptr<JsonValue>& json)
json->Put("from TextEngine paragraphs_ info", children); json->Put("from TextEngine paragraphs_ info", children);
} }
json->Put("BindSelectionMenu", std::to_string(selectionMenuMap_.empty()).c_str()); json->Put("BindSelectionMenu", std::to_string(selectionMenuMap_.empty()).c_str());
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto fontScale = pipeline->GetFontScale(); auto fontScale = pipeline->GetFontScale();
auto fontWeightScale = pipeline->GetFontWeightScale(); auto fontWeightScale = pipeline->GetFontWeightScale();
json->Put("fontScale", std::to_string(fontScale).c_str()); json->Put("fontScale", std::to_string(fontScale).c_str());
json->Put("fontWeightScale", std::to_string(fontWeightScale).c_str()); json->Put("fontWeightScale", std::to_string(fontWeightScale).c_str());
auto host = GetHost();
CHECK_NULL_VOID(host);
auto renderContext = host->GetRenderContext(); auto renderContext = host->GetRenderContext();
CHECK_NULL_VOID(renderContext); CHECK_NULL_VOID(renderContext);
if (renderContext->HasForegroundColor()) { if (renderContext->HasForegroundColor()) {

View File

@ -24,7 +24,7 @@ constexpr float BOX_EPSILON = 0.5f;
bool TextSelectOverlay::PreProcessOverlay(const OverlayRequest& request) bool TextSelectOverlay::PreProcessOverlay(const OverlayRequest& request)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, false); CHECK_NULL_RETURN(pipeline, false);
auto textPattern = GetPattern<TextPattern>(); auto textPattern = GetPattern<TextPattern>();
CHECK_NULL_RETURN(textPattern, false); CHECK_NULL_RETURN(textPattern, false);

View File

@ -334,7 +334,7 @@ void TextDragPattern::CalculateLine(std::vector<TextPoint>& points, std::shared_
Color TextDragPattern::GetDragBackgroundColor() Color TextDragPattern::GetDragBackgroundColor()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, Color(TEXT_DRAG_COLOR_BG)); CHECK_NULL_RETURN(pipeline, Color(TEXT_DRAG_COLOR_BG));
auto textTheme = pipeline->GetTheme<TextTheme>(); auto textTheme = pipeline->GetTheme<TextTheme>();
CHECK_NULL_RETURN(textTheme, Color(TEXT_DRAG_COLOR_BG)); CHECK_NULL_RETURN(textTheme, Color(TEXT_DRAG_COLOR_BG));

View File

@ -470,7 +470,7 @@ void OnTextChangedListenerImpl::OnDetach()
{ {
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "OnDetach"); TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "OnDetach");
ContainerScope scope(patternInstanceId_); ContainerScope scope(patternInstanceId_);
auto pipeline = PipelineBase::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textFieldManager = AceType::DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager()); auto textFieldManager = AceType::DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager());
CHECK_NULL_VOID(textFieldManager); CHECK_NULL_VOID(textFieldManager);

View File

@ -219,7 +219,7 @@ void TextFieldLayoutAlgorithm::ApplyIndent(LayoutWrapper* layoutWrapper, double
} }
// first line indent // first line indent
CHECK_NULL_VOID(paragraph_); CHECK_NULL_VOID(paragraph_);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto frameNode = layoutWrapper->GetHostNode(); auto frameNode = layoutWrapper->GetHostNode();
CHECK_NULL_VOID(frameNode); CHECK_NULL_VOID(frameNode);
@ -811,7 +811,7 @@ void TextFieldLayoutAlgorithm::CreateParagraph(const TextStyle& textStyle, std::
CHECK_NULL_VOID(paragraph_); CHECK_NULL_VOID(paragraph_);
paragraph_->PushStyle(textStyle); paragraph_->PushStyle(textStyle);
StringUtils::TransformStrCase(content, static_cast<int32_t>(textStyle.GetTextCase())); StringUtils::TransformStrCase(content, static_cast<int32_t>(textStyle.GetTextCase()));
auto pipeline = PipelineBase::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetTheme<TextFieldTheme>(); auto theme = pipeline->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -876,7 +876,7 @@ void TextFieldLayoutAlgorithm::CreateInlineParagraph(const TextStyle& textStyle,
CHECK_NULL_VOID(paragraph_); CHECK_NULL_VOID(paragraph_);
inlineParagraph_->PushStyle(textStyle); inlineParagraph_->PushStyle(textStyle);
StringUtils::TransformStrCase(content, static_cast<int32_t>(textStyle.GetTextCase())); StringUtils::TransformStrCase(content, static_cast<int32_t>(textStyle.GetTextCase()));
auto pipeline = PipelineBase::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto theme = pipeline->GetTheme<TextFieldTheme>(); auto theme = pipeline->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);
@ -928,7 +928,7 @@ void TextFieldLayoutAlgorithm::GetSuitableSize(SizeF& maxSize, LayoutWrapper* la
float TextFieldLayoutAlgorithm::GetTextFieldDefaultHeight() float TextFieldLayoutAlgorithm::GetTextFieldDefaultHeight()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_RETURN(pipeline, 0.0f); CHECK_NULL_RETURN(pipeline, 0.0f);
auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>(); auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>();
CHECK_NULL_RETURN(textFieldTheme, 0.0f); CHECK_NULL_RETURN(textFieldTheme, 0.0f);

View File

@ -57,7 +57,7 @@ bool TextFieldManagerNG::OnBackPressed()
void TextFieldManagerNG::SetClickPosition(const Offset& position) void TextFieldManagerNG::SetClickPosition(const Offset& position)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto rootHeight = pipeline->GetRootHeight(); auto rootHeight = pipeline->GetRootHeight();
if (GreatOrEqual(position.GetY(), rootHeight)) { if (GreatOrEqual(position.GetY(), rootHeight)) {

View File

@ -24,7 +24,7 @@ void TextFieldPaintProperty::ToJsonValue(std::unique_ptr<JsonValue>& json, const
if (filter.IsFastFilter()) { if (filter.IsFastFilter()) {
return; return;
} }
auto pipeline = PipelineBase::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>(); auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(textFieldTheme); CHECK_NULL_VOID(textFieldTheme);

View File

@ -354,7 +354,9 @@ void TextFieldPattern::CalculateBoundsRect()
void TextFieldPattern::CalcInlineScrollRect(Rect& inlineScrollRect) void TextFieldPattern::CalcInlineScrollRect(Rect& inlineScrollRect)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto scrollBar = GetScrollBar(); auto scrollBar = GetScrollBar();
CHECK_NULL_VOID(scrollBar); CHECK_NULL_VOID(scrollBar);
@ -428,9 +430,9 @@ float TextFieldPattern::GetTextOrPlaceHolderFontSize()
TextFieldPattern::TextFieldPattern() : twinklingInterval_(TWINKLING_INTERVAL_MS) TextFieldPattern::TextFieldPattern() : twinklingInterval_(TWINKLING_INTERVAL_MS)
{ {
if (PipelineBase::GetCurrentContextSafely() && if (PipelineContext::GetCurrentContextSafelyWithCheck() &&
// for normal app add version protection, enable keyboard as default start from API 10 or higher // for normal app add version protection, enable keyboard as default start from API 10 or higher
PipelineBase::GetCurrentContextSafely()->GetMinPlatformVersion() > KEYBOARD_DEFAULT_API) { PipelineContext::GetCurrentContextSafelyWithCheck()->GetMinPlatformVersion() > KEYBOARD_DEFAULT_API) {
needToRequestKeyboardOnFocus_ = true; needToRequestKeyboardOnFocus_ = true;
} }
contentController_ = MakeRefPtr<ContentController>(WeakClaim(this)); contentController_ = MakeRefPtr<ContentController>(WeakClaim(this));
@ -665,7 +667,7 @@ void TextFieldPattern::HandleContentSizeChange(const RectF& textRect)
auto eventHub = host->GetEventHub<TextFieldEventHub>(); auto eventHub = host->GetEventHub<TextFieldEventHub>();
CHECK_NULL_VOID(eventHub); CHECK_NULL_VOID(eventHub);
if (eventHub->GetOnContentSizeChange()) { if (eventHub->GetOnContentSizeChange()) {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto weak = WeakClaim(eventHub.GetRawPtr()); auto weak = WeakClaim(eventHub.GetRawPtr());
pipeline->AddAfterLayoutTask([textRect, weak]() { pipeline->AddAfterLayoutTask([textRect, weak]() {
@ -678,7 +680,9 @@ void TextFieldPattern::HandleContentSizeChange(const RectF& textRect)
void TextFieldPattern::ProcessOverlayAfterLayout(const OffsetF& prevOffset) void TextFieldPattern::ProcessOverlayAfterLayout(const OffsetF& prevOffset)
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
pipeline->AddAfterLayoutTask([weak = WeakClaim(this), prevOffset]() { pipeline->AddAfterLayoutTask([weak = WeakClaim(this), prevOffset]() {
auto pattern = weak.Upgrade(); auto pattern = weak.Upgrade();
@ -940,7 +944,7 @@ Offset TextFieldPattern::GetGlobalOffset() const
Offset offset; Offset offset;
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_RETURN(host, {}); CHECK_NULL_RETURN(host, {});
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, {}); CHECK_NULL_RETURN(pipeline, {});
auto rootOffset = pipeline->GetRootRect().GetOffset(); auto rootOffset = pipeline->GetRootRect().GetOffset();
auto globalOffset = host->GetPaintRectOffset() - rootOffset; auto globalOffset = host->GetPaintRectOffset() - rootOffset;
@ -961,7 +965,9 @@ double TextFieldPattern::GetEditingBoxTopY() const
bool TextFieldPattern::GetEditingBoxModel() const bool TextFieldPattern::GetEditingBoxModel() const
{ {
bool isDeclarative = false; bool isDeclarative = false;
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
if (pipeline && pipeline->GetIsDeclarative()) { if (pipeline && pipeline->GetIsDeclarative()) {
isDeclarative = true; isDeclarative = true;
} }
@ -2673,7 +2679,9 @@ void TextFieldPattern::ScheduleCursorTwinkling()
if (isTransparent_) { if (isTransparent_) {
return; return;
} }
auto context = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto context = host->GetContext();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
if (!context->GetTaskExecutor()) { if (!context->GetTaskExecutor()) {
@ -3605,8 +3613,12 @@ void TextFieldPattern::RestoreDefaultMouseState()
} }
void TextFieldPattern::ChangeMouseState( void TextFieldPattern::ChangeMouseState(
const Offset location, const RefPtr<PipelineContext>& pipeline, int32_t frameId, bool isByPass) const Offset location, int32_t frameId, bool isByPass)
{ {
auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline);
auto responseAreaWidth = (responseArea_ ? responseArea_->GetAreaRect().Width() : 0.0f) + auto responseAreaWidth = (responseArea_ ? responseArea_->GetAreaRect().Width() : 0.0f) +
(cleanNodeResponseArea_ ? cleanNodeResponseArea_->GetAreaRect().Width() : 0.0f); (cleanNodeResponseArea_ ? cleanNodeResponseArea_->GetAreaRect().Width() : 0.0f);
auto x = location.GetX(); auto x = location.GetX();
@ -3635,7 +3647,7 @@ void TextFieldPattern::HandleMouseEvent(MouseInfo& info)
auto tmpHost = GetHost(); auto tmpHost = GetHost();
CHECK_NULL_VOID(tmpHost); CHECK_NULL_VOID(tmpHost);
auto frameId = tmpHost->GetId(); auto frameId = tmpHost->GetId();
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = tmpHost->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
info.SetStopPropagation(true); info.SetStopPropagation(true);
selectOverlay_->SetLastSourceType(info.GetSourceDevice()); selectOverlay_->SetLastSourceType(info.GetSourceDevice());
@ -3650,7 +3662,7 @@ void TextFieldPattern::HandleMouseEvent(MouseInfo& info)
pipeline->ChangeMouseStyle(frameId, MouseFormat::DEFAULT, windowId); pipeline->ChangeMouseStyle(frameId, MouseFormat::DEFAULT, windowId);
return; return;
} }
ChangeMouseState(info.GetLocalLocation(), pipeline, frameId, info.GetAction() == MouseAction::WINDOW_LEAVE); ChangeMouseState(info.GetLocalLocation(), frameId, info.GetAction() == MouseAction::WINDOW_LEAVE);
selectOverlay_->SetUsingMouse(true); selectOverlay_->SetUsingMouse(true);
if (info.GetButton() == MouseButton::RIGHT_BUTTON) { if (info.GetButton() == MouseButton::RIGHT_BUTTON) {
@ -4347,7 +4359,7 @@ void TextFieldPattern::UltralimitShake()
AceType::MakeRefPtr<InterpolatingSpring>(VELOCITY, MASS, STIFFNESS, DAMPING); AceType::MakeRefPtr<InterpolatingSpring>(VELOCITY, MASS, STIFFNESS, DAMPING);
option.SetCurve(curve); option.SetCurve(curve);
option.SetFillMode(FillMode::FORWARDS); option.SetFillMode(FillMode::FORWARDS);
auto pipelineContext = PipelineContext::GetCurrentContextSafely(); auto pipelineContext = frameNode->GetContext();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
AnimationUtils::Animate( AnimationUtils::Animate(
option, option,
@ -5325,7 +5337,9 @@ void TextFieldPattern::HandleSurfacePositionChanged(int32_t posX, int32_t posY)
void TextFieldPattern::InitSurfaceChangedCallback() void TextFieldPattern::InitSurfaceChangedCallback()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
if (!HasSurfaceChangedCallback()) { if (!HasSurfaceChangedCallback()) {
auto callbackId = pipeline->RegisterSurfaceChangedCallback( auto callbackId = pipeline->RegisterSurfaceChangedCallback(
@ -5342,7 +5356,9 @@ void TextFieldPattern::InitSurfaceChangedCallback()
void TextFieldPattern::InitSurfacePositionChangedCallback() void TextFieldPattern::InitSurfacePositionChangedCallback()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
if (!HasSurfacePositionChangedCallback()) { if (!HasSurfacePositionChangedCallback()) {
auto callbackId = auto callbackId =
@ -7220,7 +7236,9 @@ void TextFieldPattern::DumpScaleInfo()
dumpLog.AddDesc(std::string("-----DumpScaleInfo-----")); dumpLog.AddDesc(std::string("-----DumpScaleInfo-----"));
dumpLog.AddDesc(std::string("MinFontSize:").append(GetMinFontSize())); dumpLog.AddDesc(std::string("MinFontSize:").append(GetMinFontSize()));
dumpLog.AddDesc(std::string("MaxFontSize:").append(GetMaxFontSize())); dumpLog.AddDesc(std::string("MaxFontSize:").append(GetMaxFontSize()));
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto fontScale = pipeline->GetFontScale(); auto fontScale = pipeline->GetFontScale();
auto fontWeightScale = pipeline->GetFontWeightScale(); auto fontWeightScale = pipeline->GetFontWeightScale();
@ -7506,7 +7524,7 @@ void TextFieldPattern::OnAttachToFrameNode()
auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>(); auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>();
CHECK_NULL_VOID(layoutProperty); CHECK_NULL_VOID(layoutProperty);
layoutProperty->UpdateCopyOptions(CopyOptions::Local); layoutProperty->UpdateCopyOptions(CopyOptions::Local);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = frameNode->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto fontManager = pipeline->GetFontManager(); auto fontManager = pipeline->GetFontManager();
if (fontManager) { if (fontManager) {
@ -7679,7 +7697,9 @@ void TextFieldPattern::AfterLayoutProcessCleanResponse(
const RefPtr<CleanNodeResponseArea>& cleanNodeResponseArea) const RefPtr<CleanNodeResponseArea>& cleanNodeResponseArea)
{ {
CHECK_NULL_VOID(cleanNodeResponseArea); CHECK_NULL_VOID(cleanNodeResponseArea);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
pipeline->AddAfterLayoutTask([weak = WeakClaim(cleanNodeResponseArea.GetRawPtr())]() { pipeline->AddAfterLayoutTask([weak = WeakClaim(cleanNodeResponseArea.GetRawPtr())]() {
auto cleanNodeResponseArea = weak.Upgrade(); auto cleanNodeResponseArea = weak.Upgrade();
@ -7990,7 +8010,7 @@ void TextFieldPattern::RegisterWindowSizeCallback()
isOritationListenerRegisted_ = true; isOritationListenerRegisted_ = true;
auto host = GetHost(); auto host = GetHost();
CHECK_NULL_VOID(host); CHECK_NULL_VOID(host);
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
pipeline->AddWindowSizeChangeCallback(host->GetId()); pipeline->AddWindowSizeChangeCallback(host->GetId());
} }
@ -8843,7 +8863,7 @@ void TextFieldPattern::HandleOnAIWrite()
CHECK_NULL_VOID(aiWriteAdapter); CHECK_NULL_VOID(aiWriteAdapter);
aiWriteAdapter->CloseModalUIExtension(); aiWriteAdapter->CloseModalUIExtension();
}; };
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
aiWriteAdapter_->SetPipelineContext(pipeline); aiWriteAdapter_->SetPipelineContext(pipeline);
aiWriteAdapter_->ShowModalUIExtension(info, callback); aiWriteAdapter_->ShowModalUIExtension(info, callback);
@ -9066,7 +9086,9 @@ TextFieldInfo TextFieldPattern::GenerateTextFieldInfo()
void TextFieldPattern::AddTextFieldInfo() void TextFieldPattern::AddTextFieldInfo()
{ {
CHECK_NULL_VOID(IsNeedProcessAutoFill()); CHECK_NULL_VOID(IsNeedProcessAutoFill());
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager()); auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager());
CHECK_NULL_VOID(textFieldManager); CHECK_NULL_VOID(textFieldManager);
@ -9077,12 +9099,12 @@ void TextFieldPattern::AddTextFieldInfo()
void TextFieldPattern::RemoveTextFieldInfo() void TextFieldPattern::RemoveTextFieldInfo()
{ {
CHECK_NULL_VOID(IsNeedProcessAutoFill()); CHECK_NULL_VOID(IsNeedProcessAutoFill());
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager()); auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager());
CHECK_NULL_VOID(textFieldManager); CHECK_NULL_VOID(textFieldManager);
auto host = GetHost();
CHECK_NULL_VOID(host);
auto nodeId = host->GetId(); auto nodeId = host->GetId();
auto autoFillContainerNode = firstAutoFillContainerNode_.Upgrade(); auto autoFillContainerNode = firstAutoFillContainerNode_.Upgrade();
CHECK_NULL_VOID(autoFillContainerNode); CHECK_NULL_VOID(autoFillContainerNode);
@ -9093,7 +9115,9 @@ void TextFieldPattern::RemoveTextFieldInfo()
void TextFieldPattern::UpdateTextFieldInfo() void TextFieldPattern::UpdateTextFieldInfo()
{ {
CHECK_NULL_VOID(IsNeedProcessAutoFill()); CHECK_NULL_VOID(IsNeedProcessAutoFill());
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(pipeline);
auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager()); auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager());
CHECK_NULL_VOID(textFieldManager); CHECK_NULL_VOID(textFieldManager);
@ -9110,12 +9134,12 @@ bool TextFieldPattern::IsAutoFillUserName(const AceAutoFillType& autoFillType)
bool TextFieldPattern::HasAutoFillPasswordNode() bool TextFieldPattern::HasAutoFillPasswordNode()
{ {
auto pipeline = PipelineContext::GetCurrentContextSafely(); auto host = GetHost();
CHECK_NULL_RETURN(host, false);
auto pipeline = host->GetContext();
CHECK_NULL_RETURN(pipeline, false); CHECK_NULL_RETURN(pipeline, false);
auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager()); auto textFieldManager = DynamicCast<TextFieldManagerNG>(pipeline->GetTextFieldManager());
CHECK_NULL_RETURN(textFieldManager, false); CHECK_NULL_RETURN(textFieldManager, false);
auto host = GetHost();
CHECK_NULL_RETURN(host, false);
auto nodeId = host->GetId(); auto nodeId = host->GetId();
auto autoFillContainerNode = firstAutoFillContainerNode_.Upgrade(); auto autoFillContainerNode = firstAutoFillContainerNode_.Upgrade();
CHECK_NULL_RETURN(autoFillContainerNode, false); CHECK_NULL_RETURN(autoFillContainerNode, false);

View File

@ -628,7 +628,7 @@ public:
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "NotifyKeyboardClosed"); TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "NotifyKeyboardClosed");
CHECK_NULL_VOID(HasFocus()); CHECK_NULL_VOID(HasFocus());
CHECK_NULL_VOID(!customKeyboard_ && !customKeyboardBuilder_); CHECK_NULL_VOID(!customKeyboard_ && !customKeyboardBuilder_);
auto pipelineContext = PipelineBase::GetCurrentContextSafely(); auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(pipelineContext); CHECK_NULL_VOID(pipelineContext);
auto windowManager = pipelineContext->GetWindowManager(); auto windowManager = pipelineContext->GetWindowManager();
CHECK_NULL_VOID(windowManager); CHECK_NULL_VOID(windowManager);
@ -826,7 +826,7 @@ public:
void AddDragFrameNodeToManager(const RefPtr<FrameNode>& frameNode) void AddDragFrameNodeToManager(const RefPtr<FrameNode>& frameNode)
{ {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
auto dragDropManager = context->GetDragDropManager(); auto dragDropManager = context->GetDragDropManager();
CHECK_NULL_VOID(dragDropManager); CHECK_NULL_VOID(dragDropManager);
@ -835,7 +835,7 @@ public:
void RemoveDragFrameNodeFromManager(const RefPtr<FrameNode>& frameNode) void RemoveDragFrameNodeFromManager(const RefPtr<FrameNode>& frameNode)
{ {
auto context = PipelineContext::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
auto dragDropManager = context->GetDragDropManager(); auto dragDropManager = context->GetDragDropManager();
CHECK_NULL_VOID(dragDropManager); CHECK_NULL_VOID(dragDropManager);
@ -1609,7 +1609,7 @@ private:
void HandleHoverEffect(MouseInfo& info, bool isHover); void HandleHoverEffect(MouseInfo& info, bool isHover);
void OnHover(bool isHover); void OnHover(bool isHover);
void ChangeMouseState( void ChangeMouseState(
const Offset location, const RefPtr<PipelineContext>& pipeline, int32_t frameId, bool isByPass = false); const Offset location, int32_t frameId, bool isByPass = false);
void HandleMouseEvent(MouseInfo& info); void HandleMouseEvent(MouseInfo& info);
void FocusAndUpdateCaretByMouse(MouseInfo& info); void FocusAndUpdateCaretByMouse(MouseInfo& info);
void HandleRightMouseEvent(MouseInfo& info); void HandleRightMouseEvent(MouseInfo& info);

View File

@ -201,7 +201,7 @@ void PasswordResponseArea::AddEvent(const RefPtr<FrameNode>& node)
auto button = weak.Upgrade(); auto button = weak.Upgrade();
CHECK_NULL_VOID(button); CHECK_NULL_VOID(button);
button->OnPasswordIconClicked(); button->OnPasswordIconClicked();
auto context = PipelineBase::GetCurrentContextSafely(); auto context = PipelineContext::GetCurrentContextSafelyWithCheck();
CHECK_NULL_VOID(context); CHECK_NULL_VOID(context);
auto theme = context->GetTheme<TextFieldTheme>(); auto theme = context->GetTheme<TextFieldTheme>();
CHECK_NULL_VOID(theme); CHECK_NULL_VOID(theme);

View File

@ -2145,19 +2145,18 @@ HWTEST_F(TextFieldPatternTest, TextPattern092, TestSize.Level0)
auto tmpHost = pattern->GetHost(); auto tmpHost = pattern->GetHost();
CHECK_NULL_VOID(tmpHost); CHECK_NULL_VOID(tmpHost);
auto frameId = tmpHost->GetId(); auto frameId = tmpHost->GetId();
auto pipeline = PipelineContext::GetCurrentContextSafely();
Offset offset1(1.0, -1.0); Offset offset1(1.0, -1.0);
pattern->frameRect_ = RectF(0, 0, 0, 0); pattern->frameRect_ = RectF(0, 0, 0, 0);
pattern->ChangeMouseState(offset1, pipeline, frameId, true); pattern->ChangeMouseState(offset1, frameId, true);
Offset offset2(1.0, -1.0); Offset offset2(1.0, -1.0);
pattern->frameRect_ = RectF(0, 0, 10, 0); pattern->frameRect_ = RectF(0, 0, 10, 0);
pattern->ChangeMouseState(offset2, pipeline, frameId, true); pattern->ChangeMouseState(offset2, frameId, true);
Offset offset3(1.0, 1.0); Offset offset3(1.0, 1.0);
pattern->frameRect_ = RectF(0, 0, 10, 0); pattern->frameRect_ = RectF(0, 0, 10, 0);
pattern->ChangeMouseState(offset3, pipeline, frameId, true); pattern->ChangeMouseState(offset3, frameId, true);
Offset offset4(1.0, 1.0); Offset offset4(1.0, 1.0);
pattern->frameRect_ = RectF(0, 0, 10, 50); pattern->frameRect_ = RectF(0, 0, 10, 50);
pattern->ChangeMouseState(offset4, pipeline, frameId, true); pattern->ChangeMouseState(offset4, frameId, true);
} }
/** /**