Commit graph

10289 commits

Author SHA1 Message Date
Andreas Kling
86eeac86a4 AK: Add basic percent encoder/decoder (urlencode and urldecode) 2020-06-07 21:05:05 +02:00
Andreas Kling
83ee76a53e AK: Add StringView::{begin,end} so we can range-for over StringViews 2020-06-07 21:05:05 +02:00
Matthew Olsson
1fadde2483 LibJS: Fix big int division lexing as UnterminatedRegexLiteral 2020-06-07 20:05:16 +02:00
Linus Groh
0ff9d7e189 LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
AnotherTest
40829b849a Meta: Run Crypto tests in CI
We skip the tests that are not self-contained (TLS) to avoid adding
extra variables to the tests.
2020-06-07 19:29:40 +02:00
AnotherTest
a3ff4ff8a1 test-crypto: Return 1 if any test failed 2020-06-07 19:29:40 +02:00
AnotherTest
02c53fd1f9 LibCrypto: Add bitwise operations (and/or/xor) 2020-06-07 19:29:40 +02:00
Linus Groh
fbb1d9afe5 LibCrypto: Make ModularFunctions.h compile as part of Lagom
Compiler was complaining about two ambiguous overloads.

Also make some functions "inline" to fix warnings about unused
functions.
2020-06-07 19:29:40 +02:00
Linus Groh
75b4cc13a0 LibCrypto: Fix to_base10() for zero-value BigIntegers
All the magic is happening in a "while != 0" loop, so we ended up with
an empty string for zero-value BigIntegers. Now we just check that
upfront and return early.
2020-06-07 19:29:40 +02:00
Linus Groh
5b88aa8e96 LibJS: Move Value::as_accessor() to Value.h 2020-06-07 19:29:40 +02:00
Linus Groh
5a983c238b LibJS: Use switch/case for Value::to_{string{_w/o_side_effects},boolean}
This makes them a bit more compact and improves consistency as
to_boolean() and to_number() already use this style as well.

Also re-order the types to match the table in the spec document.
2020-06-07 19:29:40 +02:00
Linus Groh
9f399f7341 LibJS: Remove reduntant set_prototype() calls
If we're inheriting from Object() we already call its constructor which
sets the prototype - no need to do it again.
2020-06-07 19:29:40 +02:00
Andreas Kling
1d94ca7cfc LibWeb: Fix codepoint_from_entity() never returning an error
If we don't find a matching entity, return an empty Optional.
2020-06-07 19:13:56 +02:00
Andreas Kling
ec83555b87 AK: Don't try to complete relative data: URLs 2020-06-07 19:09:03 +02:00
Andreas Kling
ab4c03ce2d LibWeb: Fix tokenizer swallowing an extra token after a named entity 2020-06-07 19:09:03 +02:00
Andreas Kling
767daf1c12 LibWeb: Unbreak <a title> tooltips in the main frame
The main frame doesn't have a host element, so we can't go trying to
offset things by the host element's layout rect.
2020-06-07 19:09:03 +02:00
Matthew Olsson
61ac1d3ffa LibJS: Lex and parse regex literals, add RegExp objects
This adds regex parsing/lexing, as well as a relatively empty
RegExpObject. The purpose of this patch is to allow the engine to not
get hung up on parsing regexes. This will aid in finding new syntax
errors (say, from google or twitter) without having to replace all of
their regexes first!
2020-06-07 19:06:55 +02:00
Andreas Kling
984a6ff97b LibGUI: Fix broken clip rect when scrolling a TextEditor 2020-06-07 18:02:43 +02:00
Andreas Kling
731685468a LibWeb: Start fleshing out support for relative CSS units
This patch introduces support for more than just "absolute px" units in
our Length class. It now also supports "em" and "rem", which are units
relative to the font-size of the current layout node and the <html>
element's layout node respectively.
2020-06-07 17:55:46 +02:00
Andreas Kling
d93bf78346 LibWeb: Fix broken paint invalidation after subframe changes
Now that PageView actually respects the invalidation rect provided by
the layout system, it turns out we were invalidating too little.

Unfortunately, this is not really fixable until the initial containing
block starts having the right size (same as viewport), but that will
require a bunch of work to make overflow work again. So it's a FIXME
for now, and we'll return to this.
2020-06-07 17:12:42 +02:00
Andreas Kling
3ae3729b4e LibWeb: Let subframes propagate paint invalidations via host element
When a paint invalidation occurs inside a subframe, it bubbles up to
Frame::set_needs_display(). From there, we call PageView if this is
the main frame, or otherwise invalidate the subframe host element.
2020-06-07 14:56:29 +02:00
Andreas Kling
59f9b32a44 LibWeb: Remove unused Document::on_layout_updated hook 2020-06-07 14:47:33 +02:00
Andreas Kling
747b21782e LibWeb: Open subframe links inside the subframe itself
We now only delegate to the Web::PageView embedded when clicking links
in the main frame. Links in subframes are handled internally.
2020-06-07 14:45:59 +02:00
Andreas Kling
d1852b4547 LibWeb: Add per-Frame EventHandler, handle mouse events recursively
We now handle mouse events by recursing into subframes. This makes
links, tooltips, etc, work inside <iframe> content.
2020-06-07 14:40:38 +02:00
Andreas Kling
896db187e5 LibWeb: Move Frame.{cpp,h} into a new Frame/ directory 2020-06-07 10:14:41 +02:00
Andreas Kling
5e9d1b2165 LibWeb: Whine in debug log instead of asserting on partial layout FIXME
We don't support incremental relayout of subtrees (only single nodes)
but let's not crash the browser just because this happens. We can keep
the browser up and just complain in the debug log instead.
2020-06-06 22:15:17 +02:00
Matthew Olsson
39ad42defd LibJS: Add Proxy objects
Includes all traps except the following: [[Call]], [[Construct]],
[[OwnPropertyKeys]].

