Commit graph

10055 commits

Author SHA1 Message Date
Andreas Kling 50265858ab LibWeb: Add a PARSE_ERROR() macro to the new HTML parser
Unless otherwise stated, we shouldn't stop parsing just because there's
a parse error, so let's allow ourselves to continue.

With this change, we can now tokenize and parse the ACID1 test. :^)
2020-05-25 20:02:27 +02:00
Andreas Kling 406fd95f32 LibWeb: Flesh out the remaining DOCTYPE related tokenizer states
We can now parse public and system identifiers! Not super useful, but
at least we can do it :^)
2020-05-25 19:51:23 +02:00
Andreas Kling 556a6eea61 LibWeb: Checking for "DOCTYPE" should be case insensitive in tokenizer 2020-05-25 19:51:23 +02:00
Andreas Kling 1df2a3d8ce LibWeb: Use String::is_one_of() a bunch in the HTML parser 2020-05-25 19:51:23 +02:00
Andreas Kling 5e77517e6e AK: Add String::is_one_of(...)
This allows you to compare a string against an arbitrary number of
other strings with a single call.
2020-05-25 19:51:23 +02:00
AnotherTest 21a574f6d2 Eyes: Resize the window based on the number of eyes 2020-05-25 19:06:06 +02:00
AnotherTest 46dacbfb3e Eyes: Correctly calculate the eye bounds for arbitrary number of eyes 2020-05-25 19:06:06 +02:00
Linus Groh 07af2e6b2c LibJS: Implement basic for..in and for..of loops 2020-05-25 18:45:36 +02:00
Linus Groh c378a1c730 HexEditor: Fix "Selected Bytes" count for backwards selection 2020-05-25 18:14:25 +02:00
Linus Groh fd7cbb5389 LibWeb: Add navigator.language and navigator.languages
Hardcoded to "en-US" and ["en-US"] respectively.
2020-05-25 15:15:31 +02:00
Sergey Bugaev c1a26f0b35 WindowServer: Don't crash when minimizing Eyes
Or any other window that globally tracks the mouse cursor.
2020-05-25 12:38:37 +02:00
Sergey Bugaev 431bbde6df Kernel: Fix returning random children from waitid(WNOHANG)
In case WNOHANG was specified, we want to always set should_unblock to
true (which we do since commit 4402207b98), not
wait_finished -- the latter causes us to immediately return this child to our
caller, which is not what we want -- perhaps we should return another child
which has actually exited or stopped, or nobody at all.

To avoid confusion, also rename wait_finished to fits_the_spec.

This fixes service keepalive functionality in SystemServer.
2020-05-25 12:38:37 +02:00
FalseHonesty 2c2ce5be64 Browser: Add output styles to values printed in the console
This patch adds spans around most of the console's output, allowing
for a global document stylesheet to customize the highlighting of
the console's output. It also adds some basic styling for values
like strings, numbers, and arrays using the system Palette.

