Commit graph

4078 commits

Author SHA1 Message Date
MacDue
66a428ae03 LibJS+LibWeb: Return non-const types from Ptr class operators
Even if the pointer value is const, the value they point to is not
necessarily const, so these functions should not add the qualifier.

This also removes the redundant non-const implementations of these
operators.
2022-11-19 14:37:31 +00:00
Timothy Flynn
fa2579ffa9 LibWeb: Implement most of WebDriver capability matching
We don't completely implement version matching, and currently ignore the
"proxy" capability.
2022-11-18 15:30:29 +00:00
Timothy Flynn
021eb04640 LibWeb: Extract out the User-Agent browser name and version
This way we can re-use these elsewhere, and if they ever change again,
those other uses will get updated automatically.
2022-11-18 15:30:29 +00:00
Timothy Flynn
e0c7b5747d LibWeb+WebDriver: Begin processing and matching WebDriver capabilities
Still some TODOs here:
* We don't handle all capabilities (e.g. proxy)
* We don't match the capabilities against the running browser

But this will parse the capabilities JSON object received from the
WebDriver client.
2022-11-18 12:21:57 +00:00
Timothy Flynn
5b5b563968 LibWeb: Do not reject valid WebDriver script timeouts
The spec's text is pretty awkward here, but the way we've currently
transcribed it to C++ means we reject valid script timeouts. This meant
the following would fail:

    TimeoutsConfiguration config {}; // Default values.
    auto json = timeouts_object(config);
    config = TRY(json_deserialize_as_a_timeouts_configuration(json));
2022-11-18 12:21:57 +00:00
MacDue
862320828f LibWeb: Fix clicking on links
Since ff2f31b LibWeb has segfaulted when clicking on links, as the
browsing context (a GCPtr) in the lambda was captured by reference
and was out of scope by the time the callback fired.
2022-11-18 10:08:43 +00:00
Timothy Flynn
f7bb835d09 LibWeb+LibWebView+WebContent+WebDriver: Implement Send Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn
f9b8742fff LibWeb+WebContent+WebDriver: Implement Get Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn
3e7d633954 LibWeb+WebContent+WebDriver: Implement Accept Alert 2022-11-16 17:23:56 +00:00
Timothy Flynn
7cf2feb047 LibWeb+WebContent+WebDriver: Implement Dismiss Alert 2022-11-16 17:23:56 +00:00
Timothy Flynn
159dcb9507 LibWeb: Fix typo in WebDriver section comment 2022-11-16 17:23:56 +00:00
Timothy Flynn
4b8729aea6 LibWeb: Add a flag to pause an HTML event loop's execution
This will be used to unblock the WebContent IPC event loop while waiting
for a dialog response.
2022-11-16 17:23:56 +00:00
Andreas Kling
4aeb1ffc12 LibWeb: Add naive layout for SVG foreign objects
We now layout foreign objects as if they form a nested block formatting
context. This probably isn't the most correct way to do this, but it's
a start.
2022-11-16 13:01:21 +01:00
Andreas Kling
0555684682 LibWeb: Sketch out basic support for SVG <foreignObject> elements
This patch adds basic DOM construction and IDL bindings for foreign
objects in SVG trees.
2022-11-16 13:01:21 +01:00
Andreas Kling
e9eba66361 LibWeb: Adjust foreignobject to foreignObject in HTML parser
This conversion was missing from the table we copied from the spec
for whatever reason.
2022-11-16 13:01:21 +01:00
Aliaksandr Kalenik
1b5b7e3b01 LibWeb: Solve width for absolute positioned elemenent according to spec
https://www.w3.org/TR/css-position-3/#abs-non-replaced-width
If left and width are auto and right is not auto, then
the width is shrink-to-fit. Then solve for left.
2022-11-16 03:10:26 +01:00
martinfalisse
35094fc744 LibWeb: Make auto-fit compatible with grid-gap
This fixes an error when using auto-fit with grid-gap, as previously
were not taking into account the fact that more columns had been added
to the grid yet the occupation grid had not grown.
2022-11-16 00:53:00 +01:00
martinfalisse
4b6534a26d LibWeb: Use fixed-size tracks for grid gap
Previously were incorrectly initializing the grid gap tracks as were
using the GridSize float constructor, which creates a flexible length.
What is actually wanted is a fixed-size track of a certain size,
indicated in pixels.
2022-11-16 00:53:00 +01:00
Torstennator
7c09d7c52f LibWeb: Change SVGContext initial fill_color to transparent
This patch changes the initialization of the fill_color of an SVGContext
to transparent instead of black to not draw a black filling if the
elements fill_color is defined as "none".
2022-11-15 22:59:25 +01:00
Aliaksandr Kalenik
adf0262b54 LubWeb: Call before_children_paint for positioned descendants
Add before_children_paint and after_children_paint calls for
positioned descendants with z-index: auto during painting
2022-11-15 22:53:47 +01:00
Aliaksandr Kalenik
f3d57e1157 LibWeb: Clip hidden overflow by absolute rect of containing block
Since handling overflow: hidden in PaintableBox::before_children_paint
while following paint traversal order can't result in correctly computed
clip rectangle for elements that create their own stacking context
(because before_children_paint is called only for parent but overflow:
hidden can be set somewhere deeper but not in direct ancestor), here
introduced new function PaintableBox::clip_rect() that computes clip
rectangle by looking into containing block.

