mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 23:21:05 +00:00
Merge branch 'master' into ndk_rn
Change-Id: I34886bf8ded2a58cbd409f0eee25804886cffa4d
This commit is contained in:
commit
c5d2efc5f3
@ -80,8 +80,8 @@ frameworks/core/components_ng/pattern/grid_col/ @xiexiyun
|
||||
frameworks/core/components_ng/pattern/grid_container/ @xiexiyun
|
||||
frameworks/core/components_ng/pattern/grid_row/ @xiexiyun
|
||||
frameworks/core/components_ng/pattern/hyperlink/ @techbuilding
|
||||
frameworks/core/components_ng/pattern/image/ @xiexiyun
|
||||
frameworks/core/components_ng/pattern/image_animator/ @hehongyang9
|
||||
frameworks/core/components_ng/pattern/image/ @wu-yinxiao
|
||||
frameworks/core/components_ng/pattern/image_animator/ @wu-yinxiao
|
||||
frameworks/core/components_ng/pattern/indexer/ @Zhang-Dong-hui
|
||||
frameworks/core/components_ng/pattern/linear_layout/ @xiexiyun
|
||||
frameworks/core/components_ng/pattern/linear_split/ @xiexiyun
|
||||
@ -185,7 +185,7 @@ frameworks/core/components/grid/ @zcdqs
|
||||
frameworks/core/components/grid_layout/ @zcdqs
|
||||
frameworks/core/components/hyperlink/ @techbuilding
|
||||
frameworks/core/components/ifelse/ @yan-shuifeng
|
||||
frameworks/core/components/image/ @xiexiyun
|
||||
frameworks/core/components/image/ @wu-yinxiao
|
||||
frameworks/core/components/indexer/ @Zhang-Dong-hui
|
||||
frameworks/core/components/list/ @yeyinglong_admin
|
||||
frameworks/core/components/marquee/ @liyujie43
|
||||
@ -281,9 +281,9 @@ frameworks/core/gestures/ @zheng-qiyi
|
||||
frameworks/core/components_ng/gestures/ @zheng-qiyi
|
||||
|
||||
[Image source]
|
||||
frameworks/core/image/ @xiexiyun
|
||||
frameworks/core/components_ng/image_provider/ @xiexiyun
|
||||
frameworks/core/components_ng/svg/ @xiexiyun
|
||||
frameworks/core/image/ @wu-yinxiao
|
||||
frameworks/core/components_ng/image_provider/ @wu-yinxiao
|
||||
frameworks/core/components_ng/svg/ @wu-yinxiao
|
||||
|
||||
[Advanced UI Components]
|
||||
advanced_ui_component/ @youzhi92
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ lite/jsfwk/
|
||||
lite/maplejs/
|
||||
lite/tools/
|
||||
lite/ui/
|
||||
.clangd
|
||||
|
@ -94,6 +94,7 @@ if (defined(global_parts_info.graphic_graphic_3d)) {
|
||||
|
||||
window_scene_support = true
|
||||
dynamic_component_support = true
|
||||
vsync_timeout_check = true
|
||||
|
||||
if (defined(preview_support) && preview_support) {
|
||||
defines += [ "PREVIEW" ]
|
||||
@ -194,6 +195,10 @@ if (dynamic_component_support) {
|
||||
defines += [ "DYNAMIC_COMPONENT_SUPPORT" ]
|
||||
}
|
||||
|
||||
if (vsync_timeout_check) {
|
||||
defines += [ "VSYNC_TIMEOUT_CHECK" ]
|
||||
}
|
||||
|
||||
cflags_cc = [
|
||||
"-Wno-thread-safety-attributes",
|
||||
"-Wno-thread-safety-analysis",
|
||||
|
@ -78,6 +78,9 @@ constexpr char STATECHANGE[] = "STATECHANGE";
|
||||
constexpr char MAXMENUITEM[] = "MAXMENUITEM";
|
||||
constexpr char CHANGEDEFAULTSETTING[] = "CHANGEDEFAULTSETTING";
|
||||
constexpr char SCENE_BOARD_UE_DOMAIN[] = "SCENE_BOARD_UE";
|
||||
#ifdef VSYNC_TIMEOUT_CHECK
|
||||
constexpr char EXECPTION_VSYNC[] = "VSYNC_EXCEPTION";
|
||||
#endif
|
||||
|
||||
void StrTrim(std::string& str)
|
||||
{
|
||||
@ -221,6 +224,17 @@ void EventReport::SendFormException(FormExcepType type)
|
||||
|
||||
SendEventInner(eventInfo);
|
||||
}
|
||||
#ifdef VSYNC_TIMEOUT_CHECK
|
||||
void EventReport::SendVsyncException(VsyncExcepType type)
|
||||
{
|
||||
EventInfo eventInfo = {
|
||||
.eventType = EXECPTION_VSYNC,
|
||||
.errorType = static_cast<int32_t>(type),
|
||||
};
|
||||
|
||||
SendEventInner(eventInfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
void EventReport::JsEventReport(int32_t eventType, const std::string& jsonStr)
|
||||
{
|
||||
|
@ -84,6 +84,8 @@ bool FrameReport::LoadLibrary()
|
||||
CHECK_NULL_RETURN(flushBeginFunc_, false);
|
||||
flushEndFunc_ = (FlushEndFunc)LoadSymbol("FlushEnd");
|
||||
CHECK_NULL_RETURN(flushEndFunc_, false);
|
||||
setFrameParamFunc_ = (SetFrameParamFunc)LoadSymbol("SetFrameParam");
|
||||
CHECK_NULL_RETURN(setFrameParamFunc_, false);
|
||||
frameSchedSoLoaded_ = true;
|
||||
}
|
||||
return true;
|
||||
@ -253,4 +255,12 @@ void FrameReport::FlushEnd()
|
||||
}
|
||||
flushEndFunc_();
|
||||
}
|
||||
|
||||
void FrameReport::SetFrameParam(int requestId, int load, int schedFrameNum, int value)
|
||||
{
|
||||
if (!enable_) {
|
||||
return;
|
||||
}
|
||||
setFrameParamFunc_(requestId, load, schedFrameNum, value);
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -131,4 +131,9 @@ void FrameReport::FlushEnd()
|
||||
{
|
||||
flushEndFunc_ = nullptr;
|
||||
}
|
||||
|
||||
void FrameReport::SetFrameParam(int requestId, int load, int schedFrameNum, int value)
|
||||
{
|
||||
setFrameParamFunc_ = nullptr;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -61,6 +61,12 @@ const OPERATEITEM_IMAGE_SIZE = 48;
|
||||
const HOVERING_COLOR = "#0d000000";
|
||||
const TOUCH_DOWN_COLOR = "#1a000000";
|
||||
const ACTIVED_COLOR = "#1a0a59f7";
|
||||
const RIGHT_CONTENT_NULL_LEFTWIDTH = '100%';
|
||||
const RIGHT_CONTENT_NULL_RIGHTWIDTH = '0vp';
|
||||
const LEFT_PART_WIDTH = 'calc(66% - 16vp)';
|
||||
const RIGHT_PART_WIDTH = '34%';
|
||||
const LEFT_ONLY_ARROW_WIDTH = 'calc(100% - 40vp)';
|
||||
const RIGHT_ONLY_ARROW_WIDTH = '24vp';
|
||||
const ICON_SIZE_MAP = new Map([[IconType.BADGE, 8], [IconType.NORMAL_ICON, 16], [IconType.SYSTEM_ICON, 24], [IconType.HEAD_SCULPTURE, 40], [IconType.APP_ICON, 64], [IconType.PREVIEW, 96], [IconType.LONGITUDINAL, 96], [IconType.VERTICAL, 96]]);
|
||||
|
||||
class ContentItemStruct extends ViewPU {
|
||||
@ -72,6 +78,7 @@ class ContentItemStruct extends ViewPU {
|
||||
this.secondaryText = null;
|
||||
this.description = null;
|
||||
this.itemRowSpace = 16;
|
||||
this.__leftWidth = new ObservedPropertySimplePU('calc(66% - 16vp)', this, 'leftWidth');;
|
||||
this.setInitiallyProvidedValue(t)
|
||||
}
|
||||
|
||||
@ -81,20 +88,31 @@ class ContentItemStruct extends ViewPU {
|
||||
void 0 !== e.primaryText && (this.primaryText = e.primaryText);
|
||||
void 0 !== e.secondaryText && (this.secondaryText = e.secondaryText);
|
||||
void 0 !== e.description && (this.description = e.description);
|
||||
void 0 !== e.itemRowSpace && (this.itemRowSpace = e.itemRowSpace)
|
||||
void 0 !== e.itemRowSpace && (this.itemRowSpace = e.itemRowSpace);
|
||||
void 0 !== e.leftWidth && (this.leftWidth = e.leftWidth)
|
||||
}
|
||||
|
||||
updateStateVars(e) {
|
||||
}
|
||||
|
||||
purgeVariableDependenciesOnElmtId(e) {
|
||||
this.__leftWidth.purgeDependencyOnElmtId(e)
|
||||
}
|
||||
|
||||
aboutToBeDeleted() {
|
||||
this.__leftWidth.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id__());
|
||||
this.aboutToBeDeletedInternal()
|
||||
}
|
||||
|
||||
get leftWidth() {
|
||||
return this.__leftWidth.get()
|
||||
}
|
||||
|
||||
set leftWidth(e) {
|
||||
this.__leftWidth.set(e)
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
null == this.icon && null == this.iconStyle && (this.itemRowSpace = 0)
|
||||
}
|
||||
@ -288,7 +306,7 @@ class ContentItemStruct extends ViewPU {
|
||||
Row.create({ space: this.itemRowSpace });
|
||||
Row.margin({ right: 16 });
|
||||
Row.padding({ left: 8 });
|
||||
Row.width("calc(66% - 16vp)");
|
||||
Row.width(this.leftWidth);
|
||||
Row.flexShrink(1);
|
||||
t || Row.pop();
|
||||
ViewStackProcessor.StopGetAccessRecording()
|
||||
@ -318,6 +336,7 @@ class OperateItemStruct extends ViewPU {
|
||||
this.__switchState = new ObservedPropertySimplePU(!1, this, "switchState");
|
||||
this.__radioState = new ObservedPropertySimplePU(!1, this, "radioState");
|
||||
this.__checkBoxState = new ObservedPropertySimplePU(!1, this, "checkBoxState");
|
||||
this.__rightWidth = new ObservedPropertySimplePU('34%', this, 'rightWidth');
|
||||
this.__parentCanFocus = new SynchedPropertySimpleTwoWayPU(t.parentCanFocus, this, "parentCanFocus");
|
||||
this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(t.parentCanTouch, this, "parentCanTouch");
|
||||
this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(t.parentIsHover, this, "parentIsHover");
|
||||
@ -341,6 +360,7 @@ class OperateItemStruct extends ViewPU {
|
||||
void 0 !== e.switchState && (this.switchState = e.switchState);
|
||||
void 0 !== e.radioState && (this.radioState = e.radioState);
|
||||
void 0 !== e.checkBoxState && (this.checkBoxState = e.checkBoxState);
|
||||
void 0 !== e.rightWidth && (this.rightWidth = e.rightWidth);
|
||||
void 0 !== e.rowSpace && (this.rowSpace = e.rowSpace)
|
||||
}
|
||||
|
||||
@ -351,6 +371,7 @@ class OperateItemStruct extends ViewPU {
|
||||
this.__switchState.purgeDependencyOnElmtId(e);
|
||||
this.__radioState.purgeDependencyOnElmtId(e);
|
||||
this.__checkBoxState.purgeDependencyOnElmtId(e);
|
||||
this.__rightWidth.purgeDependencyOnElmtId(e);
|
||||
this.__parentCanFocus.purgeDependencyOnElmtId(e);
|
||||
this.__parentCanTouch.purgeDependencyOnElmtId(e);
|
||||
this.__parentIsHover.purgeDependencyOnElmtId(e);
|
||||
@ -363,6 +384,7 @@ class OperateItemStruct extends ViewPU {
|
||||
this.__switchState.aboutToBeDeleted();
|
||||
this.__radioState.aboutToBeDeleted();
|
||||
this.__checkBoxState.aboutToBeDeleted();
|
||||
this.__rightWidth.aboutToBeDeleted();
|
||||
this.__parentCanFocus.aboutToBeDeleted();
|
||||
this.__parentCanTouch.aboutToBeDeleted();
|
||||
this.__parentIsHover.aboutToBeDeleted();
|
||||
@ -397,6 +419,14 @@ class OperateItemStruct extends ViewPU {
|
||||
this.__checkBoxState.set(e)
|
||||
}
|
||||
|
||||
get rightWidth() {
|
||||
return this.__rightWidth.get()
|
||||
}
|
||||
|
||||
set rightWidth(e) {
|
||||
this.__rightWidth.set(e)
|
||||
}
|
||||
|
||||
get parentCanFocus() {
|
||||
return this.__parentCanFocus.get()
|
||||
}
|
||||
@ -853,7 +883,7 @@ class OperateItemStruct extends ViewPU {
|
||||
this.observeComponentCreation(((e, t) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(e);
|
||||
Row.create({ space: this.rowSpace });
|
||||
Row.width("34%");
|
||||
Row.width(this.rightWidth);
|
||||
Row.flexShrink(1);
|
||||
Row.justifyContent(FlexAlign.End);
|
||||
t || Row.pop();
|
||||
@ -1055,6 +1085,14 @@ export class ComposeListItem extends ViewPU {
|
||||
} else undefined === this.operateItem.image && undefined === this.operateItem.icon && undefined === this.operateItem.subIcon || (this.itemHeight = 80)
|
||||
}
|
||||
|
||||
calculatedLeftWidth() {
|
||||
null === this.operateItem || '{}' === JSON.stringify(this.operateItem)? '100%' : null != this.operateItem.arrow && null == this.operateItem.text? 'calc(100% - 40vp)' : 'calc(66% - 16vp)';
|
||||
}
|
||||
|
||||
calculatedRightWidth() {
|
||||
null === this.operateItem || '{}' === JSON.stringify(this.operateItem)? '0vp' : null != this.operateItem.arrow && null == this.operateItem.text? '24vp' : '34%';
|
||||
}
|
||||
|
||||
initialRender() {
|
||||
this.observeComponentCreation(((e, t) => {
|
||||
ViewStackProcessor.StartGetAccessRecordingFor(e);
|
||||
@ -1165,7 +1203,8 @@ export class ComposeListItem extends ViewPU {
|
||||
iconStyle: this.contentItem.iconStyle,
|
||||
primaryText: "string" == typeof this.contentItem.primaryText ? this.contentItem.primaryText : null,
|
||||
secondaryText: "string" == typeof this.contentItem.secondaryText ? this.contentItem.secondaryText : null,
|
||||
description: "string" == typeof this.contentItem.description ? this.contentItem.description : null
|
||||
description: "string" == typeof this.contentItem.description ? this.contentItem.description : null,
|
||||
leftWidth: this.calculatedLeftWidth()
|
||||
}, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
|
||||
ViewStackProcessor.StopGetAccessRecording()
|
||||
}))
|
||||
@ -1207,7 +1246,8 @@ export class ComposeListItem extends ViewPU {
|
||||
parentIsHover: this.__isHover,
|
||||
parentFrontColor: this.__frontColor,
|
||||
parentIsActive: this.__isActive,
|
||||
parentCanHover: this.__canHover
|
||||
parentCanHover: this.__canHover,
|
||||
rightWidth: this.calculatedRightWidth()
|
||||
}, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
|
||||
ViewStackProcessor.StopGetAccessRecording()
|
||||
}));
|
||||
|
@ -95,6 +95,12 @@ const OPERATEITEM_IMAGE_SIZE = 48;
|
||||
const HOVERING_COLOR = '#0d000000';
|
||||
const TOUCH_DOWN_COLOR = '#1a000000';
|
||||
const ACTIVED_COLOR = '#1a0a59f7';
|
||||
const RIGHT_CONTENT_NULL_LEFTWIDTH = '100%';
|
||||
const RIGHT_CONTENT_NULL_RIGHTWIDTH = '0vp';
|
||||
const LEFT_PART_WIDTH = 'calc(66% - 16vp)';
|
||||
const RIGHT_PART_WIDTH = '34%';
|
||||
const LEFT_ONLY_ARROW_WIDTH = 'calc(100% - 40vp)';
|
||||
const RIGHT_ONLY_ARROW_WIDTH = '24vp';
|
||||
const ICON_SIZE_MAP: Map<number, number> = new Map([
|
||||
[IconType.BADGE, BADGE_SIZE],
|
||||
[IconType.NORMAL_ICON, SMALL_ICON_SIZE],
|
||||
@ -114,6 +120,7 @@ struct ContentItemStruct {
|
||||
secondaryText: string = null
|
||||
description: string = null
|
||||
private itemRowSpace: number = NORMAL_ITEM_ROW_SPACE
|
||||
@State leftWidth: string = LEFT_PART_WIDTH
|
||||
|
||||
aboutToAppear() {
|
||||
if (this.icon == null && this.iconStyle == null) {
|
||||
@ -196,7 +203,7 @@ struct ContentItemStruct {
|
||||
}
|
||||
.margin({ right: 16 })
|
||||
.padding({ left: LISTITEM_PADDING })
|
||||
.width('calc(66% - 16vp)')
|
||||
.width(this.leftWidth)
|
||||
.flexShrink(1)
|
||||
}
|
||||
}
|
||||
@ -215,6 +222,7 @@ struct OperateItemStruct {
|
||||
@State switchState: boolean = false
|
||||
@State radioState: boolean = false
|
||||
@State checkBoxState: boolean = false
|
||||
@State rightWidth: string = RIGHT_PART_WIDTH
|
||||
@Link parentCanFocus: boolean
|
||||
@Link parentCanTouch: boolean
|
||||
@Link parentIsHover: boolean
|
||||
@ -592,7 +600,7 @@ struct OperateItemStruct {
|
||||
}
|
||||
}
|
||||
}
|
||||
.width('34%')
|
||||
.width(this.rightWidth)
|
||||
.flexShrink(1)
|
||||
.justifyContent(FlexAlign.End)
|
||||
}
|
||||
@ -644,6 +652,26 @@ export struct ComposeListItem {
|
||||
}
|
||||
}
|
||||
|
||||
calculatedLeftWidth(): string {
|
||||
if (this.operateItem === null || JSON.stringify(this.operateItem) === '{}') {
|
||||
return RIGHT_CONTENT_NULL_LEFTWIDTH
|
||||
} else if (this.operateItem.arrow != null && this.operateItem.text == null) {
|
||||
return LEFT_ONLY_ARROW_WIDTH
|
||||
} else {
|
||||
return LEFT_PART_WIDTH
|
||||
}
|
||||
}
|
||||
|
||||
calculatedRightWidth(): string {
|
||||
if (this.operateItem === null || JSON.stringify(this.operateItem) === '{}') {
|
||||
return RIGHT_CONTENT_NULL_RIGHTWIDTH
|
||||
} else if (this.operateItem.arrow != null && this.operateItem.text == null) {
|
||||
return RIGHT_ONLY_ARROW_WIDTH
|
||||
} else {
|
||||
return RIGHT_PART_WIDTH
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
@ -656,7 +684,8 @@ export struct ComposeListItem {
|
||||
iconStyle: this.contentItem.iconStyle,
|
||||
primaryText: typeof this.contentItem.primaryText === 'string' ? this.contentItem.primaryText : null,
|
||||
secondaryText: typeof this.contentItem.secondaryText === 'string' ? this.contentItem.secondaryText : null,
|
||||
description: typeof this.contentItem.description === 'string' ? this.contentItem.description : null
|
||||
description: typeof this.contentItem.description === 'string' ? this.contentItem.description : null,
|
||||
leftWidth: this.calculatedLeftWidth()
|
||||
})
|
||||
}
|
||||
if (this.operateItem !== null) {
|
||||
@ -675,7 +704,8 @@ export struct ComposeListItem {
|
||||
parentIsHover: this.isHover,
|
||||
parentFrontColor: this.frontColor,
|
||||
parentIsActive: this.isActive,
|
||||
parentCanHover: this.canHover
|
||||
parentCanHover: this.canHover,
|
||||
rightWidth: this.calculatedRightWidth()
|
||||
})
|
||||
.onFocus(() => {
|
||||
this.canFocus = false
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import hilog from '@ohos.hilog';
|
||||
import resourceManager from '@ohos.resourceManager';
|
||||
import measure from '@ohos.measure';
|
||||
|
||||
const TITLE_MAX_LINES: number = 2;
|
||||
const HORIZON_BUTTON_MAX_COUNT: number = 2;
|
||||
@ -34,6 +35,8 @@ const LOADING_MAX_LINES: number = 10;
|
||||
const LOADING_TEXT_LAYOUT_WEIGHT: number = 1;
|
||||
const LOADING_TEXT_MARGIN_LEFT: number = 12;
|
||||
const LOADING_MIN_HEIGHT: number = 48;
|
||||
const LIST_MIN_HEIGHT: number = 48
|
||||
const CHECKBOX_CONTAINER_LENGTH: number = 20
|
||||
export declare type ButtonOptions = {
|
||||
value: ResourceStr;
|
||||
action?: () => void;
|
||||
@ -158,37 +161,34 @@ export struct TipsDialog{
|
||||
|
||||
@CustomDialog
|
||||
export struct SelectDialog{
|
||||
controller: CustomDialogController
|
||||
title: ResourceStr = ''
|
||||
content?: ResourceStr = ''
|
||||
selectedIndex?: number = -1
|
||||
confirm?: ButtonOptions = {value: ""}
|
||||
radioContent: Array<SheetInfo> = []
|
||||
title: ResourceStr = '';
|
||||
content?: ResourceStr = '';
|
||||
selectedIndex?: number = -1;
|
||||
confirm?: ButtonOptions = {value: ""};
|
||||
radioContent: Array<SheetInfo> = [];
|
||||
@BuilderParam contentBuilder: () => void = this.buildContent;
|
||||
controller: CustomDialogController = new CustomDialogController({
|
||||
builder: CustomContentDialog({
|
||||
primaryTitle: this.title,
|
||||
contentBuilder: () => {
|
||||
this.contentBuilder();
|
||||
},
|
||||
buttons: (this.confirm === undefined || this.confirm?.value === "") ? [] : [this.confirm],
|
||||
})
|
||||
});
|
||||
|
||||
build() {
|
||||
@Builder
|
||||
buildContent() : void {
|
||||
Scroll() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text(this.title)
|
||||
.fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.maxLines(CONTENT_MAX_LINES)
|
||||
.minFontSize(15)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis})
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.width('100%')
|
||||
}.padding({ left: 24, right: 24, top: 24 })
|
||||
.constraintSize({minHeight: 56})
|
||||
if (this.content) {
|
||||
Row() {
|
||||
Text(this.content)
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.maxLines(CONTENT_MAX_LINES)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis})
|
||||
.minFontSize($r('sys.float.ohos_id_text_size_body3'))
|
||||
}.padding({ left: 24, right: 24, top: 8, bottom: 8 })
|
||||
.fontSize($r('sys.float.Body_M'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r('sys.color.font_primary'))
|
||||
.textOverflow({overflow: TextOverflow.Ellipsis})
|
||||
}.padding({bottom: $r('sys.float.padding_level4')})
|
||||
.width('100%')
|
||||
}
|
||||
List({space: 1}) {
|
||||
@ -197,54 +197,44 @@ export struct SelectDialog{
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.title)
|
||||
.fontSize(ITEM_TEXT_SIZE)
|
||||
.fontSize($r('sys.float.Body_L'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.maxLines(CONTENT_MAX_LINES)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontColor($r('sys.color.font_primary'))
|
||||
.layoutWeight(1)
|
||||
Radio({ value: 'item.title', group: 'radioGroup'})
|
||||
.size({ width : 20, height : 20})
|
||||
Radio({value: 'item.title', group: 'radioGroup'})
|
||||
.size({width : CHECKBOX_CONTAINER_LENGTH, height : CHECKBOX_CONTAINER_LENGTH})
|
||||
.checked(this.selectedIndex == index)
|
||||
.onClick(() => {
|
||||
item.action && item.action()
|
||||
this.controller.close()
|
||||
})
|
||||
}.constraintSize({minHeight: 48}).clip(false)
|
||||
}.constraintSize({minHeight: LIST_MIN_HEIGHT}).clip(false)
|
||||
.padding({ top: $r('sys.float.padding_level4'), bottom: $r('sys.float.padding_level4') })
|
||||
.onClick(() => {
|
||||
item.action && item.action()
|
||||
this.controller.close()
|
||||
})
|
||||
if (index < this.radioContent.length - 1) {
|
||||
Divider().color($r('sys.color.ohos_id_color_list_separator'))
|
||||
Divider().color($r('sys.color.comp_divider'))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}.width('100%').padding({ left: 24, right: 24, top: 8, bottom: 8 }).clip(false)
|
||||
Row() {
|
||||
if (this.confirm.value) {
|
||||
Button(this.confirm.value)
|
||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
.backgroundColor(this.confirm.background? this.confirm.background: $r('sys.color.ohos_id_color_background_transparent'))
|
||||
.fontColor(this.confirm.fontColor ? this.confirm.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.onClick(() => {
|
||||
this.confirm.action && this.confirm.action()
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
}.width('100%').padding({ left: 16, right: 16, top: 16, bottom: 16 })
|
||||
}
|
||||
.backgroundBlurStyle(BlurStyle.Thick)
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.margin({
|
||||
left: $r('sys.float.ohos_id_dialog_margin_start'),
|
||||
right: $r('sys.float.ohos_id_dialog_margin_end'),
|
||||
bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
|
||||
})
|
||||
// 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
}.width('100%').clip(false)
|
||||
}.padding({right: $r('sys.float.padding_level8')})
|
||||
}.margin({right: -getNumberByResource('padding_level8')})
|
||||
.scrollBar(BarState.Auto)
|
||||
}
|
||||
|
||||
build() {
|
||||
CustomDialogContentComponent({
|
||||
controller: this.controller,
|
||||
primaryTitle: this.title,
|
||||
contentBuilder: () => {
|
||||
this.contentBuilder();
|
||||
},
|
||||
buttons: (this.confirm === undefined || this.confirm.value === "") ? [] : [this.confirm],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,67 +340,82 @@ export struct ConfirmDialog{
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
export struct AlertDialog{
|
||||
controller: CustomDialogController
|
||||
content: ResourceStr = ''
|
||||
primaryButton?: ButtonOptions = {value: ""}
|
||||
secondaryButton?: ButtonOptions = {value: ""}
|
||||
export struct AlertDialog {
|
||||
controller: CustomDialogController;
|
||||
content: ResourceStr = '';
|
||||
primaryButton?: ButtonOptions | null = null;
|
||||
secondaryButton?: ButtonOptions | null = null;
|
||||
buttons?: ButtonOptions[] | undefined = undefined;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text(this.content)
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
}.padding({
|
||||
left: 24,
|
||||
right: 24,
|
||||
top: 24,
|
||||
bottom: this.secondaryButton.value || this.primaryButton.value ? 0 : 24
|
||||
})
|
||||
Row() {
|
||||
if (this.primaryButton.value) {
|
||||
Button(this.primaryButton.value)
|
||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
.backgroundColor(this.primaryButton.background? this.primaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
|
||||
.fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.onClick(() => {
|
||||
if (this.primaryButton.action) this.primaryButton.action()
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
if (this.secondaryButton.value && this.primaryButton.value) {
|
||||
Column() {
|
||||
if (!this.secondaryButton.background) {
|
||||
Divider().width(DIVIDER_WIDTH).height(DIVIDER_HEIGHT).color($r('sys.color.ohos_id_color_list_separator')).vertical(true)
|
||||
}
|
||||
}.width(DIVIDER_CONTAINER_WIDTH).alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
if (this.secondaryButton.value) {
|
||||
Button(this.secondaryButton.value)
|
||||
.fontSize($r('sys.float.ohos_id_text_size_button1'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
.backgroundColor(this.secondaryButton.background? this.secondaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
|
||||
.fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.onClick(() => {
|
||||
if (this.secondaryButton.action) this.secondaryButton.action()
|
||||
this.controller.close()
|
||||
})
|
||||
}
|
||||
}.width('100%').padding({ left: 16, right: 16, top: 16, bottom: 16 })
|
||||
}
|
||||
.backgroundBlurStyle(BlurStyle.Thick)
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.margin({
|
||||
left: $r('sys.float.ohos_id_dialog_margin_start'),
|
||||
right: $r('sys.float.ohos_id_dialog_margin_end'),
|
||||
bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
|
||||
CustomDialogContentComponent({
|
||||
controller: this.controller,
|
||||
contentBuilder: () => {
|
||||
this.AlertDialogContentBuilder();
|
||||
},
|
||||
buttons: this.buttons,
|
||||
})
|
||||
// 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
}
|
||||
|
||||
@Builder
|
||||
AlertDialogContentBuilder(): void {
|
||||
Column() {
|
||||
Scroll() {
|
||||
Text(this.content)
|
||||
.fontSize($r('sys.float.Body_L'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('sys.color.font_primary'))
|
||||
.margin({ right: $r('sys.float.padding_level8'), })
|
||||
.width(`calc(100% - ${getNumberByResource('padding_level8')}vp)`)
|
||||
.textAlign(this.getTextAlign())
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.margin({ right: `${this.getMargin()}vp`, })
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.initButtons();
|
||||
}
|
||||
|
||||
private getTextAlign(): TextAlign {
|
||||
let contentSize: SizeOptions = measure.measureTextSize({
|
||||
textContent: this.content,
|
||||
fontSize: $r('sys.float.Body_L'),
|
||||
});
|
||||
let oneLineSize: SizeOptions = measure.measureTextSize({
|
||||
textContent: '1',
|
||||
fontSize: $r('sys.float.Body_L'),
|
||||
});
|
||||
|
||||
if (this.getTextHeight(contentSize) <= this.getTextHeight(oneLineSize)) {
|
||||
return TextAlign.Center;
|
||||
}
|
||||
return TextAlign.Start;
|
||||
}
|
||||
|
||||
private getTextHeight(textSize: SizeOptions): number {
|
||||
if (textSize && textSize.height !== null && textSize.height !== undefined) {
|
||||
return Number(textSize.height);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private initButtons(): void {
|
||||
if (!this.primaryButton && !this.secondaryButton) {
|
||||
return;
|
||||
}
|
||||
this.buttons = [];
|
||||
if (this.primaryButton) {
|
||||
this.buttons.push(this.primaryButton);
|
||||
}
|
||||
if (this.secondaryButton) {
|
||||
this.buttons.push(this.secondaryButton);
|
||||
}
|
||||
}
|
||||
|
||||
private getMargin(): number {
|
||||
return 0 - getNumberByResource('padding_level8');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,6 @@ template("libace_static") {
|
||||
deps += [
|
||||
"$ace_root/frameworks/bridge/declarative_frontend:declarative_js_engine_ark_$platform",
|
||||
"$ace_root/frameworks/bridge/js_frontend/engine:js_engine_ark_$platform",
|
||||
"$ace_root/frameworks/core/interfaces/native/svg:ace_core_interfaces_native_svg_$platform",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -137,6 +137,12 @@ enum class FormExcepType {
|
||||
ACTION_EVENT_CALLBACK_ERR,
|
||||
};
|
||||
|
||||
#ifdef VSYNC_TIMEOUT_CHECK
|
||||
enum class VsyncExcepType {
|
||||
VSYNC_TIMEOUT
|
||||
};
|
||||
#endif
|
||||
|
||||
enum class RawEventType { WARNING, FREEZE, RECOVER };
|
||||
|
||||
struct EventInfo {
|
||||
@ -164,6 +170,9 @@ public:
|
||||
static void SendInternalException(InternalExcepType type);
|
||||
static void SendAccessibilityException(AccessibilityExcepType type);
|
||||
static void SendFormException(FormExcepType type);
|
||||
#ifdef VSYNC_TIMEOUT_CHECK
|
||||
static void SendVsyncException(VsyncExcepType type);
|
||||
#endif
|
||||
|
||||
static void JsEventReport(int32_t eventType, const std::string& jsonStr);
|
||||
static void JsErrReport(
|
||||
|
@ -39,6 +39,7 @@ using BeginListFlingFunc = void (*)();
|
||||
using EndListFlingFunc = void (*)();
|
||||
using FlushBeginFunc = void (*)();
|
||||
using FlushEndFunc = void (*)();
|
||||
using SetFrameParamFunc = void (*)(int, int, int, int);
|
||||
|
||||
class ACE_EXPORT FrameReport final {
|
||||
public:
|
||||
@ -61,6 +62,7 @@ public:
|
||||
void EndListFling();
|
||||
void FlushBegin();
|
||||
void FlushEnd();
|
||||
void SetFrameParam(int requestId, int load, int schedFrameNum, int value);
|
||||
|
||||
private:
|
||||
FrameReport();
|
||||
@ -90,6 +92,7 @@ private:
|
||||
ACE_EXPORT EndListFlingFunc endListFlingFunc_ = nullptr;
|
||||
ACE_EXPORT FlushBeginFunc flushBeginFunc_ = nullptr;
|
||||
ACE_EXPORT FlushEndFunc flushEndFunc_ = nullptr;
|
||||
ACE_EXPORT SetFrameParamFunc setFrameParamFunc_ = nullptr;
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_FRAME_REPORT_H
|
||||
|
@ -101,6 +101,22 @@ class ArkAlphabetIndexerComponent extends ArkComponent implements AlphabetIndexe
|
||||
modifierWithKey(this._modifiersWithKeys, PopupPositionModifier.identity, PopupPositionModifier, value);
|
||||
return this;
|
||||
}
|
||||
popupItemBorderRadius(value: number): this {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupItemBorderRadiusModifier.identity, PopupItemBorderRadiusModifier, value);
|
||||
return this;
|
||||
}
|
||||
itemBorderRadius(value: number): this {
|
||||
modifierWithKey(this._modifiersWithKeys, ItemBorderRadiusModifier.identity, ItemBorderRadiusModifier, value);
|
||||
return this;
|
||||
}
|
||||
popupBackgroundBlurStyle(value: BlurStyle): this {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupBackgroundBlurStyleModifier.identity, PopupBackgroundBlurStyleModifier, value);
|
||||
return this;
|
||||
}
|
||||
popupTitleBackground(value: ResourceColor): this {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupTitleBackgroundModifier.identity, PopupTitleBackgroundModifier, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
globalThis.AlphabetIndexer.attributeModifier = function (modifier) {
|
||||
@ -426,3 +442,59 @@ class PopupPositionModifier extends ModifierWithKey<Position> {
|
||||
return !xEQ || !yEQ;
|
||||
}
|
||||
}
|
||||
|
||||
class PopupItemBorderRadiusModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('popupItemBorderRadius');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetPopupItemBorderRadius(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setPopupItemBorderRadius(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ItemBorderRadiusModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('itemBorderRadius');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetItemBorderRadius(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setItemBorderRadius(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PopupBackgroundBlurStyleModifier extends ModifierWithKey<BlurStyle> {
|
||||
constructor(value: BlurStyle) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('popupBackgroundBlurStyle');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetPopupBackgroundBlurStyle(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setPopupBackgroundBlurStyle(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PopupTitleBackgroundModifier extends ModifierWithKey<ResourceColor> {
|
||||
constructor(value: ResourceColor) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('popupTitleBackground');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetPopupTitleBackground(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setPopupTitleBackground(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -28,6 +28,41 @@ class ArkRefreshComponent extends ArkComponent implements RefreshAttribute {
|
||||
onRefreshing(callback: () => void): this {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
refreshOffset(value: number): this {
|
||||
modifierWithKey(this._modifiersWithKeys, RefreshOffsetModifier.identity, RefreshOffsetModifier, value);
|
||||
return this;
|
||||
}
|
||||
pullToRefresh(value: boolean): this {
|
||||
modifierWithKey(this._modifiersWithKeys, PullToRefreshModifier.identity, PullToRefreshModifier, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
class RefreshOffsetModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('refreshOffset');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().refresh.resetRefreshOffset(node);
|
||||
} else {
|
||||
getUINativeModule().refresh.setRefreshOffset(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
class PullToRefreshModifier extends ModifierWithKey<boolean> {
|
||||
constructor(value: boolean) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('pullToRefresh');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().refresh.resetPullToRefresh(node);
|
||||
} else {
|
||||
getUINativeModule().refresh.setPullToRefresh(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
globalThis.Refresh.attributeModifier = function (modifier) {
|
||||
|
@ -14,6 +14,22 @@
|
||||
*/
|
||||
|
||||
/// <reference path='./import.ts' />
|
||||
class RichEditorEnableDataDetectorModifier extends ModifierWithKey<boolean> {
|
||||
constructor(value: boolean) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('richEditorEnableDataDetector');
|
||||
applyPeer(node: KNode, reset: boolean) {
|
||||
if (reset) {
|
||||
getUINativeModule().richEditor.resetEnableDataDetector(node);
|
||||
} else {
|
||||
getUINativeModule().richEditor.setEnableDataDetector(node, this.value!);
|
||||
}
|
||||
}
|
||||
checkObjectDiff(): boolean {
|
||||
return !isBaseOrResourceEqual(this.stageValue, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
class RichEditorCopyOptionsModifier extends ModifierWithKey<CopyOptions> {
|
||||
constructor(value: CopyOptions) {
|
||||
@ -36,8 +52,9 @@ class ArkRichEditorComponent extends ArkComponent implements CommonMethod<RichEd
|
||||
constructor(nativePtr: KNode) {
|
||||
super(nativePtr);
|
||||
}
|
||||
enableDataDetector(enable: boolean): RichEditorAttribute {
|
||||
throw new Error('Method not implemented.');
|
||||
enableDataDetector(value: boolean): RichEditorAttribute {
|
||||
modifierWithKey(this._modifiersWithKeys, RichEditorEnableDataDetectorModifier.identity, RichEditorEnableDataDetectorModifier, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
dataDetectorConfig(config: any): RichEditorAttribute {
|
||||
|
@ -14,6 +14,23 @@
|
||||
*/
|
||||
|
||||
/// <reference path='./import.ts' />
|
||||
class TextEnableDataDetectorModifier extends ModifierWithKey<boolean> {
|
||||
constructor(value: boolean) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('textEnableDataDetector');
|
||||
applyPeer(node: KNode, reset: boolean) {
|
||||
if (reset) {
|
||||
getUINativeModule().text.resetEnableDataDetector(node);
|
||||
} else {
|
||||
getUINativeModule().text.setEnableDataDetector(node, this.value!);
|
||||
}
|
||||
}
|
||||
checkObjectDiff(): boolean {
|
||||
return !isBaseOrResourceEqual(this.stageValue, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
class FontColorModifier extends ModifierWithKey<ResourceColor> {
|
||||
constructor(value: ResourceColor) {
|
||||
super(value);
|
||||
@ -492,8 +509,9 @@ class ArkTextComponent extends ArkComponent implements TextAttribute {
|
||||
constructor(nativePtr: KNode) {
|
||||
super(nativePtr);
|
||||
}
|
||||
enableDataDetector(enable: boolean): this {
|
||||
throw new Error('Method not implemented.');
|
||||
enableDataDetector(value: boolean): this {
|
||||
modifierWithKey(this._modifiersWithKeys, TextEnableDataDetectorModifier.identity, TextEnableDataDetectorModifier, value);
|
||||
return this;
|
||||
}
|
||||
dataDetectorConfig(config: any): this {
|
||||
throw new Error('Method not implemented.');
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -5293,6 +5293,23 @@ globalThis.PatternLock.attributeModifier = function (modifier) {
|
||||
};
|
||||
|
||||
/// <reference path='./import.ts' />
|
||||
class RichEditorEnableDataDetectorModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().richEditor.resetEnableDataDetector(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().richEditor.setEnableDataDetector(node, this.value);
|
||||
}
|
||||
}
|
||||
checkObjectDiff() {
|
||||
return !isBaseOrResourceEqual(this.stageValue, this.value);
|
||||
}
|
||||
}
|
||||
RichEditorEnableDataDetectorModifier.identity = Symbol('richEditorEnableDataDetector');
|
||||
class RichEditorCopyOptionsModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
@ -5314,8 +5331,9 @@ class ArkRichEditorComponent extends ArkComponent {
|
||||
constructor(nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
enableDataDetector(enable) {
|
||||
throw new Error('Method not implemented.');
|
||||
enableDataDetector(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, RichEditorEnableDataDetectorModifier.identity, RichEditorEnableDataDetectorModifier, value);
|
||||
return this;
|
||||
}
|
||||
dataDetectorConfig(config) {
|
||||
throw new Error('Method not implemented.');
|
||||
@ -6798,6 +6816,23 @@ globalThis.Stack.attributeModifier = function (modifier) {
|
||||
};
|
||||
|
||||
/// <reference path='./import.ts' />
|
||||
class TextEnableDataDetectorModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().text.resetEnableDataDetector(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().text.setEnableDataDetector(node, this.value);
|
||||
}
|
||||
}
|
||||
checkObjectDiff() {
|
||||
return !isBaseOrResourceEqual(this.stageValue, this.value);
|
||||
}
|
||||
}
|
||||
TextEnableDataDetectorModifier.identity = Symbol('textEnableDataDetector');
|
||||
class FontColorModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
@ -7279,8 +7314,9 @@ class ArkTextComponent extends ArkComponent {
|
||||
constructor(nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
enableDataDetector(enable) {
|
||||
throw new Error('Method not implemented.');
|
||||
enableDataDetector(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, TextEnableDataDetectorModifier.identity, TextEnableDataDetectorModifier, value);
|
||||
return this;
|
||||
}
|
||||
dataDetectorConfig(config) {
|
||||
throw new Error('Method not implemented.');
|
||||
@ -9912,7 +9948,43 @@ class ArkRefreshComponent extends ArkComponent {
|
||||
onRefreshing(callback) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
refreshOffset(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, RefreshOffsetModifier.identity, RefreshOffsetModifier, value);
|
||||
return this;
|
||||
}
|
||||
pullToRefresh(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, PullToRefreshModifier.identity, PullToRefreshModifier, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class RefreshOffsetModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().refresh.resetRefreshOffset(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().refresh.setRefreshOffset(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
RefreshOffsetModifier.identity = Symbol('refreshOffset');
|
||||
class PullToRefreshModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().refresh.resetPullToRefresh(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().refresh.setPullToRefresh(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
PullToRefreshModifier.identity = Symbol('pullToRefresh');
|
||||
// @ts-ignore
|
||||
globalThis.Refresh.attributeModifier = function (modifier) {
|
||||
const elmtId = ViewStackProcessor.GetElmtIdToAccountFor();
|
||||
@ -13347,6 +13419,22 @@ class ArkAlphabetIndexerComponent extends ArkComponent {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupPositionModifier.identity, PopupPositionModifier, value);
|
||||
return this;
|
||||
}
|
||||
popupItemBorderRadius(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupItemBorderRadiusModifier.identity, PopupItemBorderRadiusModifier, value);
|
||||
return this;
|
||||
}
|
||||
itemBorderRadius(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, ItemBorderRadiusModifier.identity, ItemBorderRadiusModifier, value);
|
||||
return this;
|
||||
}
|
||||
popupBackgroundBlurStyle(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupBackgroundBlurStyleModifier.identity, PopupBackgroundBlurStyleModifier, value);
|
||||
return this;
|
||||
}
|
||||
popupTitleBackground(value) {
|
||||
modifierWithKey(this._modifiersWithKeys, PopupTitleBackgroundModifier.identity, PopupTitleBackgroundModifier, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
globalThis.AlphabetIndexer.attributeModifier = function (modifier) {
|
||||
@ -13658,6 +13746,59 @@ class PopupPositionModifier extends ModifierWithKey {
|
||||
}
|
||||
}
|
||||
PopupPositionModifier.identity = Symbol('popupPosition');
|
||||
class PopupItemBorderRadiusModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetPopupItemBorderRadius(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setPopupItemBorderRadius(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
PopupItemBorderRadiusModifier.identity = Symbol('popupItemBorderRadius');
|
||||
class ItemBorderRadiusModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetItemBorderRadius(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setItemBorderRadius(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemBorderRadiusModifier.identity = Symbol('itemBorderRadius');
|
||||
class PopupBackgroundBlurStyleModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetPopupBackgroundBlurStyle(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setPopupBackgroundBlurStyle(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemBorderRadiusModifier.identity = Symbol('popupBackgroundBlurStyle');
|
||||
|
||||
class PopupTitleBackgroundModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().alphabetIndexer.resetPopupTitleBackground(node);
|
||||
} else {
|
||||
getUINativeModule().alphabetIndexer.setPopupTitleBackground(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
PopupTitleBackgroundModifier.identity = Symbol('popupTitleBackground');
|
||||
|
||||
/// <reference path='./import.ts' />
|
||||
class TextStyleModifier extends ModifierWithKey {
|
||||
|
@ -641,6 +641,7 @@ var FormDimension;
|
||||
FormDimension["Dimension_4_4"] = 4;
|
||||
FormDimension["Dimension_2_1"] = 5;
|
||||
FormDimension["DIMENSION_1_1"] = 6;
|
||||
FormDimension["DIMENSION_4_6"] = 7;
|
||||
})(FormDimension || (FormDimension = {}));
|
||||
|
||||
let FormRenderingMode;
|
||||
|
@ -285,7 +285,39 @@ class UIContext {
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return node;
|
||||
}
|
||||
getFocusController() {
|
||||
if (this.focusController_ == null) {
|
||||
this.focusController_ = new FocusController(this.instanceId_);
|
||||
}
|
||||
return this.focusController_;
|
||||
}
|
||||
}
|
||||
|
||||
class FocusController {
|
||||
/**
|
||||
* Construct new instance of FocusController.
|
||||
* initialzie with instanceId.
|
||||
* @param instanceId obtained on the c++ side.
|
||||
* @since 12
|
||||
*/
|
||||
constructor(instanceId) {
|
||||
this.instanceId_ = instanceId;
|
||||
this.ohos_focusController = globalThis.requireNapi('arkui.focusController');
|
||||
}
|
||||
clearFocus() {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
this.ohos_focusController.clearFocus();
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
}
|
||||
|
||||
requestFocus(value) {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
let result = this.ohos_focusController.requestFocus(value);
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class ComponentUtils {
|
||||
/**
|
||||
* Construct new instance of ComponentUtils.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -206,6 +206,7 @@ template("declarative_js_engine_ark") {
|
||||
"nativeModule/arkts_native_radio_bridge.cpp",
|
||||
"nativeModule/arkts_native_rating_bridge.cpp",
|
||||
"nativeModule/arkts_native_rect_bridge.cpp",
|
||||
"nativeModule/arkts_native_refresh_bridge.cpp",
|
||||
"nativeModule/arkts_native_render_node_bridge.cpp",
|
||||
"nativeModule/arkts_native_rich_editor_bridge.cpp",
|
||||
"nativeModule/arkts_native_row_bridge.cpp",
|
||||
|
@ -32,6 +32,7 @@ constexpr Dimension DEFAULT_FONT_SIZE_VAL = 12.0_fp;
|
||||
const std::string DEFAULT_POPUP_ITEM_FONT_WEIGHT = "medium";
|
||||
constexpr Dimension DEFAULT_POPUP_POSITION_X = 60.0_vp;
|
||||
constexpr Dimension DEFAULT_POPUP_POSITION_Y = 48.0_vp;
|
||||
constexpr double RADIUS_OFFSET = 4.0;
|
||||
|
||||
bool ParseJsInteger(const EcmaVM* vm, const Local<JSValueRef>& value, int32_t& result)
|
||||
{
|
||||
@ -611,4 +612,118 @@ ArkUINativeModuleValue AlphabetIndexerBridge::ResetPopupPosition(ArkUIRuntimeCal
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupPosition(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::SetPopupItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
Local<JSValueRef> radiusArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
|
||||
CalcDimension radius;
|
||||
CalcDimension popupRadius;
|
||||
if (radiusArg->IsNull() || radiusArg->IsUndefined() || !radiusArg->IsNumber()) {
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupItemBorderRadius(nativeNode);
|
||||
} else {
|
||||
ArkTSUtils::ParseJsDimensionVp(vm, radiusArg, radius);
|
||||
popupRadius.SetValue(radius.Value() + RADIUS_OFFSET);
|
||||
popupRadius.SetUnit(DimensionUnit::VP);
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->setPopupItemBorderRadius(nativeNode, radius.Value(),
|
||||
static_cast<int>(radius.Unit()), popupRadius.Value(), static_cast<int>(popupRadius.Unit()));
|
||||
}
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::ResetPopupItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupItemBorderRadius(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::SetItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
Local<JSValueRef> radiusArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
auto radius = CalcDimension(ZERO_RADIUS, DimensionUnit::VP);
|
||||
auto indexerRadius = Dimension(ZERO_RADIUS, DimensionUnit::VP);
|
||||
if (radiusArg->IsNull() || radiusArg->IsUndefined() || !radiusArg->IsNumber()) {
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetItemBorderRadius(nativeNode);
|
||||
} else {
|
||||
ArkTSUtils::ParseJsDimensionVp(vm, radiusArg, radius);
|
||||
indexerRadius.SetValue(radius.Value() + RADIUS_OFFSET);
|
||||
indexerRadius.SetUnit(DimensionUnit::VP);
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->setItemBorderRadius(nativeNode, radius.Value(),
|
||||
static_cast<int>(radius.Unit()), indexerRadius.Value(), static_cast<int>(indexerRadius.Unit()));
|
||||
}
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::ResetItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetItemBorderRadius(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::SetPopupBackgroundBlurStyle(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
Local<JSValueRef> blurStyleArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
int32_t blurStyle = blurStyleArg->Int32Value(vm);
|
||||
if (!ArkTSUtils::ParseJsInteger(vm, blurStyleArg, blurStyle)) {
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupBackgroundBlurStyle(nativeNode);
|
||||
} else {
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->setPopupBackgroundBlurStyle(nativeNode, blurStyle);
|
||||
}
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::ResetPopupBackgroundBlurStyle(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupBackgroundBlurStyle(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::SetPopupTitleBackground(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
Local<JSValueRef> colorArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Color color;
|
||||
if (!ArkTSUtils::ParseJsColorAlpha(vm, colorArg, color)) {
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupTitleBackground(nativeNode);
|
||||
} else {
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->setPopupTitleBackground(nativeNode, color.GetValue());
|
||||
}
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue AlphabetIndexerBridge::ResetPopupTitleBackground(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getAlphabetIndexerModifier()->resetPopupTitleBackground(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -55,6 +55,14 @@ public:
|
||||
static ArkUINativeModuleValue ResetItemSize(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetPopupPosition(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetPopupPosition(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetPopupItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetPopupItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetItemBorderRadius(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetPopupBackgroundBlurStyle(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetPopupBackgroundBlurStyle(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetPopupTitleBackground(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetPopupTitleBackground(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -91,6 +91,7 @@ private:
|
||||
static void RegisterTextTimerAttributes(Local<panda::ObjectRef> object, EcmaVM* vm);
|
||||
static void RegisterXComponentAttributes(Local<panda::ObjectRef> object, EcmaVM* vm);
|
||||
static void RegisterTabContentAttributes(Local<panda::ObjectRef> object, EcmaVM* vm);
|
||||
static void RegisterRefreshAttributes(Local<panda::ObjectRef> object, EcmaVM* vm);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
#endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_ENGINE_JSI_NATIVEMODULE_ARKTS_NATIVE_API_BRIDGE_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -89,6 +89,7 @@
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_list_item_group_bridge.h"
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_text_timer_bridge.h"
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_frame_node_bridge.h"
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_refresh_bridge.h"
|
||||
#ifdef PLUGIN_COMPONENT_SUPPORTED
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_plugin_bridge.h"
|
||||
#endif
|
||||
@ -787,6 +788,10 @@ ArkUINativeModuleValue ArkUINativeModule::GetArkUINativeModule(ArkUIRuntimeCallI
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TextBridge::SetEllipsisMode));
|
||||
text->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetEllipsisMode"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TextBridge::ResetEllipsisMode));
|
||||
text->Set(vm, panda::StringRef::NewFromUtf8(vm, "setEnableDataDetector"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TextBridge::SetEnableDataDetector));
|
||||
text->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetEnableDataDetector"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TextBridge::ResetEnableDataDetector));
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "text"), text);
|
||||
|
||||
auto search = panda::ObjectRef::New(vm);
|
||||
@ -950,6 +955,10 @@ ArkUINativeModuleValue ArkUINativeModule::GetArkUINativeModule(ArkUIRuntimeCallI
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "gridRow"), gridRow);
|
||||
|
||||
auto richEditor = panda::ObjectRef::New(vm);
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "setEnableDataDetector"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::SetEnableDataDetector));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetEnableDataDetector"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::ResetEnableDataDetector));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "setCopyOptions"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::SetCopyOptions));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetCopyOptions"),
|
||||
@ -1297,6 +1306,7 @@ ArkUINativeModuleValue ArkUINativeModule::GetArkUINativeModule(ArkUIRuntimeCallI
|
||||
RegisterTextClockAttributes(object, vm);
|
||||
RegisterListItemAttributes(object, vm);
|
||||
RegisterTextTimerAttributes(object, vm);
|
||||
RegisterRefreshAttributes(object, vm);
|
||||
#ifdef PLUGIN_COMPONENT_SUPPORTED
|
||||
RegisterPluginAttributes(object, vm);
|
||||
#endif
|
||||
@ -2374,6 +2384,20 @@ void ArkUINativeModule::RegisterTabContentAttributes(Local<panda::ObjectRef> obj
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "tabContent"), tabContent);
|
||||
}
|
||||
|
||||
void ArkUINativeModule::RegisterRefreshAttributes(Local<panda::ObjectRef> object, EcmaVM* vm)
|
||||
{
|
||||
auto refresh = panda::ObjectRef::New(vm);
|
||||
refresh->Set(vm, panda::StringRef::NewFromUtf8(vm, "setRefreshOffset"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RefreshBridege::SetRefreshOffset));
|
||||
refresh->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetRefreshOffset"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RefreshBridege::ResetRefreshOffset));
|
||||
refresh->Set(vm, panda::StringRef::NewFromUtf8(vm, "setPullToRefresh"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RefreshBridege::SetPullToRefresh));
|
||||
refresh->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetPullToRefresh"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RefreshBridege::ResetPullToRefresh));
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "refresh"), refresh);
|
||||
}
|
||||
|
||||
void ArkUINativeModule::RegisterHyperlinkAttributes(Local<panda::ObjectRef> object, EcmaVM* vm)
|
||||
{
|
||||
auto hyperlink = panda::ObjectRef::New(vm);
|
||||
@ -2555,6 +2579,22 @@ void ArkUINativeModule::RegisterAlphabetIndexerAttributes(Local<panda::ObjectRef
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::SetPopupPosition));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetPopupPosition"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::ResetPopupPosition));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "setPopupItemBorderRadius"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::SetPopupItemBorderRadius));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetPopupItemBorderRadius"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::ResetPopupItemBorderRadius));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "setItemBorderRadius"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::SetItemBorderRadius));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetItemBorderRadius"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::ResetItemBorderRadius));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "setPopupBackgroundBlurStyle"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::SetPopupBackgroundBlurStyle));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetPopupBackgroundBlurStyle"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::ResetPopupBackgroundBlurStyle));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "setPopupTitleBackground"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::SetPopupTitleBackground));
|
||||
alphabetIndexer->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetPopupTitleBackground"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), AlphabetIndexerBridge::ResetPopupTitleBackground));
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "alphabetIndexer"), alphabetIndexer);
|
||||
}
|
||||
|
||||
|
@ -81,9 +81,9 @@ ArkUINativeModuleValue FrameNodeBridge::ClearChildren(ArkUIRuntimeCallInfo* runt
|
||||
ArkUINativeModuleValue FrameNodeBridge::GetChildrenNumber(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NumberRef::New(vm, -1));
|
||||
CHECK_NULL_RETURN(vm, panda::NumberRef::New(vm, 0));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
CHECK_NULL_RETURN(!firstArg.IsNull(), panda::NumberRef::New(vm, -1));
|
||||
CHECK_NULL_RETURN(!firstArg.IsNull(), panda::NumberRef::New(vm, 0));
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
auto number = GetArkUINodeModifiers()->getFrameNodeModifier()->getChildrenNumber(nativeNode);
|
||||
return panda::NumberRef::New(vm, number);
|
||||
@ -143,9 +143,9 @@ ArkUINativeModuleValue FrameNodeBridge::GetParent(ArkUIRuntimeCallInfo* runtimeC
|
||||
ArkUINativeModuleValue FrameNodeBridge::GetIdByNodePtr(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
CHECK_NULL_RETURN(vm, panda::NumberRef::New(vm, -1));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
CHECK_NULL_RETURN(!firstArg.IsNull(), panda::NativePointerRef::New(vm, nullptr));
|
||||
CHECK_NULL_RETURN(!firstArg.IsNull(), panda::NumberRef::New(vm, -1));
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
auto nodeId = GetArkUINodeModifiers()->getFrameNodeModifier()->getIdByNodePtr(nativeNode);
|
||||
return panda::NumberRef::New(vm, nodeId);
|
||||
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_refresh_bridge.h"
|
||||
|
||||
#include "frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_utils.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
constexpr int32_t CALL_ARG_0 = 0;
|
||||
constexpr int32_t CALL_ARG_1 = 1;
|
||||
ArkUINativeModuleValue RefreshBridege::SetRefreshOffset(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_0);
|
||||
Local<JSValueRef> valueArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_1);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
CalcDimension value(0.0f);
|
||||
if (valueArg->IsNull() || valueArg->IsUndefined() || !ArkTSUtils::ParseJsDimensionVp(vm, valueArg, value)) {
|
||||
GetArkUINodeModifiers()->getRefreshModifier()->resetRefreshOffset(nativeNode);
|
||||
} else {
|
||||
GetArkUINodeModifiers()->getRefreshModifier()->setRefreshOffset(
|
||||
nativeNode, value.Value(), static_cast<int>(value.Unit()));
|
||||
}
|
||||
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue RefreshBridege::ResetRefreshOffset(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getRefreshModifier()->resetRefreshOffset(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue RefreshBridege::SetPullToRefresh(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_0);
|
||||
Local<JSValueRef> valueArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_1);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
bool value = valueArg->ToBoolean(vm)->Value();
|
||||
GetArkUINodeModifiers()->getRefreshModifier()->setPullToRefresh(nativeNode, value);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue RefreshBridege::ResetPullToRefresh(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> nodeArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_0);
|
||||
auto nativeNode = nodePtr(nodeArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getRefreshModifier()->resetPullToRefresh(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_ENGINE_JSI_NATIVEMODULE_ARKTS_NATIVE_REFRESH_BRIDGE_H
|
||||
#define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_ENGINE_JSI_NATIVEMODULE_ARKTS_NATIVE_REFRESH_BRIDGE_H
|
||||
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_api_bridge.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
class RefreshBridege {
|
||||
public:
|
||||
static ArkUINativeModuleValue SetRefreshOffset(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetRefreshOffset(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetPullToRefresh(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetPullToRefresh(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
#endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_ENGINE_JSI_NATIVEMODULE_ARKTS_NATIVE_REFRESH_BRIDGE_H
|
@ -17,6 +17,36 @@
|
||||
#include "core/components/common/layout/constants.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
constexpr int NUM_0 = 0;
|
||||
constexpr int NUM_1 = 1;
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::SetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> enableDataDetectorArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (enableDataDetectorArg->IsNull() || enableDataDetectorArg->IsUndefined() ||
|
||||
!enableDataDetectorArg->IsBoolean()) {
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->resetRichEditorEnableDataDetector(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
uint32_t enableDataDetector = enableDataDetectorArg->Uint32Value(vm);
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->setRichEditorEnableDataDetector(nativeNode, enableDataDetector);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::ResetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->resetRichEditorEnableDataDetector(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::SetCopyOptions(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
|
@ -21,6 +21,8 @@
|
||||
namespace OHOS::Ace::NG {
|
||||
class RichEditorBridge {
|
||||
public:
|
||||
static ArkUINativeModuleValue SetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetCopyOptions(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetCopyOptions(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
};
|
||||
|
@ -819,4 +819,31 @@ ArkUINativeModuleValue TextBridge::ResetEllipsisMode(ArkUIRuntimeCallInfo* runti
|
||||
GetArkUINodeModifiers()->getTextModifier()->resetEllipsisMode(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue TextBridge::SetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> enableDataDetectorArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (enableDataDetectorArg->IsNull() || enableDataDetectorArg->IsUndefined() ||
|
||||
!enableDataDetectorArg->IsBoolean()) {
|
||||
GetArkUINodeModifiers()->getTextModifier()->resetEnableDataDetector(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
uint32_t enableDataDetector = enableDataDetectorArg->Uint32Value(vm);
|
||||
GetArkUINodeModifiers()->getTextModifier()->setEnableDataDetector(nativeNode, enableDataDetector);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue TextBridge::ResetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getTextModifier()->resetEnableDataDetector(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
static ArkUINativeModuleValue ResetWordBreak(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetEllipsisMode(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetEllipsisMode(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
|
@ -61,6 +61,18 @@ void JSBaseNode::BuildNode(const JSCallbackInfo& info)
|
||||
}
|
||||
auto parent = viewNode_ ? viewNode_->GetParent() : nullptr;
|
||||
auto newNode = NG::ViewStackProcessor::GetInstance()->Finish();
|
||||
// If the node is a UINode, amount it to a BuilderProxyNode.
|
||||
// Let the returned node be a FrameNode.
|
||||
auto flag = AceType::InstanceOf<NG::FrameNode>(newNode);
|
||||
if (!flag) {
|
||||
auto nodeId = ElementRegister::GetInstance()->MakeUniqueId();
|
||||
auto proxyNode = NG::FrameNode::GetOrCreateFrameNode(
|
||||
"BuilderProxyNode", nodeId, []() { return AceType::MakeRefPtr<NG::StackPattern>(); });
|
||||
auto stackLayoutAlgorithm = proxyNode->GetLayoutProperty<NG::LayoutProperty>();
|
||||
stackLayoutAlgorithm->UpdateAlignment(Alignment::TOP_LEFT);
|
||||
proxyNode->AddChild(newNode);
|
||||
newNode = proxyNode;
|
||||
}
|
||||
if (parent) {
|
||||
parent->ReplaceChild(viewNode_, newNode);
|
||||
newNode->MarkNeedFrameFlushDirty(NG::PROPERTY_UPDATE_MEASURE);
|
||||
|
@ -96,6 +96,9 @@ void JSButton::SetFontFamily(const JSCallbackInfo& info)
|
||||
if (!ParseJsFontFamilies(info[0], fontFamilies)) {
|
||||
return;
|
||||
}
|
||||
if (fontFamilies.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ButtonModel::GetInstance()->SetFontFamily(fontFamilies);
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ void JSEmbeddedComponent::JSBind(BindingTarget globalObj)
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("create", &JSEmbeddedComponent::Create, opt);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("onTerminated", &JSEmbeddedComponent::OnTerminated);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("onError", &JSEmbeddedComponent::OnError);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("width", &JSEmbeddedComponent::JsWidth);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("height", &JSEmbeddedComponent::JsHeight);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("constraintSize", &JSEmbeddedComponent::JsConstraintSize);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("aspectRatio", &JSEmbeddedComponent::JsAspectRatio);
|
||||
JSClass<JSEmbeddedComponent>::StaticMethod("layoutWeight", &JSEmbeddedComponent::JsLayoutWeight);
|
||||
@ -142,4 +144,20 @@ void JSEmbeddedComponent::OnError(const JSCallbackInfo& info)
|
||||
};
|
||||
UIExtensionModel::GetInstance()->SetOnError(std::move(onError));
|
||||
}
|
||||
|
||||
void JSEmbeddedComponent::JsWidth(const JSCallbackInfo& info)
|
||||
{
|
||||
if (info[0]->IsUndefined()) {
|
||||
return;
|
||||
}
|
||||
JSViewAbstract::JsWidth(info);
|
||||
}
|
||||
|
||||
void JSEmbeddedComponent::JsHeight(const JSCallbackInfo& info)
|
||||
{
|
||||
if (info[0]->IsUndefined()) {
|
||||
return;
|
||||
}
|
||||
JSViewAbstract::JsHeight(info);
|
||||
}
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
@ -27,6 +27,8 @@ public:
|
||||
static void Create(const JSCallbackInfo& info);
|
||||
static void OnTerminated(const JSCallbackInfo& info);
|
||||
static void OnError(const JSCallbackInfo& info);
|
||||
static void JsWidth(const JSCallbackInfo& info);
|
||||
static void JsHeight(const JSCallbackInfo& info);
|
||||
static void JsConstraintSize(const JSCallbackInfo& /* info */) {};
|
||||
static void JsAspectRatio(const JSCallbackInfo& /* info */) {};
|
||||
static void JsLayoutWeight(const JSCallbackInfo& /* info */) {};
|
||||
|
@ -22,7 +22,10 @@
|
||||
#include "bridge/declarative_frontend/jsview/js_scroller.h"
|
||||
#include "bridge/declarative_frontend/jsview/js_view_common_def.h"
|
||||
#include "bridge/declarative_frontend/jsview/models/indexer_model_impl.h"
|
||||
#include "core/components/common/layout/constants.h"
|
||||
#include "core/components/common/properties/decoration.h"
|
||||
#include "core/components/common/properties/text_style.h"
|
||||
#include "core/components/indexer/indexer_theme.h"
|
||||
#include "core/components_ng/pattern/indexer/indexer_model_ng.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
@ -54,6 +57,10 @@ const std::vector<FontStyle> FONT_STYLES = { FontStyle::NORMAL, FontStyle::ITALI
|
||||
const std::vector<V2::AlignStyle> ALIGN_STYLE = { V2::AlignStyle::LEFT, V2::AlignStyle::RIGHT };
|
||||
const std::vector<NG::AlignStyle> NG_ALIGN_STYLE = { NG::AlignStyle::LEFT, NG::AlignStyle::RIGHT };
|
||||
constexpr Dimension DEFAULT_ITEM_SIZE = 16.0_vp;
|
||||
constexpr double ZERO_RADIUS = 0.0;
|
||||
constexpr double POPUP_ITEM_DEFAULT_RADIUS = 24.0;
|
||||
constexpr double ITEM_DEFAULT_RADIUS = 8.0;
|
||||
constexpr double RADIUS_OFFSET = 4.0;
|
||||
}; // namespace
|
||||
|
||||
void JSIndexer::ParseIndexerSelectedObject(
|
||||
@ -442,6 +449,79 @@ void JSIndexer::SetAutoCollapse(bool state)
|
||||
IndexerModel::GetInstance()->SetAutoCollapse(state);
|
||||
}
|
||||
|
||||
void JSIndexer::SetPopupItemBorderRadius(const JSCallbackInfo& args)
|
||||
{
|
||||
auto radius = Dimension(ZERO_RADIUS, DimensionUnit::VP);
|
||||
auto popupRadius = Dimension(ZERO_RADIUS, DimensionUnit::VP);
|
||||
if (args.Length() > 0 && args[0]->IsNumber()) {
|
||||
auto radiusValue = args[0]->ToNumber<double>();
|
||||
if (radiusValue >= 0) {
|
||||
radius.SetValue(radiusValue);
|
||||
radius.SetUnit(DimensionUnit::VP);
|
||||
popupRadius.SetValue(radiusValue + RADIUS_OFFSET);
|
||||
popupRadius.SetUnit(DimensionUnit::VP);
|
||||
}
|
||||
} else {
|
||||
radius.SetValue(POPUP_ITEM_DEFAULT_RADIUS);
|
||||
radius.SetUnit(DimensionUnit::VP);
|
||||
popupRadius.SetValue(radius.Value() + RADIUS_OFFSET);
|
||||
popupRadius.SetUnit(DimensionUnit::VP);
|
||||
}
|
||||
IndexerModel::GetInstance()->SetPopupItemBorderRadius(radius);
|
||||
IndexerModel::GetInstance()->SetPopupBorderRadius(popupRadius);
|
||||
}
|
||||
|
||||
void JSIndexer::SetItemBorderRadius(const JSCallbackInfo& args)
|
||||
{
|
||||
auto radius = Dimension(ZERO_RADIUS, DimensionUnit::VP);
|
||||
auto indexerRadius = Dimension(ZERO_RADIUS, DimensionUnit::VP);
|
||||
if (args.Length() > 0 && args[0]->IsNumber()) {
|
||||
auto radiusValue = args[0]->ToNumber<double>();
|
||||
if (radiusValue >= 0) {
|
||||
radius.SetValue(radiusValue);
|
||||
radius.SetUnit(DimensionUnit::VP);
|
||||
indexerRadius.SetValue(radiusValue + RADIUS_OFFSET);
|
||||
indexerRadius.SetUnit(DimensionUnit::VP);
|
||||
}
|
||||
} else {
|
||||
radius.SetValue(ITEM_DEFAULT_RADIUS);
|
||||
radius.SetUnit(DimensionUnit::VP);
|
||||
indexerRadius.SetValue(radius.Value() + RADIUS_OFFSET);
|
||||
indexerRadius.SetUnit(DimensionUnit::VP);
|
||||
}
|
||||
IndexerModel::GetInstance()->SetItemBorderRadius(radius);
|
||||
IndexerModel::GetInstance()->SetIndexerBorderRadius(indexerRadius);
|
||||
}
|
||||
|
||||
void JSIndexer::SetPopupBackgroundBlurStyle(const JSCallbackInfo& args)
|
||||
{
|
||||
if (args.Length() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlurStyleOption styleOption;
|
||||
if (args[0]->IsNumber()) {
|
||||
auto blurStyle = args[0]->ToNumber<int32_t>();
|
||||
if (blurStyle >= static_cast<int>(BlurStyle::NO_MATERIAL) &&
|
||||
blurStyle <= static_cast<int>(BlurStyle::COMPONENT_ULTRA_THICK)) {
|
||||
styleOption.blurStyle = static_cast<BlurStyle>(blurStyle);
|
||||
} else {
|
||||
styleOption.blurStyle = BlurStyle::COMPONENT_REGULAR;
|
||||
}
|
||||
} else {
|
||||
styleOption.blurStyle = BlurStyle::COMPONENT_REGULAR;
|
||||
}
|
||||
IndexerModel::GetInstance()->SetPopupBackgroundBlurStyle(styleOption);
|
||||
}
|
||||
|
||||
void JSIndexer::SetPopupTitleBackground(const JSCallbackInfo& args)
|
||||
{
|
||||
if (args.Length() < 1) {
|
||||
return;
|
||||
}
|
||||
IndexerModel::GetInstance()->SetPopupTitleBackground(PaseColor(args));
|
||||
}
|
||||
|
||||
void JSIndexer::JSBind(BindingTarget globalObj)
|
||||
{
|
||||
MethodOptions opt = MethodOptions::NONE;
|
||||
@ -469,6 +549,10 @@ void JSIndexer::JSBind(BindingTarget globalObj)
|
||||
JSClass<JSIndexer>::StaticMethod("popupItemFont", &JSIndexer::SetPopupItemFont);
|
||||
JSClass<JSIndexer>::StaticMethod("popupItemBackgroundColor", &JSIndexer::SetPopupItemBackgroundColor, opt);
|
||||
JSClass<JSIndexer>::StaticMethod("autoCollapse", &JSIndexer::SetAutoCollapse, opt);
|
||||
JSClass<JSIndexer>::StaticMethod("popupItemBorderRadius", &JSIndexer::SetPopupItemBorderRadius);
|
||||
JSClass<JSIndexer>::StaticMethod("itemBorderRadius", &JSIndexer::SetItemBorderRadius);
|
||||
JSClass<JSIndexer>::StaticMethod("popupBackgroundBlurStyle", &JSIndexer::SetPopupBackgroundBlurStyle);
|
||||
JSClass<JSIndexer>::StaticMethod("popupTitleBackground", &JSIndexer::SetPopupTitleBackground, opt);
|
||||
// keep compatible, need remove after
|
||||
JSClass<JSIndexer>::StaticMethod("onPopupSelected", &JSIndexer::JsOnPopupSelected, opt);
|
||||
JSClass<JSIndexer>::StaticMethod("onPopupSelect", &JSIndexer::JsOnPopupSelected, opt);
|
||||
|
@ -50,6 +50,10 @@ public:
|
||||
static void SetPopupItemFont(const JSCallbackInfo& args);
|
||||
static void SetPopupItemBackgroundColor(const JSCallbackInfo& args);
|
||||
static void SetAutoCollapse(bool state);
|
||||
static void SetPopupItemBorderRadius(const JSCallbackInfo& args);
|
||||
static void SetItemBorderRadius(const JSCallbackInfo& args);
|
||||
static void SetPopupBackgroundBlurStyle(const JSCallbackInfo& args);
|
||||
static void SetPopupTitleBackground(const JSCallbackInfo& args);
|
||||
static std::optional<Color> PaseColor(const JSCallbackInfo& args);
|
||||
};
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
@ -468,6 +468,16 @@ bool JSProgress::ConvertGradientColor(const JsiRef<JsiValue>& param, NG::Gradien
|
||||
}
|
||||
|
||||
JSLinearGradient* jsLinearGradient = JSRef<JSObject>::Cast(param)->Unwrap<JSLinearGradient>();
|
||||
auto proxy = param->GetLocalHandle();
|
||||
if (proxy->IsProxy()) {
|
||||
auto vm = param->GetEcmaVM();
|
||||
panda::Local<panda::ProxyRef> thisProxiedObj =
|
||||
static_cast<panda::Local<panda::ProxyRef>>(proxy);
|
||||
jsLinearGradient = static_cast<JSLinearGradient *>(
|
||||
panda::Local<panda::ObjectRef>(thisProxiedObj->GetTarget(vm))
|
||||
->GetNativePointerField(0));
|
||||
}
|
||||
|
||||
if (!jsLinearGradient || jsLinearGradient->GetGradient().empty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ void JSTextEditableController::CaretPosition(int32_t caretPosition)
|
||||
{
|
||||
auto controller = controllerWeak_.Upgrade();
|
||||
if (controller) {
|
||||
caretPosition = caretPosition < 0 ? 0 : caretPosition;
|
||||
controller->CaretPosition(caretPosition);
|
||||
} else {
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT_FIELD, "CaretPosition: The JSTextEditableController is NULL");
|
||||
|
@ -356,8 +356,11 @@ void JSTextField::SetCaretPosition(const JSCallbackInfo& info)
|
||||
}
|
||||
|
||||
int32_t caretPosition = 0;
|
||||
if (!ParseJsInt32(info[0], caretPosition) || caretPosition < 0) {
|
||||
caretPosition = 0;
|
||||
if (!ParseJsInt32(info[0], caretPosition)) {
|
||||
return;
|
||||
}
|
||||
if (caretPosition < 0) {
|
||||
return;
|
||||
}
|
||||
TextFieldModel::GetInstance()->SetCaretPosition(caretPosition);
|
||||
}
|
||||
@ -1220,7 +1223,7 @@ void JSTextField::SetCancelButton(const JSCallbackInfo& info)
|
||||
if (iconJsVal->IsUndefined() || iconJsVal->IsNull() || !iconJsVal->IsObject()) {
|
||||
TextFieldModel::GetInstance()->SetCancelIconColor(Color());
|
||||
TextFieldModel::GetInstance()->SetCancelIconSize(theme->GetIconSize());
|
||||
TextFieldModel::GetInstance()->SetCanacelIconSrc(std::string());
|
||||
TextFieldModel::GetInstance()->SetCanacelIconSrc(std::string(), std::string(), std::string());
|
||||
return;
|
||||
}
|
||||
auto iconParam = JSRef<JSObject>::Cast(iconJsVal);
|
||||
@ -1237,19 +1240,21 @@ void JSTextField::SetCancelButton(const JSCallbackInfo& info)
|
||||
TextFieldModel::GetInstance()->SetCancelIconSize(iconSize);
|
||||
// set icon src
|
||||
std::string iconSrc;
|
||||
std::string bundleName;
|
||||
std::string moduleName;
|
||||
auto iconSrcProp = iconParam->GetProperty("src");
|
||||
if (iconSrcProp->IsUndefined() || iconSrcProp->IsNull() || !ParseJsMedia(iconSrcProp, iconSrc)) {
|
||||
iconSrc = "";
|
||||
}
|
||||
TextFieldModel::GetInstance()->SetCanacelIconSrc(iconSrc);
|
||||
GetJsMediaBundleInfo(iconSrcProp, bundleName, moduleName);
|
||||
TextFieldModel::GetInstance()->SetCanacelIconSrc(iconSrc, bundleName, moduleName);
|
||||
// set icon color
|
||||
Color iconColor;
|
||||
auto iconColorProp = iconParam->GetProperty("color");
|
||||
if (!iconColorProp->IsUndefined() && !iconColorProp->IsNull() && ParseJsColor(iconColorProp, iconColor)) {
|
||||
TextFieldModel::GetInstance()->SetCancelIconColor(iconColor);
|
||||
} else {
|
||||
TextFieldModel::GetInstance()->SetCancelIconColor(iconColor);
|
||||
if (!iconColorProp->IsUndefined() && !iconColorProp->IsNull()) {
|
||||
ParseJsColor(iconColorProp, iconColor);
|
||||
}
|
||||
TextFieldModel::GetInstance()->SetCancelIconColor(iconColor);
|
||||
}
|
||||
|
||||
void JSTextField::SetSelectAllValue(const JSCallbackInfo& info)
|
||||
|
@ -1059,18 +1059,18 @@ void ParseCustomPopupParam(
|
||||
if (!builderValue->IsObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSRef<JSObject> builderObj;
|
||||
builderObj = JSRef<JSObject>::Cast(builderValue);
|
||||
auto builder = builderObj->GetProperty("builder");
|
||||
if (!builder->IsFunction()) {
|
||||
return;
|
||||
if (!builderValue->IsFunction()) {
|
||||
JSRef<JSObject> builderObj;
|
||||
builderObj = JSRef<JSObject>::Cast(builderValue);
|
||||
auto builder = builderObj->GetProperty("builder");
|
||||
if (!builder->IsFunction()) {
|
||||
return;
|
||||
}
|
||||
auto builderFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSFunc>::Cast(builder));
|
||||
if (!builderFunc) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto builderFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSFunc>::Cast(builder));
|
||||
if (!builderFunc) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (popupParam) {
|
||||
popupParam->SetUseCustomComponent(true);
|
||||
}
|
||||
@ -4871,7 +4871,6 @@ std::pair<CalcDimension, CalcDimension> JSViewAbstract::ParseSize(const JSCallba
|
||||
!ParseJsDimensionVp(jsObj->GetProperty("height"), height)) {
|
||||
return std::pair<CalcDimension, CalcDimension>();
|
||||
}
|
||||
info.SetReturnValue(info.This());
|
||||
return std::pair<CalcDimension, CalcDimension>(width, height);
|
||||
}
|
||||
|
||||
@ -5225,10 +5224,7 @@ void JSViewAbstract::JsBindPopup(const JSCallbackInfo& info)
|
||||
if (info.Length() < 2) {
|
||||
return;
|
||||
}
|
||||
if (!info[0]->IsBoolean() && !info[0]->IsObject()) {
|
||||
return;
|
||||
}
|
||||
if (!info[1]->IsObject()) {
|
||||
if ((!info[0]->IsBoolean() && !info[0]->IsObject()) || !info[1]->IsObject()) {
|
||||
return;
|
||||
}
|
||||
auto popupParam = AceType::MakeRefPtr<PopupParam>();
|
||||
@ -5250,14 +5246,17 @@ void JSViewAbstract::JsBindPopup(const JSCallbackInfo& info)
|
||||
} else if (!popupObj->GetProperty("builder").IsEmpty()) {
|
||||
ParseCustomPopupParam(info, popupObj, popupParam); // Parse CustomPopupOptions param
|
||||
auto builderValue = popupObj->GetProperty("builder");
|
||||
auto builder = builderValue;
|
||||
if (!builderValue->IsObject()) {
|
||||
return;
|
||||
}
|
||||
JSRef<JSObject> builderObj;
|
||||
builderObj = JSRef<JSObject>::Cast(builderValue);
|
||||
auto builder = builderObj->GetProperty("builder");
|
||||
if (!builder->IsFunction()) {
|
||||
return;
|
||||
if (!builderValue->IsFunction()) {
|
||||
JSRef<JSObject> builderObj;
|
||||
builderObj = JSRef<JSObject>::Cast(builderValue);
|
||||
builder = builderObj->GetProperty("builder");
|
||||
if (!builder->IsFunction()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (popupParam->IsShow()) {
|
||||
auto builderFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSFunc>::Cast(builder));
|
||||
|
@ -1674,6 +1674,8 @@ void JSWeb::JSBind(BindingTarget globalObj)
|
||||
JSClass<JSWeb>::StaticMethod("onAudioStateChanged", &JSWeb::OnAudioStateChanged);
|
||||
JSClass<JSWeb>::StaticMethod("mediaOptions", &JSWeb::MediaOptions);
|
||||
JSClass<JSWeb>::StaticMethod("onFirstContentfulPaint", &JSWeb::OnFirstContentfulPaint);
|
||||
JSClass<JSWeb>::StaticMethod("onFirstMeaningfulPaint", &JSWeb::OnFirstMeaningfulPaint);
|
||||
JSClass<JSWeb>::StaticMethod("onLargestContentfulPaint", &JSWeb::OnLargestContentfulPaint);
|
||||
JSClass<JSWeb>::StaticMethod("onSafeBrowsingCheckResult", &JSWeb::OnSafeBrowsingCheckResult);
|
||||
JSClass<JSWeb>::StaticMethod("onNavigationEntryCommitted", &JSWeb::OnNavigationEntryCommitted);
|
||||
JSClass<JSWeb>::StaticMethod("onIntelligentTrackingPreventionResult",
|
||||
@ -3852,6 +3854,74 @@ void JSWeb::OnFirstContentfulPaint(const JSCallbackInfo& args)
|
||||
WebModel::GetInstance()->SetFirstContentfulPaintId(std::move(uiCallback));
|
||||
}
|
||||
|
||||
JSRef<JSVal> FirstMeaningfulPaintEventToJSValue(const FirstMeaningfulPaintEvent& eventInfo)
|
||||
{
|
||||
JSRef<JSObject> obj = JSRef<JSObject>::New();
|
||||
obj->SetProperty("navigationStartTime", eventInfo.GetNavigationStartTime());
|
||||
obj->SetProperty("firstMeaningfulPaintTime", eventInfo.GetFirstMeaningfulPaintTime());
|
||||
return JSRef<JSVal>::Cast(obj);
|
||||
}
|
||||
|
||||
void JSWeb::OnFirstMeaningfulPaint(const JSCallbackInfo& args)
|
||||
{
|
||||
if (args.Length() < 1 || args[0]->IsUndefined() || args[0]->IsNull() || !args[0]->IsFunction()) {
|
||||
return;
|
||||
}
|
||||
WeakPtr<NG::FrameNode> frameNode = NG::ViewStackProcessor::GetInstance()->GetMainFrameNode();
|
||||
auto jsFunc = AceType::MakeRefPtr<JsEventFunction<FirstMeaningfulPaintEvent, 1>>(
|
||||
JSRef<JSFunc>::Cast(args[0]), FirstMeaningfulPaintEventToJSValue);
|
||||
auto instanceId = Container::CurrentId();
|
||||
auto uiCallback = [execCtx = args.GetExecutionContext(), func = std::move(jsFunc), instanceId, node = frameNode](
|
||||
const std::shared_ptr<BaseEventInfo>& info) {
|
||||
ContainerScope scope(instanceId);
|
||||
auto context = PipelineBase::GetCurrentContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
context->UpdateCurrentActiveNode(node);
|
||||
context->PostAsyncEvent([execCtx, postFunc = func, info]() {
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
auto* eventInfo = TypeInfoHelper::DynamicCast<FirstMeaningfulPaintEvent>(info.get());
|
||||
postFunc->Execute(*eventInfo);
|
||||
});
|
||||
};
|
||||
WebModel::GetInstance()->SetFirstMeaningfulPaintId(std::move(uiCallback));
|
||||
}
|
||||
|
||||
JSRef<JSVal> LargestContentfulPaintEventToJSValue(const LargestContentfulPaintEvent& eventInfo)
|
||||
{
|
||||
JSRef<JSObject> obj = JSRef<JSObject>::New();
|
||||
obj->SetProperty("navigationStartTime", eventInfo.GetNavigationStartTime());
|
||||
obj->SetProperty("largestImagePaintTime", eventInfo.GetLargestImagePaintTime());
|
||||
obj->SetProperty("largestTextPaintTime", eventInfo.GetLargestTextPaintTime());
|
||||
obj->SetProperty("largestImageLoadStartTime", eventInfo.GetLargestImageLoadStartTime());
|
||||
obj->SetProperty("largestImageLoadEndTime", eventInfo.GetLargestImageLoadEndTime());
|
||||
obj->SetProperty("imageBPP", eventInfo.GetImageBPP());
|
||||
return JSRef<JSVal>::Cast(obj);
|
||||
}
|
||||
|
||||
void JSWeb::OnLargestContentfulPaint(const JSCallbackInfo& args)
|
||||
{
|
||||
if (args.Length() < 1 || args[0]->IsUndefined() || args[0]->IsNull() || !args[0]->IsFunction()) {
|
||||
return;
|
||||
}
|
||||
WeakPtr<NG::FrameNode> frameNode = NG::ViewStackProcessor::GetInstance()->GetMainFrameNode();
|
||||
auto jsFunc = AceType::MakeRefPtr<JsEventFunction<LargestContentfulPaintEvent, 1>>(
|
||||
JSRef<JSFunc>::Cast(args[0]), LargestContentfulPaintEventToJSValue);
|
||||
auto instanceId = Container::CurrentId();
|
||||
auto uiCallback = [execCtx = args.GetExecutionContext(), func = std::move(jsFunc), instanceId, node = frameNode](
|
||||
const std::shared_ptr<BaseEventInfo>& info) {
|
||||
ContainerScope scope(instanceId);
|
||||
auto context = PipelineBase::GetCurrentContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
context->UpdateCurrentActiveNode(node);
|
||||
context->PostAsyncEvent([execCtx, postFunc = func, info]() {
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
auto* eventInfo = TypeInfoHelper::DynamicCast<LargestContentfulPaintEvent>(info.get());
|
||||
postFunc->Execute(*eventInfo);
|
||||
});
|
||||
};
|
||||
WebModel::GetInstance()->SetLargestContentfulPaintId(std::move(uiCallback));
|
||||
}
|
||||
|
||||
JSRef<JSVal> SafeBrowsingCheckResultEventToJSValue(const SafeBrowsingCheckResultEvent& eventInfo)
|
||||
{
|
||||
JSRef<JSObject> obj = JSRef<JSObject>::New();
|
||||
@ -4025,14 +4095,14 @@ JSRef<JSObject> CreateTouchInfo(const TouchLocationInfo& touchInfo, TouchEventIn
|
||||
const OHOS::Ace::Offset& screenLocation = touchInfo.GetScreenLocation();
|
||||
touchInfoObj->SetProperty<int32_t>("type", static_cast<int32_t>(touchInfo.GetTouchType()));
|
||||
touchInfoObj->SetProperty<int32_t>("id", touchInfo.GetFingerId());
|
||||
touchInfoObj->SetProperty<double>("displayX", PipelineBase::Px2VpWithCurrentDensity(screenLocation.GetX()));
|
||||
touchInfoObj->SetProperty<double>("displayY", PipelineBase::Px2VpWithCurrentDensity(screenLocation.GetY()));
|
||||
touchInfoObj->SetProperty<double>("windowX", PipelineBase::Px2VpWithCurrentDensity(globalLocation.GetX()));
|
||||
touchInfoObj->SetProperty<double>("windowY", PipelineBase::Px2VpWithCurrentDensity(globalLocation.GetY()));
|
||||
touchInfoObj->SetProperty<double>("screenX", PipelineBase::Px2VpWithCurrentDensity(globalLocation.GetX()));
|
||||
touchInfoObj->SetProperty<double>("screenY", PipelineBase::Px2VpWithCurrentDensity(globalLocation.GetY()));
|
||||
touchInfoObj->SetProperty<double>("x", PipelineBase::Px2VpWithCurrentDensity(localLocation.GetX()));
|
||||
touchInfoObj->SetProperty<double>("y", PipelineBase::Px2VpWithCurrentDensity(localLocation.GetY()));
|
||||
touchInfoObj->SetProperty<double>("displayX", screenLocation.GetX());
|
||||
touchInfoObj->SetProperty<double>("displayY", screenLocation.GetY());
|
||||
touchInfoObj->SetProperty<double>("windowX", globalLocation.GetX());
|
||||
touchInfoObj->SetProperty<double>("windowY", globalLocation.GetY());
|
||||
touchInfoObj->SetProperty<double>("screenX", globalLocation.GetX());
|
||||
touchInfoObj->SetProperty<double>("screenY", globalLocation.GetY());
|
||||
touchInfoObj->SetProperty<double>("x", localLocation.GetX());
|
||||
touchInfoObj->SetProperty<double>("y", localLocation.GetY());
|
||||
touchInfoObj->Wrap<TouchEventInfo>(&info);
|
||||
return touchInfoObj;
|
||||
}
|
||||
|
@ -128,6 +128,8 @@ public:
|
||||
static void OnAudioStateChanged(const JSCallbackInfo& args);
|
||||
static void MediaOptions(const JSCallbackInfo& args);
|
||||
static void OnFirstContentfulPaint(const JSCallbackInfo& args);
|
||||
static void OnFirstMeaningfulPaint(const JSCallbackInfo& args);
|
||||
static void OnLargestContentfulPaint(const JSCallbackInfo& args);
|
||||
static void OnSafeBrowsingCheckResult(const JSCallbackInfo& args);
|
||||
static void OnNavigationEntryCommitted(const JSCallbackInfo& args);
|
||||
static void OnIntelligentTrackingPreventionResult(const JSCallbackInfo& args);
|
||||
|
@ -84,7 +84,8 @@ public:
|
||||
void SetEnableAutoFill(bool enableAutoFill) override {};
|
||||
void SetCleanNodeStyle(CleanNodeStyle cleanNodeStyle) override {};
|
||||
void SetCancelIconSize(const CalcDimension& iconSize) override {};
|
||||
void SetCanacelIconSrc(const std::string& iconSrc) override {};
|
||||
void SetCanacelIconSrc(
|
||||
const std::string& iconSrc, const std::string& bundleName, const std::string& moduleName) override {};
|
||||
void SetCancelIconColor(const Color& iconColor) override {};
|
||||
void SetIsShowCancelButton(bool isShowCancelButton) override {};
|
||||
void SetSelectAllValue(bool isSetSelectAllValue) override {};
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "frameworks/bridge/declarative_frontend/jsview/js_span_object.h"
|
||||
|
||||
namespace OHOS::Ace::Framework {} // namespace OHOS::Ace::Framework
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_SPAN_OBJECT_H
|
||||
#define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_SPAN_OBJECT_H
|
||||
|
||||
#include "base/geometry/dimension.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/memory/referenced.h"
|
||||
#include "bridge/declarative_frontend/engine/bindings_defines.h"
|
||||
#include "bridge/declarative_frontend/engine/js_types.h"
|
||||
#include "bridge/declarative_frontend/jsview/js_container_base.h"
|
||||
#include "core/components_ng/pattern/text/span/span_objects.h"
|
||||
#include "core/components_ng/pattern/text_field/text_field_model.h"
|
||||
#include "core/pipeline/pipeline_base.h"
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
|
||||
class JSFontSpan : public virtual AceType {
|
||||
DECLARE_ACE_TYPE(JSFontSpan, AceType)
|
||||
|
||||
public:
|
||||
JSFontSpan() = default;
|
||||
~JSFontSpan() override = default;
|
||||
static void Constructor(const JSCallbackInfo& args);
|
||||
static void Destructor(JSFontSpan* fontSpan);
|
||||
static void JSBind(BindingTarget globalObj);
|
||||
static RefPtr<FontSpan> ParseJsFontSpan(JSRef<JSObject> obj);
|
||||
void GetColor(const JSCallbackInfo& info);
|
||||
void GetSize(const JSCallbackInfo& info);
|
||||
void GetWeight(const JSCallbackInfo& info);
|
||||
void GetFamily(const JSCallbackInfo& info);
|
||||
void GetStyle(const JSCallbackInfo& info);
|
||||
|
||||
RefPtr<FontSpan>& GetFontSpan();
|
||||
void SetFontSpan(const RefPtr<FontSpan>& fontSpan);
|
||||
|
||||
private:
|
||||
ACE_DISALLOW_COPY_AND_MOVE(JSFontSpan);
|
||||
RefPtr<FontSpan> fontSpan_;
|
||||
};
|
||||
} // namespace OHOS::Ace::Framework
|
||||
#endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_SPAN_OBJECT_H
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "frameworks/bridge/declarative_frontend/jsview/js_span_string.h"
|
||||
|
||||
namespace OHOS::Ace::Framework {} // namespace OHOS::Ace::Framework
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_SPAN_STRING_H
|
||||
#define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_SPAN_STRING_H
|
||||
|
||||
#include "base/geometry/dimension.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/memory/referenced.h"
|
||||
#include "bridge/declarative_frontend/engine/bindings_defines.h"
|
||||
#include "bridge/declarative_frontend/engine/js_types.h"
|
||||
#include "bridge/declarative_frontend/jsview/js_container_base.h"
|
||||
#include "core/components_ng/pattern/text/span/mutable_span_string.h"
|
||||
#include "core/components_ng/pattern/text/span/span_string.h"
|
||||
#include "core/pipeline/pipeline_base.h"
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
|
||||
class JSSpanString : public virtual AceType {
|
||||
DECLARE_ACE_TYPE(JSSpanString, AceType)
|
||||
|
||||
public:
|
||||
JSSpanString() = default;
|
||||
~JSSpanString() override = default;
|
||||
static void Constructor(const JSCallbackInfo& args);
|
||||
static void Destructor(JSSpanString* spanString);
|
||||
static void JSBind(BindingTarget globalObj);
|
||||
void GetString(const JSCallbackInfo& info);
|
||||
void GetLength(const JSCallbackInfo& info);
|
||||
void IsEqualToSpanString(const JSCallbackInfo& info);
|
||||
void GetSubSpanString(const JSCallbackInfo& info);
|
||||
static std::vector<RefPtr<SpanBase>> ParseJsSpanBaseVector(JSRef<JSObject> obj);
|
||||
static JSRef<JSObject> CreateJSSpanBaseObject(const RefPtr<SpanBase>& spanObject);
|
||||
static JSRef<JSObject> CreateJsFontSpan(const RefPtr<SpanBase>& spanObject);
|
||||
static RefPtr<SpanBase> ParseJsSpanBase(int32_t start, int32_t length, SpanType type, JSRef<JSObject> obj);
|
||||
static RefPtr<SpanBase> ParseJsFontSpan(int32_t start, int32_t length, JSRef<JSObject> obj);
|
||||
void GetSpans(const JSCallbackInfo& info);
|
||||
void GetIndex(const JSCallbackInfo& info);
|
||||
RefPtr<SpanString>& GetController();
|
||||
void SetController(const RefPtr<SpanString>& spanString);
|
||||
|
||||
private:
|
||||
ACE_DISALLOW_COPY_AND_MOVE(JSSpanString);
|
||||
RefPtr<SpanString> spanString_;
|
||||
};
|
||||
|
||||
class JSMutableSpanString final : public JSSpanString {
|
||||
DECLARE_ACE_TYPE(JSMutableSpanString, AceType)
|
||||
|
||||
public:
|
||||
JSMutableSpanString() = default;
|
||||
~JSMutableSpanString() override = default;
|
||||
static void Constructor(const JSCallbackInfo& args);
|
||||
static void Destructor(JSMutableSpanString* spanString);
|
||||
static void JSBind(BindingTarget globalObj);
|
||||
|
||||
void ReplaceString(const JSCallbackInfo& info);
|
||||
void InsertString(const JSCallbackInfo& info);
|
||||
void RemoveString(const JSCallbackInfo& info);
|
||||
void ReplaceSpan(const JSCallbackInfo& info);
|
||||
void AddSpan(const JSCallbackInfo& info);
|
||||
void RemoveSpan(const JSCallbackInfo& info);
|
||||
void RemoveSpans(const JSCallbackInfo& info);
|
||||
void ClearAllSpans();
|
||||
void ReplaceSpanString(const JSCallbackInfo& info);
|
||||
void InsertSpanString(const JSCallbackInfo& info);
|
||||
void AppendSpanString(const JSCallbackInfo& info);
|
||||
WeakPtr<MutableSpanString>& GetMutableController();
|
||||
void SetMutableController(const RefPtr<MutableSpanString>& mutableSpanString);
|
||||
|
||||
private:
|
||||
ACE_DISALLOW_COPY_AND_MOVE(JSMutableSpanString);
|
||||
WeakPtr<MutableSpanString> mutableSpanString_;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace::Framework
|
||||
#endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_SPAN_STRING_H
|
@ -17,7 +17,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/common/ace_application_info.h"
|
||||
#include "core/components_ng/event/focus_hub.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#include "frameworks/bridge/common/utils/utils.h"
|
||||
#include "frameworks/core/components_ng/base/inspector.h"
|
||||
|
||||
@ -120,6 +123,18 @@ void FrontendDelegate::GetRectangleById(const std::string& key, NG::Rectangle& r
|
||||
NG::Inspector::GetRectangleById(key, rectangle);
|
||||
}
|
||||
|
||||
void FrontendDelegate::ResetFocus()
|
||||
{
|
||||
NG::FocusHub::LostFocusToViewRoot();
|
||||
}
|
||||
|
||||
bool FrontendDelegate::RequestFocus(const std::string& value)
|
||||
{
|
||||
auto pipeline = NG::PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_RETURN(pipeline, false);
|
||||
return pipeline->RequestFocus(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool FrontendDelegate::GetResourceData(const std::string& fileUri, T& content, std::string& ami)
|
||||
{
|
||||
|
@ -118,6 +118,10 @@ public:
|
||||
}
|
||||
virtual void GetRectangleById(const std::string& key, NG::Rectangle& rectangle);
|
||||
|
||||
virtual void ResetFocus();
|
||||
|
||||
virtual bool RequestFocus(const std::string& value);
|
||||
|
||||
// distribute
|
||||
virtual std::pair<std::string, UIContentErrorCode> RestoreRouterStack(const std::string& contentInfo)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ bool Animator::HasScheduler() const
|
||||
return scheduler_ != nullptr;
|
||||
}
|
||||
|
||||
bool Animator::SetExpectedFrameRateRange(FrameRateRange& frameRateRange)
|
||||
bool Animator::SetExpectedFrameRateRange(const FrameRateRange& frameRateRange)
|
||||
{
|
||||
if (HasScheduler() && frameRateRange.IsValid()) {
|
||||
scheduler_->SetExpectedFrameRateRange(frameRateRange);
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
void AttachScheduler(const WeakPtr<PipelineBase>& context);
|
||||
bool AttachSchedulerOnContainer();
|
||||
bool HasScheduler() const;
|
||||
bool SetExpectedFrameRateRange(FrameRateRange& frameRateRange);
|
||||
bool SetExpectedFrameRateRange(const FrameRateRange& frameRateRange);
|
||||
|
||||
// Every interpolate animation needs to add itself into animator and use the controller to drive.
|
||||
void AddInterpolator(const RefPtr<Interpolator>& animation);
|
||||
|
@ -60,9 +60,9 @@ void Scheduler::Stop()
|
||||
scheduleId_ = 0;
|
||||
}
|
||||
|
||||
void Scheduler::SetExpectedFrameRateRange(FrameRateRange& frameRateRange)
|
||||
void Scheduler::SetExpectedFrameRateRange(const FrameRateRange& frameRateRange)
|
||||
{
|
||||
displaySync_->SetExpectedFrameRateRange(std::move(frameRateRange));
|
||||
displaySync_->SetExpectedFrameRateRange(frameRateRange);
|
||||
}
|
||||
|
||||
void Scheduler::OnFrame(uint64_t nanoTimestamp)
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
|
||||
bool PrintVsyncInfoIfNeed() const;
|
||||
|
||||
void SetExpectedFrameRateRange(FrameRateRange& frameRateRange);
|
||||
void SetExpectedFrameRateRange(const FrameRateRange& frameRateRange);
|
||||
|
||||
private:
|
||||
int32_t scheduleId_ = 0;
|
||||
|
@ -55,7 +55,7 @@ double SpringMotion::GetEndValue() const
|
||||
|
||||
bool SpringMotion::IsCompleted(double value, double velocity) const
|
||||
{
|
||||
return NearZero(value - endPosition_, accuracy_) && NearZero(velocity, accuracy_);
|
||||
return NearZero(value - endPosition_, accuracy_) && NearZero(velocity, velocityAccuracy_);
|
||||
}
|
||||
|
||||
bool SpringMotion::IsCompleted()
|
||||
@ -68,6 +68,11 @@ void SpringMotion::SetAccuracy(double accuracy)
|
||||
accuracy_ = std::abs(accuracy);
|
||||
}
|
||||
|
||||
void SpringMotion::SetVelocityAccuracy(double velocityAccuracy)
|
||||
{
|
||||
velocityAccuracy_ = std::abs(velocityAccuracy);
|
||||
}
|
||||
|
||||
void SpringMotion::Reset(double start, double end, double velocity, const RefPtr<SpringProperty>& spring)
|
||||
{
|
||||
currentPosition_ = start;
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
|
||||
void SetAccuracy(double accuracy);
|
||||
|
||||
void SetVelocityAccuracy(double velocityAccuracy);
|
||||
|
||||
void Reset(double start, double end, double velocity, const RefPtr<SpringProperty>& spring);
|
||||
|
||||
std::string GetMotionType() const override;
|
||||
@ -57,6 +59,7 @@ protected:
|
||||
double currentPosition_ = 0.0;
|
||||
double currentVelocity_ = 0.0;
|
||||
double accuracy_ = NEAR_ZERO;
|
||||
double velocityAccuracy_ = NEAR_ZERO;
|
||||
RefPtr<SpringModel> model_;
|
||||
|
||||
private:
|
||||
|
@ -52,7 +52,7 @@ enum class CtrlKeysBit {
|
||||
};
|
||||
|
||||
void EventManager::TouchTest(const TouchEvent& touchPoint, const RefPtr<RenderNode>& renderNode,
|
||||
const TouchRestrict& touchRestrict, const Offset& offset, float viewScale, bool needAppend)
|
||||
TouchRestrict& touchRestrict, const Offset& offset, float viewScale, bool needAppend)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
|
||||
@ -80,7 +80,7 @@ void EventManager::TouchTest(const TouchEvent& touchPoint, const RefPtr<RenderNo
|
||||
}
|
||||
|
||||
void EventManager::TouchTest(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode,
|
||||
const TouchRestrict& touchRestrict, const Offset& offset, float viewScale, bool needAppend)
|
||||
TouchRestrict& touchRestrict, const Offset& offset, float viewScale, bool needAppend)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
|
||||
@ -220,7 +220,7 @@ void EventManager::LogTouchTestResultRecognizers(const TouchTestResult& result)
|
||||
}
|
||||
|
||||
bool EventManager::PostEventTouchTest(
|
||||
const TouchEvent& touchPoint, const RefPtr<NG::UINode>& uiNode, const TouchRestrict& touchRestrict)
|
||||
const TouchEvent& touchPoint, const RefPtr<NG::UINode>& uiNode, TouchRestrict& touchRestrict)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
ACE_FUNCTION_TRACE();
|
||||
@ -250,7 +250,7 @@ bool EventManager::PostEventTouchTest(
|
||||
}
|
||||
|
||||
void EventManager::TouchTest(
|
||||
const AxisEvent& event, const RefPtr<NG::FrameNode>& frameNode, const TouchRestrict& touchRestrict)
|
||||
const AxisEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
|
||||
@ -424,7 +424,7 @@ void EventManager::HandleOutOfRectCallback(const Point& point, std::vector<RectC
|
||||
}
|
||||
|
||||
void EventManager::TouchTest(
|
||||
const AxisEvent& event, const RefPtr<RenderNode>& renderNode, const TouchRestrict& touchRestrict)
|
||||
const AxisEvent& event, const RefPtr<RenderNode>& renderNode, TouchRestrict& touchRestrict)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
|
||||
@ -875,7 +875,7 @@ void EventManager::LogPrintMouseTest()
|
||||
}
|
||||
|
||||
void EventManager::MouseTest(
|
||||
const MouseEvent& event, const RefPtr<NG::FrameNode>& frameNode, const TouchRestrict& touchRestrict)
|
||||
const MouseEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict)
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_MOUSE,
|
||||
"Mouse test start. Event is (%{public}f,%{public}f), button: %{public}d, action: %{public}d", event.x, event.y,
|
||||
|
@ -68,19 +68,19 @@ public:
|
||||
// After the touch down event is triggered, the touch test is performed to collect the corresponding
|
||||
// touch event target list.
|
||||
void TouchTest(const TouchEvent& touchPoint, const RefPtr<RenderNode>& renderNode,
|
||||
const TouchRestrict& touchRestrict, const Offset& offset = Offset(),
|
||||
TouchRestrict& touchRestrict, const Offset& offset = Offset(),
|
||||
float viewScale = 1.0f, bool needAppend = false);
|
||||
|
||||
void TouchTest(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode,
|
||||
const TouchRestrict& touchRestrict, const Offset& offset = Offset(),
|
||||
TouchRestrict& touchRestrict, const Offset& offset = Offset(),
|
||||
float viewScale = 1.0f, bool needAppend = false);
|
||||
|
||||
bool PostEventTouchTest(const TouchEvent& touchPoint, const RefPtr<NG::UINode>& uiNode,
|
||||
const TouchRestrict& touchRestrict);
|
||||
TouchRestrict& touchRestrict);
|
||||
|
||||
void TouchTest(const AxisEvent& event, const RefPtr<RenderNode>& renderNode, const TouchRestrict& touchRestrict);
|
||||
void TouchTest(const AxisEvent& event, const RefPtr<RenderNode>& renderNode, TouchRestrict& touchRestrict);
|
||||
|
||||
void TouchTest(const AxisEvent& event, const RefPtr<NG::FrameNode>& frameNode, const TouchRestrict& touchRestrict);
|
||||
void TouchTest(const AxisEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict);
|
||||
|
||||
bool HasDifferentDirectionGesture();
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
bool DispatchMouseHoverEvent(const MouseEvent& event);
|
||||
|
||||
void LogPrintMouseTest();
|
||||
void MouseTest(const MouseEvent& event, const RefPtr<NG::FrameNode>& frameNode, const TouchRestrict& touchRestrict);
|
||||
void MouseTest(const MouseEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict);
|
||||
bool DispatchMouseEventNG(const MouseEvent& event);
|
||||
void DispatchMouseHoverAnimationNG(const MouseEvent& event);
|
||||
bool DispatchMouseHoverEventNG(const MouseEvent& event);
|
||||
|
@ -57,6 +57,9 @@ void Window::OnVsync(uint64_t nanoTimestamp, uint32_t frameCount)
|
||||
}
|
||||
callback.callback_(nanoTimestamp, frameCount);
|
||||
}
|
||||
#ifdef VSYNC_TIMEOUT_CHECK
|
||||
onVsyncEventCheckTimer_.Cancel();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Window::SetVsyncCallback(AceVsyncCallback&& callback)
|
||||
|
@ -201,6 +201,9 @@ protected:
|
||||
|
||||
uint64_t lastRequestVsyncTime_ = 0;
|
||||
uint32_t windowId_ = 0;
|
||||
#ifdef VSYNC_TIMEOUT_CHECK
|
||||
CancelableCallback<void()> onVsyncEventCheckTimer_;
|
||||
#endif
|
||||
|
||||
private:
|
||||
std::function<Rect()> windowRectImpl_;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "base/geometry/dimension.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/memory/referenced.h"
|
||||
#include "core/common/container.h"
|
||||
#include "core/components/common/properties/color.h"
|
||||
#include "core/components/common/properties/decoration.h"
|
||||
#include "core/components/common/properties/text_style.h"
|
||||
@ -135,6 +136,26 @@ public:
|
||||
{
|
||||
return popupUnselectedTextColor_;
|
||||
}
|
||||
const Color& GetPressedBgAreaColor() const
|
||||
{
|
||||
return pressedBgAreaColor_;
|
||||
}
|
||||
const Color& GetSlipPressedBackgroundColor() const
|
||||
{
|
||||
return slipPressedBackgroundColor_;
|
||||
}
|
||||
const Color& GetPopupClickedBgAreaColor() const
|
||||
{
|
||||
return popupClickedBgAreaColor_;
|
||||
}
|
||||
const Color& GetPopupTitleBackground() const
|
||||
{
|
||||
return popupTitleBackground_;
|
||||
}
|
||||
const Color& GetPopupUnclickedBgAreaColor() const
|
||||
{
|
||||
return popupUnclickedBgAreaColor_;
|
||||
}
|
||||
static constexpr double SLIP_BACKGROUND_OPACITY = 0.05;
|
||||
static constexpr double SLIP_PRESS_BACKGROUND_OPACITY = 0.1;
|
||||
static constexpr float TEXT_PADDING_LEFT = 12.0f;
|
||||
@ -164,6 +185,11 @@ protected:
|
||||
TextStyle seletctTextStyle_;
|
||||
TextStyle defaultTextStyle_;
|
||||
TextStyle popupTextStyle_;
|
||||
Color pressedBgAreaColor_;
|
||||
Color slipPressedBackgroundColor_;
|
||||
Color popupClickedBgAreaColor_;
|
||||
Color popupTitleBackground_;
|
||||
Color popupUnclickedBgAreaColor_;
|
||||
|
||||
private:
|
||||
static void ParsePattern(const RefPtr<ThemeStyle>& themeStyle, const RefPtr<IndexerTheme>& theme)
|
||||
@ -185,8 +211,6 @@ private:
|
||||
theme->selectedBackgroundColor_ =
|
||||
indexerPattern->GetAttr<Color>("selected_background_color", Color(SELECT_BACKGROUD_COLOR)).ChangeOpacity(
|
||||
indexerPattern->GetAttr<double>("selected_background_color_opacity", SELECT_BACKGROUND_OPACITY));
|
||||
theme->popupBackgroundColor_ =
|
||||
indexerPattern->GetAttr<Color>("popup_background_color", Color(POPUP_BACKGROUND_COLOR));
|
||||
theme->popupSeparateColor_ =
|
||||
indexerPattern->GetAttr<Color>("popup_separator_color", Color(POPUP_SEPARATOR_COLOR));
|
||||
theme->popupSelectedTextColor_ =
|
||||
@ -200,8 +224,6 @@ private:
|
||||
theme->hoverBgAreaSize_ =
|
||||
indexerPattern->GetAttr<Dimension>("hover_bg_area_size", Dimension(HOVER_BG_AREA_SIZE, DimensionUnit::VP));
|
||||
theme->hoverBgAreaColor_ = indexerPattern->GetAttr<Color>("hover_bg_area_color", Color(HOVER_BG_AREA_COLOR));
|
||||
theme->hoverTextSize_ =
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_size", Dimension(HOVER_TEXT_SIZE, DimensionUnit::FP));
|
||||
theme->hoverTextAlpha_ =
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_alpha", Dimension(HOVER_TEXT_ALPHA, DimensionUnit::PX));
|
||||
theme->slipHoverBackgroundColor_ =
|
||||
@ -210,21 +232,15 @@ private:
|
||||
indexerPattern->GetAttr<Color>("focus_bg_outline_color", Color(FOCUS_BG_OUTLINE_COLOR));
|
||||
theme->focusBgOutlineSize_ = indexerPattern->GetAttr<Dimension>(
|
||||
"focus_bg_outline_size", Dimension(FOCUS_BG_OUTLINE_SIZE, DimensionUnit::VP));
|
||||
theme->seletctTextStyle_.SetFontSize(
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_size", Dimension(HOVER_TEXT_SIZE, DimensionUnit::FP)));
|
||||
theme->seletctTextStyle_.SetTextColor(
|
||||
indexerPattern->GetAttr<Color>("selected_text_color", Color(SELECT_TEXT_COLOR)));
|
||||
theme->seletctTextStyle_.SetFontWeight(FontWeight::REGULAR);
|
||||
theme->seletctTextStyle_.SetFontStyle(FontStyle::NORMAL);
|
||||
std::vector<std::string> fontFamilies;
|
||||
std::string defaultFamily = "HarmonyOS Sans";
|
||||
fontFamilies.emplace_back(defaultFamily);
|
||||
theme->seletctTextStyle_.SetFontFamilies(fontFamilies);
|
||||
theme->defaultTextStyle_.SetFontSize(
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_size", Dimension(HOVER_TEXT_SIZE, DimensionUnit::FP)));
|
||||
theme->defaultTextStyle_.SetTextColor(
|
||||
indexerPattern->GetAttr<Color>("default_text_color", Color(DEFAULT_TEXT_COLOR)));
|
||||
theme->defaultTextStyle_.SetFontWeight(FontWeight::REGULAR);
|
||||
theme->defaultTextStyle_.SetFontStyle(FontStyle::NORMAL);
|
||||
theme->defaultTextStyle_.SetFontFamilies(fontFamilies);
|
||||
theme->popupTextStyle_.SetFontSize(
|
||||
@ -234,6 +250,39 @@ private:
|
||||
theme->popupTextStyle_.SetFontWeight(FontWeight::MEDIUM);
|
||||
theme->popupTextStyle_.SetFontStyle(FontStyle::NORMAL);
|
||||
theme->popupTextStyle_.SetFontFamilies(fontFamilies);
|
||||
theme->pressedBgAreaColor_ =
|
||||
indexerPattern->GetAttr<Color>("pressed_bg_area_color", Color(PRESSED_BG_AREA_COLOR));
|
||||
theme->slipPressedBackgroundColor_ =
|
||||
indexerPattern->GetAttr<Color>("slip_pressed_background_color", Color(SLIP_PRESSED_BACKGROUD_COLOR));
|
||||
theme->popupClickedBgAreaColor_ =
|
||||
indexerPattern->GetAttr<Color>("popup_clicked_bg_area_color", Color(POPUP_CLICKED_BG_AREA_COLOR));
|
||||
theme->popupTitleBackground_ =
|
||||
indexerPattern->GetAttr<Color>("popup_title_color", Color(POPUP_TITLE_BG_AREA_COLOR));
|
||||
theme->popupUnclickedBgAreaColor_ =
|
||||
indexerPattern->GetAttr<Color>("popup_unclicked_bg_area_color", Color(POPUP_UNCLICKED_BG_AREA_COLOR));
|
||||
if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) {
|
||||
theme->popupBackgroundColor_ = indexerPattern->GetAttr<Color>(
|
||||
"popup_background_color_api_twelve", Color(POPUP_BACKGROUND_COLOR_API_TWELVE));
|
||||
theme->hoverTextSize_ = indexerPattern->GetAttr<Dimension>(
|
||||
"hover_text_size_api_twelve", Dimension(HOVER_TEXT_SIZE_API_TWELVE, DimensionUnit::FP));
|
||||
theme->seletctTextStyle_.SetFontSize(indexerPattern->GetAttr<Dimension>(
|
||||
"hover_text_size_api_twelve", Dimension(HOVER_TEXT_SIZE_API_TWELVE, DimensionUnit::FP)));
|
||||
theme->seletctTextStyle_.SetFontWeight(FontWeight::MEDIUM);
|
||||
theme->defaultTextStyle_.SetFontSize(indexerPattern->GetAttr<Dimension>(
|
||||
"hover_text_size_api_twelve", Dimension(HOVER_TEXT_SIZE_API_TWELVE, DimensionUnit::FP)));
|
||||
theme->defaultTextStyle_.SetFontWeight(FontWeight::MEDIUM);
|
||||
} else {
|
||||
theme->popupBackgroundColor_ =
|
||||
indexerPattern->GetAttr<Color>("popup_background_color", Color(POPUP_BACKGROUND_COLOR));
|
||||
theme->hoverTextSize_ =
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_size", Dimension(HOVER_TEXT_SIZE, DimensionUnit::FP));
|
||||
theme->seletctTextStyle_.SetFontSize(
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_size", Dimension(HOVER_TEXT_SIZE, DimensionUnit::FP)));
|
||||
theme->seletctTextStyle_.SetFontWeight(FontWeight::REGULAR);
|
||||
theme->defaultTextStyle_.SetFontSize(
|
||||
indexerPattern->GetAttr<Dimension>("hover_text_size", Dimension(HOVER_TEXT_SIZE, DimensionUnit::FP)));
|
||||
theme->defaultTextStyle_.SetFontWeight(FontWeight::REGULAR);
|
||||
}
|
||||
}
|
||||
static constexpr uint32_t DEFAULT_TEXT_COLOR = 0x99182431;
|
||||
static constexpr uint32_t POPUP_SELECTED_TEXT_COLOR = 0xff182431;
|
||||
@ -256,6 +305,13 @@ private:
|
||||
static constexpr float FOCUS_BG_OUTLINE_SIZE = 2.0f;
|
||||
static constexpr float TEXT_COLOR_OPACITY = 0.6f;
|
||||
static constexpr float SELECT_BACKGROUND_OPACITY = 0.1f;
|
||||
static constexpr uint32_t PRESSED_BG_AREA_COLOR = 0x19182431;
|
||||
static constexpr uint32_t SLIP_PRESSED_BACKGROUD_COLOR = 0x19182431;
|
||||
static constexpr uint32_t POPUP_CLICKED_BG_AREA_COLOR = 0x0c182431;
|
||||
static constexpr uint32_t POPUP_TITLE_BG_AREA_COLOR = 0x00ffffff;
|
||||
static constexpr uint32_t POPUP_UNCLICKED_BG_AREA_COLOR = 0x00000000;
|
||||
static constexpr uint32_t POPUP_BACKGROUND_COLOR_API_TWELVE = 0x00ffffff;
|
||||
static constexpr float HOVER_TEXT_SIZE_API_TWELVE = 10.0f;
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif
|
@ -806,6 +806,27 @@ void WebClientImpl::OnFirstContentfulPaint(int64_t navigationStartTick, int64_t
|
||||
delegate->OnFirstContentfulPaint(navigationStartTick, firstContentfulPaintMs);
|
||||
}
|
||||
|
||||
void WebClientImpl::OnFirstMeaningfulPaint(
|
||||
std::shared_ptr<NWeb::NWebFirstMeaningfulPaintDetails> details)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
auto delegate = webDelegate_.Upgrade();
|
||||
CHECK_NULL_VOID(delegate);
|
||||
CHECK_NULL_VOID(details);
|
||||
delegate->OnFirstMeaningfulPaint(details);
|
||||
}
|
||||
|
||||
void WebClientImpl::OnLargestContentfulPaint(
|
||||
std::shared_ptr<NWeb::NWebLargestContentfulPaintDetails> details)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
auto delegate = webDelegate_.Upgrade();
|
||||
CHECK_NULL_VOID(delegate);
|
||||
CHECK_NULL_VOID(details);
|
||||
delegate->OnLargestContentfulPaint(details);
|
||||
}
|
||||
|
||||
|
||||
void WebClientImpl::OnSafeBrowsingCheckResult(int threat_type)
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
|
@ -201,6 +201,8 @@ public:
|
||||
std::shared_ptr<NWeb::NWebSelectPopupMenuCallback> callback) override;
|
||||
void OnAudioStateChanged(bool playing) override;
|
||||
void OnFirstContentfulPaint(int64_t navigationStartTick, int64_t firstContentfulPaintMs) override;
|
||||
void OnFirstMeaningfulPaint(std::shared_ptr<NWeb::NWebFirstMeaningfulPaintDetails> details) override;
|
||||
void OnLargestContentfulPaint(std::shared_ptr<NWeb::NWebLargestContentfulPaintDetails> details) override;
|
||||
void OnSafeBrowsingCheckResult(int threat_type) override;
|
||||
void OnCompleteSwapWithNewSize() override;
|
||||
void OnResizeNotWork() override;
|
||||
|
@ -1712,6 +1712,8 @@ bool WebDelegate::PrepareInitOHOSWeb(const WeakPtr<PipelineBase>& context)
|
||||
onTouchIconUrlV2_ = useNewPipe ? eventHub->GetOnTouchIconUrlEvent() : nullptr;
|
||||
onAudioStateChangedV2_ = GetAudioStateChangedCallback(useNewPipe, eventHub);
|
||||
onFirstContentfulPaintV2_ = useNewPipe ? eventHub->GetOnFirstContentfulPaintEvent() : nullptr;
|
||||
OnFirstMeaningfulPaintV2_ = useNewPipe ? eventHub->GetOnFirstMeaningfulPaintEvent() : nullptr;
|
||||
OnLargestContentfulPaintV2_ = useNewPipe ? eventHub->GetOnLargestContentfulPaintEvent() : nullptr;
|
||||
onSafeBrowsingCheckResultV2_ = useNewPipe ? eventHub->GetOnSafeBrowsingCheckResultEvent() : nullptr;
|
||||
onOverScrollV2_ = useNewPipe ? eventHub->GetOnOverScrollEvent()
|
||||
: AceAsyncEvent<void(const std::shared_ptr<BaseEventInfo>&)>::Create(
|
||||
@ -5000,6 +5002,23 @@ void WebDelegate::OnFirstContentfulPaint(int64_t navigationStartTick, int64_t fi
|
||||
}
|
||||
}
|
||||
|
||||
void WebDelegate::OnFirstMeaningfulPaint(std::shared_ptr<OHOS::NWeb::NWebFirstMeaningfulPaintDetails> details)
|
||||
{
|
||||
if (OnFirstMeaningfulPaintV2_) {
|
||||
OnFirstMeaningfulPaintV2_(std::make_shared<FirstMeaningfulPaintEvent>(
|
||||
details->GetNavigationStartTime(), details->GetFirstMeaningfulPaintTime()));
|
||||
}
|
||||
}
|
||||
|
||||
void WebDelegate::OnLargestContentfulPaint(std::shared_ptr<OHOS::NWeb::NWebLargestContentfulPaintDetails> details)
|
||||
{
|
||||
if (OnLargestContentfulPaintV2_) {
|
||||
OnLargestContentfulPaintV2_(std::make_shared<LargestContentfulPaintEvent>(details->GetNavigationStartTime(),
|
||||
details->GetLargestImagePaintTime(), details->GetLargestTextPaintTime(),
|
||||
details->GetLargestImageLoadStartTime(), details->GetLargestImageLoadEndTime(), details->GetImageBPP()));
|
||||
}
|
||||
}
|
||||
|
||||
void WebDelegate::OnSafeBrowsingCheckResult(int threat_type)
|
||||
{
|
||||
if (onSafeBrowsingCheckResultV2_) {
|
||||
|
@ -662,6 +662,8 @@ public:
|
||||
void OnTouchIconUrl(const std::string& iconUrl, bool precomposed);
|
||||
void OnAudioStateChanged(bool audible);
|
||||
void OnFirstContentfulPaint(int64_t navigationStartTick, int64_t firstContentfulPaintMs);
|
||||
void OnFirstMeaningfulPaint(std::shared_ptr<OHOS::NWeb::NWebFirstMeaningfulPaintDetails> details);
|
||||
void OnLargestContentfulPaint(std::shared_ptr<OHOS::NWeb::NWebLargestContentfulPaintDetails> details);
|
||||
void OnSafeBrowsingCheckResult(int threat_type);
|
||||
void OnGetTouchHandleHotZone(OHOS::NWeb::TouchHandleHotZone& hotZone);
|
||||
void OnOverScroll(float xOffset, float yOffset);
|
||||
@ -855,6 +857,8 @@ private:
|
||||
EventCallbackV2 onTouchIconUrlV2_;
|
||||
EventCallbackV2 onAudioStateChangedV2_;
|
||||
EventCallbackV2 onFirstContentfulPaintV2_;
|
||||
EventCallbackV2 OnFirstMeaningfulPaintV2_;
|
||||
EventCallbackV2 OnLargestContentfulPaintV2_;
|
||||
EventCallbackV2 onOverScrollV2_;
|
||||
EventCallbackV2 onScreenCaptureRequestV2_;
|
||||
EventCallbackV2 onNavigationEntryCommittedV2_;
|
||||
|
@ -1448,6 +1448,86 @@ private:
|
||||
int64_t firstContentfulPaintMs_;
|
||||
};
|
||||
|
||||
class ACE_EXPORT FirstMeaningfulPaintEvent : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(FirstMeaningfulPaintEvent, BaseEventInfo);
|
||||
|
||||
public:
|
||||
FirstMeaningfulPaintEvent(int64_t navigationStartTime, int64_t firstMeaningfulPaintTime)
|
||||
: BaseEventInfo("FirstMeaningfulPaintEvent"), navigationStartTime_(navigationStartTime),
|
||||
firstMeaningfulPaintTime_(firstMeaningfulPaintTime)
|
||||
{}
|
||||
|
||||
~FirstMeaningfulPaintEvent() = default;
|
||||
|
||||
int64_t GetNavigationStartTime() const
|
||||
{
|
||||
return navigationStartTime_;
|
||||
}
|
||||
|
||||
int64_t GetFirstMeaningfulPaintTime() const
|
||||
{
|
||||
return firstMeaningfulPaintTime_;
|
||||
}
|
||||
|
||||
private:
|
||||
int64_t navigationStartTime_;
|
||||
int64_t firstMeaningfulPaintTime_;
|
||||
};
|
||||
|
||||
class ACE_EXPORT LargestContentfulPaintEvent : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(LargestContentfulPaintEvent, BaseEventInfo);
|
||||
|
||||
public:
|
||||
LargestContentfulPaintEvent(int64_t navigationStartTime, int64_t largestImagePaintTime,
|
||||
int64_t largestTextPaintTime, int64_t largestImageLoadStartTime, int64_t largestImageLoadEndTime,
|
||||
double_t imageBPP)
|
||||
: BaseEventInfo("LargestContentfulPaintEvent"), navigationStartTime_(navigationStartTime),
|
||||
largestImagePaintTime_(largestImagePaintTime), largestTextPaintTime_(largestTextPaintTime),
|
||||
largestImageLoadStartTime_(largestImageLoadStartTime), largestImageLoadEndTime_(largestImageLoadEndTime),
|
||||
imageBPP_(imageBPP)
|
||||
{}
|
||||
|
||||
~LargestContentfulPaintEvent() = default;
|
||||
|
||||
int64_t GetNavigationStartTime() const
|
||||
{
|
||||
return navigationStartTime_;
|
||||
}
|
||||
|
||||
int64_t GetLargestImagePaintTime() const
|
||||
{
|
||||
return largestImagePaintTime_;
|
||||
}
|
||||
|
||||
int64_t GetLargestTextPaintTime() const
|
||||
{
|
||||
return largestTextPaintTime_;
|
||||
}
|
||||
|
||||
int64_t GetLargestImageLoadStartTime() const
|
||||
{
|
||||
return largestImageLoadStartTime_;
|
||||
}
|
||||
|
||||
int64_t GetLargestImageLoadEndTime() const
|
||||
{
|
||||
return largestImageLoadEndTime_;
|
||||
}
|
||||
|
||||
double_t GetImageBPP() const
|
||||
{
|
||||
return imageBPP_;
|
||||
}
|
||||
|
||||
private:
|
||||
int64_t navigationStartTime_;
|
||||
int64_t largestImagePaintTime_;
|
||||
int64_t largestTextPaintTime_;
|
||||
int64_t largestImageLoadStartTime_;
|
||||
int64_t largestImageLoadEndTime_;
|
||||
double_t imageBPP_;
|
||||
};
|
||||
|
||||
class ACE_EXPORT SafeBrowsingCheckResultEvent : public BaseEventInfo {
|
||||
DECLARE_RELATIONSHIP_OF_CLASSES(SafeBrowsingCheckResultEvent, BaseEventInfo);
|
||||
|
||||
|
@ -279,6 +279,24 @@ int32_t OH_NativeXComponent::SetNeedSoftKeyboard(bool needSoftKeyboard)
|
||||
return OH_NATIVEXCOMPONENT_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t OH_NativeXComponent::RegisterSurfaceShowCallback(NativeXComponent_Surface_Callback callback)
|
||||
{
|
||||
if (xcomponentImpl_ == nullptr) {
|
||||
return OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
xcomponentImpl_->SetSurfaceShowCallback(callback);
|
||||
return OH_NATIVEXCOMPONENT_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t OH_NativeXComponent::RegisterSurfaceHideCallback(NativeXComponent_Surface_Callback callback)
|
||||
{
|
||||
if (xcomponentImpl_ == nullptr) {
|
||||
return OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
xcomponentImpl_->SetSurfaceHideCallback(callback);
|
||||
return OH_NATIVEXCOMPONENT_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t OH_NativeXComponent::RegisterOnTouchInterceptCallback(
|
||||
HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event))
|
||||
{
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/components_ng/event/gesture_event_hub.h"
|
||||
|
||||
using NativeXComponent_Surface_Callback = void (*)(OH_NativeXComponent*, void*);
|
||||
|
||||
struct XComponentTouchPoint {
|
||||
float tiltX = 0.0f;
|
||||
float tiltY = 0.0f;
|
||||
@ -144,6 +146,26 @@ public:
|
||||
return mouseEventCallback_;
|
||||
}
|
||||
|
||||
NativeXComponent_Surface_Callback GetSurfaceShowCallback() const
|
||||
{
|
||||
return surfaceShowCallback_;
|
||||
}
|
||||
|
||||
void SetSurfaceShowCallback(NativeXComponent_Surface_Callback callback)
|
||||
{
|
||||
surfaceShowCallback_ = callback;
|
||||
}
|
||||
|
||||
NativeXComponent_Surface_Callback GetSurfaceHideCallback() const
|
||||
{
|
||||
return surfaceHideCallback_;
|
||||
}
|
||||
|
||||
void SetSurfaceHideCallback(NativeXComponent_Surface_Callback callback)
|
||||
{
|
||||
surfaceHideCallback_ = callback;
|
||||
}
|
||||
|
||||
void SetTouchEvent(const OH_NativeXComponent_TouchEvent touchEvent)
|
||||
{
|
||||
touchEvent_ = touchEvent;
|
||||
@ -364,6 +386,8 @@ private:
|
||||
OH_NativeXComponent_KeyEvent keyEvent_;
|
||||
OH_NativeXComponent_Callback* callback_ = nullptr;
|
||||
OH_NativeXComponent_MouseEvent_Callback* mouseEventCallback_ = nullptr;
|
||||
NativeXComponent_Surface_Callback surfaceShowCallback_ = nullptr;
|
||||
NativeXComponent_Surface_Callback surfaceHideCallback_ = nullptr;
|
||||
NativeXComponent_Callback focusEventCallback_ = nullptr;
|
||||
NativeXComponent_Callback keyEventCallback_ = nullptr;
|
||||
NativeXComponent_Callback blurEventCallback_ = nullptr;
|
||||
@ -392,6 +416,8 @@ struct OH_NativeXComponent {
|
||||
int32_t GetHistoryPoints(const void* window, int32_t* size, OH_NativeXComponent_HistoricalPoint** historicalPoints);
|
||||
int32_t RegisterCallback(OH_NativeXComponent_Callback* callback);
|
||||
int32_t RegisterMouseEventCallback(OH_NativeXComponent_MouseEvent_Callback* callback);
|
||||
int32_t RegisterSurfaceShowCallback(NativeXComponent_Surface_Callback callback);
|
||||
int32_t RegisterSurfaceHideCallback(NativeXComponent_Surface_Callback callback);
|
||||
int32_t GetToolType(size_t pointIndex, OH_NativeXComponent_TouchPointToolType* toolType);
|
||||
int32_t GetTiltX(size_t pointIndex, float* tiltX);
|
||||
int32_t GetTiltY(size_t pointIndex, float* tiltY);
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
int32_t count = 0;
|
||||
for (const auto& child : children) {
|
||||
count = child->FrameCount();
|
||||
child->SetNodeIndexOffset(startIndex, count);
|
||||
children_.push_back({ child, startIndex, count });
|
||||
startIndex += count;
|
||||
totalCount_ += count;
|
||||
@ -1448,7 +1449,10 @@ void FrameNode::RebuildRenderContextTree()
|
||||
// generate full children list, including disappear children.
|
||||
GenerateOneDepthVisibleFrameWithTransition(children);
|
||||
if (overlayNode_) {
|
||||
children.push_back(overlayNode_);
|
||||
auto property = overlayNode_->GetLayoutProperty();
|
||||
if (property && property->GetVisibilityValue(VisibleType::VISIBLE) == VisibleType::VISIBLE) {
|
||||
children.push_back(overlayNode_);
|
||||
}
|
||||
}
|
||||
for (const auto& child : children) {
|
||||
frameChildren_.emplace(child);
|
||||
@ -1751,7 +1755,7 @@ void FrameNode::AddJudgeToTargetComponent(RefPtr<TargetComponent>& targetCompone
|
||||
}
|
||||
|
||||
HitTestResult FrameNode::TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint,
|
||||
const PointF& parentRevertPoint, const TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
const PointF& parentRevertPoint, TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
bool isDispatch)
|
||||
{
|
||||
if (!isActive_ || !eventHub_->IsEnabled() || bypass_) {
|
||||
@ -1851,6 +1855,10 @@ HitTestResult FrameNode::TouchTest(const PointF& globalPoint, const PointF& pare
|
||||
childNode->GetInspectorId()->c_str());
|
||||
auto hitResult = childNode->TouchTest(
|
||||
globalPoint, localPoint, subRevertPoint, touchRestrict, newComingTargets, touchId, true);
|
||||
if (touchRes.strategy == TouchTestStrategy::FORWARD ||
|
||||
touchRes.strategy == TouchTestStrategy::FORWARD_COMPETITION) {
|
||||
touchRestrict.childTouchTestList.emplace_back(touchRes.id);
|
||||
}
|
||||
if (hitResult == HitTestResult::STOP_BUBBLING) {
|
||||
preventBubbling = true;
|
||||
consumed = true;
|
||||
@ -3076,6 +3084,11 @@ int32_t FrameNode::GetChildTrueIndex(const RefPtr<LayoutWrapper>& child) const
|
||||
return frameProxy_->GetChildIndex(child);
|
||||
}
|
||||
|
||||
uint32_t FrameNode::GetChildTrueTotalCount() const
|
||||
{
|
||||
return frameProxy_->GetTotalCount();
|
||||
}
|
||||
|
||||
const std::list<RefPtr<LayoutWrapper>>& FrameNode::GetAllChildrenWithBuild(bool addToRenderTree)
|
||||
{
|
||||
const auto& children = frameProxy_->GetAllFrameChildren();
|
||||
@ -3240,7 +3253,13 @@ void FrameNode::DoSetActiveChildRange(int32_t start, int32_t end)
|
||||
void FrameNode::OnInspectorIdUpdate(const std::string& id)
|
||||
{
|
||||
renderContext_->UpdateNodeName(id);
|
||||
RecordExposureIfNeed(id);
|
||||
PostTask(
|
||||
[weak = WeakClaim(this), inspectorId = id]() {
|
||||
auto host = weak.Upgrade();
|
||||
CHECK_NULL_VOID(host);
|
||||
host->RecordExposureIfNeed(inspectorId);
|
||||
},
|
||||
TaskExecutor::TaskType::UI);
|
||||
auto parent = GetAncestorNodeOfFrame();
|
||||
CHECK_NULL_VOID(parent);
|
||||
if (parent->GetTag() == V2::RELATIVE_CONTAINER_ETS_TAG) {
|
||||
|
@ -272,7 +272,7 @@ public:
|
||||
|
||||
// If return true, will prevent TouchTest Bubbling to parent and brother nodes.
|
||||
HitTestResult TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint, const PointF& parentRevertPoint,
|
||||
const TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId, bool isDispatch = false) override;
|
||||
TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId, bool isDispatch = false) override;
|
||||
|
||||
HitTestResult MouseTest(const PointF& globalPoint, const PointF& parentLocalPoint, MouseTestResult& onMouseResult,
|
||||
MouseTestResult& onHoverResult, RefPtr<FrameNode>& hoverNode) override;
|
||||
@ -599,6 +599,7 @@ public:
|
||||
* @return index of Child, or -1 if not found.
|
||||
*/
|
||||
int32_t GetChildTrueIndex(const RefPtr<LayoutWrapper>& child) const;
|
||||
uint32_t GetChildTrueTotalCount() const;
|
||||
const std::list<RefPtr<LayoutWrapper>>& GetAllChildrenWithBuild(bool addToRenderTree = true) override;
|
||||
void RemoveChildInRenderTree(uint32_t index) override;
|
||||
void RemoveAllChildInRenderTree() override;
|
||||
|
@ -608,7 +608,7 @@ RefPtr<PipelineContext> UINode::GetContext()
|
||||
}
|
||||
|
||||
HitTestResult UINode::TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint,
|
||||
const PointF& parentRevertPoint, const TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
const PointF& parentRevertPoint, TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
bool isDispatch)
|
||||
{
|
||||
auto children = GetChildren();
|
||||
|
@ -256,7 +256,7 @@ public:
|
||||
void SetChildrenInDestroying();
|
||||
|
||||
virtual HitTestResult TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint,
|
||||
const PointF& parentRevertPoint, const TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
const PointF& parentRevertPoint, TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
bool isDispatch = false);
|
||||
virtual HitTestMode GetHitTestMode() const
|
||||
{
|
||||
@ -529,6 +529,8 @@ public:
|
||||
|
||||
virtual bool SetParentLayoutConstraint(const SizeF& size) const;
|
||||
|
||||
virtual void SetNodeIndexOffset(int32_t start, int32_t count) {}
|
||||
|
||||
void PaintDebugBoundaryTreeAll(bool flag);
|
||||
|
||||
protected:
|
||||
|
@ -513,6 +513,13 @@ void DragEventActuator::SetFilter(const RefPtr<DragEventActuator>& actuator)
|
||||
styleOption.colorMode = static_cast<ThemeColorMode>(static_cast<int32_t>(ThemeColorMode::SYSTEM));
|
||||
option.SetDuration(FILTER_TIMES);
|
||||
option.SetCurve(Curves::SHARP);
|
||||
option.SetOnFinishEvent([pipelineWeak = WeakClaim(RawPtr(pipelineContext))] {
|
||||
auto pipelineContext = pipelineWeak.Upgrade();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
auto manager = pipelineContext->GetOverlayManager();
|
||||
CHECK_NULL_VOID(manager);
|
||||
manager->SetFilterActive(false);
|
||||
});
|
||||
columnNode->GetRenderContext()->UpdateBackBlurRadius(FILTER_VALUE);
|
||||
AnimationUtils::Animate(
|
||||
option, [columnNode, styleOption]() { columnNode->GetRenderContext()->UpdateBackBlurStyle(styleOption); },
|
||||
|
@ -826,14 +826,25 @@ void GestureEventHub::OnDragStart(const GestureEvent& info, const RefPtr<Pipelin
|
||||
if (IsPixelMapNeedScale()) {
|
||||
RefPtr<FrameNode> imageNode = overlayManager->GetPixelMapContentNode();
|
||||
DragEventActuator::CreatePreviewNode(frameNode, imageNode);
|
||||
auto frameTag = frameNode->GetTag();
|
||||
if (GetTextDraggable() && IsTextCategoryComponent(frameTag)) {
|
||||
auto textDragPattern = frameNode->GetPattern<TextDragBase>();
|
||||
CHECK_NULL_VOID(textDragPattern);
|
||||
auto dragNode = textDragPattern->MoveDragNode();
|
||||
if (dragNode) {
|
||||
auto dragNodeOffset = dragNode->GetOffsetInScreen();
|
||||
DragEventActuator::UpdatePreviewPositionAndScale(imageNode, dragNodeOffset);
|
||||
}
|
||||
}
|
||||
CHECK_NULL_VOID(imageNode);
|
||||
scale = static_cast<float>(imageNode->GetPreviewScaleVal());
|
||||
auto window = SubwindowManager::GetInstance()->ShowPreviewNG();
|
||||
if (window) {
|
||||
overlayManager = window->GetOverlayManager();
|
||||
CHECK_NULL_VOID(overlayManager);
|
||||
DragEventActuator::MountPixelMap(overlayManager, eventHub->GetGestureEventHub(), imageNode);
|
||||
dragDropManager->DoDragStartAnimation(overlayManager, info);
|
||||
auto subWindowOverlayManager = window->GetOverlayManager();
|
||||
CHECK_NULL_VOID(subWindowOverlayManager);
|
||||
DragEventActuator::MountPixelMap(subWindowOverlayManager, eventHub->GetGestureEventHub(), imageNode);
|
||||
dragDropManager->DoDragStartAnimation(subWindowOverlayManager, info);
|
||||
overlayManager->RemovePixelMap();
|
||||
if (pixelMap_ != nullptr) {
|
||||
pixelMap = pixelMap_;
|
||||
}
|
||||
|
@ -313,21 +313,28 @@ void NGGestureRecognizer::SetEventImportGestureGroup(const WeakPtr<NGGestureReco
|
||||
|
||||
bool NGGestureRecognizer::IsInAttachedNode(const TouchEvent& event)
|
||||
{
|
||||
PointF localPoint(event.x, event.y);
|
||||
bool isChildTouchTestResult = false;
|
||||
auto frameNode = GetAttachedNode();
|
||||
if (!frameNode.Invalid()) {
|
||||
auto host = frameNode.Upgrade();
|
||||
CHECK_NULL_RETURN(host, false);
|
||||
NGGestureRecognizer::Transform(localPoint, frameNode, !isPostEventResult_, isPostEventResult_);
|
||||
auto renderContext = host->GetRenderContext();
|
||||
CHECK_NULL_RETURN(renderContext, false);
|
||||
auto paintRect = renderContext->GetPaintRectWithoutTransform();
|
||||
localPoint = localPoint + paintRect.GetOffset();
|
||||
auto responseRegion = host->GetResponseRegionListForRecognizer(static_cast<int32_t>(event.sourceType));
|
||||
if (!host->InResponseRegionList(localPoint, responseRegion)) {
|
||||
return false;
|
||||
}
|
||||
if (frameNode.Invalid()) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
auto host = frameNode.Upgrade();
|
||||
CHECK_NULL_RETURN(host, true);
|
||||
auto id = host->GetInspectorIdValue("");
|
||||
isChildTouchTestResult = std::any_of(event.childTouchTestList.begin(), event.childTouchTestList.end(),
|
||||
[id](const std::string& inspectorId) {
|
||||
return inspectorId == id;
|
||||
});
|
||||
if (isChildTouchTestResult) {
|
||||
return true;
|
||||
}
|
||||
PointF localPoint(event.x, event.y);
|
||||
NGGestureRecognizer::Transform(localPoint, frameNode, !isPostEventResult_, isPostEventResult_);
|
||||
auto renderContext = host->GetRenderContext();
|
||||
CHECK_NULL_RETURN(renderContext, false);
|
||||
auto paintRect = renderContext->GetPaintRectWithoutTransform();
|
||||
localPoint = localPoint + paintRect.GetOffset();
|
||||
auto responseRegion = host->GetResponseRegionListForRecognizer(static_cast<int32_t>(event.sourceType));
|
||||
return host->InResponseRegionList(localPoint, responseRegion);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -72,10 +72,6 @@ ImageLoadingContext::ImageLoadingContext(const ImageSourceInfo& src, LoadNotifie
|
||||
containerId_(Container::CurrentId()), syncLoad_(syncLoad)
|
||||
{
|
||||
stateManager_ = MakeRefPtr<ImageStateManager>(WeakClaim(this));
|
||||
// pixmap src is ready to draw
|
||||
if (src_.GetSrcType() == SrcType::PIXMAP) {
|
||||
syncLoad_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImageLoadingContext::~ImageLoadingContext()
|
||||
|
@ -16,18 +16,28 @@
|
||||
#include "core/components_ng/image_provider/pixel_map_image_object.h"
|
||||
|
||||
#include "core/components_ng/image_provider/image_loading_context.h"
|
||||
#include "core/components_ng/image_provider/image_utils.h"
|
||||
#include "core/components_ng/render/canvas_image.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
void PixelMapImageObject::MakeCanvasImage(
|
||||
const RefPtr<ImageLoadingContext>& ctx, const SizeF& /*resizeTarget*/, bool /*forceResize*/, bool /*syncLoad*/)
|
||||
const RefPtr<ImageLoadingContext>& ctx, const SizeF& /*resizeTarget*/, bool /*forceResize*/, bool syncLoad)
|
||||
{
|
||||
if (!pixmap_) {
|
||||
ctx->FailCallback("pixmap is null when PixelMapImageObject try MakeCanvasImage");
|
||||
return;
|
||||
}
|
||||
ctx->SuccessCallback(CanvasImage::Create(pixmap_));
|
||||
if (syncLoad) {
|
||||
ctx->SuccessCallback(CanvasImage::Create(pixmap_));
|
||||
} else {
|
||||
auto task = [ctx, weak = AceType::WeakClaim(this)]() {
|
||||
auto pixelmapObject = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pixelmapObject);
|
||||
ctx->SuccessCallback(CanvasImage::Create(pixelmapObject->pixmap_));
|
||||
};
|
||||
NG::ImageUtils::PostToUI(task);
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<PixelMapImageObject> PixelMapImageObject::Create(const ImageSourceInfo& src, const RefPtr<ImageData>& data)
|
||||
|
@ -21,6 +21,9 @@ void UIDisplaySync::CheckRate(int32_t vsyncRate, int32_t refreshRateMode)
|
||||
SetVsyncRate(vsyncRate);
|
||||
SetRefreshRateMode(refreshRateMode);
|
||||
|
||||
CHECK_NULL_VOID(data_);
|
||||
CHECK_NULL_VOID(data_->rate_);
|
||||
CHECK_NULL_VOID(data_->rateRange_);
|
||||
if (IsCommonDivisor(data_->rateRange_->preferred_, vsyncRate)) {
|
||||
int32_t curRate = vsyncRate / data_->rateRange_->preferred_;
|
||||
if (data_->rate_ != curRate) {
|
||||
@ -82,7 +85,10 @@ void UIDisplaySync::AddToPipeline(WeakPtr<PipelineBase>& pipelineContext)
|
||||
{
|
||||
auto context = pipelineContext.Upgrade();
|
||||
if (!context) {
|
||||
return;
|
||||
context = PipelineBase::GetCurrentContextSafely();
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<UIDisplaySyncManager> dsm = context->GetOrCreateUIDisplaySyncManager();
|
||||
@ -96,7 +102,10 @@ void UIDisplaySync::DelFromPipeline(WeakPtr<PipelineBase>& pipelineContext)
|
||||
{
|
||||
auto context = pipelineContext.Upgrade();
|
||||
if (!context) {
|
||||
return;
|
||||
context = PipelineBase::GetCurrentContextSafely();
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<UIDisplaySyncManager> dsm = context->GetOrCreateUIDisplaySyncManager();
|
||||
@ -235,7 +244,7 @@ UIDisplaySync::UIDisplaySync() {}
|
||||
|
||||
UIDisplaySync::~UIDisplaySync() noexcept {}
|
||||
|
||||
void UIDisplaySync::SetExpectedFrameRateRange(FrameRateRange&& range)
|
||||
void UIDisplaySync::SetExpectedFrameRateRange(const FrameRateRange& range)
|
||||
{
|
||||
data_->rateRange_->Set(range.min_, range.max_, range.preferred_);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
void JudgeWhetherSkip();
|
||||
void OnFrame();
|
||||
|
||||
void SetExpectedFrameRateRange(FrameRateRange&& frameRateRange);
|
||||
void SetExpectedFrameRateRange(const FrameRateRange& frameRateRange);
|
||||
bool SetVsyncRate(int32_t vsyncRate);
|
||||
bool IsCommonDivisor(int32_t expectedRate, int32_t vsyncRate);
|
||||
|
||||
|
@ -274,6 +274,7 @@ void ContainerModalPatternEnhance::UpdateTitleInTargetPos(bool isShow, int32_t h
|
||||
floatingContext->OnTransformTranslateUpdate({ 0.0f, height, 0.0f });
|
||||
});
|
||||
buttonsContext->OnTransformTranslateUpdate({ 0.0f, height - static_cast<float>(titlePopupDistance), 0.0f });
|
||||
SetControlButtonVisibleBeforeAnim(controlButtonsLayoutProperty->GetVisibilityValue());
|
||||
controlButtonsLayoutProperty->UpdateVisibility(VisibleType::VISIBLE);
|
||||
AnimationUtils::Animate(option, [buttonsContext, height]() {
|
||||
buttonsContext->OnTransformTranslateUpdate({ 0.0f, height, 0.0f });
|
||||
@ -288,8 +289,10 @@ void ContainerModalPatternEnhance::UpdateTitleInTargetPos(bool isShow, int32_t h
|
||||
0.0f });
|
||||
buttonsContext->OnTransformTranslateUpdate({ 0.0f, 0.0f, 0.0f });
|
||||
},
|
||||
[floatingLayoutProperty]() {
|
||||
[floatingLayoutProperty, controlButtonsLayoutProperty, weak = WeakClaim(this)]() {
|
||||
auto enhancePattern = weak.Upgrade();
|
||||
floatingLayoutProperty->UpdateVisibility(VisibleType::GONE);
|
||||
controlButtonsLayoutProperty->UpdateVisibility(enhancePattern->GetControlButtonVisibleBeforeAnim());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,15 @@ public:
|
||||
void UpdateTitleInTargetPos(bool isShow, int32_t height);
|
||||
void SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize) override;
|
||||
void ShowTitle(bool isShow, bool hasDeco = true, bool needUpdate = false) override;
|
||||
VisibleType GetControlButtonVisibleBeforeAnim()
|
||||
{
|
||||
return controlButtonVisibleBeforeAnim_;
|
||||
}
|
||||
|
||||
void SetControlButtonVisibleBeforeAnim(VisibleType visibleType)
|
||||
{
|
||||
controlButtonVisibleBeforeAnim_ = visibleType;
|
||||
}
|
||||
|
||||
protected:
|
||||
RefPtr<UINode> GetTitleItemByIndex(const RefPtr<FrameNode>& controlButtonsNode, int32_t originIndex) override;
|
||||
@ -43,6 +52,9 @@ protected:
|
||||
const RefPtr<FrameNode>& buttonNode, InternalResource::ResourceId icon, bool isFocus) override;
|
||||
|
||||
bool CanHideFloatingTitle() override;
|
||||
|
||||
private:
|
||||
VisibleType controlButtonVisibleBeforeAnim_;
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_CONTAINER_MODAL_CONTAINER_MODAL_PATTERN_ENHANCE_H
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "core/components_ng/render/adapter/rosen_render_context.h"
|
||||
#include "core/components_ng/render/drawing.h"
|
||||
#include "core/image/sk_image_cache.h"
|
||||
#include "core/common/font_manager.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
namespace {
|
||||
@ -96,6 +97,10 @@ void CanvasPaintMethod::UpdateContentModifier(PaintWrapper* paintWrapper)
|
||||
if (lastLayoutSize_ != frameSize) {
|
||||
lastLayoutSize_.SetSizeT(frameSize);
|
||||
}
|
||||
auto fontManager = context->GetFontManager();
|
||||
if (fontManager && rsRecordingCanvas_) {
|
||||
rsRecordingCanvas_->SetIsCustomTextType(fontManager->IsDefaultFontChanged());
|
||||
}
|
||||
#ifndef USE_ROSEN_DRAWING
|
||||
if (!skCanvas_) {
|
||||
return;
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "core/image/image_provider.h"
|
||||
#include "core/image/sk_image_cache.h"
|
||||
#include "core/pipeline/base/rosen_render_context.h"
|
||||
#include "core/common/font_manager.h"
|
||||
|
||||
#ifdef ENABLE_ROSEN_BACKEND
|
||||
#include "pipeline/rs_recording_canvas.h"
|
||||
@ -159,17 +158,6 @@ void CustomPaintPaintMethod::UpdateRecordingCanvas(float width, float height)
|
||||
rsRecordingCanvas_ = std::make_shared<RSRecordingCanvas>(width, height);
|
||||
rsCanvas_ = std::static_pointer_cast<RSCanvas>(rsRecordingCanvas_);
|
||||
contentModifier_->UpdateCanvas(rsRecordingCanvas_);
|
||||
auto context = context_.Upgrade();
|
||||
CHECK_NULL_VOID(context);
|
||||
auto fontManager = context->GetFontManager();
|
||||
CHECK_NULL_VOID(fontManager);
|
||||
if (fontManager->IsDefaultFontChanged()) {
|
||||
CHECK_NULL_VOID(rsRecordingCanvas_);
|
||||
rsRecordingCanvas_->SetIsCustomTextType(true);
|
||||
} else {
|
||||
CHECK_NULL_VOID(rsRecordingCanvas_);
|
||||
rsRecordingCanvas_->SetIsCustomTextType(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -426,7 +414,7 @@ void CustomPaintPaintMethod::UpdatePaintShader(const Ace::Pattern& pattern, RSPe
|
||||
CHECK_NULL_VOID(pixelMap);
|
||||
auto rsBitmapFormat = Ace::ImageProvider::MakeRSBitmapFormatFromPixelMap(pixelMap);
|
||||
auto rsBitmap = std::make_shared<RSBitmap>();
|
||||
rsBitmap->Build(pixelMap->GetWidth(), pixelMap->GetHeight(), rsBitmapFormat);
|
||||
rsBitmap->Build(pixelMap->GetWidth(), pixelMap->GetHeight(), rsBitmapFormat, pixelMap->GetRowStride());
|
||||
rsBitmap->SetPixels(const_cast<void*>(reinterpret_cast<const void*>(pixelMap->GetPixels())));
|
||||
auto image = std::make_shared<RSImage>();
|
||||
CHECK_NULL_VOID(image->BuildFromBitmap(*rsBitmap));
|
||||
|
@ -76,7 +76,7 @@ std::shared_ptr<MMI::PointerEvent> ConvertPointerEvent(const OffsetF offsetF, co
|
||||
}
|
||||
|
||||
HitTestResult FormNode::TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint,
|
||||
const PointF& parentRevertPoint, const TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
const PointF& parentRevertPoint, TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId,
|
||||
bool isDispatch)
|
||||
{
|
||||
// The mousetest has been merged into touchtest.
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
~FormNode() override = default;
|
||||
|
||||
HitTestResult TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint, const PointF& parentRevertPoint,
|
||||
const TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId, bool isDispatch = false) override;
|
||||
TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId, bool isDispatch = false) override;
|
||||
|
||||
static RefPtr<FormNode> GetOrCreateFormNode(
|
||||
const std::string& tag, int32_t nodeId, const std::function<RefPtr<Pattern>(void)>& patternCreator);
|
||||
|
@ -330,7 +330,7 @@ void GridLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper)
|
||||
}
|
||||
gridLayoutInfo_.endIndex_ = itemIndex - 1;
|
||||
gridLayoutInfo_.startMainLineIndex_ = 0;
|
||||
gridLayoutInfo_.endMainLineIndex_ = gridLayoutInfo_.hasBigItem_ ? gridLayoutInfo_.gridMatrix_.size() - 1 : rowIndex;
|
||||
gridLayoutInfo_.endMainLineIndex_ = gridLayoutInfo_.gridMatrix_.size() - 1 ;
|
||||
}
|
||||
|
||||
void GridLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
|
||||
|
@ -285,6 +285,7 @@ struct GridLayoutInfo {
|
||||
bool hasBigItem_;
|
||||
|
||||
bool offsetUpdated_ = false;
|
||||
float originOffset_ = 0.0f;
|
||||
std::optional<int32_t> targetIndex_;
|
||||
|
||||
private:
|
||||
|
@ -348,6 +348,7 @@ bool GridPattern::UpdateCurrentOffset(float offset, int32_t source)
|
||||
FireAndCleanScrollingListener();
|
||||
// When finger moves down, offset is positive.
|
||||
// When finger moves up, offset is negative.
|
||||
gridLayoutInfo_.originOffset_ = offset;
|
||||
auto itemsHeight = gridLayoutInfo_.GetTotalHeightOfItemsInView(GetMainGap());
|
||||
if (gridLayoutInfo_.offsetEnd_) {
|
||||
auto overScroll = gridLayoutInfo_.currentOffset_ - (GetMainContentSize() - itemsHeight);
|
||||
|
@ -63,8 +63,6 @@ void GridScrollLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper)
|
||||
// Step2: Measure children that can be displayed in viewport of Grid
|
||||
float mainSize = GetMainAxisSize(idealSize, axis);
|
||||
float crossSize = GetCrossAxisSize(idealSize, axis);
|
||||
canSkipMeasure_ = (gridLayoutInfo_.lastCrossSize_ == crossSize) && (gridLayoutInfo_.lastMainSize_ == mainSize) &&
|
||||
(gridLayoutProperty->GetPropertyChangeFlag() == PROPERTY_UPDATE_MEASURE_SELF);
|
||||
if (!NearEqual(mainSize, gridLayoutInfo_.lastMainSize_)) {
|
||||
gridLayoutInfo_.ResetPositionFlags();
|
||||
UpdateOffsetOnVirtualKeyboardHeightChange(layoutWrapper, mainSize);
|
||||
@ -194,7 +192,7 @@ void GridScrollLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
|
||||
childFrameOffset_ = OffsetF(padding.left.value_or(0.0f), padding.top.value_or(0.0f));
|
||||
childFrameOffset_ += gridLayoutProperty->IsVertical() ? OffsetF(0.0f, gridLayoutInfo_.currentOffset_)
|
||||
: OffsetF(gridLayoutInfo_.currentOffset_, 0.0f);
|
||||
|
||||
layoutWrapper->RemoveAllChildInRenderTree();
|
||||
float prevLineHeight = 0.0f;
|
||||
int32_t startIndex = -1;
|
||||
int32_t endIndex = -1;
|
||||
@ -1649,16 +1647,29 @@ int32_t GridScrollLayoutAlgorithm::MeasureChildPlaced(const SizeF& frameSize, in
|
||||
return crossSpan;
|
||||
}
|
||||
|
||||
bool GridScrollLayoutAlgorithm::CheckNeedMeasure(const RefPtr<LayoutWrapper>& layoutWrapper,
|
||||
const LayoutConstraintF& layoutConstraint) const
|
||||
{
|
||||
if (layoutWrapper->CheckNeedForceMeasureAndLayout()) {
|
||||
return true;
|
||||
}
|
||||
auto geometryNode = layoutWrapper->GetGeometryNode();
|
||||
CHECK_NULL_RETURN(geometryNode, true);
|
||||
auto constraint = geometryNode->GetParentLayoutConstraint();
|
||||
CHECK_NULL_RETURN(constraint, true);
|
||||
return constraint.value() != layoutConstraint;
|
||||
}
|
||||
|
||||
void GridScrollLayoutAlgorithm::MeasureChild(LayoutWrapper* layoutWrapper, const SizeF& frameSize,
|
||||
const RefPtr<LayoutWrapper>& childLayoutWrapper, int32_t crossStart, int32_t crossSpan)
|
||||
{
|
||||
if (canSkipMeasure_ && !childLayoutWrapper->CheckNeedForceMeasureAndLayout()) {
|
||||
return;
|
||||
}
|
||||
auto gridLayoutProperty = DynamicCast<GridLayoutProperty>(layoutWrapper->GetLayoutProperty());
|
||||
auto mainSize = GetMainAxisSize(frameSize, gridLayoutInfo_.axis_);
|
||||
auto crossSize = GetCrossAxisSize(frameSize, gridLayoutInfo_.axis_);
|
||||
auto childConstraint = CreateChildConstraint(mainSize, crossSize, gridLayoutProperty, crossStart, crossSpan);
|
||||
if (!CheckNeedMeasure(childLayoutWrapper, childConstraint)) {
|
||||
return;
|
||||
}
|
||||
auto childLayoutProperty = childLayoutWrapper->GetLayoutProperty();
|
||||
if (!childLayoutProperty) {
|
||||
childLayoutWrapper->Measure(childConstraint);
|
||||
|
@ -104,6 +104,7 @@ private:
|
||||
// Measure grid item which exist in grid matrix already, needn't to place it again.
|
||||
int32_t MeasureChildPlaced(const SizeF& frameSize, int32_t itemIndex, int32_t crossStart,
|
||||
LayoutWrapper* layoutWrapper, const RefPtr<LayoutWrapper>& childLayoutWrapper);
|
||||
bool CheckNeedMeasure(const RefPtr<LayoutWrapper>& layoutWrapper, const LayoutConstraintF& layoutConstraint) const;
|
||||
void MeasureChild(LayoutWrapper* layoutWrapper, const SizeF& frameSize,
|
||||
const RefPtr<LayoutWrapper>& childLayoutWrapper, int32_t crossStart, int32_t crossSpan);
|
||||
|
||||
@ -193,7 +194,6 @@ private:
|
||||
float crossPaddingOffset_ = 0;
|
||||
int32_t lastCross_ = 0;
|
||||
bool isChildrenUpdated_ = false;
|
||||
bool canSkipMeasure_ = false;
|
||||
bool canOverScroll_ = false;
|
||||
bool enableSkipping_ = true; // enables skipping lines on a large offset change.
|
||||
GridLayoutInfo scrollGridLayoutInfo_;
|
||||
|
@ -214,10 +214,14 @@ void GridIrregularLayoutAlgorithm::MeasureForward(float mainSize)
|
||||
|
||||
if (!overScroll_ && info.endIndex_ == info.childrenCount_ - 1) {
|
||||
float overDis = mainSize - info.contentEndPadding_ - (info.GetTotalHeightOfItemsInView(mainGap_) + res.pos);
|
||||
if (GreatNotEqual(overDis, 0.0f)) {
|
||||
info.currentOffset_ += overDis;
|
||||
res = solver.FindStartingRow(mainGap_);
|
||||
UpdateStartInfo(info, res);
|
||||
if (LessOrEqual(overDis, 0.0f)) {
|
||||
return;
|
||||
}
|
||||
info.currentOffset_ += overDis;
|
||||
res = solver.FindStartingRow(mainGap_);
|
||||
UpdateStartInfo(info, res);
|
||||
if (info.startIndex_ == 0) {
|
||||
info.currentOffset_ = std::min(info.currentOffset_, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,53 +115,4 @@ std::optional<SizeF> ImageLayoutAlgorithm::MeasureContent(
|
||||
return contentConstraint.Constrain(size);
|
||||
}
|
||||
|
||||
void ImageLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
|
||||
{
|
||||
BoxLayoutAlgorithm::Layout(layoutWrapper);
|
||||
// if layout size has not decided yet, resize target can not be calculated
|
||||
if (!layoutWrapper->GetGeometryNode()->GetContent()) {
|
||||
return;
|
||||
}
|
||||
const auto& props = DynamicCast<ImageLayoutProperty>(layoutWrapper->GetLayoutProperty());
|
||||
CHECK_NULL_VOID(props);
|
||||
const auto& dstSize = layoutWrapper->GetGeometryNode()->GetContentSize();
|
||||
bool autoResize = props->GetAutoResize().value_or(autoResizeDefault_);
|
||||
|
||||
ImageFit imageFit = props->GetImageFit().value_or(ImageFit::COVER);
|
||||
const std::optional<SizeF>& sourceSize = props->GetSourceSize();
|
||||
bool hasValidSlice = false;
|
||||
if (layoutWrapper->GetHostNode()) {
|
||||
auto renderProp = layoutWrapper->GetHostNode()->GetPaintProperty<ImageRenderProperty>();
|
||||
hasValidSlice = renderProp && renderProp->HasImageResizableSlice();
|
||||
}
|
||||
auto loadingCtx = loadingCtx_.Upgrade();
|
||||
if (loadingCtx) {
|
||||
loadingCtx->MakeCanvasImageIfNeed(dstSize, autoResize, imageFit, sourceSize, hasValidSlice);
|
||||
} else {
|
||||
auto host = layoutWrapper->GetHostNode();
|
||||
if (host && host->GetPattern<ImagePattern>()) {
|
||||
auto pattern = host->GetPattern<ImagePattern>();
|
||||
loadingCtx_ = pattern->GetImageLoadingContext();
|
||||
auto ctx = loadingCtx_.Upgrade();
|
||||
if (ctx) {
|
||||
ctx->MakeCanvasImageIfNeed(dstSize, autoResize, imageFit, sourceSize, hasValidSlice);
|
||||
}
|
||||
}
|
||||
}
|
||||
auto altLoadingCtx = altLoadingCtx_.Upgrade();
|
||||
if (altLoadingCtx) {
|
||||
altLoadingCtx->MakeCanvasImageIfNeed(dstSize, autoResize, imageFit, sourceSize, hasValidSlice);
|
||||
} else if (props->GetAlt()) {
|
||||
auto host = layoutWrapper->GetHostNode();
|
||||
if (host && host->GetPattern<ImagePattern>()) {
|
||||
auto pattern = host->GetPattern<ImagePattern>();
|
||||
altLoadingCtx_ = pattern->GetAltImageLoadingContext();
|
||||
auto ctx = altLoadingCtx_.Upgrade();
|
||||
if (ctx) {
|
||||
ctx->MakeCanvasImageIfNeed(dstSize, autoResize, imageFit, sourceSize, hasValidSlice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -27,9 +27,8 @@ class ACE_EXPORT ImageLayoutAlgorithm : public BoxLayoutAlgorithm {
|
||||
|
||||
public:
|
||||
ImageLayoutAlgorithm(
|
||||
const WeakPtr<ImageLoadingContext>& loadingCtx, const WeakPtr<ImageLoadingContext>& altLoadingCtx = nullptr,
|
||||
bool autoResizeDefault = true)
|
||||
: loadingCtx_(loadingCtx), altLoadingCtx_(altLoadingCtx), autoResizeDefault_(autoResizeDefault)
|
||||
const WeakPtr<ImageLoadingContext>& loadingCtx, const WeakPtr<ImageLoadingContext>& altLoadingCtx = nullptr)
|
||||
: loadingCtx_(loadingCtx), altLoadingCtx_(altLoadingCtx)
|
||||
{}
|
||||
~ImageLayoutAlgorithm() override = default;
|
||||
|
||||
@ -42,12 +41,9 @@ public:
|
||||
std::optional<SizeF> MeasureContent(
|
||||
const LayoutConstraintF& contentConstraint, LayoutWrapper* layoutWrapper) override;
|
||||
|
||||
void Layout(LayoutWrapper* layoutWrapper) override;
|
||||
|
||||
private:
|
||||
WeakPtr<ImageLoadingContext> loadingCtx_;
|
||||
WeakPtr<ImageLoadingContext> altLoadingCtx_;
|
||||
bool autoResizeDefault_;
|
||||
ACE_DISALLOW_COPY_AND_MOVE(ImageLayoutAlgorithm);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -26,8 +26,12 @@
|
||||
#include "base/geometry/ng/vector.h"
|
||||
#include "base/log/dump_log.h"
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/common/ace_engine_ext.h"
|
||||
#include "core/common/ai/image_analyzer_adapter.h"
|
||||
#include "core/common/ai/image_analyzer_mgr.h"
|
||||
#include "core/common/container.h"
|
||||
#include "core/common/frontend.h"
|
||||
#include "core/common/udmf/udmf_client.h"
|
||||
#include "core/components/common/layout/constants.h"
|
||||
#include "core/components/image/image_theme.h"
|
||||
#include "core/components/theme/icon_theme.h"
|
||||
@ -38,10 +42,6 @@
|
||||
#include "core/components_ng/pattern/image/image_pattern.h"
|
||||
#include "core/components_ng/property/measure_property.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#include "core/common/ace_engine_ext.h"
|
||||
#include "core/common/ai/image_analyzer_adapter.h"
|
||||
#include "core/common/container.h"
|
||||
#include "core/common/udmf/udmf_client.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
ImagePattern::ImagePattern()
|
||||
@ -252,7 +252,12 @@ void ImagePattern::OnImageDataReady()
|
||||
geometryNode->GetContentOffset().GetX(), geometryNode->GetContentOffset().GetY());
|
||||
imageEventHub->FireCompleteEvent(event);
|
||||
|
||||
host->MarkDirtyNode(PROPERTY_UPDATE_MEASURE);
|
||||
auto geo = host->GetGeometryNode();
|
||||
if (geo->GetContent() && !host->CheckNeedForceMeasureAndLayout()) {
|
||||
StartDecoding(geo->GetContentSize());
|
||||
} else {
|
||||
host->MarkDirtyNode(PROPERTY_UPDATE_MEASURE);
|
||||
}
|
||||
}
|
||||
|
||||
void ImagePattern::OnImageLoadFail(const std::string& errorMsg)
|
||||
@ -266,6 +271,32 @@ void ImagePattern::OnImageLoadFail(const std::string& errorMsg)
|
||||
imageEventHub->FireErrorEvent(event);
|
||||
}
|
||||
|
||||
void ImagePattern::StartDecoding(const SizeF& dstSize)
|
||||
{
|
||||
// if layout size has not decided yet, resize target can not be calculated
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
if (!host->GetGeometryNode()->GetContent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& props = DynamicCast<ImageLayoutProperty>(host->GetLayoutProperty());
|
||||
CHECK_NULL_VOID(props);
|
||||
bool autoResize = props->GetAutoResize().value_or(autoResizeDefault_);
|
||||
|
||||
ImageFit imageFit = props->GetImageFit().value_or(ImageFit::COVER);
|
||||
const std::optional<SizeF>& sourceSize = props->GetSourceSize();
|
||||
auto renderProp = host->GetPaintProperty<ImageRenderProperty>();
|
||||
bool hasValidSlice = renderProp && renderProp->HasImageResizableSlice();
|
||||
|
||||
if (loadingCtx_) {
|
||||
loadingCtx_->MakeCanvasImageIfNeed(dstSize, autoResize, imageFit, sourceSize, hasValidSlice);
|
||||
}
|
||||
if (altLoadingCtx_) {
|
||||
altLoadingCtx_->MakeCanvasImageIfNeed(dstSize, autoResize, imageFit, sourceSize, hasValidSlice);
|
||||
}
|
||||
}
|
||||
|
||||
void ImagePattern::SetImagePaintConfig(const RefPtr<CanvasImage>& canvasImage, const RectF& srcRect,
|
||||
const RectF& dstRect, const ImageSourceInfo& sourceInfo, int32_t frameCount)
|
||||
{
|
||||
@ -319,6 +350,9 @@ bool ImagePattern::OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty,
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& dstSize = dirty->GetGeometryNode()->GetContentSize();
|
||||
StartDecoding(dstSize);
|
||||
|
||||
if (loadingCtx_) {
|
||||
auto renderProp = GetPaintProperty<ImageRenderProperty>();
|
||||
if (renderProp && renderProp->HasImageResizableSlice() && image_) {
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override
|
||||
{
|
||||
return MakeRefPtr<ImageLayoutAlgorithm>(loadingCtx_, altLoadingCtx_, autoResizeDefault_);
|
||||
return MakeRefPtr<ImageLayoutAlgorithm>(loadingCtx_, altLoadingCtx_);
|
||||
}
|
||||
|
||||
RefPtr<EventHub> CreateEventHub() override
|
||||
@ -185,6 +185,12 @@ private:
|
||||
|
||||
void OnLanguageConfigurationUpdate() override;
|
||||
|
||||
/**
|
||||
* @brief Start decoding image after ImageData is ready and dstSize is determined.
|
||||
*
|
||||
* @param dstSize The size of the image to be decoded.
|
||||
*/
|
||||
void StartDecoding(const SizeF& dstSize);
|
||||
void OnImageDataReady();
|
||||
void OnImageLoadFail(const std::string& errorMsg);
|
||||
void OnImageLoadSuccess();
|
||||
|
@ -43,7 +43,9 @@ void IndexerLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper)
|
||||
auto itemSize = indexerLayoutProperty->GetItemSize().value_or(Dimension(INDEXER_ITEM_SIZE, DimensionUnit::VP));
|
||||
itemSize_ = ConvertToPx(itemSize, layoutConstraint.scaleProperty, layoutConstraint.maxSize.Height()).value();
|
||||
auto defaultHorizontalPadding = Dimension(INDEXER_PADDING_LEFT, DimensionUnit::VP).ConvertToPx();
|
||||
auto defaultVerticalPadding = Dimension(INDEXER_PADDING_TOP, DimensionUnit::VP).ConvertToPx();
|
||||
auto defaultVerticalPadding = Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)
|
||||
? Dimension(INDEXER_PADDING_TOP_API_TWELVE, DimensionUnit::VP).ConvertToPx()
|
||||
: Dimension(INDEXER_PADDING_TOP, DimensionUnit::VP).ConvertToPx();
|
||||
const auto& padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorderWithDefault(
|
||||
static_cast<float>(defaultHorizontalPadding), static_cast<float>(defaultVerticalPadding), 0, 0);
|
||||
auto verticalPadding = (padding.top.value_or(0) + padding.bottom.value_or(0));
|
||||
@ -89,7 +91,9 @@ void IndexerLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
|
||||
CHECK_NULL_VOID(layoutProperty);
|
||||
auto size = layoutWrapper->GetGeometryNode()->GetFrameSize();
|
||||
auto defaultHorizontalPadding = Dimension(INDEXER_PADDING_LEFT, DimensionUnit::VP).ConvertToPx();
|
||||
auto defaultVerticalPadding = Dimension(INDEXER_PADDING_TOP, DimensionUnit::VP).ConvertToPx();
|
||||
auto defaultVerticalPadding = Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)
|
||||
? Dimension(INDEXER_PADDING_TOP_API_TWELVE, DimensionUnit::VP).ConvertToPx()
|
||||
: Dimension(INDEXER_PADDING_TOP, DimensionUnit::VP).ConvertToPx();
|
||||
const auto& padding = layoutProperty->CreatePaddingAndBorderWithDefault(
|
||||
static_cast<float>(defaultHorizontalPadding), static_cast<float>(defaultVerticalPadding), 0, 0);
|
||||
MinusPaddingToSize(padding, size);
|
||||
|
@ -63,6 +63,12 @@ public:
|
||||
virtual void SetChangeEvent(std::function<void(const int32_t selected)>&& changeEvent) {};
|
||||
virtual void SetCreatChangeEvent(std::function<void(const int32_t selected)>&& changeEvent) {};
|
||||
virtual void SetAutoCollapse(bool state) = 0;
|
||||
virtual void SetPopupBorderRadius(const Dimension& radius) {};
|
||||
virtual void SetPopupItemBorderRadius(const Dimension& radius) {};
|
||||
virtual void SetItemBorderRadius(const Dimension& radius) {};
|
||||
virtual void SetIndexerBorderRadius(const Dimension& radius) {};
|
||||
virtual void SetPopupBackgroundBlurStyle(const BlurStyleOption& indexerBlurStyle) {};
|
||||
virtual void SetPopupTitleBackground(const std::optional<Color>& color) {};
|
||||
|
||||
private:
|
||||
static std::unique_ptr<IndexerModel> instance_;
|
||||
|
@ -280,6 +280,75 @@ void IndexerModelNG::SetAutoCollapse(bool autoCollapse)
|
||||
ACE_UPDATE_LAYOUT_PROPERTY(IndexerLayoutProperty, AutoCollapse, autoCollapse);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupBorderRadius(const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_PAINT_PROPERTY(IndexerPaintProperty, PopupBorderRadius, radius);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupItemBorderRadius(const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_PAINT_PROPERTY(IndexerPaintProperty, PopupItemBorderRadius, radius);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetItemBorderRadius(const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_PAINT_PROPERTY(IndexerPaintProperty, ItemBorderRadius, radius);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetIndexerBorderRadius(const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_PAINT_PROPERTY(IndexerPaintProperty, IndexerBorderRadius, radius);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupBackgroundBlurStyle(const BlurStyleOption& indexerBlurStyle)
|
||||
{
|
||||
ACE_UPDATE_PAINT_PROPERTY(IndexerPaintProperty, PopupBackgroundBlurStyle, indexerBlurStyle);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupTitleBackground(const std::optional<Color>& color)
|
||||
{
|
||||
if (color.has_value()) {
|
||||
ACE_UPDATE_PAINT_PROPERTY(IndexerPaintProperty, PopupTitleBackground, color.value());
|
||||
} else {
|
||||
ACE_RESET_PAINT_PROPERTY_WITH_FLAG(IndexerPaintProperty, PopupTitleBackground, PROPERTY_UPDATE_RENDER);
|
||||
}
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupBorderRadius(FrameNode* frameNode, const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_NODE_PAINT_PROPERTY(IndexerPaintProperty, PopupBorderRadius, radius, frameNode);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupItemBorderRadius(FrameNode* frameNode, const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_NODE_PAINT_PROPERTY(IndexerPaintProperty, PopupItemBorderRadius, radius, frameNode);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetItemBorderRadius(FrameNode* frameNode, const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_NODE_PAINT_PROPERTY(IndexerPaintProperty, ItemBorderRadius, radius, frameNode);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetIndexerBorderRadius(FrameNode* frameNode, const Dimension& radius)
|
||||
{
|
||||
ACE_UPDATE_NODE_PAINT_PROPERTY(IndexerPaintProperty, IndexerBorderRadius, radius, frameNode);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupBackgroundBlurStyle(FrameNode* frameNode, const BlurStyleOption& indexerBlurStyle)
|
||||
{
|
||||
ACE_UPDATE_NODE_PAINT_PROPERTY(IndexerPaintProperty, PopupBackgroundBlurStyle, indexerBlurStyle, frameNode);
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetPopupTitleBackground(FrameNode* frameNode, const std::optional<Color>& color)
|
||||
{
|
||||
if (color.has_value()) {
|
||||
ACE_UPDATE_NODE_PAINT_PROPERTY(IndexerPaintProperty, PopupTitleBackground, color.value(), frameNode);
|
||||
} else {
|
||||
ACE_RESET_NODE_PAINT_PROPERTY_WITH_FLAG(
|
||||
IndexerPaintProperty, PopupTitleBackground, PROPERTY_UPDATE_RENDER, frameNode);
|
||||
}
|
||||
}
|
||||
|
||||
void IndexerModelNG::SetFontSize(FrameNode* frameNode, const Dimension& fontSize)
|
||||
{
|
||||
if (fontSize.IsValid()) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_INDEXER_INDEXER_MODEL_NG_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_INDEXER_INDEXER_MODEL_NG_H
|
||||
|
||||
#include "core/components/common/properties/decoration.h"
|
||||
#include "core/components_ng/pattern/indexer/indexer_model.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
@ -52,6 +53,12 @@ public:
|
||||
void SetChangeEvent(std::function<void(const int32_t selected)>&& changeEvent) override;
|
||||
void SetCreatChangeEvent(std::function<void(const int32_t selected)>&& changeEvent) override;
|
||||
void SetAutoCollapse(bool state) override;
|
||||
void SetPopupBorderRadius(const Dimension& radius) override;
|
||||
void SetPopupItemBorderRadius(const Dimension& radius) override;
|
||||
void SetItemBorderRadius(const Dimension& radius) override;
|
||||
void SetIndexerBorderRadius(const Dimension& radius) override;
|
||||
void SetPopupBackgroundBlurStyle(const BlurStyleOption& indexerBlurStyle) override;
|
||||
void SetPopupTitleBackground(const std::optional<Color>& color) override;
|
||||
|
||||
static void SetFontSize(FrameNode* frameNode, const Dimension& fontSize);
|
||||
static void SetFontWeight(FrameNode* frameNode, const FontWeight weight);
|
||||
@ -78,6 +85,12 @@ public:
|
||||
static void SetItemSize(FrameNode* frameNode, const Dimension& value);
|
||||
static void SetPopupPositionX(FrameNode* frameNode, const std::optional<Dimension>& popupPositionXOpt);
|
||||
static void SetPopupPositionY(FrameNode* frameNode, const std::optional<Dimension>& popupPositionYOpt);
|
||||
static void SetPopupBorderRadius(FrameNode* frameNode, const Dimension& radius);
|
||||
static void SetPopupItemBorderRadius(FrameNode* frameNode, const Dimension& radius);
|
||||
static void SetItemBorderRadius(FrameNode* frameNode, const Dimension& radius);
|
||||
static void SetIndexerBorderRadius(FrameNode* frameNode, const Dimension& radius);
|
||||
static void SetPopupBackgroundBlurStyle(FrameNode* frameNode, const BlurStyleOption& indexerBlurStyle);
|
||||
static void SetPopupTitleBackground(FrameNode* frameNode, const std::optional<Color>& color);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_INDEXER_INDEXER_MODEL_NG_H
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user