Commit graph

9850 commits

Author SHA1 Message Date
FalseHonesty
d32889b19d Browser: Add "Paste & Go" action to the location box 2020-05-23 01:30:20 +02:00
Andreas Kling
6caa5661f3 LibWeb: Teach HTMLTokenizer how to tokenize attributes
Properly tokenize single-quoted, double-quoted and unquoted attributes!
2020-05-23 01:22:15 +02:00
Linus Groh
daf74838dd LibJS: Add missing exception check to ArrayPrototype's for_each_item()
Object::get_by_index() cannot throw for positive indices *right now*,
but once we implement descriptors for array index properties, it can.
2020-05-23 00:38:00 +02:00
Linus Groh
843e000f18 LibJS: Fix Array.prototype.lastIndexOf() implementation 2020-05-23 00:02:13 +02:00
Linus Groh
6a4280e6e5 LibJS: Treat missing arg in Array.prototype.{indexOf,lastIndexOf}() as undefined 2020-05-23 00:02:13 +02:00
Sergey Bugaev
a3e4dfdf98 AK: Fix .. handling in FileSystemPath
We shouldn't just drop leading ..-s for relative paths. At the same time,
we should handle paths like

    ../foo/../../bar

correctly: the first .. after the foo cancels out the foo, but the second
one should get treated as a leading one and not get dropped.

Note that since this path resolution is purely lexical, it's never going to be
completely correct with respect to symlinks and other filesystem magic. Better
don't use it when dealing with files.
2020-05-22 23:55:35 +02:00
Linus Groh
75f587d3df LibC: Add (empty) netinet/tcp.h back
This file is required for building the git port.

It was already added before and then removed again when the CI script
for license header checks was added as it seemed irrelevant.
2020-05-22 23:46:24 +02:00
Andreas Kling
004ef9a86b LibWeb: Minor tweaks to HTMLToken declaration 2020-05-22 23:45:02 +02:00
Andreas Kling
494870e696 Userland: Add a missing license header 2020-05-22 23:16:22 +02:00
Andreas Kling
272b35d2e1 LibWeb: Begin work on a spec-compliant HTML parser
In order to actually view the web as it is, we're gonna need a proper
HTML parser. So let's build one!

This patch introduces the Web::HTMLTokenizer class, which currently
operates on a StringView input stream where it fetches (ASCII only atm)
codepoints and tokenizes acccording to the HTML spec tokenization algo.

The tokenizer state machine looks a bit weird but is written in a way
that tries to mimic the spec as closely as possible, in order to make
development easier and bugs less likely.

This initial version is far from finished, but it can parse a trivial
document with a DOCTYPE and open/close tags. :^)
2020-05-22 21:46:13 +02:00
Andreas Kling
120cd44011 LibWeb: Move Attribute to its own header file
This will allow us to use it without including Element.h
2020-05-22 21:45:00 +02:00
Sergey Bugaev
f03e452085 LibC: Sync file position when dropping read ahead buffer
When we flush a FILE, we behave differently depending on whether we reading from
the file or writing to it:

* If we're writing, we actually write out the buffered data.
* If we're reading, we just drop the buffered (read ahead) data.

After flushing, there should be no additional buffered state stdio keeps about a
FILE, compared to what is true about the underlying file. This includes file
position (offset). When flushing writes, this is taken care of automatically,
but dropping the buffer is not enough to achieve that when reading. This commit
fixes that by seeking back explicitly in that case.

One way the problem manifested itself was upon fseek(SEEK_CUR) calls, as the
position of the underlying file was oftentimes different to the logical position
of the FILE. Since FILE::seek() already calls FILE::flush() prior to actually
modifying the position, fixing FILE::flush() to sync the positions is enough to
fix that issue.
2020-05-22 18:58:36 +02:00
Sergey Bugaev
799f6f4ec6 Kernel: Return ESPIPE when seeking an unseekable
This is what Dr. POSIX says it should do.
2020-05-22 18:58:36 +02:00
FalseHonesty
5431e81bc3 Browser: Pop up a context menu when requested on a bookmark button
This right click context menu currently allows for the removal of
bookmarks as well as opening them in a new tab.
2020-05-22 18:23:02 +02:00
FalseHonesty
28f74df2e6 LibGUI: Add hook when a context menu is requested on a button 2020-05-22 18:23:02 +02:00
Linus Groh
040c75a3cc LibJS: Make Array.prototype.{join,toString}() generic 2020-05-22 17:43:44 +02:00
Linus Groh
e9ee06b19e LibJS: Make Array.prototype.pop() generic 2020-05-22 17:43:44 +02:00
Linus Groh
4334a1b208 LibJS: Make Array.prototype.push() generic 2020-05-22 17:43:44 +02:00
Linus Groh
9f7a6e116a LibJS: Let Array.prototype.join() ignore additional arguments
I.e.

array.join("x", "y", "z") === array.join("x")

rather than

array.join("x", "y", "z") === array.join()
2020-05-22 17:43:44 +02:00
Andreas Kling
9fc4ad2a52 PixelPaint: Make the EllipseTool previews work while zoomed in 2020-05-22 15:57:04 +02:00
Andreas Kling
d12cce76a7 PixelPaint: Make the RectangleTool previews work while zoomed in 2020-05-22 14:57:10 +02:00
Andreas Kling
f57df29724 PixelPaint: Make the LineTool previews work while zoomed in 2020-05-22 14:45:14 +02:00
Andreas Kling
53b859c5ad Kernel: Remove some now-unnecessary casts in ProcFS
Now that we can pass arbitrary integer types to the JSON serialization
code, we don't have to cast to u32 as much!
2020-05-22 13:59:18 +02:00
Andreas Kling
a1db1e6664 AK: Make JsonValue and JsonObjectSerializer speak int/long/long long
While width-oriented integer types are nicer from the programmer's
perspective, we have to accept that C++ thinks in int/long/long long.
2020-05-22 13:57:23 +02:00
Andreas Kling
ba390f9b34 Kernel: Remove outdated FIXME's in the static ACPI parser
We no longer blindly use PAGE_SIZE here. :^)
2020-05-22 13:38:20 +02:00
Andreas Kling
4b847810bf Kernel: Simplify scanning BIOS/EBDA and MP parser initialization
Add a MappedROM::find_chunk_starting_with() helper since that's a very
common usage pattern in clients of this code.

Also convert MultiProcessorParser from a persistent singleton object
to a temporary object constructed via a failable factory function.
2020-05-22 13:36:57 +02:00
Andreas Kling
84b7bc5e14 Kernel: Add convenient ways to map whole BIOS and EBDA into memory
This patch adds a MappedROM abstraction to the Kernel VM subsystem.
It's basically the read-only byte buffer equivalent of a TypedMapping.

We use this in the ACPI and MP table parsers to scan for interesting
stuff in low memory instead of doing a bunch of address arithmetic.
2020-05-22 13:17:38 +02:00
Andreas Kling
6b5d2afd00 Kernel: Clean up and simplify MP table parsing
Use map_typed<T> to map physically addressed structs into kernel VM.
This is so much easier than doing address arithmetic everywhere. :^)
2020-05-22 12:01:01 +02:00
Matthew Olsson
c35732c011 LibJS: Add object literal getter/setter shorthand
Adds support for the following syntax:

let foo = {
    get x() {
        // ...
    },
    set x(value) {
        // ...
    }
}
2020-05-22 10:59:05 +02:00
Yonatan Goldschmidt
3a90a01dd4 Ext2FS: Fix indirect-blocks iteration
For singly-indirect blocks, "callback" is just "add_block".
For doubly-indirect blocks, "callback" is the lambda function
iterating on singly-indirect blocks: so instead of adding itself to the
list, the doubly-indirect block will add all its childs, but they add
themselves again when they run the callback of singly-indirect blocks.
And nothing adds the doubly-indirect block itself :(

This leads to a double free of all child blocks of the doubly-indirect
block, which is the failed assert described in #1549.

Closes: #1549.
2020-05-22 10:50:41 +02:00
Yonatan Goldschmidt
00c0650f96 Build: Add Dockerfile 2020-05-22 01:19:15 +02:00
Linus Groh
27913154ea LibJS: Disallow multiple parameters in paren-less arrow function
Fixes #2323.
2020-05-22 00:50:57 +02:00
Andreas Kling
84b508befa PixelPaint: Rename original_event => image_event
These events are in image coordinates, not really original coordinates.
2020-05-21 22:56:32 +02:00
Matthew Olsson
45dfa094e9 LibJS: Add getter/setter support
This patch adds a GetterSetterPair object. Values can now store pointers
to objects of this type. These objects are created when using
Object.defineProperty and providing an accessor descriptor.
2020-05-21 22:56:18 +02:00
Linus Groh
a4d04cc748 LibJS: Refactor Array.prototype callback functions and make them generic 2020-05-21 22:50:14 +02:00
Linus Groh
5db9becc4a LibJS: Treat missing arg in Array.prototype.includes() as undefined 2020-05-21 22:50:14 +02:00
Linus Groh
fbcfc8dcd0 LibLine: Hide debug output behind SUGGESTIONS_DEBUG define 2020-05-21 22:50:14 +02:00
FalseHonesty
9241c3a957 Browser: Pop up a context menu when one is requested on a tab
Currently, the tab's context menu only has options to reload and
close, but this patch allows for those options to be quickly
expanded!
2020-05-21 21:53:17 +02:00
FalseHonesty
bf2e6325a4 LibGUI: Add hook when a context menu is requested on a tab 2020-05-21 21:53:17 +02:00
Andreas Kling
ff98f55b85 LibGUI: Fix view column auto-sizing of icon-only columns
For icon columns, just use the item height as the auto width for now.
This gives us 16x16 icons, which is always what we want anyway.
2020-05-21 20:54:21 +02:00
Andreas Kling
248f2d5cf5 LibGUI: Remove Model::row_name() since nothing used it 2020-05-21 20:19:43 +02:00
Andreas Kling
278b307713 LibGUI: Make all views use CenterLeft as the default text alignment
If a model doesn't specify a text alignment for a given field, we now
fall back to CenterLeft. This will look better than Center in the vast
majority of cases.
2020-05-21 19:55:44 +02:00
Andreas Kling
2adb0a07e5 LibGUI: Get rid of Model::ColumnMetadata and always use auto-sizing
Auto-sizing of view columns is now enabled by default. This removes the
last remaining need for ColumnMetadata, so this patch gets rid of it.
2020-05-21 19:55:44 +02:00
Andreas Kling
c666c251c8 LibGUI: Replace ColumnMetadata::sortable => Model::is_column_sortable()
Now there's only one thing left in ColumnMetadata: the initial width.
2020-05-21 19:55:44 +02:00
Andreas Kling
2e03bded43 LibGUI: Add Model::Role::TextAlignment and remove from ColumnMetadata 2020-05-21 19:55:44 +02:00
Andreas Kling
3c819b8ff4 Applications: Sort CMakeLists.txt alphabetically :^) 2020-05-21 19:55:44 +02:00
Andreas Kling
04187576ff LibGUI: Models should always specify font via Model::Role::Font
This gets rid of one field in ColumnData. The goal is to get rid of all
fields and lose ColumnData entirely.
2020-05-21 19:55:44 +02:00
Luke
57d15acd4c LibJS: Add Array.prototype.every 2020-05-21 19:44:59 +02:00
Andreas Kling
4cdbdf0a84 LibGUI: Always paint the cursor visible when focusing a TextEditor
If the cursor happened to be blinking in the invisible state, it would
take 500ms before we actually see the cursor in a newly focused editor
widget. This patch makes it show up right away.
2020-05-21 17:38:01 +02:00
Andreas Kling
4806cd122d LibGUI: Focus the first focusable widget added to a window
It feels really awkward if nothing is focused when opening a window.
2020-05-21 17:26:09 +02:00