should_clip_overflow flag that disables clip for absolutely positioned
elements in before_children_paint and after_children_paint is removed
because after changing clip rectangle to be computed from not parent
but containing block it is not needed anymore (absolutely positioned
item is clipped if it's containing block has hidden overflow)
2022-11-15 22:53:47 +01:00
Aliaksandr Kalenik
c1401b37c4 LibWeb: Join out-of-flow block nodes in last parent child if possible
Join out-of-flow block nodes into last child of parent node if last
child has inline children.
2022-11-15 22:52:08 +01:00
Idan Horowitz
43c5b94ea6 LibWeb: Implement document.open(string, string, string) 2022-11-15 21:48:19 +00:00
Idan Horowitz
a63c7549e1 LibWeb: Implement window.open
This implementation is some-what complete, with the most common missing
/broken feature being opening pages in new tabs using the "_blank"
target.

This is currently broken due to 2 reasons:
 - We currently always claim the Window does not have transient
   activation, as we do not track the transient activation timestamp
   yet. This means that all such window.open calls are detected as
   pop-ups, and as such they are blocked. This can be easily bypassed
   by unchecking the 'Block Pop-ups' checkbox in the debug menu.
 - There is currently no mechanism for the WebContent process to
   request a new tab to be created by the Browser process, and as
   such the call to BrowsingContext::choose_a_browsing_context does not
   actually open another tab.
2022-11-15 21:48:19 +00:00
Idan Horowitz
d15d7636e5 LibWeb: Add window.open feature detection abstract operations 2022-11-15 21:48:19 +00:00
Idan Horowitz
798d7c6fae LibWeb: Add 'should block pop ups' user config to Page
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
ff2f31bc81 LibWeb: Bring BrowsingContext::choose_a_browsing_context closer to spec 2022-11-15 21:48:19 +00:00
Idan Horowitz
c948873c5b LibWeb: Add the 'opener browsing context' BrowsingContext property
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
b27f855107 LibWeb: Add the 'is popup' BrowsingContext property
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Idan Horowitz
efe94d9040 LibWeb: Support parsing a URL relative to environment settings object 2022-11-15 21:48:19 +00:00
Idan Horowitz
f69c135796 LibWeb: Implement the 'Entry Realm/{settings,global} object' concepts 2022-11-15 21:48:19 +00:00
Idan Horowitz
c9f9fcd8fd LibWeb: Remove accidentally commited dbglns 2022-11-15 21:48:19 +00:00
Timothy Flynn
05f41382bb Userland: Properly define IPC::encode and IPC::decode specializations
In order to avoid the base encode/decode methods from being used (and
failing a static assertion), we must be sure to declare/define the
custom type implementations as template specializations.

After this, LibIPC is no longer sensitive to include order.
2022-11-15 13:25:51 -05:00
Timothy Flynn
8e624c8f6d LibWeb+WebContent+WebDriver: Implement Find Elements From Shadow Root 2022-11-15 11:55:36 +00:00
Timothy Flynn
6d9bd04233 LibWeb+WebContent+WebDriver: Implement Find Element From Shadow Root 2022-11-15 11:55:36 +00:00
Timothy Flynn
4d9fd5d190 LibWeb+WebContent+WebDriver: Implement Get Element Shadow Root 2022-11-15 11:55:36 +00:00
Timothy Flynn
cb91e6067c LibWeb+WebContent+WebDriver: Implement Get Active Element
Unfortunately, nothing ever calls DOM::Document::set_active_element at
the moment, so this will always return ErrorCode::NoSuchElement.
2022-11-15 11:55:36 +00:00
Itamar
8d65df935e LibWeb: Handle inset properties in style_value_for_property()
This adds support for the Top, Right, Bottom and Left CSS properties
in style_value_for_property().
2022-11-14 21:22:27 +00:00
Aliaksandr Kalenik
2675b9390b LibWeb: Parse unknown media type in media queries
Prevent media query parser from falling back into
MediaQuery::create_not_all() for queries with unknown media type.
With this change following test works correctly:
http://wpt.live/css/css-conditional/at-media-001.html
2022-11-14 16:08:35 +00:00
Aliaksandr Kalenik
7f527ddde3 LibWeb: Support device-height and device-width media query values 2022-11-14 16:08:35 +00:00
Aliaksandr Kalenik
93238edf8f LibWeb: Respect media attribute of style tag 2022-11-14 14:47:37 +00:00
Linus Groh
93c0c73b9e LibWeb: Implement XMLHttpRequest.withCredentials 2022-11-14 10:00:11 +00:00
Linus Groh
bfa378660b LibWeb: Add a clarifying comment to XHR::m_response_object
Trying to change this to a JS::Object didn't quite work, so let's add
a helpful comment instead.
2022-11-14 10:00:11 +00:00
Linus Groh
fb57500394 LibWeb: Use HeaderList from Fetch for XHR author request headers 2022-11-14 10:00:11 +00:00
Linus Groh
c8184d85c1 LibWeb: Rename XHR::{m_request_headers => m_author_request_headers} 2022-11-14 10:00:11 +00:00
Linus Groh
6e53dd8767 LibWeb: Rename XHR::{m_url => m_request_url} 2022-11-14 10:00:11 +00:00
Linus Groh
29a8414a05 LibWeb: Rename XHR::{m_method => m_request_method} 2022-11-14 10:00:11 +00:00
Linus Groh
338ada66fa LibWeb: Add spec comments and links to XHR members 2022-11-14 10:00:11 +00:00
Linus Groh
04eaff3bb4 LibWeb: Rename XHR's ReadyState / m_ready_state to just State / m_state
This is what the spec calls it.
2022-11-14 10:00:11 +00:00
Timothy Flynn
9fbc4138bb LibWeb: Define the route for the Fullscreen Window command
This was missed in 4eefa292df.
2022-11-14 00:05:15 +00:00