Documentation
¶
Overview ¶
Package webkit provides a WebKit2GTK-backed browser view and window.
Index ¶
- Variables
- func AddCSSProvider(css string)
- func AddShortcutToController(controller uintptr, key string, handle uintptr) error
- func BoxAppend(box uintptr, child uintptr)
- func BoxInsertChildAfter(box uintptr, child uintptr, sibling uintptr)
- func BoxPrepend(box uintptr, child uintptr)
- func BoxRemove(box uintptr, child uintptr)
- func CreateGlobalShortcutController(window uintptr) uintptr
- func GenerateCodecControlScript(prefs CodecPreferencesConfig) string
- func IdleAdd(fn func() bool) uintptr
- func IdleRemove(handle uintptr)
- func InitMainThread()
- func InitWebKitLogCapture() error
- func IsBox(widget uintptr) bool
- func IsMainThread() bool
- func IsNativeAvailable() bool
- func IsPaned(widget uintptr) bool
- func IsWebKitLogCaptureActive() bool
- func IterateMainLoop() bool
- func LabelGetText(label uintptr) string
- func LabelSetEllipsize(label uintptr, mode EllipsizeMode)
- func LabelSetMaxWidthChars(label uintptr, nChars int)
- func LabelSetText(label uintptr, text string)
- func LogMemoryConfiguration(config *Config)
- func NewBox(orientation Orientation, spacing int) uintptr
- func NewLabel(text string) uintptr
- func NewPaned(orientation Orientation) uintptr
- func NewTestWidget() uintptr
- func PanedGetEndChild(paned uintptr) uintptr
- func PanedGetPosition(paned uintptr) int
- func PanedGetStartChild(paned uintptr) uintptr
- func PanedSetEndChild(paned uintptr, child uintptr)
- func PanedSetPosition(paned uintptr, pos int)
- func PanedSetResizeEnd(paned uintptr, resize bool)
- func PanedSetResizeStart(paned uintptr, resize bool)
- func PanedSetStartChild(paned uintptr, child uintptr)
- func PrefersDarkTheme() bool
- func QuitMainLoop()
- func ResetWidgetStubsForTesting()
- func RunMainLoop()
- func SetURISchemeResolver(r SchemeResolver)
- func SetWidgetBoundsForTesting(widget uintptr, bounds WidgetBounds)
- func SetupWebKitDebugLogging(cfg *config.Config)
- func SimulateFocusForTesting(widget uintptr)
- func StartWebKitOutputCapture()
- func StopWebKitLogCapture()
- func ValidateMemoryConfig(config *MemoryConfig) error
- func WidgetAddCSSClass(widget uintptr, class string)
- func WidgetAddFocusController(widget uintptr, onEnter, onLeave func()) uintptr
- func WidgetAddHoverHandler(widget uintptr, fn func()) uintptr
- func WidgetGetParent(widget uintptr) uintptr
- func WidgetGetVisible(widget uintptr) bool
- func WidgetGrabFocus(widget uintptr)
- func WidgetHasCSSClass(widget uintptr, class string) bool
- func WidgetHide(widget uintptr)
- func WidgetHookDestroy(widget uintptr)
- func WidgetIsValid(widget uintptr) bool
- func WidgetQueueAllocate(widget uintptr)
- func WidgetQueueDraw(widget uintptr)
- func WidgetQueueResize(widget uintptr)
- func WidgetRealizeInContainer(widget uintptr)
- func WidgetRef(widget uintptr) bool
- func WidgetRefCount(widget uintptr) uint
- func WidgetRemoveCSSClass(widget uintptr, class string)
- func WidgetRemoveFocusController(widget uintptr, token uintptr)
- func WidgetRemoveHoverHandler(widget uintptr, token uintptr)
- func WidgetResetSizeRequest(widget uintptr)
- func WidgetSetFocusChild(widget uintptr, child uintptr)
- func WidgetSetHExpand(widget uintptr, expand bool)
- func WidgetSetMargin(widget uintptr, margin int)
- func WidgetSetMarginBottom(widget uintptr, margin int)
- func WidgetSetMarginEnd(widget uintptr, margin int)
- func WidgetSetMarginStart(widget uintptr, margin int)
- func WidgetSetMarginTop(widget uintptr, margin int)
- func WidgetSetSizeRequest(widget uintptr, width, height int)
- func WidgetSetVExpand(widget uintptr, expand bool)
- func WidgetSetVisible(widget uintptr, visible bool)
- func WidgetShow(widget uintptr)
- func WidgetUnparent(widget uintptr)
- func WidgetUnref(widget uintptr)
- func WidgetWaitForDraw(widget uintptr)
- type CacheModel
- type CodecPreferencesConfig
- type ColorPalette
- type ColorPalettes
- type Config
- type EllipsizeMode
- type MemoryConfig
- type Orientation
- type RenderingConfig
- type SchemeResolver
- type ValidationError
- type VideoAccelerationConfig
- type WebView
- func (w *WebView) CheckWebViewState() bool
- func (w *WebView) CloseDevTools() error
- func (w *WebView) CloseFind() error
- func (w *WebView) CreateRelatedView() *WebView
- func (w *WebView) Destroy() error
- func (w *WebView) DestroyWindow()
- func (w *WebView) DispatchCustomEvent(eventName string, detail map[string]any) error
- func (w *WebView) FindQuery(q string) error
- func (w *WebView) GetCurrentURL() string
- func (w *WebView) GetNativePointer() unsafe.Pointer
- func (w *WebView) GetTitle() string
- func (w *WebView) GetZoom() (float64, error)
- func (w *WebView) GoBack() error
- func (w *WebView) GoForward() error
- func (w *WebView) Hide() error
- func (w *WebView) ID() string
- func (w *WebView) InitializeContentBlocking(filterManager interface{}) error
- func (w *WebView) InjectScript(js string) error
- func (w *WebView) IsActive() bool
- func (w *WebView) IsDestroyed() bool
- func (w *WebView) LoadURL(rawURL string) error
- func (w *WebView) LogDebugInfo()
- func (w *WebView) OnNavigate(url string, filterManager interface{})
- func (w *WebView) OnWindowTypeDetected(callback func(WindowType, *WindowFeatures))
- func (w *WebView) OpenFind(initial string) error
- func (w *WebView) PrepareForReparenting()
- func (w *WebView) RefreshAfterReparenting()
- func (w *WebView) RegisterCloseHandler(cb func())
- func (w *WebView) RegisterFaviconChangedHandler(cb func(data []byte))
- func (w *WebView) RegisterFaviconURIChangedHandler(cb func(pageURI, faviconURI string))
- func (w *WebView) RegisterKeyboardShortcut(accel string, callback func()) error
- func (w *WebView) RegisterNavigationPolicyHandler(cb func(url string, isUserGesture bool) bool)
- func (w *WebView) RegisterPopupHandler(cb func(string) *WebView)
- func (w *WebView) RegisterScriptMessageHandler(cb func(payload string))
- func (w *WebView) RegisterTitleChangedHandler(cb func(title string))
- func (w *WebView) RegisterURIChangedHandler(cb func(uri string))
- func (w *WebView) RegisterZoomChangedHandler(cb func(level float64))
- func (w *WebView) Reload() error
- func (w *WebView) ReloadBypassCache() error
- func (w *WebView) RootWidget() uintptr
- func (w *WebView) RunOnMainThread(fn func())
- func (w *WebView) SeedDomZoom(level float64)
- func (w *WebView) SetActive(active bool)
- func (w *WebView) SetTestContainer(container uintptr)
- func (w *WebView) SetWindowFeatures(features *WindowFeatures)
- func (w *WebView) SetZoom(level float64) error
- func (w *WebView) Show() error
- func (w *WebView) ShowDevTools() error
- func (w *WebView) ShowPrintDialog() error
- func (w *WebView) UpdateContentFilters(filterManager interface{}) error
- func (w *WebView) UsesDomZoom() bool
- func (w *WebView) Widget() uintptr
- func (w *WebView) Window() *Window
- type WidgetAllocation
- type WidgetBounds
- type Window
- type WindowFeatures
- type WindowShortcuts
- type WindowType
Constants ¶
This section is empty.
Variables ¶
var ErrContentManagerNotFound = errors.New("webkit: user content manager not found")
ErrContentManagerNotFound is returned when WebKit user content manager cannot be retrieved
var ErrNotImplemented = errors.New("webkit: not implemented")
ErrNotImplemented is returned by stub implementations pending WebKit2GTK migration.
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 BoxInsertChildAfter ¶ added in v0.11.0
func BoxPrepend ¶ added in v0.11.0
func CreateGlobalShortcutController ¶ added in v0.9.0
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
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 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 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 LabelSetEllipsize ¶ added in v0.11.0
func LabelSetEllipsize(label uintptr, mode EllipsizeMode)
func LabelSetMaxWidthChars ¶ added in v0.11.0
func LabelSetText ¶ added in v0.11.0
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 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
PanedGetEndChild is a no-op in non-CGO builds and returns 0.
func PanedGetPosition ¶ added in v0.11.0
PanedGetPosition gets the current position of the divider in a GtkPaned (stub)
func PanedGetStartChild ¶ added in v0.11.0
PanedGetStartChild is a no-op in non-CGO builds and returns 0.
func PanedSetEndChild ¶ added in v0.9.0
func PanedSetPosition ¶ added in v0.9.0
PanedSetPosition is a no-op in stub builds.
func PanedSetResizeEnd ¶ added in v0.9.0
func PanedSetResizeStart ¶ added in v0.9.0
func PanedSetStartChild ¶ added in v0.9.0
func PrefersDarkTheme ¶ added in v0.10.0
func PrefersDarkTheme() bool
PrefersDarkTheme returns true if GTK is configured to prefer dark theme (stub)
func ResetWidgetStubsForTesting ¶ added in v0.9.0
func ResetWidgetStubsForTesting()
ResetWidgetStubsForTesting clears widget stub state for deterministic tests.
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
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 WidgetAddFocusController ¶ added in v0.11.0
Focus controller functions for GTK4 EventControllerFocus (stub implementations)
func WidgetAddHoverHandler ¶ added in v0.9.0
func WidgetGetParent ¶ added in v0.9.0
func WidgetGetVisible ¶ added in v0.11.0
func WidgetGrabFocus ¶ added in v0.9.0
func WidgetGrabFocus(widget uintptr)
func WidgetHasCSSClass ¶ added in v0.11.0
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 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 WidgetRefCount ¶ added in v0.9.0
func WidgetRemoveCSSClass ¶ added in v0.9.0
func WidgetRemoveFocusController ¶ added in v0.11.0
func WidgetRemoveHoverHandler ¶ added in v0.9.0
func WidgetResetSizeRequest ¶ added in v0.11.0
func WidgetResetSizeRequest(widget uintptr)
func WidgetSetFocusChild ¶ added in v0.11.0
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 WidgetSetMargin ¶ added in v0.11.0
func WidgetSetMarginBottom ¶ added in v0.11.0
func WidgetSetMarginEnd ¶ added in v0.11.0
func WidgetSetMarginStart ¶ added in v0.11.0
func WidgetSetMarginTop ¶ added in v0.11.0
func WidgetSetSizeRequest ¶ added in v0.11.0
func WidgetSetVExpand ¶ added in v0.9.0
func WidgetSetVisible ¶ added in v0.11.0
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 ¶
RenderingConfig controls hardware acceleration preferences. Mode accepts: "auto" (default), "gpu", or "cpu". DebugGPU enables compositing indicators if supported.
type SchemeResolver ¶
SchemeResolver provides bytes and mime for a given custom URI.
type ValidationError ¶ added in v0.3.0
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 ¶
NewWebView constructs a new WebView instance.
func NewWebViewWithRelated ¶ added in v0.9.0
NewWebViewWithRelated creates a new WebView related to an existing one (non-CGO stub)
func (*WebView) CheckWebViewState ¶ added in v0.7.0
CheckWebViewState always returns false in stub builds
func (*WebView) CloseDevTools ¶
CloseDevTools is a no-op in the non-CGO build.
func (*WebView) CloseFind ¶ added in v0.3.0
CloseFind closes the find overlay and clears highlights.
func (*WebView) CreateRelatedView ¶ added in v0.9.0
CreateRelatedView returns a new WebView (stub creates independent)
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
DispatchCustomEvent sends a CustomEvent into the page world with the provided detail payload.
func (*WebView) FindQuery ¶ added in v0.3.0
FindQuery sets or updates the current find query and applies highlighting.
func (*WebView) GetCurrentURL ¶
GetCurrentURL returns the last requested URL (non-CGO build approximation).
func (*WebView) GetNativePointer ¶ added in v0.9.0
GetNativePointer returns nil for non-CGO build (stub implementation)
func (*WebView) ID ¶ added in v0.9.0
ID returns the unique identifier for this WebView as a string (stub)
func (*WebView) InitializeContentBlocking ¶ added in v0.8.0
InitializeContentBlocking initializes WebKit content blocking with filter manager (stub)
func (*WebView) InjectScript ¶
InjectScript evaluates JavaScript in the active WebView context.
func (*WebView) IsActive ¶ added in v0.9.0
IsActive returns whether this WebView is currently active/focused (stub)
func (*WebView) IsDestroyed ¶ added in v0.10.0
IsDestroyed returns whether this WebView has been destroyed
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
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
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
RegisterFaviconChangedHandler registers a callback invoked when the page favicon changes.
func (*WebView) RegisterFaviconURIChangedHandler ¶ added in v0.10.0
RegisterFaviconURIChangedHandler registers a callback invoked when WebKit detects a favicon URI.
func (*WebView) RegisterKeyboardShortcut ¶
RegisterKeyboardShortcut binds a global or window-scoped accelerator to a callback.
func (*WebView) RegisterNavigationPolicyHandler ¶ added in v0.11.0
func (*WebView) RegisterPopupHandler ¶ added in v0.9.0
func (*WebView) RegisterScriptMessageHandler ¶
RegisterScriptMessageHandler registers a callback invoked when the content script posts a message.
func (*WebView) RegisterTitleChangedHandler ¶
RegisterTitleChangedHandler registers a callback invoked when the page title changes.
func (*WebView) RegisterURIChangedHandler ¶
RegisterURIChangedHandler registers a callback invoked when the current page URI changes.
func (*WebView) RegisterZoomChangedHandler ¶ added in v0.3.0
RegisterZoomChangedHandler registers a callback invoked when zoom level changes.
func (*WebView) ReloadBypassCache ¶ added in v0.6.0
ReloadBypassCache is not supported in the non-CGO stub.
func (*WebView) RootWidget ¶ added in v0.9.0
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
SeedDomZoom stores the desired DOM zoom level for the next navigation (stub implementation).
func (*WebView) SetActive ¶ added in v0.9.0
SetActive sets whether this WebView is currently active/focused (stub)
func (*WebView) SetTestContainer ¶ added in v0.11.0
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) ShowDevTools ¶
ShowDevTools is a no-op in the non-CGO build.
func (*WebView) ShowPrintDialog ¶ added in v0.10.0
ShowPrintDialog is a no-op in the non-CGO build.
func (*WebView) UpdateContentFilters ¶ added in v0.8.0
UpdateContentFilters updates the content filters dynamically (stub)
func (*WebView) UsesDomZoom ¶ added in v0.9.0
UsesDomZoom reports whether DOM-based zoom is enabled in this WebView.
type WidgetAllocation ¶ added in v0.11.0
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
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 ¶
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
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 )