Commit graph

10079 commits

Author SHA1 Message Date
Sergey Bugaev
e12388c349 Userland: Treat all text/* MIME types as text when pasting
It's a bit weird to get a newline after plain text but not after, say, a URL
list.
2020-05-30 15:01:18 +02:00
Sergey Bugaev
66c6e0035e LibVT: Fix emitting \0 when pressing a modifier key
This causes the kernel to return EOF, which in turn confuses everything. This is
a regression from the LibVT port of VirtualConsole.
2020-05-30 15:01:18 +02:00
Sergey Bugaev
52711921c6 Base: Document getopt 2020-05-30 15:01:18 +02:00
Sergey Bugaev
b4ca45b5ec LibCore: Update Core::ArgsParser to the new error message format 2020-05-30 15:01:18 +02:00
Sergey Bugaev
2930fbcfcf LibC: Rewrite getopt()
Fixes https://github.com/SerenityOS/serenity/issues/91
2020-05-30 15:01:18 +02:00
Andreas Kling
f662b1ea37 LibWeb: Implement enough parsing to parse the HTML spec front page :^)
We can now actually open http://html.spec.whatwg.org/ in Browser.
2020-05-30 13:07:47 +02:00
Andreas Kling
7f22e2a3c4 LibWeb: Use the globals from HTML::AttributeNames in style resolution
Using these avoids the FlyString lookups, so we should basically always
prefer them over string literal attribute names.
2020-05-30 13:06:26 +02:00
Andreas Kling
770372ad02 LibWeb: Handle end-of-file token during "in body" insertion mode 2020-05-30 12:40:12 +02:00
Andreas Kling
5833359065 LibWeb: Add default UA style for <hgroup> element 2020-05-30 12:39:51 +02:00
Andreas Kling
368044eabd LibWeb: Flesh out the "in head" insertion mode and add missing cases 2020-05-30 12:28:12 +02:00
Andreas Kling
e82226f3fb LibWeb: Handle two kinds of deferred script executions
This patch adds two script lists to Document:

- Scripts to execute when parsing has finished
- Scripts to execute as soon as possible

Since we don't actually load scripts asynchronously yet (we just do a
synchronous load when parsing the <script> element for simplicity),
these are already loaded by the time we get to "The end" of parsing.
2020-05-30 12:26:15 +02:00
Andreas Kling
6f85422e8a Base: Add HTML spec (multipage) to the default Browser bookmarks :^) 2020-05-30 12:25:37 +02:00
Andreas Kling
0d5be35c1f LibWeb: Don't render list item markers for "list-style-type: none" 2020-05-30 12:04:15 +02:00
Andreas Kling
e1e9fb8290 LibWeb: Turn <input type=button> into an actual button :^) 2020-05-30 11:59:10 +02:00
Andreas Kling
3c6801c3a5 LibWeb: Naive support for CSS "background" shorthand
Many sites simply use "background" as an alias for "background-color"
so let's at least support that.
2020-05-30 11:58:05 +02:00
Andreas Kling
62885b5646 LibWeb: Fix accidental swallow of self-closing tag tokens
Instead of dropping self-closing tags on the floor, we now emit them
into the token stream. :^)
2020-05-30 11:31:49 +02:00
Andreas Kling
fbd52047bb LibWeb: Parse "form" tags during the "in body" insertion mode 2020-05-30 11:31:49 +02:00
Andreas Kling
851a0f983a LibWeb: Tokenizing a semicolon-less HTML entity is (just a) parse error
No need to blow chunks over this.
2020-05-30 11:31:49 +02:00
Andreas Kling
b9d5d45eff LibWeb: Handle an error condition for "a" start tag during "in body"
If we have an <a> element on the list of active formatting elements
when hitting another "a" start tag, that's a parse error. Recover by
using the AAA.
2020-05-30 11:31:49 +02:00
Andreas Kling
c8e0426ab9 LibWeb: Parser should prefer the longest matchable HTML entity
If we can match both "&copy" and "&copy;" we should prefer the latter.

Also remove invalid FIXME's about case insensitive entities.
2020-05-30 11:31:49 +02:00
Andreas Kling
1ef5d609d9 AK+LibC: Add TODO() as an alternative to ASSERT_NOT_REACHED()
I've been using this in the new HTML parser and it makes it much easier
to understand the state of unfinished code branches.

TODO() is for places where it's okay to end up but we need to implement
something there.

ASSERT_NOT_REACHED() is for places where it's not okay to end up, and
something has gone wrong.
2020-05-30 11:31:49 +02:00
Andreas Kling
cfbd95f42a LibWeb: Turn a bunch of ASSERT_NOT_REACHED() in the parser into TODO() 2020-05-30 11:31:49 +02:00
Andreas Kling
6854f726ce LibWeb: Improve support for "a" and "li" during "in body" insertion
We can now parse welcome.html once again, without resorting to hacks
or fallbacks during "in body" :^)
2020-05-30 11:31:49 +02:00
Andreas Kling
30d64fccde LibWeb: Parse "li" start tags in the "in body" insertion mode 2020-05-30 11:31:49 +02:00
Andreas Kling
643464c455 AK: Make {String,FlyString}::is_one_of() const
Also, make the zero-argument variant private since it's not meant to be
called by clients directly.
2020-05-30 11:31:49 +02:00
Andreas Kling
2b1517f215 LibWeb: Add all branches from the parsing spec to "in body"
This makes us crash in TODO() more often, but it's better that we know
what's missing instead of incorrectly ending up on the fallback path.
2020-05-30 11:31:49 +02:00
Jack Karamanian
d4e97b17ab LibJS: Use a non-arrow function to check the |this| value in the
callback for Array.prototype.{reduce,reduceRight}

Arrow functions always retain the |this| binding.

Running this code in Node:

[1, 2].reduce(() => { "use strict"; console.log(this === undefined) }

Output: false
2020-05-30 10:33:24 +02:00
Jack Karamanian
4a49c8412c LibJS: Add tests ensuring the |this| value can't be set for arrow
functions in Function.prototype.{call,apply}
2020-05-30 10:33:24 +02:00
Jack Karamanian
f4129ac422 LibJS: Use the function's bound |this| and bound arguments in
Interpreter::call()
2020-05-30 10:33:24 +02:00
Jack Karamanian
3ffb0a4e87 LibJS: Throw a TypeError when an arrow function is used as a constructor 2020-05-30 10:33:24 +02:00
Jack Karamanian
1110b1b444 LibJS: Don't define the "prototype" property for arrow functions 2020-05-30 10:33:24 +02:00
Jack Karamanian
45ccd9f8d9 LibJS: Set the bound |this| value to the |this| value of the current
scope for arrow functions
2020-05-30 10:33:24 +02:00
Jack Karamanian
c12125fa81 LibJS: Track whether ScriptFunctions and FunctionExpressions are arrow
functions
2020-05-30 10:33:24 +02:00
Jack Karamanian
5243e9974d LibJS: Remove unnecessary explicit from the 3 argument Function
constructor
2020-05-30 10:33:24 +02:00
Matthew Olsson
4e331a1fcf LibJS: Object.getOwnPropertyDescriptor works properly with accessors 2020-05-30 10:32:52 +02:00
FalseHonesty
12fe546be9 LibGUI+HackStudio: Fix cursor appearance and crash while debugging
HackStudio uses a TreeView to display the list of current variables
while debugging, and when the program completes, it sets that view's
model to a null model. This would trip an assertion if the TreeView
had something selected at the time, so this patch lessens the
assertion into a simple null check.

Additionally, the cursor would look laggy when moving about the
editor because the code was waiting for a window repaint to update
the cursor's look when it makes more sense to update the cursor
when it actually moves. This change also requires the base
GUI::TextEditor to expose a getter to tell if its currently in a drag
selection.

Finally, requesting a context menu in the line ruler on the side of
the editor would also place/remove breakpoints, which was counter
intuitive, so this requires a left click to modify breakpoint placement.
2020-05-30 10:18:14 +02:00
AnotherTest
77039e5354 Shell: Correctly complete paths in redirections
This commit allows the Shell to complete paths in redirections.
A closing quote is added if the path is an unclosed quote.
```
$ foo > "foob<tab>
$ foo > "foobar"
```
2020-05-30 00:36:51 +02:00
Marcin Gasperowicz
9a4ee9aa1a Lagom: Adjust AK, LibCore and LibTLS to build on MacOS 2020-05-30 00:36:13 +02:00
Marcin Gasperowicz
4e8de753c9 LibJS: Parse arrow function expression with correct precedence
The parser was chomping on commas present after the arrow function expression. eg. [x=>x,2] would parse as [x=>(x,2)] instead of [(x=>x),2].

This is not the case anymore. I've added a small test to prove this.
2020-05-30 00:33:18 +02:00
FalseHonesty
20faa93cb0 LibMarkdown: Change internal MD API to return OwnPtrs
Previously, all Markdown blocks had a virtual parse method which has
been swapped out for a static parse method returning an OwnPtr of
that block's type.

The Text class also now has a static parse method that will return an
Optional<Text>.
2020-05-30 00:32:12 +02:00
FalseHonesty
7ca562b200 LibMarkdown: Change MD Document parse API to return a RefPtr
Markdown documents are now obtained via the static Document::parse
method, which returns a RefPtr<Document>, or nullptr on failure.
2020-05-30 00:32:12 +02:00
FalseHonesty
9a2177437b Browser: Add clear output button to the console 2020-05-29 22:14:45 +02:00
FalseHonesty
2619d72eeb LibJS: Add all remaining tokens to MarkupGenerator's style converter 2020-05-29 22:14:45 +02:00
FalseHonesty
061938206a LibGUI: Fix cursor being out of view after typing
Previously, if the cursor moved out of the visible area while text
was being inserted, the text editor would never scroll the cursor
back into view until the arrow keys were pressed to move the cursor.
This was caused by the TextEditor's reflow deferral system stopping
visual line recomputation until the end of text insertion, so now
when reflow deferral is completed, the TextEditor will make sure
the cursor is visible.
2020-05-29 22:14:45 +02:00
Paul Redmond
4d4e578edf Ports: Fix CMake-based ports
The SDL port failed to build because the CMake toolchain filed pointed
to the old root. Now the toolchain file assumes that the Root is in
Build/Root.

Additionally, the AK/ and Kernel/ headers need to be installed in the
root too.
2020-05-29 20:21:10 +02:00
FalseHonesty
b0b03c52af LibGUI: Fix TextEditor crashing when selecting a blank line
Previously, the TextEditor would crash when selecting a line with
no codepoints due to a null dereference, so this patch makes sure
there is actually any text to render before giving it to the painter.
2020-05-29 20:17:53 +02:00
AnotherTest
2a241a11bb LibCrypto: Fix some issues preventing compilation w/ clang 10 2020-05-29 20:17:12 +02:00
AnotherTest
d497521d2b LibCrypto: Format all files with clang-format 10 2020-05-29 20:17:12 +02:00
Matthew Olsson
d52ea37717 LibJS: Integrate labels into the Interpreter
The interpreter now considers a statement or block's label when
considering whether or not to break. All statements can be labelled.
2020-05-29 16:20:32 +02:00
Matthew Olsson
03615a7872 LibJS: Parse labels in continue and break statements 2020-05-29 16:20:32 +02:00