Commit graph

15567 commits

Author SHA1 Message Date
Matthew Olsson 34efc668d2 LibPDF: Handle SCN and scn operators 2022-03-31 18:10:45 +02:00
Matthew Olsson e1115cfe48 LibPDF: Add basic ICCBased color space handling 2022-03-31 18:10:45 +02:00
Matthew Olsson 1238e65d30 LibPDF: Move color space creation from Renderer to ColorSpace 2022-03-31 18:10:45 +02:00
Linus Groh 8e175b4959 LibJS: Adjust ISO8601 representation for years between 1 BCE and 999 CE
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/39eeecd
2022-03-31 17:09:10 +01:00
Linus Groh cfb04765fa LibJS: Correct PlainYearMonth arithmetic for non-ISO calendars
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/61e8dd0
2022-03-31 17:09:10 +01:00
Linus Groh b020b8eea2 LibJS: Handle Etc/GMT timezones properly in TimeZone{IANA,Bracketed}Name
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/8c73780
2022-03-31 17:09:10 +01:00
Linus Groh b5392f9e39 LibJS: Emit reference information for { calendarName: "always" } option
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/4f7519a
2022-03-31 17:09:10 +01:00
Linus Groh 29aa938fa5 LibJS: Fix Duration.compare() for dates with unusual number of hours
This is a normative change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/08bcd53
- https://github.com/tc39/proposal-temporal/commit/e962797
2022-03-31 17:09:10 +01:00
Linus Groh 04e40b7aaa Browser+WebContent: Add a Debug menu action to disable scripting :^) 2022-03-31 17:08:38 +02:00
Linus Groh 780e5441b4 WebContent: Add plumbing for 'is scripting enabled' setting 2022-03-31 17:08:38 +02:00
Linus Groh 7bdbac7fd9 LibWeb: Add 'is scripting enabled' concept to EnvironmentSettingsObject
This is now the source of truth for 'user enabled/disabled scripting',
but it has to ask the window's page, which actually stores the setting.

Also use this new functionality in two places where it was previously
marked as a FIXME.
2022-03-31 17:08:38 +02:00
Linus Groh f60a2a1d80 LibWeb: Remove Document::is_scripting_enabled() and use Node's
There's no need to have a custom is_scripting_enabled() for the
Document class, as it (indirectly) inherits from Node.
Also, let's not hardcode false here :^)
2022-03-31 17:08:38 +02:00
Hendiadyoin1 c79e4961f6 LibJS: Add explicit default copy+move constructors to ThrowCompletionOr
This stops clangd from complaining about not being able to determine the
copy-constructibility of ThrowCompletionOr and Completion.
2022-03-31 09:25:17 -04:00
Brian Gianforcaro 7d667b9f69 LibELF: Remove unused m_program_interpreter member from DynamicLoader
While profiling I realized that this member is unused, so the
StringBuilder and String allocation are completely un-necessary.
2022-03-31 10:18:07 +02:00
Brian Gianforcaro 39f924a731 LibELF: Skip DynamicObject::dump() if logging isn't enabled
I noticed that we were populating this StringBuilder and then throwing
away the result while profiling `true` with UserSpace emulator.

Before:

    courage:~ $ time -n 1000 true
    Timing report: 3454 ms
    ==============
    Command:         true
    Average time:    3.45 ms (median: 3, stddev: 3.42, min: 0, max:11)
    Excluding first: 3.45 ms (median: 3, stddev: 3.42, min: 0, max:11)

After:

    courage:~ $ time -n 1000 true
    Timing report: 3308 ms
    ==============
    Command:         true
    Average time:    3.30 ms (median: 3, stddev: 3.28, min: 0, max:12)
    Excluding first: 3.30 ms (median: 3, stddev: 3.29, min: 0, max:12)
2022-03-31 10:18:07 +02:00
Idan Horowitz 1577bac6a5 LibWeb: Add the HTMLOrSVGElement IDL interface mixin 2022-03-31 01:10:47 +02:00
Idan Horowitz 46fa18657c LibWeb: Use a callback function in ResizeObserver IDL 2022-03-31 01:10:47 +02:00
Idan Horowitz b267c4178a LibWeb: Use a callback function in IntersectionObserver IDL 2022-03-31 01:10:47 +02:00
Idan Horowitz f45d361f03 LibWeb: Replace ad-hoc EventHandler type with callback function typedef 2022-03-31 01:10:47 +02:00
Arif Orhun Uzun eb34015748 SpaceAnalyzer: Fix the crash caused by using arrow keys
Previously, SpaceAnalyzer set focus on the selected BreadcrumbButton.
Using arrow keys triggered the keydown_event of the AbstractButton,
which later on caused a Function object to be deleted while it is still
being used.

