Skip to content

docs(ohos): document set_bounds semantics for natural vs child webviews - #20

Open
ddxwzc-boop wants to merge 1 commit into
Eulogizethesun:ohdevfrom
ddxwzc-boop:ohdev
Open

docs(ohos): document set_bounds semantics for natural vs child webviews#20
ddxwzc-boop wants to merge 1 commit into
Eulogizethesun:ohdevfrom
ddxwzc-boop:ohdev

Conversation

@ddxwzc-boop

Copy link
Copy Markdown

Summary

Comment-only change. Documents the OHOS webview sizing semantics introduced by the child-webview bounds fix (companion to Eulogizethesun/openharmony-ability#45 and Eulogizethesun/tauri#73):

  • Natural-layout webviews (created without style.width — the main webview of each window): runtime set_bounds width/height is stripped ArkTS-side, so they keep "100%" sizing and follow window resizes naturally. This is what prevents the resize-relayout regression fixed earlier (explicit pixel dims on resize desync ArkWeb page layout).
  • Explicit-bounds child webviews (is_child=true with bounds → WebViewStyle{x,y,w,h}): accept width/height at creation and at runtime.
  • Notes the BuilderNode.update caveat: runtime resizes of child webviews size the Web node but do not reliably notify ArkWeb to relayout the page content (stale layout until next navigation).

Context

0cac4c3 (openharmony-ability) replaced WebViewStyle width/height with "100%" natural layout to fix a main-webview resize bug, which silently broke child webview geometry: a child created at (x, y, w, h) rendered window-sized at (x, y), so its bottom-right overflow was clipped by the window edge. The fix restores explicit sizing with a naturalLayout guard; this wry comment update reflects the final semantics so future readers don't re-introduce either regression.

Testing

No functional change (comments only). The behavior it documents was verified on device (HUAWEI MateBook Pro 2in1): the create_webview (multi-webview) manual test renders the exact 300x200 @(50,50) child rect, and main-window resize keeps page layout in sync.

ArkTS now distinguishes natural-layout webviews (created without
style.width: runtime width/height stripped, "100%" sizing follows window
resizes) from explicit-bounds child webviews (accept width/height at
creation and runtime). Update the set_bounds comment to match and note
the BuilderNode.update caveat: runtime resizes of child webviews size the
Web node but do not reliably notify ArkWeb to relayout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant