Commit Graph

27557 Commits

Author SHA1 Message Date
Andreas Kling
d553fd7f4f LibJS: Add a barebones Module class
This corresponds to the "Abstract Module Record" from the spec.
2021-09-14 21:41:51 +02:00
Andreas Kling
df5414f47f LibJS: Reorganize ExecutionContext a little bit
- Move it to a separate header file
- Annotate the members that represent spec slots
- Reorganize the members (by spec vs non-spec)
2021-09-14 21:41:51 +02:00
Ali Mohammad Pur
72ddaa31e3 LibJS: Implement parsing and execution of optional chains 2021-09-14 20:03:27 +01:00
Ali Mohammad Pur
4f7e14e0aa LibJS: Reorder the global eval function call detection conditions a bit
This just makes it clearer, since the actual check is off-screen, making
the reader wonder what that check is for.
2021-09-14 20:03:27 +01:00
Ali Mohammad Pur
f7a68ae998 LibJS: Mark two JS::Reference functions const
These two are inherently const, and the next commit needs to call them
on a const object, so let's just mark them const.
2021-09-14 20:03:27 +01:00
Brian Gianforcaro
fbb31b4519 Kernel: Disable lock rank enforcement by default for now
There are a few violations with signal handling that I won't be able to
fix it until later this week. So lets put lock rank enforcement under a
debug option for now so other folks don't hit these crashes until rank
enforcement is more fleshed out.
2021-09-14 18:31:16 +00:00
Ali Mohammad Pur
44cc6e1662 Profiler: Make the ProfileModel searchable
Note that this only searches the items at the same level as the selected
index.
2021-09-14 21:33:15 +04:30
Ali Mohammad Pur
bf0315ff8f LibRegex: Avoid excessive Vector copy when compiling regexps
Previously we would've copied the bytecode instead of moving the chunks
around, use the fancy new DisjointChunks<T> abstraction to make that
happen automagically.
This decreases vector copies and uses of memmove() by nearly 10x :^)
2021-09-14 21:33:15 +04:30
Ali Mohammad Pur
7e75a16e6f Meta: Tweak the error in check-ak-test-files.sh a bit
This can also be tripped when the change was simply not being committed,
avoid confusing the author by simply mentioning that.
2021-09-14 21:33:15 +04:30
Ali Mohammad Pur
ccb53c64e9 AK: Add an abstraction over multiple disjoint buffers
DisjointChunks<T> provides a nice interface over multiple sequential
Vector<T>'s, allowing the user to iterate over/index into/slice from
said buffers as if they were a single contiguous buffer.
To work with views on such objects, DisjointSpans<T> is provided, which
has the same behaviour but does not own the underlying objects.
2021-09-14 21:33:15 +04:30
Andreas Kling
910de95e7a LibJS: Add a fast failure path to try_parse_arrow_function_expression()
The save/load of parser state performed by lookahead parsing is quite
expensive so let's try to avoid it in the most common case.

This is a 15-20% speedup on various chunks of JS I've tested. :^)
2021-09-14 02:51:16 +02:00
Linus Groh
a50e33abe3 LibJS: Skip ID_{Start,Continue} property lookup for any ASCII characters
Before this change, Lexer::is_identifier_{start,middle}() would do a
Unicode property lookup via Unicode::code_point_has_property() quite
frequently, especially for common characters like .,;{}[]() etc.

Since these and any other ASCII characters not covered by the alpha /
alphanumeric check are known to not have the ID_Start / ID_Continue
(except '_', which is special-cased now) properties, we can easily
avoid this function call.
2021-09-14 02:48:57 +02:00
Luke Wilde
e4d97add3d LibWeb: Implement ParentNode.children
Required by Web Platform Tests for the innerHTML/outerHTML tests.
2021-09-14 02:09:18 +02:00
Luke Wilde
8e0f3436a2 LibWeb: Make the innerHTML setter spec compliant
This adds innerHTML to ShadowRoot in the process.
2021-09-14 02:09:18 +02:00
Luke Wilde
f62477c093 LibWeb: Implement HTML fragment serialisation and use it in innerHTML
The previous implementation was about a half implementation and was
tied to Element::innerHTML. This separates it and puts it into
HTMLDocumentParser, as this is in the parsing section of the spec.

