Commit graph

28437 commits

Author SHA1 Message Date
Brian Gianforcaro 0223faf6f4 Kernel: Access MemoryManager static functions statically
SonarCloud flagged this "Code Smell", where we are accessing these
static methods as if they are instance methods. While it is technically
possible, it is very confusing to read when you realize they are static
functions.
2021-10-02 18:16:15 +02:00
Andreas Kling 024367d82e LibJS+AK: Use Vector<u16, 1> for UTF-16 string storage
It's very common to encounter single-character strings in JavaScript on
the web. We can make such strings significantly lighter by having a
1-character inline capacity on the Vectors.
2021-10-02 17:39:38 +02:00
Luke Wilde ae0bdda86e LibJS: Remove read buffer overflow in Lexer::consume
The position is added to manually in the line terminator and Unicode
character cases. While it checks for EOF after doing so, the EOF check
used `!=` instead of `<`, meaning if the position went _over_ the
source length, it wouldn't think it was EOF and would cause read buffer
overflows.

For example, `0xea` followed by `0xfd` would cause this.
2021-10-02 17:16:09 +02:00
Andreas Kling bb6634b024 LibRegex: Don't emit signpost events for every regular expression
The time we were spending on these signposts was adding up to way too
much, so let's not do it automatically.
2021-10-02 16:53:03 +02:00
Andreas Kling 6a1b82df2b LibJS: Put zombie cell tracking code behind a compile-time flag
Since this is a debug-only feature, let's not have it impact GC marking
performance when you don't need it.
2021-10-02 16:39:28 +02:00
Andreas Kling f290c59dd8 LibJS: Keep track of PrimitiveStrings and share them
VM now has a string cache which tracks all live PrimitiveStrings and
reuses an existing one if possible. This drastically reduces the number
of GC-allocated strings in many real-word situations.
2021-10-02 16:39:28 +02:00
Linus Groh ba6e4c7ae1 LibJS+LibWeb: Use Object::set_prototype() in more places 2021-10-02 14:53:06 +01:00
Linus Groh 84c9f3e0d0 LibJS: Add Object::set_prototype()
This is just factoring out step "9. Set O.[[Prototype]] to V." of
10.1.2 [[SetPrototypeOf]] into its own method so that we don't have to
use internal_set_prototype_of() for setting an object prototype in all
cases.
2021-10-02 14:53:06 +01:00
Linus Groh c500ebdcd5 LibWeb: Implement Navigator.cookieEnabled 2021-10-02 13:55:19 +01:00
Idan Horowitz a4bc3fa255 LibWeb: Initialize IDL-generated prototypes' prototype directly
Instead of setting it to the default object prototype and then
immediately setting it again via internal_set_prototype_of, we can just
set it directly in the parent constructor call.
2021-10-02 13:23:59 +01:00
networkException a7ce118249 Base: Add glyphs for the U+20AC euro sign to all bitmap fonts 2021-10-02 09:21:38 +01:00
Nico Weber 6c4392bc50 Prekernel: Better datasheet link for RPi3 2021-10-02 02:01:07 +02:00
Idan Horowitz 6a8246cacc Base: Add glyphs for the U+2014 em dash to KaticaRegular 2021-10-01 20:54:48 +02:00
Idan Horowitz 036bdb0a01 Base: Add glyphs for the U+2019 apostrophe to KaticaRegular 2021-10-01 20:54:48 +02:00
Andreas Kling 77f0e57b27 RequestServer: Don't hide the SIGINFO state dump behind a debug macro
Until we're confident that RequestServer doesn't need this runtime debug
dump helper, it's much nicer if everyone has it built in, so they can
simply send a SIGINFO if they see it acting up.
2021-10-01 20:17:15 +02:00
Andreas Kling 3db847c64a LibWeb: Implement CSSRule and CSSStyleDeclaration serialization
There are a handful of FIXME's here, but this seems generally good.
Note that CSS *values* don't get serialized in a spec-compliant way
since we currently rely on StyleValue::to_string() which is ad-hoc.
2021-10-01 20:17:15 +02:00
Andreas Kling c953103d2f LibWeb: Make CSSStyleDeclaration support both dashed-name and camelCase
Turns out we need to support *both* of these styles since there's
content that uses one or both of these.
2021-10-01 20:17:15 +02:00
Andreas Kling 918b0b4394 LibWeb: Add missing virtual/override/final in CSSStyleRule 2021-10-01 20:17:15 +02:00
Tobias Christiansen 1496ad0605 LibWeb: Flexbox: Catch zero flex-basis and use width instead
A flex-basis of zero doesn't actually mean that the preferred size of
the particular Box is 0. It means that the Box should take the least
amount of space possible while still accomodating the content inside.

