From ad573712e106dd7775d332aa236bd113b137ed45 Mon Sep 17 00:00:00 2001 From: laosan_ted Date: Tue, 27 Dec 2022 18:23:13 +0800 Subject: [PATCH] webview support scroll Signed-off-by: laosan_ted --- api/@internal/component/ets/web.d.ts | 16 ++++++++++++ api/@ohos.web.webview.d.ts | 39 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index df369ecb..fd14c124 100644 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -2211,6 +2211,22 @@ declare class WebAttribute extends CommonMethod { */ blockNetwork(block: boolean): WebAttribute; + /** + * Set whether paint horizontal scroll bar. + * @param horizontalScrollBar True if it needs to paint horizontal scroll bar. + * + * @since 9 + */ + horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute; + + /** + * Set whether paint vertical scroll bar. + * @param verticalScrollBar True if it needs to paint vertical scroll bar. + * + * @since 9 + */ + verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute; + /** * Triggered when the application receive the url of an apple-touch-icon. * @param callback The triggered callback when the application receive an new url of an diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index fdc5d77f..4cfa67ad 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -1073,6 +1073,45 @@ declare namespace webview { * @since 9 */ removeCache(clearRom: boolean): void; + + /** + * Scroll to the position. + * + * @param { boolean } x - the x of the position. + * @param { boolean } y - the y of the position. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + scrollTo(x:number, y:number): void; + + /** + * Scroll by the delta position. + * + * @param { boolean } deltaX - the delta x of the position. + * @param { boolean } deltaY - the delta y of the position. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + scrollBy(deltaX:number, deltaY:number): void; + + /** + * Slide by the speed. + * + * @param { boolean } vx - the x speed of the speed. + * @param { boolean } vy - the y speed of the speed. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + slideScroll(vx:number, vy:number): void; } } -- Gitee