Skip to content

phase-3: subsurface position sync + viewport clipping on resize #147

@mxaddict

Description

@mxaddict

Keep the WebKit subsurface aligned with buffr's browser region as the window resizes and chrome strips reflow.

Scope

When the chrome layout changes (`browser_rect` recomputed), call:

  • `wl_subsurface::set_position(rect.x, rect.y)` on the WebKit subsurface.
  • Resize WebKit's WPEToplevel via existing path: `tab.resize(rect.w, rect.h)`.
  • Commit the parent surface to apply.

wp_viewporter for source-rect clipping

If the WebKit-rendered buffer is larger than the browser rect (it shouldn't be after we resize WPEToplevel, but defensively): use `wp_viewport` extension to clip the source rect.

Bind via wl_registry; cache the `wp_viewporter` global ptr if present. Some compositors don't ship it — skip clipping gracefully and rely on WPE's resize alone.

Cadence

`set_position` runs on every chrome layout change — not every redraw. The apps layer already debounces resize events (`winit: pending Resized debounce` in logs). Hook into the same path.

Out of scope

Acceptance

  • Drag-resize buffr window → WebKit subsurface tracks the browser region without lag.
  • Chrome strip toggle (omnibar open/close shifts the browser rect) → subsurface re-positions.
  • No flicker.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestparkedDormant — feature kept in backlog but not actively worked on

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions