webkit

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package webkit provides a WebKit2GTK-backed browser view and window.

Index

Constants

This section is empty.

Variables

View Source
var ErrContentManagerNotFound = errors.New("webkit: user content manager not found")

ErrContentManagerNotFound is returned when WebKit user content manager cannot be retrieved

View Source
var ErrNotImplemented = errors.New("webkit: not implemented")

ErrNotImplemented is returned by stub implementations pending WebKit2GTK migration.

View Source
var ErrWebViewNotInitialized = errors.New("webkit: webview not initialized")

ErrWebViewNotInitialized is returned when WebView operations are attempted on uninitialized WebView

Functions

func AddCSSProvider added in v0.9.0

func AddCSSProvider(css string)

func AddShortcutToController added in v0.9.0

func AddShortcutToController(controller uintptr, key string, handle uintptr) error

func BoxAppend added in v0.11.0

func BoxAppend(box uintptr, child uintptr)

func BoxInsertChildAfter added in v0.11.0

func BoxInsertChildAfter(box uintptr, child uintptr, sibling uintptr)

func BoxPrepend added in v0.11.0

func BoxPrepend(box uintptr, child uintptr)

func BoxRemove added in v0.11.0

func BoxRemove(box uintptr, child uintptr)

func CreateGlobalShortcutController added in v0.9.0

func CreateGlobalShortcutController(window uintptr) uintptr

Stub implementations for Go wrapper functions

func GenerateCodecControlScript added in v0.6.0

func GenerateCodecControlScript(prefs CodecPreferencesConfig) string

GenerateCodecControlScript creates JavaScript code to control codec preferences This script overrides MediaCapabilities API and platform-specific player configurations

func IdleAdd added in v0.9.0

func IdleAdd(fn func() bool) uintptr

IdleAdd simulates GTK's idle callback system - DEPRECATED, use WidgetWaitForDraw instead

func IdleRemove added in v0.11.0

func IdleRemove(handle uintptr)

IdleRemove cancels a simulated idle callback (no-op in stub builds).

func InitMainThread added in v0.11.0

func InitMainThread()

InitMainThread is a no-op in non-CGO builds.

func InitWebKitLogCapture added in v0.5.0

func InitWebKitLogCapture() error

InitWebKitLogCapture initializes the WebKit log capture system (stub version)

func IsBox added in v0.11.0

func IsBox(widget uintptr) bool

IsBox checks if a widget is a GtkBox container.

func IsMainThread added in v0.11.0

func IsMainThread() bool

IsMainThread always returns true in non-CGO builds since there's no GTK main thread.

func IsNativeAvailable

func IsNativeAvailable() bool

IsNativeAvailable reports whether the native WebKit2GTK backend is compiled in. In non-CGO builds, this returns false and WebView methods are logical no-ops.

func IsPaned added in v0.11.0

func IsPaned(widget uintptr) bool

IsPaned checks if a widget is a GtkPaned container.

func IsWebKitLogCaptureActive added in v0.5.0

func IsWebKitLogCaptureActive() bool

IsWebKitLogCaptureActive returns whether WebKit log capture is active (stub version)

func IterateMainLoop added in v0.11.0

func IterateMainLoop() bool

IterateMainLoop is a no-op in non-CGO builds and always returns false.

func LabelGetText added in v0.11.0

func LabelGetText(label uintptr) string

func LabelSetEllipsize added in v0.11.0

func LabelSetEllipsize(label uintptr, mode EllipsizeMode)

func LabelSetMaxWidthChars added in v0.11.0

func LabelSetMaxWidthChars(label uintptr, nChars int)

func LabelSetText added in v0.11.0

func LabelSetText(label uintptr, text string)

func LogMemoryConfiguration added in v0.3.0

func LogMemoryConfiguration(config *Config)

LogMemoryConfiguration logs the current memory configuration for debugging

func NewBox added in v0.11.0

func NewBox(orientation Orientation, spacing int) uintptr

func NewLabel added in v0.11.0

func NewLabel(text string) uintptr

func NewPaned added in v0.9.0

func NewPaned(orientation Orientation) uintptr

func NewTestWidget added in v0.9.0

func NewTestWidget() uintptr

NewTestWidget returns a unique widget handle for tests.

func PanedGetEndChild added in v0.11.0

func PanedGetEndChild(paned uintptr) uintptr

PanedGetEndChild is a no-op in non-CGO builds and returns 0.

func PanedGetPosition added in v0.11.0

func PanedGetPosition(paned uintptr) int

PanedGetPosition gets the current position of the divider in a GtkPaned (stub)

func PanedGetStartChild added in v0.11.0

func PanedGetStartChild(paned uintptr) uintptr

PanedGetStartChild is a no-op in non-CGO builds and returns 0.

func PanedSetEndChild added in v0.9.0

func PanedSetEndChild(paned uintptr, child uintptr)

func PanedSetPosition added in v0.9.0

func PanedSetPosition(paned uintptr, pos int)

PanedSetPosition is a no-op in stub builds.

func PanedSetResizeEnd added in v0.9.0

func PanedSetResizeEnd(paned uintptr, resize bool)

func PanedSetResizeStart added in v0.9.0

func PanedSetResizeStart(paned uintptr, resize bool)

func PanedSetStartChild added in v0.9.0

func PanedSetStartChild(paned uintptr, child uintptr)

func PrefersDarkTheme added in v0.10.0

func PrefersDarkTheme() bool

PrefersDarkTheme returns true if GTK is configured to prefer dark theme (stub)

func QuitMainLoop

func QuitMainLoop()

QuitMainLoop is a no-op in non-CGO builds.

func ResetWidgetStubsForTesting added in v0.9.0

func ResetWidgetStubsForTesting()

ResetWidgetStubsForTesting clears widget stub state for deterministic tests.

func RunMainLoop

func RunMainLoop()

RunMainLoop is a no-op in non-CGO builds.

func SetURISchemeResolver

func SetURISchemeResolver(r SchemeResolver)

SetURISchemeResolver is a no-op in non-CGO builds.

func SetWidgetBoundsForTesting added in v0.9.0

func SetWidgetBoundsForTesting(widget uintptr, bounds WidgetBounds)

SetWidgetBoundsForTesting assigns bounds for the widget in stub builds.

func SetupWebKitDebugLogging added in v0.7.0

func SetupWebKitDebugLogging(cfg *config.Config)

SetupWebKitDebugLogging is a stub for non-CGO builds

func SimulateFocusForTesting added in v0.11.0

func SimulateFocusForTesting(widget uintptr)

SimulateFocusForTesting gives focus to a widget for test scenarios

func StartWebKitOutputCapture added in v0.5.0

func StartWebKitOutputCapture()

StartWebKitOutputCapture starts capturing webkit stdout/stderr (stub version)

func StopWebKitLogCapture added in v0.5.0

func StopWebKitLogCapture()

StopWebKitLogCapture stops the WebKit log capture (stub version)

func ValidateMemoryConfig added in v0.3.0

func ValidateMemoryConfig(config *MemoryConfig) error

ValidateMemoryConfig validates memory configuration parameters

func WidgetAddCSSClass added in v0.9.0

func WidgetAddCSSClass(widget uintptr, class string)

func WidgetAddFocusController added in v0.11.0

func WidgetAddFocusController(widget uintptr, onEnter, onLeave func()) uintptr

Focus controller functions for GTK4 EventControllerFocus (stub implementations)

func WidgetAddHoverHandler added in v0.9.0

func WidgetAddHoverHandler(widget uintptr, fn func()) uintptr

func WidgetGetParent added in v0.9.0

func WidgetGetParent(widget uintptr) uintptr

func WidgetGetVisible added in v0.11.0

func WidgetGetVisible(widget uintptr) bool

func WidgetGrabFocus added in v0.9.0

func WidgetGrabFocus(widget uintptr)

func WidgetHasCSSClass added in v0.11.0

func WidgetHasCSSClass(widget uintptr, class string) bool

func WidgetHide added in v0.11.0

func WidgetHide(widget uintptr)

func WidgetHookDestroy added in v0.9.0

func WidgetHookDestroy(widget uintptr)

func WidgetIsValid added in v0.9.0

func WidgetIsValid(widget uintptr) bool

func WidgetQueueAllocate added in v0.9.0

func WidgetQueueAllocate(widget uintptr)

func WidgetQueueDraw added in v0.11.0

func WidgetQueueDraw(widget uintptr)

func WidgetQueueResize added in v0.11.0

func WidgetQueueResize(widget uintptr)

func WidgetRealizeInContainer added in v0.9.0

func WidgetRealizeInContainer(widget uintptr)

func WidgetRef added in v0.9.0

func WidgetRef(widget uintptr) bool

func WidgetRefCount added in v0.9.0

func WidgetRefCount(widget uintptr) uint

func WidgetRemoveCSSClass added in v0.9.0

func WidgetRemoveCSSClass(widget uintptr, class string)

func WidgetRemoveFocusController added in v0.11.0

func WidgetRemoveFocusController(widget uintptr, token uintptr)

func WidgetRemoveHoverHandler added in v0.9.0

func WidgetRemoveHoverHandler(widget uintptr, token uintptr)

func WidgetResetSizeRequest added in v0.11.0

func WidgetResetSizeRequest(widget uintptr)

func WidgetSetFocusChild added in v0.11.0

func WidgetSetFocusChild(widget uintptr, child uintptr)

WidgetSetFocusChild sets or clears the focus child of a widget. Pass 0 as child to clear the focus child (prevents GTK focus chain warnings during reparenting).

func WidgetSetHExpand added in v0.9.0

func WidgetSetHExpand(widget uintptr, expand bool)

func WidgetSetMargin added in v0.11.0

func WidgetSetMargin(widget uintptr, margin int)

func WidgetSetMarginBottom added in v0.11.0

func WidgetSetMarginBottom(widget uintptr, margin int)

func WidgetSetMarginEnd added in v0.11.0

func WidgetSetMarginEnd(widget uintptr, margin int)

func WidgetSetMarginStart added in v0.11.0

func WidgetSetMarginStart(widget uintptr, margin int)

func WidgetSetMarginTop added in v0.11.0

func WidgetSetMarginTop(widget uintptr, margin int)

func WidgetSetSizeRequest added in v0.11.0

func WidgetSetSizeRequest(widget uintptr, width, height int)

func WidgetSetVExpand added in v0.9.0

func WidgetSetVExpand(widget uintptr, expand bool)

func WidgetSetVisible added in v0.11.0

func WidgetSetVisible(widget uintptr, visible bool)

func WidgetShow added in v0.9.0

func WidgetShow(widget uintptr)

func WidgetUnparent added in v0.9.0

func WidgetUnparent(widget uintptr)

func WidgetUnref added in v0.9.0

func WidgetUnref(widget uintptr)

func WidgetWaitForDraw added in v0.11.0

func WidgetWaitForDraw(widget uintptr)

WidgetWaitForDraw is a no-op validation stub in this build. It does NOT provide any synchronization or guarantee that widget draw operations are complete. In the stub, it only validates the widget state and does not wait for any operations. In real GTK builds, this would wait for all pending draw operations to complete.

Types

type CacheModel added in v0.3.0

type CacheModel string

CacheModel represents WebKit cache model options for memory optimization.

const (
	CacheModelDocumentViewer    CacheModel = "document_viewer"     // Minimal caching, lowest memory
	CacheModelWebBrowser        CacheModel = "web_browser"         // Default, balanced caching
	CacheModelPrimaryWebBrowser CacheModel = "primary_web_browser" // Maximum caching, highest memory
)

type CodecPreferencesConfig added in v0.6.0

type CodecPreferencesConfig struct {
	PreferredCodecs           []string
	BlockedCodecs             []string
	ForceAV1                  bool
	CustomUserAgent           string
	DisableTwitchCodecControl bool
}

CodecPreferencesConfig holds codec preferences for WebKit media playback

type ColorPalette added in v0.11.0

type ColorPalette struct {
	Background     string
	Surface        string
	SurfaceVariant string
	Text           string
	Muted          string
	Accent         string
	Border         string
}

ColorPalette holds semantic UI tokens for a theme.

type ColorPalettes added in v0.11.0

type ColorPalettes struct {
	Light ColorPalette
	Dark  ColorPalette
}

ColorPalettes hosts both light and dark color palettes.

type Config