This provides a near finished HTML fragment serialisation algorithm,
bar namespaces in attributes and the `is` value.
2021-09-14 02:09:18 +02:00
Idan Horowitz
ed5128d759 LibWeb: Add the URL::{protocol, pathname, search, hash} attributes 2021-09-14 00:14:45 +02:00
Idan Horowitz
7f9818bcbc LibWeb: Add the URL::host, URL::hostname & URL:port attributes 2021-09-14 00:14:45 +02:00
Idan Horowitz
e89320887e LibWeb: Add the URL::username, URL::password & URL::origin attributes 2021-09-14 00:14:45 +02:00
Idan Horowitz
fe32c9c3bd LibWeb: Add the URL::searchParams attribute 2021-09-14 00:14:45 +02:00
Idan Horowitz
1841fbd3e4 LibWeb: Add the URL::href attribute and URL::to_json method 2021-09-14 00:14:45 +02:00
Idan Horowitz
e6abc1b44e LibWeb: Add a bare implementation of the URL built-in
This only has the constructor implemented for now.
2021-09-14 00:14:45 +02:00
Idan Horowitz
30849b10d5 AK: Move the path argument of URL::append_path instead of copying it 2021-09-14 00:14:45 +02:00
Idan Horowitz
d6cfa34667 AK: Make URL::m_port an Optional<u16>, Expose raw port getter
Our current way of signalling a missing port with m_port == 0 was
lacking, as 0 is a valid port number in URLs.
2021-09-14 00:14:45 +02:00
Idan Horowitz
1c9c43785d AK: Add URL::cannot_have_a_username_or_password_or_port
As defined by the URL specification:
https://url.spec.whatwg.org/#cannot-have-a-username-password-port
2021-09-14 00:14:45 +02:00
Idan Horowitz
929af64a67 AK: Change URL::cannot_be_a_base_url, URL::is_valid return type to bool
There's no need to return a const reference (8 bytes) when the value is
always used as a temporary bool (1 byte).
2021-09-14 00:14:45 +02:00
Idan Horowitz
55b67ba7a7 AK: Accept optional url and state override parameters in URLParser
These are required in the specification and used by the web's URL
built-in, this commit also removes the Badge<AK::URL> from URLParser
to allow other classes that need to call the parser directly like the
web's URL built-in to do so.
2021-09-14 00:14:45 +02:00
Idan Horowitz
6fa4fc8353 AK: Add URL::serialize_origin based on HTML's origin definition 2021-09-14 00:14:45 +02:00
Idan Horowitz
af5b62d8cd LibWeb: Move url_{encode, decode} to URL/URLSearchParams.{h, cpp}
The new URL built-in that will reside in URL.{h, cpp} will have an
URLSearchParams member, which means it has to include its header, and
as such URLSearchParams.h can't include URL's header, which it needs as
it uses the url_{encode, decode} functions.
2021-09-14 00:14:45 +02:00
Idan Horowitz
23997005cf LibWeb: Allow IDL attribute setters to throw DOMExceptions 2021-09-14 00:14:45 +02:00
Idan Horowitz
f9a169380c LibWeb: Consume the extra whitespace in stringifier attributes 2021-09-14 00:14:45 +02:00
Mustafa Quraish
0f749681a9 Everywhere: Use my fancy new serenityos.org email :^) 2021-09-13 20:51:50 +00:00
Andreas Kling
268b36e2d1 Meta: Add Mustafa Quraish to the contributors list :^) 2021-09-13 22:21:57 +02:00
Andreas Kling
bf86419979 LibWeb: Use ComputedCSSStyleDeclaration to generate data for inspector 2021-09-13 22:21:57 +02:00
Andreas Kling
2e4b34b8c3 LibWeb: Generate CSS::{first,last}_property_id constants
These will allow us to iterate through all known CSS properties.
2021-09-13 22:21:57 +02:00
Andreas Kling
3ca2e701e6 LibJS: Log scripts parsed by JS::Script::parse() and how long it took 2021-09-13 22:21:57 +02:00
Andreas Kling
7f71f54fc3 Browser: Rename "DOM Inspector" to just "Inspector"
It inspects more than the DOM, after all. :^)
2021-09-13 22:21:57 +02:00
Tobias Christiansen
416559414c LibWeb: Use right dimension when positioning flex-items
Previously the cross-size was used to determine the position along the
main axis which is obviously wrong.
2021-09-13 21:20:35 +01:00
Linus Groh
8cd4a889fe LibWeb: Stop dumping selectors in ParentNode::query_selector{,_all}()
This isn't particularly useful (anymore), especially without any context
about _why_ this output suddenly appears in the debug console.
2021-09-13 21:16:33 +01:00
Mustafa Quraish
f28b2a875a PixelPaint: Make CloneTool change cursor temporarily while selecting
This just provides some nice visual feedback when you are in the
middle of selecting a color. An eyedropper might not be the ideal
choice here, but among the cursors we already have it is the
best one.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
11263beaca PixelPaint: Add ImageEditor::update_tool_cursor() method
This just allows us to ask the image editor to update the tool's
current cursor. This is useful in cases where a tool may want to
change it's cursor for some operation, and wants to invalidate the
active cursor cached in the ImageEditor.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
0472063b96 PixelPaint: Add a marker for CloneTool's selected position
Now we add a little marker to show the current sample position of
the CloneTool. The current implementation for updating the cursor
location is really dumb since it just updates the whole editor,
but that's a yak on the stack to fix.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
fafbe417d1 PixelPaint: Incorporate CloneTool into toolbox 2021-09-13 22:13:22 +02:00
Mustafa Quraish
22b78226b3 PixelPaint: Add Clone Tool :^)
There's still a lot to be desired in terms of functionality and
usability, but this is a start. When using the clone tool, you
can press Alt to sample a location, and then the brush will clone
the color from there.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
1dcf2f9d94 Base: Add new icon for PixelPaint clone tool 2021-09-13 22:13:22 +02:00
Linus Groh
35cc579264 LibJS: Also set ExecutionContext::realm in Bytecode::Interpreter::run()
I forgot to consider the bytecode Interpreter when adding a Realm to the
ExecutionContext. This should make it a lot less crashy again :^)
2021-09-13 21:06:18 +01:00
Tobias Christiansen
1d47ec380f LibWeb: FlexBox: Use correct source when querying for the main size
This was an error in understanding what calculated_values are and that
those are not what is wanted when getting the main available size of the
box in the FlexFormattingContext.
The calculation around the size calculation is still a bit wonky, but
this is definietly better.
2021-09-13 21:37:16 +02:00
Tobias Christiansen
4c1da4d43a LibWeb: Fix opacity ComputedCSSStyleDeclaration
There was a classic copy&paste error, opacity wasn't getting the right
computed value to convert.
2021-09-13 21:26:31 +02:00
Mohsan Ali
102d345a8f ImageViewer: Enable and disable navigation
Before there was dialogs to indicate if
current file is last or first.

So in this commit, I added functionality to enable
and disable forward and backward navigation based
on if the next file is avialable or not and if the
pervious file is avialable or not, respectively.

ImageViewer: Refactor code and init data

Data intialization was not happening properly, now I did
Initializations properly so that navigation can work from
the very first image.
2021-09-13 23:46:16 +04:30
Tobias Christiansen
f160fe0407 LibWeb: Add support for a bunch of ComputedCSSStyleDeclarations
This patch adds support for a whole lot of other more easy
ComputedCSSStyleDeclararions.
2021-09-13 20:31:06 +02:00
James Puleo
ae6862cb2d AK: Remove unimplemented method fill_buffer from UUID 2021-09-13 20:19:34 +02:00