Commit graph

5008 commits

Author SHA1 Message Date
Idan Horowitz
a93b1c7ea0 LibJS: Add Date.prototype.setMonth() 2021-06-06 19:14:11 +01:00
Idan Horowitz
59034554a4 LibJS: Account for differences in month representations (0-11 vs 1-12)
Since DateTime stores months as 1 to 12, while JS accepts months as
0 to 11, we have to account for the difference (by subtracting or
adding 1) where appropriate.
2021-06-06 19:14:11 +01:00
Idan Horowitz
b893963651 LibJS: Add Date.prototype.setDate() 2021-06-06 19:14:11 +01:00
Idan Horowitz
3eb05d9413 LibJS: Stub out Date.prototype.getTimezoneOffset()
We only support UTC currently, so this always returns 0 as long as the
date is not invalid.
2021-06-06 19:14:11 +01:00
Idan Horowitz
44926b3f80 LibJS: Ignore arguments in Date's constructor when called as a function
Since theres no way to drop the arguments before the call to the
constructor (or to signal to the constructor that it was not called
directly), we simply reuse the code for the no arguments provided
special case. (And to prevent code duplication, the code was extracted
into the separate static function Date::now(GlobalObject&).
2021-06-06 19:14:11 +01:00
Linus Groh
ba9d3bc38c LibJS: Create 1970-01-01 00:00:00 local time Date for invalid ctor call
When using Core::DateTime::from_timestamp(0) the resulting Date is
1970-01-01 00:00:00 in UTC, which might be something different in local
time - this is incorrect and relevant as invalid Dates can be made valid
later on.
2021-06-06 19:34:43 +02:00
Linus Groh
ff5aa3ca70 LibJS: Make it so that Date.prototype.toGMTString === .toUTCString 2021-06-06 19:34:43 +02:00
Linus Groh
60aace8400 LibJS: Remove unused includes from SymbolPrototype.cpp 2021-06-06 19:34:43 +02:00
Linus Groh
b661363dfe LibJS: Implement String.prototype[@@toPrimitive]() 2021-06-06 19:34:43 +02:00
Linus Groh
e9a0759b16 LibJS: Add String.prototype.valueOf()
It should have its own and not inherit from the Object prototype.
2021-06-06 19:34:43 +02:00
Linus Groh
8d7ec28924 LibJS: Remove String.prototype.length
A string's length property is supposed to be a regular non-writable,
non-enumerable, non-configurable property on the StringObject instead.
2021-06-06 19:34:43 +02:00
Linus Groh
fc2673d111 LibJS: Replace SymbolPrototype's typed_this() with this_symbol_value()
This brings the code close to the spec with no trade-offs, which is
always valuable.

No functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
6f96f01171 LibJS: Replace StringPrototype's typed_this() with this_string_value()
This brings the code close to the spec with no trade-offs, which is
always valuable.

No functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
68d669443f LibJS: Replace bigint_object_from() with this_bigint_value()
This brings the code close to the spec with no trade-offs, which is
always valuable.

No functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
d255e6892b LibJS: Update NumberPrototype's this_number_value() to take a Value
This is now about as close to the spec as it gets - instead of querying
the |this| value inside of the function, we now pass it in from the
outside.
Also get rid of the oddly specific error messages, they're nice but
pretty inconsistent with most others. Let's prefer consistency and
simplicity for now.

Other than that, no functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
3cfd9f51f7 LibJS: Replace some is_nullish() checks with require_object_coercible() 2021-06-06 19:34:43 +02:00
Linus Groh
cd12b2aa57 LibJS: Implement the RequireObjectCoercible abstract operation
Throws an exception if the given value is nullish, returns it otherwise.
We can now gradually replace such manual checks with this function where
applicable.

This also has the advantage that the somewhat useless "ToObject on null
or undefined" will be replaced with "null cannot be converted to an
object" or "undefined cannot be converted to an object". :^)
2021-06-06 19:34:43 +02:00
Andreas Kling
4c47b3951d Clipboard: Tighten pledge promises a bit earlier :^) 2021-06-06 17:56:34 +02:00
FalseHonesty
db20f7b6d8 Userland: Add matroska program to test parsing Matroska container files 2021-06-06 17:47:00 +02:00
FalseHonesty
403bb07443 LibVideo: Scaffold LibVideo and implement simplistic Matroska parser
This commit initializes the LibVideo library and implements parsing
basic Matroska container files. Currently, it will only parse audio
and video tracks.
2021-06-06 17:47:00 +02:00
Max Wipfli
30cdebfa9e LibProtocol: Use URL class in RequestClient::start_request argument
This changes the RequestClient::start_request() method to take a URL
object instead of a URL string as argument. All callers of the method
already had a URL object anyway, and start_request() in turn parses the
URL string back into a URL object. This removes this unnecessary
conversion.
2021-06-06 16:00:11 +02:00
Max Wipfli
5b5f7bc360 LibProtocol: Change RequestClient.{cpp,h} to use east const style 2021-06-06 16:00:11 +02:00
Eugene Barnett
cab2ee5ea2 Magnifier: Add desktop display scale awareness
Continues to magnify correctly at the most current
desktop scale.
2021-06-06 15:56:43 +02:00
Eugene Barnett
4ef85de9dc WindowServer: Add a GetDesktopDisplayScale IPC request
Tells you which scale factor is configured in window manager.
2021-06-06 15:56:43 +02:00
Andreas Kling
f290048662 LibJS: Pass unwinding target labels a bit more efficiently
Use const reference or move semantics when passing these labels.
2021-06-06 11:45:52 +02:00
dylanbobb
e24f1dfbe1 LibGUI: Don't delete within a line if the line is empty 2021-06-06 11:25:59 +02:00
Tom
2c8309c841 WindowServer: Simplify determining transparent/opaque occlusions
By moving the logic to determine what window areas (shadow, frame,
content) into WindowFrame::opaque/transparent_render_rects we can
simplify the occlusion calculation and properly handle more
arbitrary opaque/transparent areas.

