Commit graph

10979 commits

Author SHA1 Message Date
FrHun
ec1e25929e LibGUI: Add effective and calculated sizes to Widget
Effective sizes are the ones that are actually to be used for layout.
They are just their respective propertys value, or the value returned
by the calculated_<min/preferred>_size, when the respective property
is set to shrink or fit.
The "calculated" values in turn are specific to the widget. Container
widgets for example can calculate their values depending on their
layout and child widget requirement.
Simple widgets like labels and buttons can for example calculate their
values based upon their current text.
2022-06-28 17:52:42 +01:00
FrHun
d825c8ad18 LibGUI: Change preferred_size in Layout to new layout system 2022-06-28 17:52:42 +01:00
FrHun
b2951a2116 LibGUI: Add min_size to Layout 2022-06-28 17:52:42 +01:00
FrHun
2600669b73 LibGUI: Use preferred_size to emulate old is_shrink_to_fit 2022-06-28 17:52:42 +01:00
FrHun
bd277939a1 LibGUI: Add preferred_size to Widget 2022-06-28 17:52:42 +01:00
FrHun
a4aced7f3a LibGUI: Introduce UIDimension properties 2022-06-28 17:52:42 +01:00
FrHun
b47bf2fd7c LibGUI: Use UIDimension in place of int in Widget 2022-06-28 17:52:42 +01:00
FrHun
024305e742 LibGUI: Add UIDimension and UISize types
These types are used to represent size information for layouts.
They can hold integer (int) values ≥0 or special values like shrink
and fit.
2022-06-28 17:52:42 +01:00
FrHun
e29314f837 LibGUI: Refactor BoxLayout for minor readability improvements 2022-06-28 17:52:42 +01:00
FrHun
e08508dcc1 LibGUI: Add direction totals to Margins 2022-06-28 17:52:42 +01:00
Luke Wilde
50642f85ac LibWeb/WebGL: Add WebGLRenderingContextBase.canvas 2022-06-27 22:54:41 +01:00
Luke Wilde
0ec8a19a34 LibWeb/WebGL: Forward the render context ref count to HTMLCanvasElement
This allows HTMLCanvasElement and WebGL rendering contexts to share
their lifetime, as JS allows them to arbitrarily access them at any
time and WebGLRCB.canvas expects a non-null return value.
2022-06-27 22:54:41 +01:00
Luke Wilde
adf8341c4e LibWeb: Forward CRC2D's ref count to HTMLCanvasElement
This allows HTMLCanvasElement and CRC2D to share their lifetime, as JS
allows them to arbitrarily access them at any time and CRC2D.canvas
expects a non-null return value.
2022-06-27 22:54:41 +01:00
Luke Wilde
cd9864bbf1 LibHTTP+RequestServer: Recognize more HTTP methods
Previously it would default to GET for all of these and cause the
Discord API to return Method Not Allowed errors for certain endpoints.
2022-06-27 22:53:36 +01:00
Luke Wilde
1ceba560f4 LibWeb: Add CDATASection
Not used for anything currently other than exposing it on the Window
object. This allows Web Components Polyfills to patch its prototype.
2022-06-27 22:53:04 +01:00
Cyber Gsus
f97e664d8f LibJS: Check for add overflow in DataViewConstructor
Use the Checked type from AK to verify that offset + view_byte_length
is buffer_byte_length at most.
2022-06-27 20:51:00 +01:00
Humberto Alves
bbfafa19b4 LibGUI: Invert button icons only when the contrast ratio improves
Fix the algorithm that automatically inverts solid color button icons
when placed in similarly colored backgrounds. It was meant for fixing
black icons in dark themed buttons.

However, there may be situations where the resulting inverted version
is actually worse than the original. This change prevents those cases.
2022-06-27 20:22:40 +01:00
Lucas CHOLLET
662711fa26 Browser+LibWeb+WebContent: Allow Browser to load local files
To achieve this goal:
 - The Browser unveils "/tmp/portal/filesystemaccess"
 - Pass the page through LoadRequest => ResourceLoader
 - ResourceLoader requests a file to the FileSystemAccessServer via IPC
 - OutOfProcessWebView handles it and sends a file descriptor back to
 the Page.
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
deb525fd9d LibFileSystemAccessClient: Return an errno instead of a string literal
Returning an errno to ease error transmission over IPC.
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
9521952f36 FileSystemAccessServer: Manage concurrent file requests
Before this patch, when you called FileSystemAccessServer::Client::try_*
twice, the second call used the same variable to store the promise. This
"race condition" is now solved using a HashMap, to store multiple
parallel requests.
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
e432a284d7 LibCore: Avoid some successive allocations in Stream::read_all()
For the general case, allocations will always have the size of a block.
In case of a smaller read a block will be filled entirely before another
allocation appends.

It also adds a specialization for Stream::File::read_all() that tries to
detect the size of the file with fstat to perform a single allocation.
2022-06-27 20:22:15 +01:00
Lenny Maiorani
ef46100fd3 LibGfx: Increase cache-friendliness in FastBoxBlurFilter
Change from 4 vectors of u8 to a single vector of a struct of 4
u8. Since all the accesses are on the same indicies into each vector
the cache pressure is decreased by co-locating the data.

When scrolling up and down in the `box-shadow` example page the
profile changes from about 75% of the function calls being in
`apply_single_pass()` to only about 70% on my machine.
2022-06-26 22:11:10 +01:00
MacDue
b652546a16 LibWeb: Fix parsing of background-size: contain/cover
The lack of the commit() before returning the x_value here meant,
that in parse_background_value() the token stream would be one token
behind after parsing the background-size. This led to it to returning
null, after it sees the unexpected 'second' contain / cover token.