An important implication of this commit is that any call to any virtual
Object method has the potential to throw an exception. These methods
were not checked in this commit -- a future commit will have to protect
these various method calls throughout the codebase.
2020-06-06 22:13:01 +02:00
Matthew Olsson
58a72e9b81 LibJS: Value.in uses has_property instead of get().is_empty() 2020-06-06 22:13:01 +02:00
Matthew Olsson
24430b3860 LibJS: Object.setPrototypeOf throws error on too few arguments 2020-06-06 22:13:01 +02:00
Matthew Olsson
79958f4520 LibJS: Add PropertyDescriptor object
This new struct is now returned from get_own_property_descriptor. To
preserve the old functionality of returning an object, there is now a
get_own_property_descriptor_object method, for use in
{Object,Reflect}.getOwnPropertyDescriptor().

This change will be useful for the implementation of Proxies, which do a
lot of descriptor checks. We want to avoid as many object gets and puts
as possible.
2020-06-06 22:13:01 +02:00
Matthew Olsson
5ad5322f6a LibJS: Distinguish between omitted descriptor attributes and false ones
When calling Object.defineProperty, there is now a difference between
omitting a descriptor attribute and specifying that it is false. For
example, "{}" and "{ configurable: false }" will have different
attribute values.
2020-06-06 22:13:01 +02:00
Andreas Kling
5c485d4a1e LibGUI: Fix TextEditor painting glitch after add_clip_rect() change 2020-06-06 19:37:03 +02:00
Andreas Kling
ba6a77f281 LibGfx: Make Painter::add_clip_rect() use logical coordinates
It was really confusing that add_clip_rect() didn't apply transforms
to the new clip rect, but instead interpreted it as an absolute rect.

This makes web pages with <iframe> render correctly when scrolled.

Something might break from this, but we'll find it soon enough. :^)
2020-06-06 19:36:40 +02:00
Andreas Kling
37b21cfd7d LibWeb: Make Frame::page_view() always go via main_frame()
When you ask a subframe for its PageView, you'll now always get the
main frame's PageView. Subframes don't have a PageView of their own.
2020-06-06 16:36:18 +02:00
Andreas Kling
be6abce44f LibWeb: Handle EOF tokens during "text" insertion 2020-06-06 16:36:18 +02:00
Andreas Kling
38ada2d102 LibWeb: Delay sub-Frame construction until host Document is attached
While we're parsing a new document, we don't have a Frame to grab at.
We now use the Node::document_did_attach_to_frame() notification hook
to delay subframe construction.

With this, subframes now always have a valid reference to their
enclosing main frame.
2020-06-06 16:36:18 +02:00
Andreas Kling
285a4165f3 LibWeb: Add Node notifications for Document<=>Frame attach/detach
Some DOM nodes will want to do stuff when we attach/detach from a Frame
and this seems like a simple enough way to let them know.
2020-06-06 16:36:18 +02:00
nanoproductions
07e726729c
Base: Add "Discord" theme (#2515)
A new theme for Serenity which brings colors from the Discord theme
colors. Some colors were modified to ensure great looks on Serenity.
2020-06-06 14:45:10 +02:00
Sergey Bugaev
4643f51eaa Base: Document find(1) 2020-06-06 14:42:31 +02:00
Sergey Bugaev
f2f1975baa Userland: Add find(1)
This is a somewhat incomplete implementation of the Unix find command :^)

Closes https://github.com/SerenityOS/serenity/issues/272
2020-06-06 14:42:31 +02:00
Sergey Bugaev
9e046bcef1 AK: Fix printf("%c", 0)
It was me who has broken this, sorry ;(
2020-06-06 14:42:31 +02:00
Andreas Kling
71da52482c LibWeb: Show error page if we can't handle a frame's main resource
If we can't figure out how to make a Document for the main resource
in a Frame, just show an error page.
2020-06-06 14:14:43 +02:00
Andreas Kling
f88146c7c9 LibWeb: Let Resource figure out its own encoding and MIME type
Also, if the request URL is a data: URL, use the MIME type from the URL
itself if available. This makes it possible to load arbitrary MIME type
data: URLs in the browser :^)
2020-06-06 14:14:43 +02:00
Andreas Kling
efe9d36eba LibWeb: Always scroll PageView to top when a new document is set 2020-06-06 14:14:43 +02:00
Andreas Kling
de6028dfa7 LibWeb: Turn FrameLoader into a ResourceClient
We now use the new resource-based loader for the main resource in each
Frame. This gives us access to caching and sharing. :^)
2020-06-06 14:14:43 +02:00
Andreas Kling
52fcaae71c LibWeb: Make Document::url() return URL by value
Returning it by reference can lead to unpleasant situations if we use
this getter when the document may go away. Better to make the getter
return a copy than have to think about this everywhere.
2020-06-06 14:14:43 +02:00
Andreas Kling
5c0ee72b30 LibWeb: Use FrameLoader to load iframes :^) 2020-06-06 14:14:43 +02:00
Andreas Kling
075bd75859 LibWeb: Add a FrameLoader class and move PageView's loading logic there
Each Frame now has a FrameLoader which will be responsible for handling
loading inside that frame.
2020-06-06 14:14:43 +02:00
Marcin Gasperowicz
0cbef87944 LibJS: Fix rest-params test to take function hoisting into account 2020-06-06 10:53:06 +02:00
Marcin Gasperowicz
2579d0bf55 LibJS: Hoist function declarations
This patch adds function declaration hoisting. The mechanism
is similar to var hoisting. Hoisted function declarations are to be put
before the hoisted var declarations, hence they have to be treated
separately.
2020-06-06 10:53:06 +02:00