This also solves the problem where we would render the entire
window frame as transparency only because the frame had a window
shadow.
2021-06-06 09:37:27 +01:00
Linus Groh
939da41fa1 LibRegex: Fix compilation errors on my host machine
I have no idea *why*, but this stopped working suddenly:

    return { { .code_point = '-', .is_character_class = false } };

Fails with:

    error: could not convert ‘{{'-', false}}’ from
    ‘<brace-enclosed initializer list>’ to
    ‘AK::Optional<regex::CharClassRangeElement>

Might be related to 66f15c2 somehow, going one past that commit makes
the build work again, however reverting the commit doesn't. Not sure
what's up with that.

Consider this patch a band-aid until we can find the reason and an
actual fix...

Compiler version:
gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
2021-06-06 09:26:07 +01:00
Linus Groh
887852f36d LibJS: Make Number.prototype.toString() radix coercion spec compliant
This should use the ToIntegerOrInfinity() abstract operation.
2021-06-06 07:03:12 +01:00
Linus Groh
adc3de4480 LibJS: Implement Number.prototype.valueOf() 2021-06-06 06:56:08 +01:00
Idan Horowitz
0bf597e99d LibJS: Uncomment and add parseInt tests
Added another test that checks radices > 16, as well as uncommented
several "FIXME" tests that are now working.
2021-06-06 01:34:22 +01:00
Idan Horowitz
aa5b144f90 LibJS: Correct modulo behaviour in to_i32 to match the specification 2021-06-06 01:34:22 +01:00
Idan Horowitz
bbf75d0bea LibJS: Trim initial whitespace in parseFloat 2021-06-06 01:34:22 +01:00
Idan Horowitz
bda32e9440 LibJS: Parse digits with parse_ascii_base36_digit in parseInt
This was accidentally replaced with parse_ascii_hex_digit in
bc8d16ad28 which caused radices above
16 (hex) to fail.
2021-06-06 01:34:22 +01:00
Idan Horowitz
26a0dbdd9e LibJS: Set the length property of parseInt to 2
The method takes 2 arguments
2021-06-06 01:34:22 +01:00
NonStdModel
0e4dc5f7a1 LibKeyboard: Use correct filename in debug message 2021-06-06 00:21:12 +01:00
NonStdModel
484ec94624 KeyboardMapper: Add GUI alert in case load from file fails
Previously there was no visual clue letting the user know that loading
from file failed.
2021-06-06 00:21:12 +01:00
Tobias Christiansen
b253b63bb4 LibWeb: Resolve flex: shorthand correctly
This patch removes some FIXMEs from the StyleResolver, specifically
adding the proper float-parsing to the flex: shorthand. The
functionality was already there it just didn't get plumbed in before.
2021-06-06 00:16:27 +01:00
Idan Horowitz
2a8f4f097c LibJS: Throw TypeError on write to non-writable property in strict mode 2021-06-05 23:54:08 +01:00
Tobias Christiansen
31534055e4 LibWeb: Implement FlexBox Layout Algorithm 2021-06-06 01:46:06 +04:30
Tobias Christiansen
c51dbb4372 LibWeb: Expose size calculation of BlockFormattingContext
This is a hack for the FlexFormattingContext
2021-06-06 01:46:06 +04:30
Tobias Christiansen
ce7c8e215f LibWeb: Parse and resolve flex: shorthand 2021-06-06 01:46:06 +04:30
Tobias Christiansen
ae61e9ded2 LibWeb: Add flex-grow and flex-shrink
They get parsed and are available to the programmer of Layouts :^)
2021-06-06 01:46:06 +04:30
Tobias Christiansen
af4d80af4d LibWeb: Add parsing for NumericStyleValue
This StyleValue can hold an arbitrary float value.
2021-06-06 01:46:06 +04:30
Tobias Christiansen
ae3e6510d6 LibWeb: Parse flex-basis
Flex-basis accepts either 'content' or a Length.
2021-06-06 01:46:06 +04:30
Tobias Christiansen
27704f5f9e LibWeb: Add support for 'definite size' determination
This is pretty naive and there are more nuances in the spec but should
be enough for now.
2021-06-06 01:46:06 +04:30
Tobias Christiansen
ead864acf3 LibWeb: Parse and resolve flex-flow property 2021-06-06 01:46:06 +04:30
Tobias Christiansen
e6545d5259 LibWeb: Add parsing for flex-wrap property 2021-06-06 01:46:06 +04:30
Tobias Christiansen
72d5394b8c LibWeb: Flex-items aren't affected by float nor clear
There are a few other things to notice, but they don't seem to be
implemented yet.
2021-06-06 01:46:06 +04:30
Tobias Christiansen
7f81c8fba2 LibWeb: LayoutNodes know whether they are flex-items
This is useful for debugging when dumping the layout tree.
2021-06-06 01:46:06 +04:30