This change sets the focus on TreeMapWidget and adds an event handler
to TreeMapWidget for keydown events.

Fixes #13254.
2022-03-30 23:04:15 +02:00
sin-ack 51df97e799 LibWeb: Consolidate mouse handling + only trigger event on left click
This commit moves a couple more special cases in mouse event handling to
handle_mouseup. Additionally, it gets rid of the special casing with
should_dispatch_event and only fires a click event to the EventTarget
when the left mouse button is clicked. Finally it restores the link
context menu callback that was lost during 0fc8c65.
2022-03-30 21:17:04 +02:00
Enver Balalic 8b4d09932a LibWeb: Fix sizing of flex child that has flex-basis 0
Before if an element didn't have a main min size we would clamp
it to a literal zero. If that element also had a flex-basis 0
it's width would end up being 0.
This patch adds a determine_min_main_size_of_child function that
will calculate the minimum main size for the box based on the
content of the box.
We use the result of that function now instead of clamping
the element main min size to 0.

This also adds one more box to the flex.html test page, which is
the same flex: 0 0 0 box but with flex-direction: column.
2022-03-30 21:16:47 +02:00
Enver Balalic 74d8e201eb LibWeb: Fix calculating the intrinsic height of a box
For computing height in FormattingContext::calculate_intrinsic_sizes
we were calling into BlockFormattingContext::compute_theoretical_height
which will check if the CSS height property was defined and calculate
the height based on that instead of calculating the intrinsic height

This patch adds a new function calculate_intrinsic_height, which will
call into compute_auto_height_for_block_level_element for a block
element, or into compute_height_for_replaced_element for a replaced
element.
2022-03-30 21:16:47 +02:00
stelar7 b526a10d76 LibWeb: Add Crypto.randomUUID() 2022-03-30 18:47:53 +02:00
Sam Atkins 9a60b697aa LibWeb: Remove redundant [[nodiscard]] from CSS Parser methods
Optional and smart-pointers are already `[[nodiscard]]` so functions
returning them do not need to be declared as such.
2022-03-30 18:43:07 +02:00
Sam Atkins cd199d9d06 LibWeb: Implement and use parse_a_style_blocks_contents() 2022-03-30 18:43:07 +02:00
Sam Atkins 6a0adbefc7 LibWeb: Tidy up StyleRule API
Constantly accessing private `m_foo` fields feels uncomfortable and
doesn't fit well with our code style.
2022-03-30 18:43:07 +02:00
Sam Atkins 75db8b1f86 LibWeb: Spec-comment consume_a_function() 2022-03-30 18:43:07 +02:00
Sam Atkins 512d1df1c4 LibWeb: Spec-comment consume_a_simple_block() 2022-03-30 18:43:07 +02:00
Sam Atkins 5a23965e93 LibWeb: Comment discrepancy from spec in consume_a_declaration()
We're calling this in a way that is incorrect, and so the algorithm's
assumption that the next token is an `<ident-token>` is wrong, and we
have to handle that failing. Ideally we would just stop calling this
incorrectly, but until then, let's actually document what is happening.
2022-03-30 18:43:07 +02:00
Sam Atkins 999cc51512 LibWeb: Spec-comment consume_a_component_value() 2022-03-30 18:43:07 +02:00
Sam Atkins be86d19529 LIbWeb: Spec-comment consume_a_list_of_declarations() 2022-03-30 18:43:07 +02:00
Sam Atkins e72f42bea1 LibWeb: Spec-comment consume_a_qualified_rule() 2022-03-30 18:43:07 +02:00
Sam Atkins fe86718035 LibWeb: Spec-comment consume_an_at_rule() 2022-03-30 18:43:07 +02:00
Sam Atkins d77de5ccec LibWeb: Spec-comment consume_a_list_of_rules() 2022-03-30 18:43:07 +02:00
Sam Atkins a4f8056828 LibWeb: Spec-comment parse_a_comma_separated_list_of_component_values
The code had to change a bit to match. Previously, we appended an empty
sub-list immediately, but now we append it at the end. The difference
is that if there are no tokens, we now correctly return an empty
list-of-lists, instead of a list containing an empty list.
2022-03-30 18:43:07 +02:00
Sam Atkins 6ec92f5527 LibWeb: Spec-comment parse_a_list_of_component_values() 2022-03-30 18:43:07 +02:00
Sam Atkins 34b3c09462 LibWeb: Spec-comment parse_a_component_value() 2022-03-30 18:43:07 +02:00
Sam Atkins bcf4254331 LibWeb: Spec-comment parse_a_list_of_declarations()
The `parse_as_list_of_declarations()` public method is unused and will
not be used by any user code so has been removed.
2022-03-30 18:43:07 +02:00
Sam Atkins 2aac9f9258 LibWeb: Bring parse_a_declaration() to spec and add comments
User code now calls `parse_as_supports_condition()` which actually does
the conversion to a StyleProperty.
2022-03-30 18:43:07 +02:00
Sam Atkins 239c36a19e LibWeb: Spec-comment parse_a_rule()
We now correctly call convert_to_rule() outside of this function.

