Commit Graph

33 Commits

Author SHA1 Message Date
Andreas Kling
cd7262ee56 LibWeb+LibWebView+WebContent: Add Web::Platform::ImageCodecPlugin
This replaces the previous Web::ImageDecoding::Decoder interface.
While we're doing this, also move the SerenityOS implementation of this
interface from LibWebView to WebContent. That means we no longer have to
link with LibImageDecoderClient in applications that use a web view.
2022-09-16 15:15:50 +02:00
Andreas Kling
ffad902c07 LibWeb: Use cached_web_prototype() as much as possible
Unlike ensure_web_prototype<T>(), the cached version doesn't require the
prototype type to be fully formed, so we can use it without including
the FooPrototype.h header. It's also a bit less verbose. :^)
2022-09-06 00:27:09 +02:00
Andreas Kling
6f433c8656 LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00
Andreas Kling
5d60212076 LibWeb: Make StyleSheet and CSSStyleSheet GC-allocated 2022-09-06 00:27:09 +02:00
DexesTTP
2198091bbc LibWeb: Abstract the image decoding via Web::ImageDecoding::Decoder
After this change, LibWeb now expects Web::ImageDecoding::Decoder to be
pre-initialized with a concrete implementation before using the webpage.
The previous implementation, based on the ImageDecoder service, has been
provided directly through an adapter in LibWebClient, and is now used as
the default value by WebContent.
2022-05-15 12:17:36 +02:00
Sam Atkins
c449cabae3 LibWeb: Move CSS Parser into new Web::CSS::Parser namespace
The goal here is to move the parser-internal classes into this namespace
so they can have more convenient names without causing collisions. The
Parser itself won't collide, and would be more convenient to just
remain `CSS::Parser`, but having a namespace and a class with the same
name makes C++ unhappy.
2022-04-12 23:03:46 +02:00
Anthony Van de Gejuchte
06d9853a8b LibWeb: Update displayed favicon when a favicon is loaded
When a favicon has been loaded, trigger a favicon update on
document level. Of all the link tags in the header, the last
favicon that is load should be shown.

When the favicon could not be loaded, load the next icon in reverse tree
order.
2022-04-10 12:10:59 +02:00
Anthony Van de Gejuchte
13847aa7e8 LibWeb: Add icon as possible resource type on the link tag 2022-04-10 12:10:59 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Sam Atkins
05bd0ca3ee LibWeb: Rename parse_css() -> parse_css_stylesheet() 2022-03-30 18:43:07 +02:00
Andreas Kling
02497888a6 LibWeb: Ignore linked stylesheets with MIME types other than text/css
This makes the "Acid3" text on ACID3 not show up in red. :^)
2022-03-20 17:20:59 +01:00
Andreas Kling
ceb055a75e LibWeb: Don't delay document "load" event for non-loading link elements
If we try loading a link element but it's reject for whatever reason
(broken URL, content filtering, etc.) make sure we don't mark that link
element as delaying the document load event.
2022-03-19 15:04:48 +01:00
Lenny Maiorani
c37820b898 Libraries: Use default constructors/destructors in LibWeb
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-17 17:23:49 +00:00
Simon Wanner
1ed5e79478 LibWeb: Fix resolving relative URLs in style sheets
Relative URLs in style sheets should be resolved relative to the
style sheet they're in instead of the document.
2022-03-14 22:22:53 +01:00
Andreas Kling
1b6ed558bb LibWeb: Move QualifiedName into the Web::DOM namespace 2022-02-19 14:45:59 +01:00
Andreas Kling
32b8023ad1 LibWeb: Don't delay document load event forever with cached style sheets
If we try to <link> a stylesheet that was already cached, we'll get a
synchronous resource_did_load() callback. Because of this, it's
necessary to set up the document load event delayer *before* calling
set_resource(), as otherwise we'd be stuck without a load event forever.
2022-02-15 14:14:02 +01:00
Sam Atkins
60867703c0 LibWeb: Make HTMLLinkElement responsible for its own loading
This is the last use of CSSLoader, which can now be deleted.
2021-11-18 21:11:19 +01:00
Ali Mohammad Pur
f0e2c517fc LibWeb: Implement the dns-prefetch and preconnect link relationships 2021-09-28 22:32:31 +02:00
Ali Mohammad Pur
e9b9f89e70 LibWeb: Use Document::parse_url() for preload links 2021-09-28 22:32:31 +02:00
Andreas Kling
5bb2e6597a LibWeb: Preload resources hinted by <link rel="preload">
If a page is nice enough to give us some preload hints, we can tell
RequestServer to get started on downloading the resources right away,
instead of waiting until discovering them later on during parsing.
2021-09-27 02:07:55 +02:00
Andreas Kling
e1fb8bef09 LibWeb: Rename Document::complete_url() => parse_url()
This better matches the spec nomenclature.
2021-09-09 21:25:10 +02:00
Sam Atkins
3bd14941c7 LibWeb: Switch to new CSS Parser :^)
Change all the places that were including the deprecated parser, to
include the new one instead, and then delete the old parser code.

`ParentNode::query_selector[_all]()` now treat their input as a
comma-separated list of selectors, instead of just one, and return
elements that match any of the selectors in that list. This is according
to these specs:

- querySelector/querySelectorAll:
https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselector%E2%91%A0
- selector matching algorithm:
https://www.w3.org/TR/selectors-4/#match-against-tree
2021-08-02 19:01:25 +04:30
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Luke
e3d01c5e10 LibWeb: Make the node mutation event functions spec compliant
This particularly affects the insertion steps and the removed steps.

The insertion steps no longer take into the parent that the node
was inserted to, as per the spec. Due to this, I have renamed the
function from "inserted_into" to simply "inserted". None of the
users of the insertion steps was using it anyway.

The removed steps now take a pointer to the old parent instead of
a reference. This is because it is optional according to the spec
and old parent is null when running the removal steps for the
descendants of a node that just got removed.

This commit does not affect HTMLScriptElement as there is a bit
more to that, which is better suited for a separate commit.

Also adds in the adopted steps as they will be used later.
2021-04-06 21:42:00 +02:00
Andreas Kling
16cde3f14a LibWeb: Rename CSSParser => DeprecatedCSSParser 2021-03-09 17:35:57 +01:00
Andreas Kling
bc116f3b13 LibWeb: Give CSSLoader a backpointer to its owner element
This allows CSSLoader to set up the style sheet owner node internally,
and avoids an awkward weak link between CSSLoader and Document.
2021-03-08 16:03:14 +01:00
Andreas Kling
d07fcba69b LibWeb: Implement StyleSheet.ownerNode :^) 2021-03-08 16:03:14 +01:00
Sviatoslav Peleshko
183ebaee91 LibWeb: Add actual document loading for the CSS (at)import rule 2021-02-28 10:27:32 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
9de1253f44 LibWeb: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
Andreas Kling
330c3fcb59 LibWeb: Use move semantics for QualifiedName more often 2021-02-07 11:20:15 +01:00
asynts
7d783d8b84 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-22 22:14:30 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00