Commit Graph

28165 Commits

Author SHA1 Message Date
Andreas Kling
0ab31d8c84 LibWeb: Support simplest form of CSSStyleDeclaration.setProperty()
This patch adds the setProperty(name, value) API to CSSStyleDeclaration.
Setting an invalid or empty value will cause the property to be removed
from the declaration.

Note that this only works on mutable declarations (i.e element.style)
and not on resolved declarations (i.e window.getComputedStyle(element)).
2021-09-26 19:07:03 +02:00
Luke Wilde
e0e41116a4 LibWeb: Make WindowObject's prototype immutable
While I was implementing IDL special operations, I noticed that for
global platform objects (e.g. WindowObject), the IDL spec makes their
prototype immutable.

https://heycam.github.io/webidl/#platform-object-setprototypeof
2021-09-26 18:59:56 +02:00
Luke Wilde
f6b24a72ee LibWeb: Add support for HTMLOrSVGElement.dataset 2021-09-26 18:59:56 +02:00
Luke Wilde
37347cbcb6 LibWeb: Convert HTMLCollection to use IDL special operations 2021-09-26 18:59:56 +02:00
Luke Wilde
41ae0c0216 LibWeb: Add support for IDL legacy platform objects
A legacy platform object is a non-global platform object that
implements a special operation. A special operation is a getter, setter
and/or deleter. This is particularly used for old collection types,
such as HTMLCollection, NodeList, etc.

This will be used to make these spec-compliant and remove their custom
wrappers. Additionally, it will be used to implement collections that
we don't have yet, such as DOMStringMap.
2021-09-26 18:59:56 +02:00
Luke Wilde
e06762f312 LibJS: Make Object::ordinary_set_with_own_descriptor non-static
This needs to be accessible for implementing IDL legacy platform
objects.
2021-09-26 18:59:56 +02:00
Luke Wilde
27dfd0170e LibWeb: Implement Document.importNode 2021-09-26 18:59:19 +02:00
Andreas Kling
3252d984ae LibJS: Allow statements to have multiple labels
This is a curious thing that occurs more often than you'd think in
minified JavaScript:

    a: b: c: for (...) { ... break b; ... }
2021-09-26 18:24:19 +02:00
Linus Groh
ababcc5725 LibJS: Defer execution of switch default clause until after case clauses
When we encounter a default clause in a switch statement, we should not
execute it immediately, instead we need to wait until all case clauses
have been executed as a matching case clause can break from the
switch/case.

The code is nowhere close to the spec, so instead of fixing it properly
I just made it slightly worse, but correct. Needs a complete refactor at
some point.
2021-09-26 18:04:25 +02:00
Andreas Kling
a248ec63e3 LibWeb: Implement window.queueMicrotask(callback)
This API allows authors to schedule a serialized JS callback that will
get invoked at the next spec-allowed opportunity.
2021-09-26 14:39:14 +02:00
Andreas Kling
831fdcaabc LibWeb: Add the PageTransitionEvent interface and fire "pageshow" events
We now fire "pageshow" events at the appropriate time during document
loading (done by the parser.)

Note that there are no corresponding "pagehide" events yet.
2021-09-26 12:47:51 +02:00
Andreas Kling
508edcd217 LibWeb: Add a "page showing" flag to documents
This will be used to determine whether "pageshow" and "pagehide" events
are appropriate. We won't actually make use of it until we implement
more of history traversal and document unloading.
2021-09-26 12:47:51 +02:00
Andreas Kling
a2f77a2e39 LibWeb: Implement "update the current document readiness" from spec
The only difference from what we were already doing is that setting the
same ready state twice no longer fires a "readystatechange" event.
I don't think that could happen in practice though.
2021-09-26 12:47:51 +02:00
Andreas Kling
8496024756 LibWeb: Store HTML document ready state as an enum 2021-09-26 12:47:51 +02:00
Andreas Kling
c4ccbc5b83 LibWeb: Make unhandled JS exception stand out more in debug log
Let's log "unhandled exception" messages in red text so that they stand
out better among lots of other debug logging.
2021-09-26 12:47:51 +02:00
Rodrigo Tobar
5ae384fc33 LibELF: Indicate value of unimplemented dtag
For flags that are not mapped to a string this message prints DT_??,
which isn't really useful.
2021-09-26 12:45:55 +02:00
Rodrigo Tobar
a67e06184b LibC+LibELF: Add definitions for extra dtags
These are found in some libraries, and LibELF doesn't know how to handle
them, not even their name. Adding these definitions should at least help
readelf display information correctly, but more work is needed to
actually implement them.
2021-09-26 12:45:55 +02:00
Rodrigo Tobar
3efd7b458a LibELF+readelf: Remove duplicated dtag->string map
A copy of the same mapping was found both in LibELF and in the readelf
utility, which uses LibELF; keeping them both is redundant and removing
the duplicate saves (a bit of) space.
2021-09-26 12:45:55 +02:00
Nico Weber
93f62384f5 Base: Update man2/pipe.md after 5d180d1f99 2021-09-26 12:45:19 +02:00
Karol Kosek
1803c5966d ThemeEditor: Show currently opened theme path in the window title
You can open files since #9979, so let's show the path there
to distinguish open theme files more easily!
2021-09-26 12:44:51 +02:00
Nico Weber
fdc86ddae5 Kernel: Add a GPIO class for aarch64
This allows configuring the alternate pin functions and pin
pull up/down states, which is needed for using the UART.
2021-09-26 11:55:51 +02:00
Andreas Kling
5ac82efbe1 LibWeb: Mark event listeners generated by event handler attributes
We have to mark the EventListener objects so that we can tell them apart
from listeners added via the addEventListener() API.