As before, I've renamed `parse_as_rule()` -> `parse_as_css_rule()` to
match the free function that calls it.
2022-03-30 18:43:07 +02:00
Sam Atkins 12a787ef8a LibWeb: Use parse_a_list_of_rules() for @media and @supports
From the spec:
> "Parse a list of rules" is intended for the content of at-rules such
> as @media. It differs from "Parse a stylesheet" in the handling of
> <CDO-token> and <CDC-token>.
- https://www.w3.org/TR/css-syntax-3/#ref-for-parse-a-list-of-rules
2022-03-30 18:43:07 +02:00
Sam Atkins 7a225a380c LibWeb: Bring parse_a_list_of_rules() to spec
This is not actually used by anything currently, but it should be used
for `@media` and other at-rules.

Removed the public parse_as_list_of_rules() because public functions
should be things that outside classes actually need to use.
2022-03-30 18:43:07 +02:00
Sam Atkins 85d8c652e9 LibWeb: Implement and use "parse a CSS stylesheet" algorithm
`parse_a_stylesheet()` should not do any conversion on its rules. This
change corrects that. There are other places where we get this wrong,
but one thing at a time. :^)
2022-03-30 18:43:07 +02:00
Sam Atkins fc3d51c59e LibWeb: Use an enum class for the "top-level flag" 2022-03-30 18:43:07 +02:00
Sam Atkins 87b125dcb9 LibWeb: Spec-comment parse_a_stylesheet()
Also introduce a `location` parameter when parsing a CSSStyleSheet. This
is not provided by anyone yet.
2022-03-30 18:43:07 +02:00
Sam Atkins 05bd0ca3ee LibWeb: Rename parse_css() -> parse_css_stylesheet() 2022-03-30 18:43:07 +02:00
Elisée Maurer 34db0dab41 LibWeb: Implement Element.toggleAttribute() 2022-03-30 18:30:29 +02:00
Itamar 1ec3847acd HackStudio: Hide FindWidget on escape key press 2022-03-30 11:26:26 -04:00
Timothy Flynn 4fd463dae0 LibJS: Normalize mathematical references to negative zero
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/d4be24e
2022-03-30 14:24:32 +01:00
Timothy Flynn 41df4c6353 LibJS: Modernize InitializeDateTimeFormat and simplify error handling
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/4cf1d2c
2022-03-30 14:24:32 +01:00
Timothy Flynn 066352c9aa LibJS+LibUnicode: Align ECMA-402 "sanctioned" terminology with UTS 35
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/087995c
https://github.com/tc39/ecma402/commit/233d29c

This also adds a missing spec link for the sanctioned units and fixes a
broken spec link for IsSanctionedSingleUnitIdentifier. In LibUnicode,
the NumberFormat generator is updated to use the constexpr helper to
retrieve sanctioned units.
2022-03-30 14:24:32 +01:00
Timothy Flynn 1a76839e8d LibJS: Use consistent ASCII case-transformation and string language
Also update the incorrect spec link for IsWellFormedCurrencyCode.

