mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
Ladybird: Do not assume the web view is embedded in a normal tab
The LadybirdWebView currently assumed it is viewed with a Tab instance. This will not be true with the JavaScript console. This patch removes this assumption by plumbing WebContent callbacks through a new protocol. The Tab interface then implements this protocol.
This commit is contained in:
parent
85b2782052
commit
c9b9278092
4 changed files with 154 additions and 98 deletions
|
@ -7,15 +7,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibWeb/CSS/PreferredColorScheme.h>
|
||||
#include <LibWeb/HTML/ActivateTab.h>
|
||||
|
||||
#import <System/Cocoa.h>
|
||||
|
||||
@protocol LadybirdWebViewObserver <NSObject>
|
||||
|
||||
- (String const&)onCreateNewTab:(URL const&)url
|
||||
activateTab:(Web::HTML::ActivateTab)activate_tab;
|
||||
|
||||
- (String const&)onCreateNewTab:(StringView)html
|
||||
url:(URL const&)url
|
||||
activateTab:(Web::HTML::ActivateTab)activate_tab;
|
||||
|
||||
- (void)loadURL:(URL const&)url;
|
||||
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect;
|
||||
|
||||
- (void)onTitleChange:(DeprecatedString const&)title;
|
||||
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap;
|
||||
|
||||
- (void)onNavigateBack;
|
||||
- (void)onNavigateForward;
|
||||
- (void)onReload;
|
||||
|
||||
@end
|
||||
|
||||
@interface LadybirdWebView : NSClipView
|
||||
|
||||
- (instancetype)init:(id<LadybirdWebViewObserver>)observer;
|
||||
|
||||
- (void)loadURL:(URL const&)url;
|
||||
- (void)loadHTML:(StringView)html url:(URL const&)url;
|
||||
|
||||
- (String const&)handle;
|
||||
|
||||
- (void)handleResize;
|
||||
- (void)handleScroll;
|
||||
- (void)handleVisibility:(BOOL)is_visible;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue