Vladimir Shakhov
e2391105a1
LibWeb: Call process_session_history_traversal_queue on history update
...
Spec declares that the updates to history should be synchronous on
initial page load and on history pushState/replaceState.
2023-12-15 22:11:49 +01:00
Andreas Kling
70193c0009
LibWeb: Let Document have a direct GCPtr to its containing Web::Page
...
With this change, Document now always has a Web::Page. This means we no
longer rely on the breakable link between Document and BrowsingContext
to find a relevant Web::Page.
Fixes #22290
2023-12-15 22:04:46 +01:00
Andrew Kaster
ec11743fae
LibWeb: Use StructuredSerializeWithTransfer in window.postMessage()
...
And update tests to transfer message a message port between iframes.
2023-12-14 08:36:11 -07:00
Aliaksandr Kalenik
e464d484c4
LibWeb: Implement getBoundingClientRect() for inline paintables
...
This fixes the issue that occurred when, after clicking an inline
paintable page would always scroll to the top. The problem was that
`scroll_an_element_into_view()` relies on `get_bounding_client_rect()`
to produce the correct scroll position and for inline paintables we
were always returning zero rect before this change.
2023-12-14 16:25:27 +01:00
Shannon Booth
ed97946975
LibWeb: Support obsolete but required -webkit- CSS parsing quirk
...
As outlined in: https://www.w3.org/TR/selectors-4/#compat
We now do not treat unknown webkit pseudo-elements as invalid at parse
time, and also support serializing these elements.
Fixes : #21959
2023-12-11 16:54:59 +01:00
Andreas Kling
6994ea5885
LibWeb: Skip out-of-flow boxes when wrapping inlines in anonymous block
...
Out-of-flow boxes (floating and absolutely-positioned elements) were
previously collected and put in the anonymous block wrapper as well, but
this actually made hit testing not able to find them, since they were
breaking expectations about tree structure that hit testing relies on.
After this change, we simply let out-of-flow boxes stay in their
original parent, preserving the author's intended box tree structure.
2023-12-11 13:19:12 +01:00
Andreas Kling
cfe9577b48
LibWeb: Bring HTMLElement.offset{Left,Top,Parent} closer to spec
...
(Or rather, bring offsetLeft and offsetTop closer to spec, and implement
the previously-missing offsetParent)
This makes mouse inputs on https://nerget.com/fluidSim/ work properly.
2023-12-10 16:30:21 +01:00
Bastiaan van der Plaat
ea04a86715
LibWeb: Add fieldset elements property
2023-12-10 08:07:41 -05:00
Bastiaan van der Plaat
466153e680
Ladybird+LibWeb: Add basic select element support
2023-12-09 22:06:20 +01:00
Andrew Kaster
512624f31a
LibWeb: Add a basic MessageChannel test
2023-12-09 21:52:28 +01:00
Bastiaan van der Plaat
fef7571931
LibWeb: Add output element value
2023-12-09 21:50:17 +01:00
Bastiaan van der Plaat
1b9a961fb0
LibWeb: Add input stepUp and stepDown functions
2023-12-07 16:46:28 -05:00
Timothy Flynn
fd297a3248
LibWeb: Run the unfocusing steps when a click does not focus anything
...
For example, when clicking the document body outside of a focused input
element, we should unfocus that element.
2023-12-04 01:33:57 +01:00
Timothy Flynn
48240a6fc3
LibWeb: Focus the document element when unfocusing an element
...
Otherwise, the currently focused element remains focused.
2023-12-04 01:33:57 +01:00
Timothy Flynn
08ee48606d
LibWeb: Fire a change event on input elements in the focus update steps
...
This ensures the change event is received before the blur event.
2023-12-04 01:33:57 +01:00
Timothy Flynn
301d58e2d9
LibWeb: Fire the change
event synchronously when committing changes
...
The spec does not say to do this asynchronously on a task queue.
2023-12-04 01:33:57 +01:00
Andreas Kling
ec081a2ef5
LibWeb: Don't crash on FormData.append() with emoji in name
...
If you can believe it, we were once again using StringBuilder's append()
when we really wanted append_code_point().
2023-12-04 00:04:04 +01:00
Andreas Kling
0d74ced9b5
LibWeb: Don't crash on Document.createElement() with emoji in tag name
...
Once again, we were mistakenly using StringBuilder's append(char) when
we really wanted append_code_point(u32).
2023-12-04 00:04:04 +01:00
Andreas Kling
1b81e0081d
LibWeb: Don't crash on Element.setAttribute() with emoji in name
...
We were mistakenly using StringBuilder's append(char) when we really
wanted append_code_point(u32).
2023-12-04 00:04:04 +01:00
Andreas Kling
dbca63a1db
LibWeb: Don't get stuck in TreeWalker.nextNode() when current detached
...
This fixes a hang on https://reddit.com/
Spec bug: https://github.com/whatwg/dom/issues/1102
2023-12-03 23:16:26 +01:00
Kenneth Myhra
d9fb116bcc
Tests/LibWeb: Initialize Blob with string and read it from arrayBuffer()
2023-12-03 20:28:10 +01:00
Kenneth Myhra
b72489409a
Tests/LibWeb: Initialize Blob with string and read it from text()
2023-12-03 20:28:10 +01:00
Shannon Booth
a8caa3edbc
LibWeb/Tests: Add a test to cover byte stream enqueue and respond
2023-12-03 20:26:14 +01:00
Kemal Zebari
24b9d05ea8
LibWeb/HTML: Implement text attribute in HTMLTitleElement
2023-12-02 10:35:43 +01:00
Timothy Flynn
7edfeb7056
LibWeb: Support committing changes to <input> elements
...
We currently fire the change event on <input> elements when they lose
focus. The spec allows for us to also fire the event when changes are
"committed", so long as such an action makes sense for the input type.
This patch detects when the return key is entered in an <input> element
and uses that as the commit action for text-related types. If no change
has occurred since the last commit, no change event is fired.
2023-12-02 10:34:22 +01:00
Timothy Flynn
ff48b7333c
LibWeb: Remove shadow roots from elements that are removed from the DOM
...
We currently create a shadow tree once for each DOM element that renders
with a shadow tree (e.g. <input>, <details>). If such an element is
removed from the DOM, we must remove its shadow tree. Otherwise, the
shadow tree will refer to the old document in perpetuity.
If the node is added back to a DOM, then recreate the shadow tree.
2023-11-30 08:49:15 +00:00
Kenneth Myhra
e3f5bbcbbe
Tests/LibWeb: Move existing XHR Text tests in under the XHR folder
2023-11-29 21:51:35 +01:00
Kenneth Myhra
3d86e16407
Tests/LibWeb: Verify instantiation behavior of Blob w/empty constructor
...
This verifies that a Blob instantiated with an empty constructor creates
a Blob with Blob.size equal to 0 and Blob.type equal to "".
2023-11-29 21:51:35 +01:00
Kenneth Myhra
36fddab68e
Tests/LibWeb: Verify XHR.response is an instance of Blob
...
This verifies that XHR.response is an instance of Blob when
XHR.responseType is set to 'blob'.
2023-11-29 21:51:35 +01:00
Kenneth Myhra
09487679eb
Tests/LibWeb: Verify XHR.response is an instance of Document
...
This verifies that XHR.response is an instance of Document when
XHR.responseType is set to 'document' and the response contains HTML.
2023-11-29 21:51:35 +01:00
Kenneth Myhra
990f73708d
Tests/LibWeb: Verify XHR.response is an instance of ArrayBuffer
...
This verifies that XHR.response is an instance of ArrayBuffer when
XHR.responseType is set to 'arraybuffer'.
2023-11-29 21:51:35 +01:00
Kenneth Myhra
68fa8f52b4
Tests/LibWeb: Verify XHR.open() throws on forbidden method
...
This verifies that XHR.open() throws a Security Error when 'CONNECT',
'TRACE', or 'TRACK' is passed as the method argument.
2023-11-29 21:51:35 +01:00
Kenneth Myhra
eb6a7ccc59
Tests/LibWeb: Verify XHR.open() throws on illegal token in method arg
...
This verifies that XHR.open() throws a Syntax Error if an illegal token
is passed to the method argument.
2023-11-29 21:51:35 +01:00
Kenneth Myhra
ff05f19c84
Tests/LibWeb: Verify XHR.send() throws when called twice
...
This verifies that XHR.send() throws an Invalid State Error when called
twice.
2023-11-29 21:51:35 +01:00
Kenneth Myhra
ac82585ae7
Tests/LibWeb: Verify XHR.send() throws when XHR.readyState is UNSENT
...
This verifies that an Invalid State Error is being thrown when
XHR.open() has not been called before calling XHR::send().
2023-11-29 21:51:35 +01:00
Aliaksandr Kalenik
afe24883b7
LibWeb: Remove exit for javascript urls in anchor activation_behavior()
...
This early return is no longer needed because Navigable::navigate()
can process `javascript:` urls.
Fixes https://github.com/SerenityOS/serenity/issues/22052
2023-11-25 16:33:54 +01:00
Shannon Booth
673329e1bd
LibWeb: Use ArrayBufferView for ReadableStreamBYOBReader
...
Which means that we now have support for DataViews.
Using the ArrayBufferView class also seems to make this read a whole
bunch nicer as well.
2023-11-24 08:43:35 +01:00
timmot
9f2ee86e4d
Tests/LibWeb: Test canvas fillStyle parsing of rgb strings
2023-11-24 08:42:18 +01:00
Andrew Kaster
1602663b9e
LibWeb+WebWorker: Implement a first cut of post_message for Workers
...
This implementation completely ignores MessagePorts, and manually plumbs
data through LocalSockets.
2023-11-24 08:41:38 +01:00
Andrew Kaster
79fa892ca1
Tests: Add stub for the internals object when not running in test mode
...
This allows developers to open LibWeb test html files in Ladybird or in
other browsers to observe their behavior without the internals object.
2023-11-24 08:41:38 +01:00
Shannon Booth
decc071060
LibWeb: Return a scroll offset of 0 for colgroup elements
...
Ideally we would not create a layout node at all for these elements so
that every layout node would always have a paintable associated with it.
But for now, to fix the crash, just leave a FIXME and special case this
element.
Also leave a VERIFY to make it easier to debug this type of crash in the
future.
Fixes a crash seen on codecov.io for my 'patch' project.
2023-11-23 13:06:48 +01:00
Andreas Kling
ef809eea1e
LibWeb: Don't assume IO.unobserve() called on observed element
...
It's perfectly possible for JavaScript to call unobserve() on an element
that hasn't been observed. Let's stop asserting if that happens. :^)
Fixes #22020
2023-11-23 09:37:12 +01:00
Andreas Kling
cc9de38ea4
LibWeb: Fix null pointer dereference in DOM::Node::remove()
...
Instead of blindly dereferencing m_registered_observer_list, just use
the add_registered_observer() helper.
Fixes #22005
2023-11-20 20:50:53 +01:00
Shannon Booth
1daded768d
LibWeb: Implement ReadableStreamBYOBReader::read
...
Similiarly to the underlying AO's, currently only TypedArrays are
supported.
2023-11-19 18:53:17 +01:00
Aliaksandr Kalenik
6bed27cca9
LibWeb: Use border box rect in getBoundingClientRect()
...
With this change we scroll to correct position on Acid2 :)
2023-11-17 20:46:56 +01:00
Idan Horowitz
20734ac335
LibWeb: Support [de]serialization for {Map, Set, Object, Array} objects
2023-11-11 22:18:41 +01:00
Idan Horowitz
1d24e08934
LibWeb: Support [de]serialization for Error objects
2023-11-11 22:18:41 +01:00
Timothy Flynn
4b94b0b561
LibWeb: Begin implementing the Clipboard API
...
https://w3c.github.io/clipboard-apis/
This implements enough for navigator.clipboard.writeText(String).
2023-11-11 08:54:37 +01:00
Shannon Booth
87a4a5b302
LibWeb: Remove FIXMe's for HTML attribute serialization steps
...
As far as I can tell all of these steps are just equivalent to using the
qualified name. Add some tests which cover some of these cases, and
remove the FIXME's.
2023-11-11 08:50:25 +01:00
Nicolas Ramz
68e916490b
LibGfx/JPEGWriter: Fix crash on macOS when csize coefficient is 0
...
This fixes #21108
2023-11-09 16:07:28 +01:00