type Config struct {
	// Assets provides access to embedded GUI files
	Assets interface{ ReadFile(string) ([]byte, error) }

	// InitialURL is the first URL to load when creating a WebView.
	InitialURL string

	// UserAgent allows overriding the default user agent string.
	UserAgent string

	// EnableDeveloperExtras enables devtools/inspector.
	EnableDeveloperExtras bool

	// ZoomDefault sets an initial zoom factor (1.0 = 100%).
	ZoomDefault float64

	// DataDir is the base directory for persistent website data (cookies, localStorage, etc.).
	DataDir string
	// CacheDir is the base directory for cache data.
	CacheDir string

	// Fonts apply to pages that don't specify fonts (browser defaults).
	DefaultSansFont      string
	DefaultSerifFont     string
	DefaultMonospaceFont string
	DefaultFontSize      int // CSS px (~points)

	// Rendering controls GPU/CPU selection and debug options
	Rendering RenderingConfig

	// VideoAcceleration controls video hardware acceleration settings
	VideoAcceleration VideoAccelerationConfig

	// Memory controls memory optimization settings
	Memory MemoryConfig

	// CodecPreferences for media playback
	CodecPreferences CodecPreferencesConfig

	// APIToken holds the per-session token used to authenticate dumb://api requests
	// It's optional; if empty, API token enforcement may be disabled by the app.
	APIToken string

	// UseDomZoom toggles CSS/DOM-based zoom instead of WebKit's native zoom.
	UseDomZoom bool

	// Colors defines the light/dark palette tokens for the GUI.
	Colors ColorPalettes

	// CreateWindow controls whether to create a window during WebView initialization.
	// Set to false when creating WebViews for workspace panes that will be reparented.
	CreateWindow bool
}

Config holds initialization settings for the WebKit-based browser components. This will map to WebKit2GTK and GTK settings in the real implementation.

func GetBalancedConfig added in v0.3.0

func GetBalancedConfig() *Config

GetBalancedConfig returns a Config with moderate memory optimizations This configuration aims to reduce memory usage by 20-30% with minimal performance impact

func GetHighPerformanceConfig added in v0.3.0

func GetHighPerformanceConfig() *Config

GetHighPerformanceConfig returns a Config optimized for performance over memory This uses default/high memory settings for maximum performance

func GetMemoryOptimizedConfig added in v0.3.0

func GetMemoryOptimizedConfig() *Config

GetMemoryOptimizedConfig returns a Config optimized for low memory usage This configuration aims to reduce memory usage by 40-60% compared to defaults

type EllipsizeMode added in v0.11.0

type EllipsizeMode int

EllipsizeMode represents PangoEllipsizeMode values in stub builds.

const (
	EllipsizeNone   EllipsizeMode = 0
	EllipsizeStart  EllipsizeMode = 1
	EllipsizeMiddle EllipsizeMode = 2
	EllipsizeEnd    EllipsizeMode = 3
)

type MemoryConfig added in v0.3.0

type MemoryConfig struct {
	// MemoryLimitMB sets the maximum memory limit per WebView in MB (0 = unlimited)
	MemoryLimitMB int

	// ConservativeThreshold triggers early memory cleanup (0.0-1.0, default 0.33)
	ConservativeThreshold float64

	// StrictThreshold triggers aggressive memory cleanup (0.0-1.0, default 0.5)
	StrictThreshold float64

	// KillThreshold kills processes at this memory usage (0.0-1.0, 0 = disabled)
	KillThreshold float64

	// PollIntervalSeconds sets how often to check memory usage (default 2.0)
	PollIntervalSeconds float64

	// CacheModel determines caching strategy (default: web_browser)
	CacheModel CacheModel

	// EnablePageCache enables back/forward page caching (default: true)
	EnablePageCache bool

	// EnableOfflineAppCache enables offline application caching (default: true)
	EnableOfflineAppCache bool

	// ProcessRecycleThreshold recycles WebView after N page loads (0 = disabled)
	ProcessRecycleThreshold int

	// EnableGCInterval enables periodic JS garbage collection in seconds (0 = disabled)
	EnableGCInterval int

	// EnableMemoryMonitoring logs memory usage and pressure events
	EnableMemoryMonitoring bool
}

MemoryConfig controls memory optimization settings.

type Orientation added in v0.9.0

type Orientation int

Orientation mirrors GtkOrientation in stub builds.

const (
	OrientationHorizontal Orientation = 0
	OrientationVertical   Orientation = 1
)

type RenderingConfig

type RenderingConfig struct {
	Mode     string
	DebugGPU bool
}