These are editorial changes in the Intl spec. See:
https://github.com/tc39/ecma402/commit/6939b44
https://github.com/tc39/ecma402/commit/3a775eb
https://github.com/tc39/ecma402/commit/97a7940
https://github.com/tc39/ecma402/commit/129c790
https://github.com/tc39/ecma402/commit/42ec908
https://github.com/tc39/ecma402/commit/ea25c36
2022-03-30 14:24:32 +01:00
Timothy Flynn 72674d7905 LibJS: Set DateTimeFormat's [[HourCycle]] internal slot only once
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/8081868
2022-03-30 14:24:32 +01:00
Timothy Flynn 0975eba724 LibJS: Mark an invocation to RequireObjectCoercible as fallible
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/6939b44
2022-03-30 14:24:32 +01:00
Timothy Flynn 36bff95f15 LibJS: Use the new TransformCase AO for locale-aware case conversions
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/6939b44
2022-03-30 14:24:32 +01:00
Timothy Flynn f8e7701cf3 LibJS: Disallow calendar display names which contain an underscore
This is a normative change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/2703d06
2022-03-30 14:24:32 +01:00
Timothy Flynn 7c41e6058a LibJS: Explicitly indicate infallible incovations
These are editorial changes in the Intl spec.

See:
https://github.com/tc39/ecma402/commit/6804096
https://github.com/tc39/ecma402/commit/6361167
https://github.com/tc39/ecma402/commit/8718171
https://github.com/tc39/ecma402/commit/fd37cb4
https://github.com/tc39/ecma402/commit/00fcfb0
https://github.com/tc39/ecma402/commit/913f832
2022-03-30 14:24:32 +01:00
Kenneth Myhra 6581cf47ab test: Port to LibMain 2022-03-30 09:53:11 +01:00
safarp 704e1d13f4 AK: Allow printing wide characters using %ls modifier 2022-03-30 11:30:43 +04:30
Idan Horowitz 8abe653009 LibWeb: Make WebSocket::close() arguments optional to match IDL 2022-03-30 08:56:25 +03:00
Kenneth Myhra c843f2e3a5 seq: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra 1ee93e0fe7 tty: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra cf154ec0d9 tt: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra ab9a78a305 tr: Utilize TRY more
This converts the local functions to return ErrorOr<T> and utilizes TRY
more.
2022-03-29 21:28:29 -07:00
Kenneth Myhra e548b2cff2 tr: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra 8bd7c5b3d5 test_env: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra 3df8c9e9de test-unveil: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra 0015040ebd LibCore: Add syscall wrapper for access() 2022-03-29 21:28:29 -07:00
Kenneth Myhra f4aef35e6e test-pthread: Port to LibMain and let local functions return ErrorOr<T>
This ports 'test-pthread' to LibMain and converts the local functions of
the program to return ErrorOr<T>.
2022-03-29 21:28:29 -07:00
Kenneth Myhra d69f3aa958 test-fuzz: Allow listing fuzzing targets without specifying input file 2022-03-29 21:28:29 -07:00
Kenneth Myhra 4994718d8d test-fuzz: Port to LibMain
Also use StringView in place of raw C strings and String.
2022-03-29 21:28:29 -07:00
Kenneth Myhra b47a9ab4dc test-bindtodevice: Port to LibMain
This ports 'test-bindtodevice' to LibMain and convert the local 'test'
function to return ErrorOr<T>.
2022-03-29 21:28:29 -07:00
Kenneth Myhra e302fac34b kcov-example: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra 234025ee53 telws: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra bb4994d67b run-tests: Port to LibMain 2022-03-29 21:28:29 -07:00
Kenneth Myhra 7d87f0d56d markdown-check: Use Core::ArgsParser 2022-03-29 21:28:29 -07:00
Kenneth Myhra de7d333d43 markdown-check: Port to LibMain 2022-03-29 21:28:29 -07:00
Simon Wanner 6437f5da36 LibWeb: Add basic support for the attr() CSS function
CSS Values and Units Module Level 5 defines attr as:
  `attr(<q-name> <attr-type>?, <declaration-value>?)`

This implementation does not contain support for the type argument,
effectively supporting `attr(<q-name>, <declaration-value>?)`
2022-03-30 03:18:14 +02:00
Andreas Kling 6a4247bee9 LibWeb: Use more precise font metrics when doing inline layout
We now position inline-level boxes based on ascent and descent metrics
from the font in use. This makes our basic text layouts look a lot more
like those produced by other browsers. :^)

I've tried to match the terminology used by the CSS Inline Layout spec.

