Files
ladybird/Userland/Libraries/LibWebView/CMakeLists.txt
Sam Atkins 1db243c006 LibWebView: Use LibSyntax to highlight document source
This has no visible effect, but internally it's also highlighting any
CSS and JS embedded in the page, which will be made use of later. We'll
also be able to use this code for highlighting CSS or JS files directly
in the future.

It's not a perfect fit - the syntax highlighters give specific styles to
their spans, which we then ignore and just use their data integer to
figure out which CSS class to give to the span. It feels cleaner to me
to produce HTML styled that way, instead of every token having
`style="color: ...; font-weight: ...; text-decoration: ...;"` set on
it.

Most of this new `to_html_string()` code is adapted from Serenity's
`TextEditor::paint_event()`, so it should be pretty solid.
2024-09-30 08:53:25 +01:00

71 lines
2.2 KiB
CMake

include(${SerenityOS_SOURCE_DIR}/Meta/CMake/public_suffix.cmake)
set(SOURCES
Application.cpp
Attribute.cpp
ChromeProcess.cpp
CookieJar.cpp
Database.cpp
InspectorClient.cpp
ProcessHandle.cpp
Process.cpp
ProcessManager.cpp
RequestServerAdapter.cpp
SearchEngine.cpp
SourceHighlighter.cpp
URL.cpp
UserAgent.cpp
ViewImplementation.cpp
WebContentClient.cpp
WebSocketClientAdapter.cpp
${PUBLIC_SUFFIX_SOURCES}
)
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
embed_as_string(
"NativeStyleSheetSource.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Native.css"
"NativeStyleSheetSource.cpp"
"native_stylesheet_source"
NAMESPACE "WebView"
)
compile_ipc(UIProcessServer.ipc UIProcessServerEndpoint.h)
compile_ipc(UIProcessClient.ipc UIProcessClientEndpoint.h)
set(GENERATED_SOURCES
${GENERATED_SOURCES}
../../Services/RequestServer/RequestClientEndpoint.h
../../Services/RequestServer/RequestServerEndpoint.h
../../Services/WebContent/WebContentClientEndpoint.h
../../Services/WebContent/WebContentServerEndpoint.h
../../Services/WebContent/WebDriverClientEndpoint.h
../../Services/WebContent/WebDriverServerEndpoint.h
NativeStyleSheetSource.cpp
UIProcessClientEndpoint.h
UIProcessServerEndpoint.h
)
serenity_lib(LibWebView webview)
target_link_libraries(LibWebView PRIVATE LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibRequests LibJS LibWeb LibUnicode LibURL LibSyntax)
target_compile_definitions(LibWebView PRIVATE ENABLE_PUBLIC_SUFFIX=$<BOOL:${ENABLE_PUBLIC_SUFFIX_DOWNLOAD}>)
# Third-party
find_package(SQLite3 REQUIRED)
target_link_libraries(LibWebView PRIVATE SQLite::SQLite3)
if (ENABLE_INSTALL_HEADERS)
foreach(header ${GENERATED_SOURCES})
get_filename_component(extension ${header} EXT)
if (NOT "${extension}" STREQUAL ".h")
continue()
endif()
get_filename_component(subdirectory ${header} DIRECTORY)
string(REGEX REPLACE "^\\.\\./\\.\\./" "" subdirectory "${subdirectory}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${header}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${subdirectory}")
endforeach()
endif()