Documentation
¶
Overview ¶
Package webkit provides a WebKit2GTK-backed browser view and window.
Index ¶
- Variables
- func IsNativeAvailable() bool
- func QuitMainLoop()
- func RunMainLoop()
- func SetURISchemeResolver(r SchemeResolver)
- type Config
- type RenderingConfig
- type SchemeResolver
- type WebView
- func (w *WebView) CloseDevTools() error
- func (w *WebView) Destroy() error
- func (w *WebView) GetCurrentURL() 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) InjectScript(js string) error
- func (w *WebView) LoadURL(rawURL string) error
- func (w *WebView) RegisterKeyboardShortcut(accel string, callback func()) error
- 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) SetZoom(level float64) error
- func (w *WebView) Show() error
- func (w *WebView) ShowDevTools() error
- func (w *WebView) Window() *Window
- type Window
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("webkit: not implemented")
ErrNotImplemented is returned by stub implementations pending WebKit2GTK migration.
Functions ¶
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 SetURISchemeResolver ¶
func SetURISchemeResolver(r SchemeResolver)
SetURISchemeResolver is a no-op in non-CGO builds.
Types ¶
type Config ¶
type Config struct {
// 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
}
Config holds initialization settings for the WebKit-based browser components. This will map to WebKit2GTK and GTK settings in the real implementation.
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 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 (*WebView) CloseDevTools ¶
CloseDevTools is a no-op in the non-CGO build.
func (*WebView) GetCurrentURL ¶
GetCurrentURL returns the last requested URL (non-CGO build approximation).
func (*WebView) InjectScript ¶
InjectScript evaluates JavaScript in the active WebView context.
func (*WebView) RegisterKeyboardShortcut ¶
RegisterKeyboardShortcut binds a global or window-scoped accelerator to a callback.
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) ShowDevTools ¶
ShowDevTools is a no-op in the non-CGO build.