With this change all of backgrounds.html is working again.
2022-06-26 22:04:20 +01:00
Linus Groh
93b4c3bb82 LibJS: Infer file extensions when resolving module paths
This allows `import "./foo"` to succeed, even if the file is actually
called `foo.js`. IDEs commonly exclude file extensions in auto-imports.

Closes #14364.
2022-06-26 22:03:53 +01:00
Linus Groh
2b3dd87296 LibJS: Rename filepath to filename in module related code
This is already the parameter name of Core::File::open() and
VM::get_stored_module() - both of which this is passed to - as well as
the member name of the Module class.
2022-06-26 22:03:53 +01:00
Linus Groh
893978ea89 LibJS: Replace enumeration macro in typed_array_species_create()
Use the newly added TypedArrayBase::intrinsic_constructor() instead to
get the required constructor from the global object.

Also add spec comments while we're here.
2022-06-26 21:57:39 +01:00
Linus Groh
3885fa1d10 LibJS: Store fn pointer to its intrinsic constructor on TypedArrayBase
This represents "the intrinsic object listed in column one of Table X"
in the spec.
2022-06-26 21:57:39 +01:00
Liav A
e02da2ed41 LibC: Implement the getsubopt function
This is a LibC function that POSIX defines to help userspace programs
to get suboptions. An example of a suboption is the token "pixclk" from
a Shell command running "edid-decode --gtf w=1024,h=768,pixclk=48".
The function should be run in a while loop to acquire all suboptions
until the last one.
2022-06-25 12:10:04 +01:00
Linus Groh
3beb7fc42f LibJS/Tests: Correct pluralSmallestPluralDisallowedOptions largestUnit 2022-06-24 22:12:03 +01:00
Linus Groh
ee0d5d6649 LibJS: Refactor common option reading into the GetDifferenceSettings AO
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/78abbb8
2022-06-24 22:12:03 +01:00
Linus Groh
05c5263ecc LibJS: Mark CreateTemporalDate in AddDateTime as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/cd356a6
2022-06-24 22:12:03 +01:00
Linus Groh
80663d9d3b LibJS: Mark CreateTemporalDate in ToRelativeTemporalObject as fallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/09e9f9c
2022-06-24 22:12:03 +01:00
Linus Groh
3679f671b9 LibJS: Mark some calls of CreateTemporalDate as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/30344e8
2022-06-24 22:12:03 +01:00
Linus Groh
26990ab41c LibJS: Mark PlainTime.prototype.round's CreateTemporalTime infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6b57938
2022-06-24 22:12:03 +01:00
Linus Groh
709e16004d LibJS: Assert RoundISODateTime is called with values within the limits
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/eaa7042
2022-06-24 22:12:03 +01:00
Linus Groh
f54ed48ef1 LibJS: Assert AddTime is called with a valid time
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0ead23c
2022-06-24 22:12:03 +01:00
Linus Groh
416f94eb3b LibJS: Add Number conversion in PrepareTemporalFields
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/687d06c
2022-06-24 22:12:03 +01:00
Linus Groh
78bfeca643 LibJS: Add Number conversion in ZonedDateTime.prototype.getISOFields()
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bc59d8d
2022-06-24 22:12:03 +01:00
Linus Groh
ea023ac62c LibJS: Add Number conversion in AddDu/ToOrSubtractDu/FromPlainYearMonth
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/823300c
2022-06-24 22:12:03 +01:00
Linus Groh
98dc964649 LibJS: Add conversion to mathematical number in ToTemporalTimeRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9f37d10
2022-06-24 22:12:03 +01:00
Linus Groh
7138f10c30 LibJS: Check for invalid epoch ns in DisambiguatePossibleInstants
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c12d20d
2022-06-24 22:12:03 +01:00
Linus Groh
7b5a7e7759 LibJS: Check for invalid epoch nanoseconds in NanosecondsToDays
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/f1f016e
2022-06-24 22:12:03 +01:00
Linus Groh
ddea6d451b LibJS: Check for invalid epoch nanoseconds in InterpretISODateTimeOffset
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/cdfe4a5
2022-06-24 22:12:03 +01:00
Linus Groh
d10e0f0e3e LibJS: Check for invalid epoch nanoseconds in getPossibleInstantsFor()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/439e6af
2022-06-24 22:12:03 +01:00
Linus Groh
61bdbe712e LibJS: Remove duplicate steps for offset-only time zones
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/7813599
2022-06-24 22:12:03 +01:00
Linus Groh
34f02bed17 LibJS: Remove check for Instant range before subtracting UTC offset
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/5e2fecb
2022-06-24 22:12:03 +01:00
Linus Groh
9c31fee4b5 LibJS: Remove unnecessary modulo operation in GetISOPartsFromEpoch
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fc3f80d
2022-06-24 22:12:03 +01:00
Linus Groh
0ff6260afb LibJS: Use ToTemporalDuration in AddDu/ToOrSubtractDu/FromPlainYearMonth
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a454134
2022-06-24 22:12:03 +01:00
Tim Schumacher
6732fec8b8 LibELF: Warn on self-dlopening libraries while initializing 2022-06-24 11:28:05 +01:00
Tim Schumacher
082a7baa3b LibELF: Check if initializers ran instead of trusting s_global_objects
The original heuristic of "a library being in `s_global_objects` means
that it was fully initialized already" doesn't hold up anymore since we
changed the loading order. This was causing us to skip parts of the
initialization of dependency libraries when running dlopen (since it was
the only user of that setting).

Instead, set a flag after we run stage 4 (which is the "run the global
initializers" stage) and check that flag when determining unfinished
dependencies. This entirely replaces the `skip_global_objects` logic.
2022-06-24 11:28:05 +01:00