Commit Graph

9782 Commits

Author SHA1 Message Date
Andreas Kling
59a56a78c0 Kernel: Oops, we need to use map_typed_writable() for write access :^) 2020-05-23 15:50:50 +02:00
Andreas Kling
a04c8d7101 Kernel: Use TypedMappings when looking for APIC information 2020-05-23 15:46:56 +02:00
Marcin Gasperowicz
c21dc21f36
Build: Make Lagom build under macOS (#2341)
Lagom now builds under macOS. Only two minor adjustments were required:

* LibCore TCP/UDP code can't use `SOCK_{NONBLOCK,CLOEXEC}` on macOS,
use ioctl() and fcntl() instead

* LibJS `Heap` code pthread usage ported to MacOS
2020-05-23 15:31:30 +02:00
Andreas Kling
dd924b730a Kernel+LibC: Fix various build issues introduced by ssize_t
Now that ssize_t is derived from size_t, we have to
2020-05-23 15:27:33 +02:00
Andreas Kling
2fe6b3725a Kernel: Use TypedMappings in the very unfinished APIC code 2020-05-23 15:25:43 +02:00
Andreas Kling
1afbd8936a Kernel+LibC: Let's say that off_t is a ssize_t 2020-05-23 15:25:43 +02:00
Andreas Kling
45450c7edc LibWeb: Make BEGIN_STATE and END_STATE include some {{{ and }}}
This makes it a compile error to omit the END_STATE. Also add some more
missing END_STATE's exposed by this (nice!)

Thanks to @predmond for suggesting the multi-pair trick! :^)
2020-05-23 15:25:43 +02:00
Andreas Kling
d63b6287f5 Kernel: Add missing casts when calling AK::min() 2020-05-23 15:25:43 +02:00
Andreas Kling
8fe4512f8e AK: Fix inconsistent signature for dbgputstr() 2020-05-23 15:25:43 +02:00
Andreas Kling
a0d3c03950 LibC: Declare ssize_t in a platform-agnostic way
While the compiler provides __SIZE_TYPE__ for declaring size_t,
there's unfortunately no __SSIZE_TYPE__ for ssize_t.

However, we can trick the preprocessor into doing what we want anyway
by doing "#define unsigned signed" before using __SIZE_TYPE__ again.
2020-05-23 15:25:43 +02:00
Andreas Kling
8ec8304d74 Kernel: Tweak some suspicious casts in InterruptManagement
This code needs a closer looking-into at some point. It doesn't seem
entirely safe to be casting u32's to pointers like it does.
2020-05-23 15:25:43 +02:00
Andreas Kling
7c278eb970 Kernel: Dont't static_assert that size_t is 32-bit :^) 2020-05-23 15:25:43 +02:00
Andreas Kling
b3736c1b1e Kernel: Use a FlatPtr for the "argument" to ioctl()
Since it's often used to pass pointers, it should really be a FlatPtr.
2020-05-23 15:25:43 +02:00
Andreas Kling
b8af5cd8da Kernel: Simplify MP table parser a little bit more
Get rid of the ConfigurationTableEntryLength enum and just look at the
sizeof() for each entry type.
2020-05-23 15:25:43 +02:00
Andreas Kling
7379c589c7 Kernel: Make dump_backtrace_impl() take base pointer as a FlatPtr
Since FlatPtr is register width agnostic. :^)
2020-05-23 15:25:43 +02:00
Andreas Kling
4177953530 AK: Simplify Types.h a little bit 2020-05-23 15:25:43 +02:00
Andreas Kling
e90ecdda48 AK: Add MakeSigned<T> helper template 2020-05-23 15:25:43 +02:00
Andreas Kling
6cefb96e98 AK: Allow NumericLimits.h to compile in a kernel context
We explicitly disallow floating point numbers during kernel compilation
so we have to #ifdef out those parts here.
2020-05-23 15:25:43 +02:00
FalseHonesty
78412ee76d Browser: An anchor link should open in a new tab when required
Previously, clicking on an anchor link (href="#section1")
would always scroll to it on the current page, even if control was
held or the target="_blank" attribute was set. This fixes that
behaviour, and the link will always open in a new tab if required.
2020-05-23 11:53:25 +02:00
FalseHonesty
e5c2e53739 LibWeb: Fix HtmlView not scrolling to a url's anchor on page load
Previously, when HtmlView loaded a url, the url's fragment was ignored,
but now it will be automatically scrolled to.
2020-05-23 11:53:25 +02:00
FalseHonesty
b1e4f70173 AK: Fix URL::complete_url behaviour for when a fragment is passed
Previously, passing a fragment string ("#section3") to the complete_url
method would result in a URL that looked like
"file:///home/anon/www/#section3" which was obviously incorrect. Now the
result looks like "file:///home/anon/www/afrag.html#section3".
2020-05-23 11:53:25 +02:00
Andreas Kling
2e4147d0fc LibWeb: Add missing END_STATE for TagName
Fixes #2339.
2020-05-23 10:33:23 +02:00
Andreas Kling
a58500fdc5 LibWeb: Teach HTMLTokenizer how to tokenize comments
We can now correctly tokenize the welcome.html test page. :^)
2020-05-23 01:54:26 +02:00
AnotherTest
909ac2a558 LibLine: Make the comments follow the project style 2020-05-23 01:31:41 +02:00
AnotherTest
3c3edf5831 LibLine: Properly paginate suggestions in XtermSuggestionDisplay
This commit adds back suggestion pagination, and makes it 10x better.
Also adds a "< page m of n >" indicator at the bottom if there are more
suggestions than would fit in a page.
It properly handles cycling forwards and backwards :^)
2020-05-23 01:31:41 +02:00
AnotherTest
0446b7e347 Userland/js: Do not construct a full CompletionSuggestion just to compare against 2020-05-23 01:31:41 +02:00
AnotherTest
2427f3b38b LibLine: Add a constructor for CompletionSuggestions purely for comparison
`CompletionSuggestion(text, ForSearch)` creates a suggestion whose only
purpose is to be compared against.
This constructor skips initialising the views.
2020-05-23 01:31:41 +02:00
AnotherTest
f0862cf2b7 LibLine: Refactor suggestion handling and display logic out 2020-05-23 01:31:41 +02:00
AnotherTest
65adf2aea2 LibLine: Correctly handle multibyte codepoints in suggestions 2020-05-23 01:31:41 +02:00
AnotherTest
2b3e9c28b2 Shell: Take whitespace into account when suggesting tokens
Prior to this, we did not care if there was any whitespace after the
last token in the prompt, and this caused a regression:
```
> lsp <tab>
> lsp ci
```
2020-05-23 01:31:41 +02:00
AnotherTest
e2886aabcd LibLine: Make suggest() utf8-aware 2020-05-23 01:31:41 +02:00
FalseHonesty
e0312ec2ce LibGUI: Improve double click selection on documents without spans
Previously, double clicking would select the range around your click up
until it found a space, and in the browser's location bar this behavior
didn't suffice. Now, it will select the range around your click until
there is a "word break". A word break is considered to be when your
selection changes from being alphanumeric to being non alphanumeric, or
vice versa.
2020-05-23 01:30:20 +02:00
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