We catch and circumvent this now right when the flex-basis property gets
read for the FlexFormattingContext.

This isn't mentioned anywhere in the seemingly relevant portions of the
spec, however thanks to this answer https://stackoverflow.com/a/47579078
(which is not entirely correct about width either) lead to the behavior
that is wanted and used by other Browsers.
2021-10-01 20:16:58 +02:00
Idan Horowitz d426edb87f LibWeb: Create real Keybord & Message events in Document::create_event 2021-10-01 20:14:45 +02:00
Idan Horowitz 37586f61be LibWeb: Change the type of MouseEvent members to double
These are defined as integers only in the legacy specification, the
new one defines these as doubles.
2021-10-01 20:14:45 +02:00
Idan Horowitz f74b612aa4 LibWeb: Add the missing KeyboardEvent IDL constructor
This commit also does a bit of general cleanup on the header file.
2021-10-01 20:14:45 +02:00
Idan Horowitz c5b924b1e6 LibWeb: Dispatch keydown/keyup events on the appropriate target 2021-10-01 20:14:45 +02:00
Idan Horowitz 43482dfde3 LibWeb: Support dictionary-only IDL files 2021-10-01 20:14:45 +02:00
Idan Horowitz b888d14e42 LibWeb: Change the parent interface of MouseEvent to UIEvent
This was accidentally set to Event
2021-10-01 20:14:45 +02:00
Idan Horowitz ac25c28c43 LibWeb: Add the missing UIEvent IDL constructor 2021-10-01 20:14:45 +02:00
Idan Horowitz 7b2c63fd87 LibWeb: Add support for unwrapping the WindowObject to WrapperGenerator 2021-10-01 20:14:45 +02:00
Idan Horowitz f176514db8 LibWeb: Add the UIEvent::{view, detail} IDL attributes 2021-10-01 20:14:45 +02:00
Idan Horowitz 1c4404c46a LibWeb: Add the missing PageTransitionEvent IDL constructor 2021-10-01 20:14:45 +02:00
Idan Horowitz 4d71f22673 LibWeb: Add the missing ProgressEvent IDL constructor 2021-10-01 20:14:45 +02:00
Idan Horowitz 1e8ba0d9d3 LibWeb: Add the missing SubmitEvent IDL constructor
This commit also removes the SubmitEvent.cpp file, as all of the method
implementations were trivial and could be inlined into the header file.
2021-10-01 20:14:45 +02:00
Idan Horowitz d44857d34d LibWeb: Add the missing MessageEvent IDL constructor 2021-10-01 20:14:45 +02:00
Idan Horowitz 9863de4609 LibWeb: Add the lastEventId IDL attribute to MessageEvent 2021-10-01 20:14:45 +02:00
Idan Horowitz b53fc8ad3d LibWeb: Change the IDL type of MessageEvent::data to any 2021-10-01 20:14:45 +02:00
Idan Horowitz ded8e84f32 LibWeb: Add the missing CloseEvent IDL constructor 2021-10-01 20:14:45 +02:00
Idan Horowitz 7f551d7f6a LibWeb: Use the LibWeb source directory as the IDL #import base path
This allows us to include IDL files from other base LibWeb directories
wihout using relative `../foo.idl` references.
2021-10-01 20:14:45 +02:00
Sam Atkins bd648d082c LibWeb: Parse media queries! :^)
While not complete by any means, we are now compatible with the [level 3
spec](https://www.w3.org/TR/css3-mediaqueries/#syntax) and some parts of
[level 4.](https://www.w3.org/TR/mediaqueries-4#mq-syntax)

Compatibility with level 4+ requires:
- Implementing the range syntax: `(800px <= width <= 1200px)`
- Parsing `<general-enclosed>`, which represents syntax that is not yet
used but they may use in the future.
2021-10-01 20:03:03 +02:00
Sam Atkins 2ed0f880ee LibWeb: Add TokenStream::rewind_to_position()
Parsing media queries sometimes requires significant back-tracking, so
`reconsume_current_input_token()` was not good enough.
`rewind_to_position()` lets you reconsume an erbitrary number of tokens
to return to an earlier point in the stream, which you previously saved
from `TokenStream::position()`.
2021-10-01 20:03:03 +02:00
Sam Atkins c7cd489689 LibWeb: Parse @media rules into CSSMediaRule objects
This is not yet actually useful, since we only have a stub for parsing
the query part, but now I have a nice way to test that things are
working. :^)
2021-10-01 20:03:03 +02:00
Sam Atkins b4833bf2a3 Base: Add media-queries test page 2021-10-01 20:03:03 +02:00
Sam Atkins 9c5430b9ee LibWeb: Make consume_a_qualified_rule() understand block tokens
This now matches the spec, and fixes the situation where if it was given
a TokenStream of StyleComponentValueRules, it would drop any Blocks on
the floor instead of adding them to the result StyleRule.
2021-10-01 20:03:03 +02:00
Sam Atkins f1af136925 LibWeb: Make MediaQueryList store MediaQueries instead of a String 2021-10-01 20:03:03 +02:00
Sam Atkins 5bbbdb81dc LibWeb: Sketch out media-query parsing
This does everything except actually parse the individual media queries.
2021-10-01 20:03:03 +02:00
Sam Atkins 3e74c194f9 LibWeb: Add CSSMediaRule
This is the class corresponding to a `@media` rule. It contains a list
of media queries and a list of child css rules.
2021-10-01 20:03:03 +02:00
Sam Atkins 8ac622f056 LibWeb: Add MediaList
This is a list of MediaQuery objects. Not to be confused with
`MediaQueryList`, which is concerned with firing events when a media
query's match-state changes.
2021-10-01 20:03:03 +02:00
Sam Atkins 0a4d9c6d31 LibWeb: Partially implement MediaQuery class :^)
The main thing that's missing is the actual matching, but this is enough
to get started.
2021-10-01 20:03:03 +02:00
Brian Gianforcaro b90cc1148a Kernel: Switch RTL8168NetworkAdapter::possible_device_name to StringView
There is no need to allocate a `AK::String` for the device name, when
the list of devices is entirely static.
2021-10-01 17:22:17 +00:00
Brian Gianforcaro 2770433d30 Kernel: Convert network adapter names to Kernel::KString
Another step of incremental progress of removing `AK::String` from the
kernel, to harden against OOM.
2021-10-01 17:22:17 +00:00
Tobias Christiansen 33a9f908a6 LibWeb: Flexbox: Check for relative resolvability on the cross axis
If an element has a relative specified length on the cross axis, but in
the lineage there are no parents that have any fixed cross size, this
would have resulted in a 0 cross size.
We now catch that and check whether the relative length would result in
an actual definite length if resolved.
2021-10-01 13:52:41 +02:00
Ali Mohammad Pur a3fe981daa RequestServer: Ignore preconnect requests for available connections
There's no need to schedule a useless job when the connection is already
there and established.
2021-10-01 13:52:26 +02:00