Note: This patch simply adds support for highlighting output values,
the lines of JS code printed to console are still unformatted.
2020-05-25 11:33:52 +02:00
FalseHonesty 4ad891a078 LibGUI: Add flag to TextDocument's word break locator methods
TextDocument::first_word_break_before was refactored out to be able
to be used in multiple places throughout the project. It turns out
that its behaviour needs to be slightly different depending on
where its called, so it now has a start_at_column_before flag
to decide which letter it "thinks" was clicked.
2020-05-25 11:33:39 +02:00
Andreas Kling 21b1aba03b LibWeb: Add missing copyright header 2020-05-25 00:25:33 +02:00
AnotherTest b4ca563637 Shell: Warn the user about active jobs on exit
And make sure that the user means to exit and kill current jobs before exiting.
2020-05-25 00:08:32 +02:00
AnotherTest c23c354779 Shell: Parse and correctly evaluate 'command &' and 'command &&'
This commit adds the InBackground and ShortCircuitOnFailure attributes
to commands, which respectively cause the command to be run in the
background, and abort the command chain with exit status != 0.
2020-05-25 00:08:32 +02:00
AnotherTest 143be7234f Shell: Kill existing jobs when exiting 2020-05-25 00:08:32 +02:00
AnotherTest 0d39418b0b Shell: Add the `disown' shell builtin 2020-05-25 00:08:32 +02:00
Andreas Kling 4cbe202d2c LibWeb: Finally parse enough that we can actually handle welcome.html!
We made it, at last! What a long journey this was. :^)
2020-05-24 23:54:22 +02:00
Andreas Kling 65d8d5e83e LibWeb: Yet more work towards parsing www/welcome.html :^) 2020-05-24 23:54:22 +02:00
Andreas Kling 45da08a1e6 LibWeb: A whole bunch of work towards spec-compliant <script> elements
This is still very unfinished, but there's at least a skeleton of code.
2020-05-24 23:54:22 +02:00
Andreas Kling 3a30180e1e LibWeb: Add HTMLScriptElement to the forwarding header 2020-05-24 23:54:22 +02:00
Andreas Kling 128eaf9295 LibWeb: Add some helpers to the DOM Node class
This patch adds the following things needed by the HTML spec:

- Node::child_text_content()
- Node::is_connected()
- Node::root()
2020-05-24 23:54:22 +02:00
Andreas Kling 6c409310a8 LibWeb: Add a way to opt out of TreeNode::append_child() notifications
This will be used temporarily by the new HTML parser while we're
bringing it up.
2020-05-24 23:54:22 +02:00
Andreas Kling 5d332c1f11 LibWeb: Parse enough to handle a <style> inside a <head> :^) 2020-05-24 23:54:22 +02:00
Andreas Kling af8a9331b2 LibWeb: Support comments in the "in head" insertion mode 2020-05-24 23:54:22 +02:00
Andreas Kling 20911efd4d LibWeb: More work on the HTML parser and tokenizer
The parser can now switch the state of the tokenizer! Very webby. :^)
2020-05-24 23:54:22 +02:00
Andreas Kling 31db3f21ae LibWeb: Start implementing character token parsing
Now that we've gotten rid of the misguided character buffering in the
tokenizer, it actually spits out character tokens that we have to deal
with in the parser.

This patch implements enough to bring us back to speed with simple.html
2020-05-24 23:54:22 +02:00
Andreas Kling 53d2f4df70 LibWeb: Factor out the "stack of open elements" into its own class
This will allow us to write more expressive parsing code. :^)
2020-05-24 23:54:22 +02:00
Andreas Kling 96cc1138c0 LibWeb: Remove tokenizer's premature character buffering optimization 2020-05-24 23:54:22 +02:00
Linus Groh 92fd140cb2 LibJS: Make Array.prototype.includes() generic 2020-05-24 23:51:14 +02:00
Linus Groh e78bc2f6fd LibJS: Make Array.prototype.lastIndexOf() generic 2020-05-24 23:51:14 +02:00
Linus Groh 9b9b6a4cff LibJS: Make Array.prototype.indexOf() generic 2020-05-24 23:51:14 +02:00
Sergey Bugaev 174ac5d348 Demos: Add Eyes demo
This is a neat clone of xeyes. It demoes the new ellipse filling functionality,
as well as the existing global mouse cursor tracking functionality :^)
2020-05-24 23:30:12 +02:00
Sergey Bugaev 8520d3a425 LibGfx: Add Painter::fill_ellipse() 2020-05-24 23:30:12 +02:00
Sergey Bugaev 31359e3ad2 LibJS: Use the new math constants
Instead of evaluating their values at runtime.
2020-05-24 23:30:12 +02:00
Sergey Bugaev a449a0b977 LibM: Add M_SQRT2 and M_SQRT1_2 2020-05-24 23:30:12 +02:00
Marcin Gasperowicz 99991761fd LibJS: add Array.prototype.reduceRight()
This patch adds `Array.prototype.reduceRight()` method to LibJS Runtime. The implementation is (to my best knowledge) conformant to https://tc39.es/ecma262/#sec-array.prototype.reduceright.

Short test in `LibJS/Tests/Array.prototype-generic-functions.js` demonstrates that the function can be applied to other objects besides `Array`.
2020-05-24 20:58:14 +02:00
Linus Groh 9c8d390682 LibJS: Refactor Accessor
This changes Accessor's m_{getter,setter} from Value to Function* which
seems like a better API to me - a getter/setter must either be a
function or missing, and the creation of an accessor with other values
must be prevented by the parser and Object.defineProperty() anyway.

Also add Accessor::set_{getter,setter}() so we can reuse an already
created accessor when evaluating an ObjectExpression with getter/setter
shorthand syntax.
2020-05-24 18:49:58 +02:00
Andreas Kling bdc19563ef Browser: Add new icons for the add/remove bookmark toolbar button
Here's a freshly drawn icon without antialiasing so it fits better with
the system visual style. :^)
2020-05-24 18:46:48 +02:00
Daniel Gustafsson 6561987e9f
LibWeb: Fix copy-paste error in HTMLDocumentParser (#2358)
When watching the video of the new HTML parser I noticed a small copy
and paste error. In one of the cases in `handle_after_head` the code
was checking for end tags when it should check for start tags.

I haven't tested this change, just looking at the spec.
2020-05-24 13:48:46 +02:00
Itamar 10bdb6f33b functrace: use Core::ArgsParser 2020-05-24 10:42:21 +02:00
Itamar bedce69b23 Debugger: Use Core::ArgsParser 2020-05-24 10:42:21 +02:00
Itamar 773ed930cb Debugger: Re-introduce the sdb alias 2020-05-24 10:42:21 +02:00
Itamar f9d62fd5e5 LibDebug: Make sure to not single step the program twice
After hitting a breakpoint, we single step the program to execute the
instruction we breaked on and re-enable the breakpoint.
We also single step the program when the user of LibDebug returned a
DebugDecision::SingleStep.

Previously, if we hit a breakpoint and then were asked to to a
DebugDecision::SingleStep, we would single step twice.

This bug can actually crash programs, because it might cause us to
skip over a patched INT3 instruction in the second single-step.

Interestingely enough, this bug manifested as functrace crashing
certain programs: after hitting a breakpoint on a CALL instruction,
functrace single steps the program to see where the CALL jumps to
(yes, this can be optimized :D). functrace crashed when a CALL
instruction jumps to another CALL, because it inserts breakpoints on CALL
instructions, and so the INT3 in the 2nd CALL was skipped over, and we
executed garbage :).

This commit fixes this by making sure not to single-step twice.
2020-05-24 10:42:21 +02:00
Itamar 2686957836 LibDebug: Tolerate missing debug information
We previously crashed when programs were missing certain debug information.
2020-05-24 10:42:21 +02:00
Jack Byrne 58480a510f
LibWeb: Improve support for white-space CSS property (#2348)
Add reasonable support for all values of white-space CSS property.

Values of the property are translated into a 3-tuple of rules:

    do_collapse:        whether whitespace is to be collapsed
    do_wrap_lines:      whether to wrap on word boundaries when
                        lines get too long
    do_wrap_breaks:     whether to wrap on linebreaks

The previously separate handling of per-line splitting and per-word
splitting have been unified. The Word structure is now a more
general Chunk, which represents different amounts of text depending
on splitting rules.
2020-05-24 09:49:02 +02:00
Emanuele Torre 3f2158bbfe LibWeb: HtmlTokenizer.cpp: fix ON_WHITESPACE macro
The "audible bell" character ('\a' U+0007) was treated as whitespace
while the "line feed" character ('\n' U+000a) was not.

'\a' is no longer considered whitespace.
'\n' is now considered whitespace.
2020-05-24 09:47:28 +02:00
FalseHonesty 20df82c983 Browser: Set the console's interpreter when a tab's document changes
Previously, once a console was opened for a tab, its interpreter
would never change, leaving it with a stale interpreter. Now, when
the tab's HtmlView loads a new document, the console will receive
that document's interpreter.
2020-05-24 02:20:08 +02:00