This will regress Acid2 a little bit, and probably various other sites,
but on the whole it's the direction we should be heading, so let's go.
2022-03-30 01:12:44 +02:00
Andreas Kling fae8fde913 LibWeb: Draw inspector overlay label with default font 2022-03-30 00:57:15 +02:00
Andreas Kling 6d260b14b4 LibGfx: Rasterize TTF glyphs using "hhea" metrics instead of "os2"
This matches what other font systems appear to do.
2022-03-30 00:57:15 +02:00
Andreas Kling 9b0d158e69 LibWeb: Only set children-are-not-inline when inserting in-flow child
We were marking block boxes as having non-inline children when inserting
any child box, even if the child was out-of-flow.
2022-03-30 00:57:15 +02:00
Andreas Kling 1c88536298 LibWeb: Use the new Gfx::Painter::draw_text_run() API for drawing text
This avoids a bunch of unnecessary work in Painter which not only took
time, but sometimes also led to alignment issues. draw_text_run() will
draw the text where we tell it, and that's it.
2022-03-30 00:57:15 +02:00
Andreas Kling dd940dfa85 LibWeb: Use font-derived metrics for "line-height:normal"
Instead of multiplying the font-size with 1.4f because reasons, we now
ask the font for its preferred line spacing.
2022-03-30 00:57:15 +02:00
Andreas Kling 56a284713d LibGfx: Add ascent, descent and line gap to FontPixelMetrics
These are the main values we need in LibWeb to perform inline layout.
2022-03-30 00:57:15 +02:00
Andreas Kling 7850628ff1 LibGfx: Add Painter::draw_text_run(), a simplified text painting API
This API does:
    - Take a Utf8View
    - Take the starting point on the baseline as its input coordinate

This API does not:
    - Align the text
    - Wrap the text
    - Elide too-long text into "..."
2022-03-30 00:57:15 +02:00
Andreas Kling e398164f10 LibGfx: Make Font::pixel_metrics() virtual
This makes it easier for BitmapFont and ScaledFont to implement metrics
lookup themselves.
2022-03-30 00:57:15 +02:00
Andreas Kling 344374588b LibGfx: Rename FontMetrics => FontPixelMetrics
Let's make it clear in the type name that this contains pixel metrics.
Also rename Font::metrics() => Font::pixel_metrics().
2022-03-30 00:57:15 +02:00
Andreas Kling 0f6dd8c62b LibGfx: Make Gfx::FontMetrics include the advance of '0' instead of 'M'
CSS actually wants the advance of the ASCII '0' character for its "ch"
units, so let's include that instead of the arbitrarily chosen 'M'.
2022-03-30 00:57:15 +02:00
Andreas Kling 2f7b6af87e LibGfx: Remove code point parameter from Gfx::Font::Metrics
Everyone was asking for the glyph width of 'M' anyway. We can just make
that request implicit and simplify the API.
2022-03-30 00:57:15 +02:00
Andreas Kling b0955fd269 LibWeb: Add fast_is<T>() for some common DOM Node subclasses 2022-03-30 00:52:02 +02:00
Jelle Raaijmakers 02e2f11380 Browser: Make storage inspector columns sortable 2022-03-29 23:51:47 +01:00
Jelle Raaijmakers 62fbf282b1 Browser: Reorder storage inspector columns
Show "domain" and "path" as the first two columns. Since we're showing
all cookies for all domains and all paths, you will probably want to
see the domain and path before the actual cookie name and value.
2022-03-29 23:51:47 +01:00
Linus Groh 68ee193464 LibJS: Check type of ShadowRealm.prototype.importValue() 2nd argument
This is a normative change in the ShadowRealm spec.

See: https://github.com/tc39/proposal-shadowrealm/commit/2b45a15
2022-03-29 23:48:25 +01:00
Linus Groh f1d744e11a LibJS: Fix sign in PlainYearMonth.prototype.subtract()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6cf421b
2022-03-29 23:21:17 +01:00
Linus Groh e4fe60b972 LibJS: Update incorrect spec comment in ToRelativeTemporalObject
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/4cb192d
2022-03-29 22:56:03 +01:00
Jelle Raaijmakers cf1baddb67 LibC: Implement getdtablesize() 2022-03-29 22:49:27 +01:00
GeekFiftyFive 8fee285d72 LibHTTP: Append port to Host header if it exists 2022-03-30 00:34:29 +03:00
Andreas Kling 0fd51ae811 LibWeb: Ignore empty anonymous block children in height:auto calculation
This fixes a regression on GitHub from
5da7ebb806.

Thanks to Simon for reporting it! :^)
2022-03-29 22:30:58 +02:00
Linus Groh 1e01a85cdf LibJS: Import C++ sources from libjs-test262 :^)
This commit upstreams most of the C++ bits of the LibJS test262 runner
at https://github.com/linusg/libjs-test262/, specifically everything but
the main.cpp file serving as the actual executable.
Since all of these are just regular JS objects, I opted to put them in
LibJS itself, in a new Contrib/ directory like many other projects have
one. Other code that can end up there in the future is the runtime for
esvu, which might even share some functionality with test262's $262
object.