This makes element.onfoo getters actually return the handler function.
2021-09-26 02:53:57 +02:00
Andreas Kling
5f4a723e51 LibWeb: Implement more of "completely finish loading the document" 2021-09-26 02:25:02 +02:00
Andreas Kling
bfec16ce46 LibWeb: Remove nonsensical assignment in script-became-ready callback
We don't need to set m_script_ready in the callback that gets invoked
precisely because m_script_ready has been set. :^)
2021-09-26 02:05:54 +02:00
Andreas Kling
65e0f8184d LibWeb: Make parser <script> elements delay the document load event 2021-09-26 02:05:49 +02:00
Andreas Kling
fc2a255c72 LibWeb: Make <link> style sheets delay the document load event 2021-09-26 02:00:24 +02:00
Andreas Kling
dbba0a520f LibWeb: Allow HTML parser to delay delivery of the document "load" event
We will now spin in "the end" until there are no more "things delaying
the load event". Of course, nothing actually uses this yet, and there
are a lot of things that need to.
2021-09-26 02:00:00 +02:00
Andreas Kling
b1529e3202 LibWeb: Remove some unused includes and a member in HTMLScriptElement 2021-09-26 01:03:17 +02:00
Andreas Kling
e7af6af626 LibWeb: Implement more of HTMLParser::the_end() and bring closer to spec 2021-09-26 00:52:19 +02:00
Andreas Kling
c772134e25 LibWeb: Make update_style() a no-op if there's no browsing context
Style is needed to lay out and paint a document, but we can't do either
those when the document isn't attached to a browsing context.
2021-09-26 00:48:30 +02:00
Andreas Kling
e452550fda LibWeb: Split out "The end" from the HTML parsing spec to a function
Also add a spec link and some comments.
2021-09-26 00:04:33 +02:00
Andreas Kling
f67648f872 LibWeb: Rename HTMLDocumentParser => HTMLParser 2021-09-25 23:36:43 +02:00
Andreas Kling
0ee457dfdf LibWeb: Provide a default DOM::EventTarget::dispatch_event()
All EventTarget subclasses except Window do the same exact thing in
their overrides, so let's just share an implementation in the base.
2021-09-25 23:36:43 +02:00
Idan Horowitz
8dcf4e0346 LibWeb: Return undefined from generated EventHandler setters
Returning an empty value without throwing an exception is no longer
valid.
2021-09-25 23:35:54 +02:00
Karol Kosek
5a5f6d11ef PixelPaint: Close image tabs on middle click 2021-09-25 23:34:02 +02:00
Karol Kosek
df195188bc PixelPaint: Close New Image dialog after pressing return key
13e526de43 added the feature to new Layer
dialog. This patch adds it to Image dialog to stay consistent across
the app. :^)
2021-09-25 23:34:02 +02:00
Andreas Kling
926a49cd81 LibWeb: Use Core::EventLoop::spin_until() for the ad-hoc loop spinning
The ideal solution here is to implement a more spec-compliant event
loop, but while we get all the pieces in place for that, this at least
makes the HTML event loop a bit more responsive since it never has to
wait for a 16ms timer to fire.
2021-09-25 19:34:21 +02:00
Andreas Kling
f2b9ec9f8a LibCore: Add Core::EventLoop::spin_until(Function<bool()>)
This function spins the event loop until a goal condition is met.
2021-09-25 19:32:14 +02:00
Andreas Kling
2c0987c93b LibWeb: Move window.scroll{X,Y} from wrapper into DOM::Window
The less we do in WindowObject, the easier it will be to eventually
auto-generate the entire thing.
2021-09-25 18:47:19 +02:00
Linus Groh
38157a6093 LibJS: Move has_constructor() from NativeFunction to FunctionObject
At a later point this will indicate whether some FunctionObject "has a
[[Construct]] internal method" (separate from the current FunctionObject
call() / construct()), to help with a more spec-compliant implementation
of [[Call]] and [[Construct]].
This means that it is no longer relevant to just NativeFunction.
2021-09-25 17:51:30 +02:00
Linus Groh
e14f420a44 LibJS: Add const Value::as_function() 2021-09-25 17:51:30 +02:00
Linus Groh
2dba048146 LibJS: Remove unused FunctionObject::environment()
ECMAScriptFunctionObject::environment() can just be non-virtual.
2021-09-25 17:51:30 +02:00
Linus Groh
9043041dd3 LibJS: Move [[BoundThis]] and [[BoundArguments]] to BoundFunction 2021-09-25 17:51:30 +02:00
Linus Groh
4566472ed6 LibJS: Rename BoundFunction::m_target_function to match spec name 2021-09-25 17:51:30 +02:00
Linus Groh
a08292d76c LibJS: Move has_simple_parameter_list to ECMAScriptFunctionObject 2021-09-25 17:51:30 +02:00
Linus Groh
76eb8fe717 LibJS: Move [[Fields]] to ECMAScriptFunctionObject 2021-09-25 17:51:30 +02:00
Linus Groh
136451c3af LibJS: Move [[HomeObject]] to ECMAScriptFunctionObject 2021-09-25 17:51:30 +02:00
Linus Groh
06726d41ac LibJS: Move [[ConstructorKind]] to ECMAScriptFunctionObject 2021-09-25 17:51:30 +02:00
Linus Groh
1e97a85095 LibJS: Move [[ThisMode]] to ECMAScriptFunctionObject 2021-09-25 17:51:30 +02:00
Linus Groh
ce946dd656 LibJS: Add ECMAScriptFunctionObject forward declaration 2021-09-25 17:51:30 +02:00