RenderingConfig controls hardware acceleration preferences. Mode accepts: "auto" (default), "gpu", or "cpu". DebugGPU enables compositing indicators if supported.

type SchemeResolver

type SchemeResolver func(uri string) (mime string, data []byte, ok bool)

SchemeResolver provides bytes and mime for a given custom URI.

type ValidationError added in v0.3.0

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a configuration validation error

func (*ValidationError) Error added in v0.3.0

func (e *ValidationError) Error() string

type VideoAccelerationConfig added in v0.5.0

type VideoAccelerationConfig struct {
	EnableVAAPI      bool
	AutoDetectGPU    bool
	VAAPIDriverName  string
	EnableAllDrivers bool
	LegacyVAAPI      bool
}

VideoAccelerationConfig controls video hardware acceleration settings.

type WebView

type WebView struct {
	// contains filtered or unexported fields
}

WebView represents a browser view powered by WebKit2GTK. Methods are currently stubs returning ErrNotImplemented to satisfy TDD ordering.

func NewWebView

func NewWebView(cfg *Config) (*WebView, error)

NewWebView constructs a new WebView instance.

func NewWebViewWithRelated added in v0.9.0

func NewWebViewWithRelated(cfg *Config, relatedView *WebView) (*WebView, error)

NewWebViewWithRelated creates a new WebView related to an existing one (non-CGO stub)

func (*WebView) CheckWebViewState added in v0.7.0

func (w *WebView) CheckWebViewState() bool

CheckWebViewState always returns false in stub builds

func (*WebView) CloseDevTools

func (w *WebView) CloseDevTools() error

CloseDevTools is a no-op in the non-CGO build.

func (*WebView) CloseFind added in v0.3.0

func (w *WebView) CloseFind() error

CloseFind closes the find overlay and clears highlights.

func (*WebView) CreateRelatedView added in v0.9.0

func (w *WebView) CreateRelatedView() *WebView

CreateRelatedView returns a new WebView (stub creates independent)

func (*WebView) Destroy

func (w *WebView) Destroy() error

Destroy releases native resources.

func (*WebView) DestroyWindow added in v0.9.0

func (w *WebView) DestroyWindow()

DestroyWindow is a no-op in stub builds.

func (*WebView) DispatchCustomEvent added in v0.9.0

func (w *WebView) DispatchCustomEvent(eventName string, detail map[string]any) error

DispatchCustomEvent sends a CustomEvent into the page world with the provided detail payload.

func (*WebView) FindQuery added in v0.3.0

func (w *WebView) FindQuery(q string) error

FindQuery sets or updates the current find query and applies highlighting.

func (*WebView) GetCurrentURL

func (w *WebView) GetCurrentURL() string

GetCurrentURL returns the last requested URL (non-CGO build approximation).

func (*WebView) GetNativePointer added in v0.9.0

func (w *WebView) GetNativePointer() unsafe.Pointer

GetNativePointer returns nil for non-CGO build (stub implementation)

func (*WebView) GetTitle added in v0.11.0

func (w *WebView) GetTitle() string

GetTitle returns a stub page title.

func (*WebView) GetZoom

func (w *WebView) GetZoom() (float64, error)

GetZoom returns the current zoom factor.

func (*WebView) GoBack

func (w *WebView) GoBack() error

GoBack is not supported in the non-CGO stub.

func (*WebView) GoForward

func (w *WebView) GoForward() error

GoForward is not supported in the non-CGO stub.

func (*WebView) Hide

func (w *WebView) Hide() error

Hide hides the WebView window.

func (*WebView) ID added in v0.9.0

func (w *WebView) ID() string

ID returns the unique identifier for this WebView as a string (stub)

func (*WebView) InitializeContentBlocking added in v0.8.0

func (w *WebView) InitializeContentBlocking(filterManager interface{}) error

InitializeContentBlocking initializes WebKit content blocking with filter manager (stub)

func (*WebView) InjectScript

func (w *WebView) InjectScript(js string) error

InjectScript evaluates JavaScript in the active WebView context.

func (*WebView) IsActive added in v0.9.0

func (w *WebView) IsActive() bool

IsActive returns whether this WebView is currently active/focused (stub)

func (*WebView) IsDestroyed added in v0.10.0

func (w *WebView) IsDestroyed() bool

IsDestroyed returns whether this WebView has been destroyed

func (*WebView) LoadURL