The code has been copied verbatim, and only a small number of changes
have been made:

- Putting everything into the JS::Test262 namespace
- Removing now redundant JS namespace prefixes
- Updating includes to use absolute <LibJS/...> paths
- Updating the SPDX-License-Identifier comments from MIT to BSD-2-Clause

I gained permission to change the license and upstream these changes
from all the major contributors to this code: Ali, Andrew, David, Idan.

The removal of the code from the source repository is here:
https://github.com/linusg/libjs-test262/pull/54

This is only the first step, the goal is to eventually upstream the
actual libjs-test262-runner executable and supporting Python scripts
into SerenityOS as well.
2022-03-29 21:01:08 +01:00
Andreas Kling e7eb6241c2 LibWeb: Ignore list-item marker boxes in height:auto calculation 2022-03-29 21:50:31 +02:00
Andreas Kling 5da7ebb806 LibWeb: Make height:auto for non-BFC-root blocks more correct
Unlike BFC root blocks with height:auto, when the block *isn't* a BFC
root, we don't have to look for the "bottommost" block-level child and
determine the width from that.

Instead, we should just look at the last in-flow block-level child.
This was already indicated in the spec comment next to the code, but
the code itself was wrong.

This makes the body element on Acid3 have the correct height. It also
introduces a small regression on Acid2 that we'll have to track down.
2022-03-29 18:53:27 +02:00
Andreas Kling 18048efce0 LibWeb: Don't round numbers too early when painting backgrounds
Preserve floating point precision and delay rounding until the last
moment when figuring out where to paint background layers. This fixes an
issue on Acid3 where a thin sliver of red was visible because the
background X position was incorrectly rounded by 1px.
2022-03-29 18:53:27 +02:00
Andreas Kling afebc372b9 LibGfx: Use llroundf() in Rect<float>::to_rounded()
No need to drag the values through a float-to-double conversion.
2022-03-29 18:53:27 +02:00
Daniel Glazman 91e1383b85 LibWeb: Implement attribute selector case identifier 2022-03-29 18:53:20 +02:00
Daniel Glazman 049d847230 LibWeb: Clarify attribute selectors when needle is empty 2022-03-29 18:53:20 +02:00
Tim Schumacher aa7b6852ce LibC: Make prctl() a varargs function 2022-03-29 09:10:34 -07:00
Itamar d9d299f884 HackStudio: Add FindWidget
The find widget appears on Ctrl+F.

It uses the GUI::TextEditor search API to search for text, which also
takes care of highlighting the search results.
2022-03-29 17:45:36 +02:00
Itamar de902ab659 TextEditor: Use the search API of GUI::TextEditor
This enables us to remove some code duplication and also makes the
search results highlighted.
2022-03-29 17:45:36 +02:00
Itamar 5f2a0f03a6 LibGUI: Add search API to TextEditor with highlighted results
This adds a search API to TextEditor.

The API that is similar to "find_text" of TextDocument (which is used
internally to do the search).

All search results (as well as the current one) are highlighted with
a "span collection", which is pretty neat :^)
2022-03-29 17:45:36 +02:00
Itamar a12385dc4b LibGUI: Add match_case parameter to TextDocument::find_all() 2022-03-29 17:45:36 +02:00
Itamar ab0b4f46f7 LibGUI: Support multiple layers of TextDocument spans
TextDocument::set_spans() now also takes a "span collection index"
argument.

TextDocument keeps a map between a span collection index and its spans.
It merges the spans from all collections into a single set of spans
whenever set_spans() is called.

This allows us to style a document with multiple layers of spans, where
as previously we only supported a single layer of spans that was set
from the SyntaxHighlighter.
2022-03-29 17:45:36 +02:00
Itamar b75ed992a6 LibGUI: Add operators >,>= to TextPosition 2022-03-29 17:45:36 +02:00
Itamar 1d522e4b4c LibGUI: Add DoClamp option to AbstractSlider::set_value() 2022-03-29 17:45:36 +02:00
Andreas Kling 427beb97b5 LibWeb: Streamline how inline CSS style declarations are constructed
When parsing the "style" attribute on elements, we'd previously ask the
CSS parser for a PropertyOwningCSSStyleDeclaration. Then we'd create a
new ElementCSSInlineStyleDeclaration and transfer the properties from
the first object to the second object.

