mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:17:45 +00:00
Ladybird: Implement a basic Inspector window for the AppKit chrome
This commit includes only fetching the DOM tree from the WebContent process and displaying it in an NSOutlineView. The displayed tree includes some basic styling (e.g. colors).
This commit is contained in:
parent
33b006f157
commit
4483204c9c
10 changed files with 400 additions and 0 deletions
58
Ladybird/AppKit/UI/InspectorController.mm
Normal file
58
Ladybird/AppKit/UI/InspectorController.mm
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#import <UI/Inspector.h>
|
||||
#import <UI/InspectorController.h>
|
||||
#import <UI/LadybirdWebView.h>
|
||||
#import <UI/Tab.h>
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
# error "This project requires ARC"
|
||||
#endif
|
||||
|
||||
@interface InspectorController () <NSWindowDelegate>
|
||||
|
||||
@property (nonatomic, strong) Tab* tab;
|
||||
|
||||
@end
|
||||
|
||||
@implementation InspectorController
|
||||
|
||||
- (instancetype)init:(Tab*)tab
|
||||
{
|
||||
if (self = [super init]) {
|
||||
self.tab = tab;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private methods
|
||||
|
||||
- (Inspector*)inspector
|
||||
{
|
||||
return (Inspector*)[self window];
|
||||
}
|
||||
|
||||
#pragma mark - NSWindowController
|
||||
|
||||
- (IBAction)showWindow:(id)sender
|
||||
{
|
||||
self.window = [[Inspector alloc] init:self.tab];
|
||||
[self.window setDelegate:self];
|
||||
[self.window makeKeyAndOrderFront:sender];
|
||||
|
||||
[[self inspector] inspect];
|
||||
}
|
||||
|
||||
#pragma mark - NSWindowDelegate
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)notification
|
||||
{
|
||||
[self.tab onInspectorClosed];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue