1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 14:07:45 +00:00

Ladybird: Implement an AppKit chrome for macOS :^)

This adds an alternative Ladybird chrome for macOS using the AppKit
framework. Just about everything needed for normal web browsing has
been implemented. This includes:

* Tabbed, scrollable navigation
* History navigation (back, forward, reload)
* Keyboard / mouse events
* Favicons
* Context menus
* Cookies
* Dialogs (alert, confirm, prompt)
* WebDriver support

This does not include debugging tools like the JavaScript console and
inspector, nor theme support.

The Qt chrome is still used by default. To use the AppKit chrome, set
the ENABLE_QT CMake option to OFF.
This commit is contained in:
Timothy Flynn 2023-08-20 16:14:31 -04:00 committed by Tim Flynn
parent 66a89bd695
commit 5722d0025b
28 changed files with 3248 additions and 3 deletions

View file

@ -81,6 +81,8 @@ if (ENABLE_QT)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Network Multimedia)
elseif (APPLE)
find_library(COCOA_LIBRARY Cocoa)
endif()
set(BROWSER_SOURCE_DIR ${SERENITY_SOURCE_DIR}/Userland/Applications/Browser/)
@ -124,11 +126,33 @@ if (ENABLE_QT)
Qt/main.cpp
)
target_link_libraries(ladybird PRIVATE Qt::Core Qt::Gui Qt::Network Qt::Widgets)
elseif (APPLE)
add_executable(ladybird MACOSX_BUNDLE
${SOURCES}
AppKit/main.mm
AppKit/Application/Application.mm
AppKit/Application/ApplicationDelegate.mm
AppKit/Application/EventLoopImplementation.mm
AppKit/UI/Event.mm
AppKit/UI/LadybirdWebView.mm
AppKit/UI/LadybirdWebViewBridge.cpp
AppKit/UI/Tab.mm
AppKit/UI/TabController.mm
AppKit/Utilities/Conversions.mm
AppKit/Utilities/URL.mm
)
target_include_directories(ladybird PRIVATE AppKit)
target_link_libraries(ladybird PRIVATE ${COCOA_LIBRARY})
target_compile_options(ladybird PRIVATE
-fobjc-arc
-Wno-deprecated-anon-enum-enum-conversion # Required for CGImageCreate
)
else()
# TODO: Check for other GUI frameworks here when we move them in-tree
# For now, we can export a static library of common files for chromes to link to
add_library(ladybird STATIC ${SOURCES})
endif()
target_sources(ladybird PUBLIC FILE_SET browser TYPE HEADERS
BASE_DIRS ${SERENITY_SOURCE_DIR}/Userland/Applications
FILES ${BROWSER_HEADERS}
@ -205,9 +229,7 @@ function(create_ladybird_bundle target_name)
endif()
endfunction()
if (ENABLE_QT)
create_ladybird_bundle(ladybird)
endif()
create_ladybird_bundle(ladybird)
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/InstallRules.cmake)