This patch teaches the parser to make ElementCSSInlineStyleDeclaration
objects directly.
2022-03-29 16:35:46 +02:00
Andreas Kling 3efa6cedec LibWeb: Remove unused StyleSheetList::m_generation 2022-03-29 16:35:46 +02:00
Andreas Kling 0de488749f LibWeb: Use rounding instead of enclosing_int_rect() when painting
By using enclosing_int_rect(), borders and backgrounds of boxes were
sometimes 1 pixel off, making things slightly larger than they should
be. Fix this by using to_rounded() instead of enclosing_int_rect().

There's definitely more of these type of issues lurking in the code,
and we'll get to them in time.
2022-03-29 16:35:46 +02:00
Ali Mohammad Pur e1cf51b0bd Shell: Add a shell option for autocompleting via the program itself
This feature needs a bit more work, so let's disable it by default.
Note that the shell will still use _complete_foo if it is defined
regardless of this setting.
2022-03-29 15:42:55 +02:00
Tim Schumacher cdca6fc113 LibC: Make wchar size definitions available from stdint.h
POSIX describes WCHAR_MIN and WCHAR_MAX in stdint.h(0P), while
wchar.h(0P) only says "as described in stdint.h".

As there isn't a trivial path of "may make visible", just move it to a
shared header and include it from both files.
2022-03-29 15:19:39 +02:00
Andreas Kling f4ed4b2806 LibWeb: Swallow whitespace when it causes us to break the line
This fixes an issue seen on Acid3 where the instruction text would shift
around when moving from "white-space:pre-wrap" to "white-space:normal".
2022-03-29 13:37:54 +02:00
Idan Horowitz 02e97b3313 LibJS: Bring ForIn body evaluation closer to the specification
This fixes 2 bugs in our current implementation:
 * Properties deleted during iteration were still being iterated
 * Properties with the same name in both the object and it's prototype
   were iterated twice
2022-03-29 14:34:08 +03:00
Idan Horowitz 9cfbbfd8d8 LibJS: Implement the EnumerateObjectProperties AO 2022-03-29 14:34:08 +03:00
Andreas Kling 9711e1b303 LibWeb: Make floating boxes in IFC occupy horizontal margin box
Previously, we only allowed floats to take up its own border box's worth
of horizontal space when laid out inside an IFC.

We should instead consume the full margin box horizonally. This fixes an
issue where a floated box on Acid3 had {width:20px; margin-right:-20px;}
but still consumed 20px of the previously available space, despite being
moved out of the way by its own negative margin.
2022-03-29 12:35:31 +02:00
Andreas Kling 5def3b0150 LibWeb: Use LineBox::height() when determining IFC auto heights
We don't need to loop through all the fragments on the line to work out
how tall it is. Just ask for the height. :^)
2022-03-29 12:25:34 +02:00
Andreas Kling 03008d9c9c LibWeb: Ensure that TextNode::ChunkIterator emits preserved newlines
When doing max-content layout, we were not committing newlines even
though we were supposed to due to white-space:pre*.

This broke the WPT harness due to a VERIFY() in ChunkIterator where we
were assuming the commit would always succeed.

Thanks to Orphis for reporting this! :^)
2022-03-29 03:05:11 +02:00
Andreas Kling a6eb031058 LibWeb: Use correct top content edge when calculating auto block heights
When the spec tells us to measure from the top content edge of a block,
that just means we should measure from Y=0. We don't need to go looking
for a child box with a negative top offset and measure from there.
2022-03-29 02:59:00 +02:00
Matthew Olsson 4e81663b31 LibPDF: Attempt to unecrypt strings and streams 2022-03-29 02:52:57 +02:00
Matthew Olsson 60c3e786be LibPDF: Require Document* in Parser constructor
This makes it a bit easier to avoid calling parser->set_document, an
issue which cost me ~30 minutes to find.
2022-03-29 02:52:57 +02:00
Matthew Olsson a8de9cf541 LibPDF: Keep track of the current object index/generation while Parsing
This information is required to decrypt encrypted strings/streams.
2022-03-29 02:52:57 +02:00
Matthew Olsson 5b316462b2 LibPDF: Add implementation of the Standard security handler
Security handlers manage encryption and decription of PDF files. The
standard security handler uses RC4/MD5 to perform its crypto (AES as
well, but that is not yet implemented).
2022-03-29 02:52:57 +02:00
Matthew Olsson c98bda8ce6 LibPDF: Get rid of PlainText/Encoded StreamObject
This was a small optimization to allow a stream object to simply hold
a reference to the bytes in a PDF document rather than duplicating
them. However, as we move into features such as encryption, this
optimization does more harm than good. This can be revisited in the
future if necessary.
2022-03-29 02:52:57 +02:00
Matthew Olsson 15b7999313 LibPDF: Change CommonNames' enumerator macro parameter name
Apparently "V" is a PDF property. Let's hope "A" isn't!
2022-03-29 02:52:57 +02:00
Matthew Olsson 9a4a3318a9 LibPDF: Store a PDFFont in the Renderer's text state 2022-03-29 02:52:57 +02:00
Matthew Olsson 0624472768 LibPDF: Add initial support for Type1 fonts
This is enough to get a char code -> code point mapping
2022-03-29 02:52:57 +02:00
Matthew Olsson 8441fa2bc4 LibPDF: Add support for builtin and custom Encodings 2022-03-29 02:52:57 +02:00
Andreas Kling 1f9aed2617 LibWeb: Load and use fonts described by @font-face rules :^)
When encountering a @font-face rule, StyleComputer will now fire off
a resource request and download the first source URL specified.

