feat(webkit): implement DevToolsOpener and Printer on WebView
Add OpenDevTools() and PrintPage() wrapper methods on *webkit.WebView so it satisfies the port.DevToolsOpener and port.Printer interfaces. Add compile-time checks alongside the existing port.WebView check.
- commit
- 82dcb2db2df363b6139b58da4561580aa070b233
- author
- brice · · 2026-03-15 16:14 UTC
- parent
- 005fae9
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +13 -1
M internal/infrastructure/webkit/webview.go +13 -1
| @@ -24,8 +24,10 @@ import ( | |||
| 24 | 24 | "github.com/rs/zerolog" | |
| 25 | 25 | ) | |
| 26 | 26 | ||
| 27 | - | // Compile-time interface check: WebView must implement port.WebView. | |
| 27 | + | // Compile-time interface checks. | |
| 28 | 28 | var _ port.WebView = (*WebView)(nil) | |
| 29 | + | var _ port.DevToolsOpener = (*WebView)(nil) | |
| 30 | + | var _ port.Printer = (*WebView)(nil) | |
| 29 | 31 | ||
| 30 | 32 | // WebViewID is an alias to port.WebViewID for clean architecture compliance. | |
| 31 | 33 | // Infrastructure layer uses the type defined in the application port. | |
| @@ -1580,6 +1582,16 @@ func (wv *WebView) Print() error { | |||
| 1580 | 1582 | return nil | |
| 1581 | 1583 | } | |
| 1582 | 1584 | ||
| 1585 | + | // OpenDevTools implements port.DevToolsOpener. | |
| 1586 | + | func (wv *WebView) OpenDevTools() { | |
| 1587 | + | _ = wv.ShowDevTools() | |
| 1588 | + | } | |
| 1589 | + | ||
| 1590 | + | // PrintPage implements port.Printer. | |
| 1591 | + | func (wv *WebView) PrintPage() { | |
| 1592 | + | _ = wv.Print() | |
| 1593 | + | } | |
| 1594 | + | ||
| 1583 | 1595 | // IsDestroyed returns true if the WebView has been destroyed. | |
| 1584 | 1596 | func (wv *WebView) IsDestroyed() bool { | |
| 1585 | 1597 | return wv.destroyed.Load() | |
| @@ -24,8 +24,10 @@ import ( | |||||
| 24 | "github.com/rs/zerolog" | 24 | "github.com/rs/zerolog" | ||
| 25 | ) | 25 | ) | ||
| 26 | 26 | ||||
| 27 | - | // Compile-time interface check: WebView must implement port.WebView. | 27 | + | // Compile-time interface checks. |
| 28 | var _ port.WebView = (*WebView)(nil) | 28 | var _ port.WebView = (*WebView)(nil) | ||
| 29 | + | var _ port.DevToolsOpener = (*WebView)(nil) | |||
| 30 | + | var _ port.Printer = (*WebView)(nil) | |||
| 29 | 31 | ||||
| 30 | // WebViewID is an alias to port.WebViewID for clean architecture compliance. | 32 | // WebViewID is an alias to port.WebViewID for clean architecture compliance. | ||
| 31 | // Infrastructure layer uses the type defined in the application port. | 33 | // Infrastructure layer uses the type defined in the application port. | ||
| @@ -1580,6 +1582,16 @@ func (wv *WebView) Print() error { | |||||
| 1580 | return nil | 1582 | return nil | ||
| 1581 | } | 1583 | } | ||
| 1582 | 1584 | ||||
| 1585 | + | // OpenDevTools implements port.DevToolsOpener. | |||
| 1586 | + | func (wv *WebView) OpenDevTools() { | |||
| 1587 | + | _ = wv.ShowDevTools() | |||
| 1588 | + | } | |||
| 1589 | + | ||||
| 1590 | + | // PrintPage implements port.Printer. | |||
| 1591 | + | func (wv *WebView) PrintPage() { | |||
| 1592 | + | _ = wv.Print() | |||
| 1593 | + | } | |||
| 1594 | + | ||||
| 1583 | // IsDestroyed returns true if the WebView has been destroyed. | 1595 | // IsDestroyed returns true if the WebView has been destroyed. | ||
| 1584 | func (wv *WebView) IsDestroyed() bool { | 1596 | func (wv *WebView) IsDestroyed() bool { | ||
| 1585 | return wv.destroyed.Load() | 1597 | return wv.destroyed.Load() | ||