If the attribute value is the empty string `(lang="")`, the language
is set to unknown. `lang` attribute higher up in the document tree
will no longer be applied to the content of that element.
This updates the CSS parser to support the keyword 'none' in the CSS4
color functions. The underlying CSSColorValue already supports this
keyword, meaning the parser can instantiate the color directly.
We track this node ID to navigate to a default element when opening the
Inspector. So for all intents and purposes, <frameset> and <body> should
be treated the same.
We guarded one step against a null navigable, but the very next step
also needs to be protected. Let's just abort early instead. This was
caught by the following imported WPT test:
html/dom/elements/the-innertext-and-outertext-properties/innertext-setter.html
This test adds a <frame> element and immediately removes it, but the
task to process the src attribute is already queued. Note that <iframe>
would have the same issue, but this test does not include them.
NavigableContainer is our home grown concept which already contains the
AOs needed for frame and iframe elements. This patch simply aligns our
HTMLFrameElement implementation with this class.
A couple of notes:
1. The <script> in the <head> element is intentional. The <frameset>
element effectively takes the place of the <body> element, and we
cannot add a <script> to a <frameset> element.
2. We don't render <frameset> or <frame> at all. Rendering is defined
in the following spec:
https://html.spec.whatwg.org/multipage/rendering.html#frames-and-framesets
3. If you load the test page in your browser, you won't see anything,
regardless of (2). Our test infra adds a <pre> element to the "body"
element (which is the <frameset> element here). Such children will
never be rendered. In the future, we could come up with something
better for our test infra to do, but this isn't important anyways
for this test - we can still grab the <pre> element's innerText.
This change allows the test list given to “WPT.sh run” to include full
filesystem relative or absolute pathnames. That facilitates using tab
completion in the shell to browse for pathnames, and also facilitates
copy-paste of full filesystem pathnames. For example:
./Meta/WPT.sh run Tests/LibWeb/WPT/wpt/dom/historical.html
./Meta/WPT.sh run /opt/ladybird/Tests/LibWeb/WPT/wpt/dom/historical.html
Otherwise, without this change, the test list can’t include full
filesystem pathnames, but is instead limited to only path fragments that
specify WPT subdirectory pathnames — which doesn’t allow for tab
completion on pathnames in the shell, nor copy-paste of full pathnames.
Unfortunately, there isn't an exact spec method to get the rendered text
of an element, including its shadow DOM. The WebDriver spec requires
just doing exactly what Selenium does.
This patch does not implement this, but is a step in the right direction
as we will now handle text transforms.
This fixes structured serialization of DataView. It was expected
to be uniform with TypedArray, which returns u32 for byte_offset().
This was covered by a number of WPT infrastructure tests, which this
commit also imports.
Previously, callers were passing the size in bytes, but the method
expected bits. This caused a crash in LibCrypto when verifying the key
size later on.
Also make the naming of local variables and parameters a little more
clear between the different AES algorithms :^)
It's actually possible for there to be no adjusted current node, when
the stack of open elements is empty. This was covered by one of the WPT
parsing tests.
We currently only use these methods with AK JSON objects, but they're
actually spec'd for JS objects, as the WebDriver spec sort of assumes
we are sending encoded JS objects over the wire.
When we fully implement JSON deserialization for executing scripts, we
will need to invoke these AOs with JS objects.
This is a bit unfortunate, but if a function provided to this struct is
overloaded, the C++ compiler cannot distinguish which overload should be
assigned to the Function object. This is explained in detail here:
https://stackoverflow.com/a/30394755
C-style function pointers do work, however, and are fine here because
we only ever assign global free functions to these members.
Instead of maintaining a list of script execution result types, which we
then map to WebDriver error types, just return the WebDriver error that
is specified by the spec. Then perform the JSON clone algorithm from the
caller in WebDriverConnection, again as specified by the spec. To do so,
this moves the JSON clone algorithm to its own file. This will also be
the future home of the JSON deserialize algorithm, which will need some
of the internal AOs implemented there.
DOMTokenList and FileList do not have the 'length' own property - their
prototypes have this property instead. So we must go through [[Get]] to
retrieve this property, which will consider the prototype.
This is an ad-hoc change to account for the fact that we may run
arbitrary code while waiting for the tasks in this function to complete.
Same exact idea as ac48222ed7, once again.
If we reach the end of the token stream when "ignoring and moving on
to the next token" in the "in body" state, we should just not move
on to the next token, since there isn't one.
Covered by various WPT HTML parsing tests that will be imported in
a subsequent commit.
Use the `writing-mode` property to determine what values should be used
for computing each element's rect on the screen. If it is a vertical
mode, swap the inline and block, lengths and offsets.
This only lays out whole inline formatting contexts vertically, and does
not currently support mixing the two orientations in a single context.
This patch separates the notion of x, y, width, and height, from
inline_offset, block_offset, inline_length, and block_length.
These can then be used to compute the final screen positions,
in respect of the desired layout direction. This is the terminology
used in https://drafts.csswg.org/css-writing-modes/#text-flow
This makes it possible to use this layout algorithm to flow
text in any direction. For example, vertically.