Once downloaded, we try to parse it as a TrueType font file, and if it
works, it's added to a cache in StyleComputer. This effectively makes
fonts per-document since every document has its own StyleComputer.

This is very unoptimized and could definitely use some caching, etc.
But it does work on Acid3. :^)
2022-03-29 02:14:20 +02:00
Karol Kosek b006a60366 LibTextCodec: Pass code points instead of bytes on UTF-8 string process
Previously we were passing raw UTF-8 bytes as code points, which caused
CSS content properties to display incorrect characters.

This makes bullet separators in Wikipedia templates display correctly.
2022-03-29 01:01:32 +02:00
Simon Wanner 7e4793df63 LibWeb: Size table cells using a combination of min- and max-widths
This gets us a bit closer to the recommended algorithms in CSS 2.2 and
CSS Table Module 3.

A couple of table heavy websites (e.g. news.ycombinator.com,
html5test.com, etc.) now look quite okay. :^)
2022-03-29 00:39:57 +02:00
Simon Wanner bc4974648c LibWeb: Add HTMLTableCellElement::rowSpan 2022-03-29 00:39:57 +02:00
Simon Wanner b7b647e9cd LibWeb: Add HTMLTableCellElement::colSpan 2022-03-29 00:39:57 +02:00
Simon Wanner b92cc3670b LibWeb: Only size width: auto table-cells by min-content 2022-03-29 00:39:57 +02:00
Ali Mohammad Pur 5a0123fd2f LibWeb: Load X(HT)ML documents and transform them into HTML DOM 2022-03-28 23:11:48 +02:00
Ali Mohammad Pur c1649e3372 LibWeb: Define HTML::perform_a_microtask_checkpoint()
This was declared and not defined.
2022-03-28 23:11:48 +02:00
Ali Mohammad Pur 67357fe984 LibXML: Add a fairly basic XML parser
Currently this can parse XML and resolve external resources/references,
and read a DTD (but not apply or verify its rules).
That's good enough for _most_ XHTML documents as the HTML 5 spec
enforces its own rules about document well-formedness, and does not make
use of XML DTDs (aside from a list of predefined entities).

An accompanying `xml` utility is provided that can read and dump XML
documents, and can also run the XML conformance test suite.
2022-03-28 23:11:48 +02:00
Hendiadyoin1 50b6e74d33 LibIPC: Add IPCErrorOr Type alias 2022-03-28 23:08:08 +02:00
Sam Atkins 6672c19c93 LibWeb: Parse @font-face rules
This is very limited for now, only caring about `font-family` and `src`.
2022-03-28 22:25:25 +02:00
Sam Atkins 804b8c85e8 LibWeb: Implement initial CSSFontFaceRule and FontFace classes
For now, this is the bare minimum that's needed: font-family and src.
2022-03-28 22:25:25 +02:00
Sam Atkins 1dcde57922 LibWeb: Bring "parse a list of declarations" closer to spec
The work to create a PropertyOwningCSSStyleDeclaration is now moved to
convert_to_style_declaration() instead.
2022-03-28 22:25:25 +02:00
Sam Atkins da1a819858 LibWeb: Rename parse_css_declaration() -> parse_css_style_attribute() 2022-03-28 22:25:25 +02:00