Commit graph

6 commits

Author SHA1 Message Date
Timothy Flynn
3af63bc5a3 Everywhere: Replace miscellaneous references to the chrome process 2025-03-15 19:57:27 -04:00
Shannon Booth
2827374edc LibWebView: Handle missing URL for view source
Instead of potentially passing through an invalid URL.
2025-03-04 16:24:19 -05:00
Sam Atkins
9b7fb0850d LibJS+LibWebView: Treat trivia tokens as comments
Trivia is whatever whitespace and comments appear before a token.
Previously this was always given a TokenCategory of Invalid, so it
would be displayed as an error in the view-source page, with red wiggly
underlines. Instead, treat it as what it actually is: whitespace and
comments!
2025-03-04 15:54:03 -05:00
Sam Atkins
6147557999 LibWebView: Normalize source-code text before highlighting it
The previous code to determine the SourceDocument's lines was too naive:
the source text can contain other newline characters and sequences, and
the HTML/CSS/JS syntax highlighters would take those into account when
determining what line a token is on. This disagreement would cause
incorrect highlighting, or even crashes, if the source didn't solely use
`\n` for its newlines.

In order to have everyone agree on what a line is, this patch first
processes the source to replace all newlines with `\n`. The need to
copy the source like this is unfortunate, but viewing the source is a
rare enough action that this should not cause any noticeable
performance problems.

As the callers have a String, and we want a String, this also changes
the function parameters to keep the source as a String instead of
converting it to StringView and back.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/3169
2025-02-04 08:49:25 +00:00
Shannon Booth
fd27eef0d1 LibWeb: Return OptionalNone from DOMURL::parse on failure
This ports one more function away from needing to use the awkward
valid state of the URL class.
2025-01-22 12:33:55 +00:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibWebView/SourceHighlighter.cpp (Browse further)