func (w *WebView) LoadURL(rawURL string) error

LoadURL navigates the webview to the specified URL.

func (*WebView) LogDebugInfo added in v0.7.0

func (w *WebView) LogDebugInfo()

LogDebugInfo is a stub for non-CGO builds

func (*WebView) OnNavigate added in v0.8.0

func (w *WebView) OnNavigate(url string, filterManager interface{})

OnNavigate sets up domain-specific cosmetic filtering on navigation (stub)

func (*WebView) OnWindowTypeDetected added in v0.9.0

func (w *WebView) OnWindowTypeDetected(callback func(WindowType, *WindowFeatures))

OnWindowTypeDetected registers a callback (stored but never invoked in stub)

func (*WebView) OpenFind added in v0.3.0

func (w *WebView) OpenFind(initial string) error

OpenFind opens the in-page find overlay (reusing omnibox) with an optional initial query.

func (*WebView) PrepareForReparenting added in v0.9.0

func (w *WebView) PrepareForReparenting()

PrepareForReparenting is a no-op in stub builds.

func (*WebView) RefreshAfterReparenting added in v0.9.0

func (w *WebView) RefreshAfterReparenting()

RefreshAfterReparenting is a no-op in stub builds.

func (*WebView) RegisterCloseHandler added in v0.9.0

func (w *WebView) RegisterCloseHandler(cb func())

func (*WebView) RegisterFaviconChangedHandler added in v0.10.0

func (w *WebView) RegisterFaviconChangedHandler(cb func(data []byte))

RegisterFaviconChangedHandler registers a callback invoked when the page favicon changes.

func (*WebView) RegisterFaviconURIChangedHandler added in v0.10.0

func (w *WebView) RegisterFaviconURIChangedHandler(cb func(pageURI, faviconURI string))

RegisterFaviconURIChangedHandler registers a callback invoked when WebKit detects a favicon URI.

func (*WebView) RegisterKeyboardShortcut

func (w *WebView) RegisterKeyboardShortcut(accel string, callback func()) error

RegisterKeyboardShortcut binds a global or window-scoped accelerator to a callback.

func (*WebView) RegisterNavigationPolicyHandler added in v0.11.0

func (w *WebView) RegisterNavigationPolicyHandler(cb func(url string, isUserGesture bool) bool)

func (*WebView) RegisterPopupHandler added in v0.9.0

func (w *WebView) RegisterPopupHandler(cb func(string) *WebView)

func (*WebView) RegisterScriptMessageHandler

func (w *WebView) RegisterScriptMessageHandler(cb func(payload string))

RegisterScriptMessageHandler registers a callback invoked when the content script posts a message.

func (*WebView) RegisterTitleChangedHandler

func (w *WebView) RegisterTitleChangedHandler(cb func(title string))

RegisterTitleChangedHandler registers a callback invoked when the page title changes.

func (*WebView) RegisterURIChangedHandler

func (w *WebView) RegisterURIChangedHandler(cb func(uri string))

RegisterURIChangedHandler registers a callback invoked when the current page URI changes.

func (*WebView) RegisterZoomChangedHandler added in v0.3.0

func (w *WebView) RegisterZoomChangedHandler(cb func(level float64))

RegisterZoomChangedHandler registers a callback invoked when zoom level changes.

func (*WebView) Reload added in v0.6.0

func (w *WebView) Reload() error

Reload is not supported in the non-CGO stub.

func (*WebView) ReloadBypassCache added in v0.6.0

func (w *WebView) ReloadBypassCache() error

ReloadBypassCache is not supported in the non-CGO stub.

func (*WebView) RootWidget added in v0.9.0

func (w *WebView) RootWidget() uintptr

RootWidget returns the container widget handle in CGO builds. Stub returns 0.

func (*WebView) RunOnMainThread added in v0.9.0

func (w *WebView) RunOnMainThread(fn func())

RunOnMainThread executes fn immediately in non-CGO builds.

func (*WebView) SeedDomZoom added in v0.9.0

func (w *WebView) SeedDomZoom(level float64)

SeedDomZoom stores the desired DOM zoom level for the next navigation (stub implementation).

func (*WebView) SetActive added in v0.9.0

func (w *WebView) SetActive(active bool)

SetActive sets whether this WebView is currently active/focused (stub)

func (*WebView) SetTestContainer added in v0.11.0

func (w *WebView) SetTestContainer(container uintptr)

SetTestContainer is a testing helper to set the container field for WebView in stub builds

func (*WebView) SetWindowFeatures added in v0.9.0

func (w *WebView) SetWindowFeatures(features *WindowFeatures)

SetWindowFeatures sets the window features for this WebView (stub)

func (*WebView) SetZoom

func (w *WebView) SetZoom(level float64) error

SetZoom sets the current zoom factor for the WebView.

func (*WebView) Show

func (w *WebView) Show() error

Show makes the WebView visible.

func (*WebView) ShowDevTools

func (w *WebView) ShowDevTools() error

ShowDevTools is a no-op in the non-CGO build.

func (*WebView) ShowPrintDialog added in v0.10.0

func (w *WebView) ShowPrintDialog() error

ShowPrintDialog is a no-op in the non-CGO build.

func (*WebView) UpdateContentFilters added in v0.8.0

func (w *WebView) UpdateContentFilters(filterManager interface{}) error

UpdateContentFilters updates the content filters dynamically (stub)

func (*WebView) UsesDomZoom added in v0.9.0

func (w *WebView) UsesDomZoom() bool

UsesDomZoom reports whether DOM-based zoom is enabled in this WebView.

func (*WebView) Widget added in v0.9.0

func (w *WebView) Widget() uintptr

Widget returns an empty handle in stub builds.

func (*WebView) Window

func (w *WebView) Window() *Window

Window returns the associated native window wrapper (non-nil).

type WidgetAllocation added in v0.11.0

type WidgetAllocation struct {
	X      int
	Y      int
	Width  int
	Height int
}

WidgetAllocation represents a widget's allocation (position and size) in stub builds

func WidgetGetAllocation added in v0.11.0

func WidgetGetAllocation(widget uintptr) WidgetAllocation

WidgetGetAllocation returns a stub allocation for the widget

type WidgetBounds added in v0.9.0

type WidgetBounds struct {
	X      float64
	Y      float64
	Width  float64
	Height float64
}

WidgetBounds mirrors the CGO struct for stub builds.

func WidgetGetBounds added in v0.9.0

func WidgetGetBounds(widget uintptr) (WidgetBounds, bool)

type Window

type Window struct {
	Title string
	// contains filtered or unexported fields
}

Window represents a top-level application window hosting a WebView. Stub for future GTK application window management.

func NewWindow

func NewWindow(title string) (*Window, error)

NewWindow constructs a Window. In real implementation, this would create a GTK window.

func (*Window) InitializeGlobalShortcuts added in v0.9.0

func (w *Window) InitializeGlobalShortcuts() *WindowShortcuts

InitializeGlobalShortcuts returns a stub implementation for non-CGO builds

func (*Window) SetChild added in v0.9.0

func (w *Window) SetChild(child uintptr)

SetChild is a stubbed window child setter for non-CGO builds. Simulates GTK4 behavior where setting child to 0 unparents the current child.

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

SetTitle updates the window title (no-op in non-CGO build).

type WindowFeatures added in v0.9.0

type WindowFeatures struct {
	Width              int
	Height             int
	ToolbarVisible     bool
	LocationbarVisible bool
	MenubarVisible     bool
	Resizable          bool
}

WindowFeatures describes the window features detected from WebKitWindowProperties

type WindowShortcuts added in v0.9.0

type WindowShortcuts struct {
	// contains filtered or unexported fields
}

WindowShortcuts stub implementation for non-CGO builds

func (*WindowShortcuts) Cleanup added in v0.9.0

func (ws *WindowShortcuts) Cleanup()

Cleanup stub implementation

func (*WindowShortcuts) RegisterGlobalShortcut added in v0.9.0

func (ws *WindowShortcuts) RegisterGlobalShortcut(key string, callback func()) error

RegisterGlobalShortcut stub - always returns nil for non-CGO builds

type WindowType added in v0.9.0

type WindowType int

WindowType indicates how a new WebView should be treated

const (
	// WindowTypeTab represents an independent WebView (future: tab)
	WindowTypeTab WindowType = iota
	// WindowTypePopup represents a related WebView (shares process/context)
	WindowTypePopup
	// WindowTypeUnknown indicates type not detected yet
	WindowTypeUnknown
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL