Commit graph

5004 commits

Author SHA1 Message Date
Andreas Kling 68e23bca3f AK: Delete operator!() and operator bool() from the Nonnull pointers
Since NonnullRefPtr and NonnullOwnPtr cannot be null, it is pointless
to convert them to a bool, since it would always be true.

This patch makes it an error to null-check one of these pointers.
2019-11-07 18:00:05 +01:00
Andreas Kling b88ff97537 LibHTML: Make the CSS parser return RefPtr's
It should be possible for the CSS parser to fail, and we'll know it
failed if it returns nullptr. Returning RefPtr's makes it actually
possible to return nullptr. :^)
2019-11-07 17:58:54 +01:00
Andreas Kling 6a8695e759 AK: Add Vector::prepend(T&&) 2019-11-07 10:35:13 +01:00
Andreas Kling a377e8d3f5 LibHTML+IRCClient: Add an escape_html_entities() helper
This simple helper escapes '<', '>' and '&' so they can be used in HTML
text without interfering with the parser.

Use this in IRCClient to prevent incoming messages from messing with
the DOM :^)
2019-11-06 22:40:01 +01:00
Andreas Kling d17930d9e2 Meta: Time for a new screenshot (Quake edition) :^) 2019-11-06 21:51:33 +01:00
Andreas Kling 1133acabb2 Meta: Move "Notes on WSL" to a separate file in Documentation/
Since this is not relevant to the majority of people, let's move it
out of the way.
2019-11-06 21:03:18 +01:00
Andreas Kling 2c693094d9 Kernel: If a process is interrupted during usleep(), return -EINTR 2019-11-06 21:01:44 +01:00
Andreas Kling ac2cc7d78f LibHTML: Make parse_html_document() return a RefPtr
Parsing might not always succeed, so let's have a way to signal errors.
2019-11-06 20:54:50 +01:00
Andreas Kling f60c46ceb7 IRCClient: Use parse_html_fragment() to add messages to the HtmlView
HTML fragment strings are so much nicer to work with than raw DOM APIs.
This makes it feel like we're using innerHTML :^)
2019-11-06 20:53:30 +01:00
Andreas Kling 794f2d5645 LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:52:18 +01:00
Andreas Kling f5cf8d4ad8 Revert "LibHTML: Rename parse_html() => parse_html_document()"
This reverts commit f6439789db.
Oops, I committed unrelated changes here, let me clean that up..
2019-11-06 20:51:07 +01:00
Andreas Kling f6439789db LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:31:56 +01:00
Andreas Kling 635717ed0f LibHTML: Add parse_html_fragment()
This function parses a partial DOM and returns it wrapped in a document
fragment node (DocumentFragment.)

There are now two entrances into the HTML parser, one for parsing full
documents, and one for parsing fragments. Internally the both wrap the
same parsing function.
2019-11-06 20:30:39 +01:00
Andreas Kling f404a1dc16 LibHTML: Add DocumentFragment
Right now this is just a simple ParentNode subclass with its node type
being DOCUMENT_FRAGMENT_NODE.
2019-11-06 20:27:53 +01:00
Andreas Kling 26493a3039 LibHTML: Add TreeNode::remove_child()
This removes a child from the tree and returns it to the caller.
It optionally (but by default) calls removed_from(parent) on the child.
2019-11-06 20:26:17 +01:00
Andreas Kling 9a5e065229 AK: Always rebuild unit tests if AK headers change
This is a hack to avoid failing AK unit tests because it didn't even
try to rebuild.
2019-11-06 19:14:34 +01:00
Andreas Kling 2f16e31afc Kernel: A running process should keep its TTY alive
It's not safe to use a raw pointer for Process::m_tty. A pseudoterminal
pair will disappear when file descriptors are closed, and we'd end up
looking dangly. Just use a RefPtr.
2019-11-06 16:52:54 +01:00
Andreas Kling 083c5f8b89 Kernel: Rework Process::Priority into ThreadPriority
Scheduling priority is now set at the thread level instead of at the
process level.

This is a step towards allowing processes to set different priorities
for threads. There's no userspace API for that yet, since only the main
thread's priority is affected by sched_setparam().
2019-11-06 16:30:06 +01:00
Andreas Kling e33bbdb6ba AK: Remove unused AK::not_implemented()
Whatever this was supposed to be, it was ironically... not implemented.
2019-11-06 13:58:08 +01:00
Andreas Kling 14dc323f4d Kernel: Sort the C++ objects in the Makefile 2019-11-06 13:45:21 +01:00
Andreas Kling 49635e62fa LibELF: Move AK/ELF/ into Libraries/LibELF/
Let's arrange things like this instead. It didn't feel right for all of
the ELF handling code to live in AK.
2019-11-06 13:42:38 +01:00
Andreas Kling 31beff8afb Kernel: Remove unnecessary init_ksyms() function 2019-11-06 13:36:37 +01:00
Andreas Kling 4f4d4670fe Kernel: Don't instantiate and throw away ProcFS + DevPtsFS on boot
Oops, we were creating these and then throwing them away. They will
get instantiated a bit later, when we bring up the mounts in /etc/fstab
from userspace.
2019-11-06 13:21:44 +01:00
Andreas Kling 9a4b117f48 Kernel: Simplify kernel entry points slightly
It was silly to push the address of the stack pointer when we can also
just change the callee argument to be a value type.
2019-11-06 13:15:55 +01:00
Andreas Kling 349d2ec1c2 Kernel: Link with libgcc
This allows us to get rid of all the custom 64-bit division helpers.
I wanted to do this ages ago but couldn't get it working. Turns out it
was unstable due to libgcc using the regular ABI and the kernel being
built with -mregparm=3.

Now that we build the kernel with regular calls, we can just link with
libgcc and get this stuff for free. :^)
2019-11-06 13:07:07 +01:00
Andreas Kling 1c6f8d3cbd Kernel: Don't build with -mregparm=3
It was really confusing to have different calling conventions in kernel
and userspace. Also this has prevented us from linking with libgcc.
2019-11-06 13:04:47 +01:00
Andreas Kling 01b21e5e05 Kernel: Use KParams::has() instead of !KParams::get().is_null()
Also rename a local variable to be consistent with what it represents.
2019-11-06 11:47:04 +01:00
Andreas Kling 9e570d0d6d Kernel+SystemServer: Get rid of two virtual consoles
Having four virtual (text) consoles by default seems really overkill
for a system that can't even switch to them anyway (yet!)
2019-11-06 11:41:50 +01:00
Andreas Kling 2ad0ec325a AK: Get rid of TStyle (output styling helper for LogStream)
This didn't end up getting used, so let's get rid of it.
2019-11-06 11:37:03 +01:00
Andreas Kling 1c8f017730 Kernel: Remove unused SynthFS filesystem
This used to be the base class of ProcFS and DevPtsFS but not anymore.
2019-11-06 11:36:24 +01:00
Andreas Kling f3f0b08d43 LibHTML: Build some foundation for text selection
Add LayoutPosition and LayoutRange classes. The layout tree root node
now has a selection() LayoutRange. It's essentially a start and end
LayoutPosition.

A LayoutPosition is a LayoutNode, and an optional index into that node.
The index is only relevant for text nodes, where it's the character
index into the rendered text.

HtmlView now updates the selection start/end of the LayoutDocument when
clicking and dragging with the left mouse button.

We don't paint the selection yet, and there's no way to copy what's
selected. It only exists as a LayoutRange.
2019-11-05 22:13:26 +01:00
Andreas Kling 2755184e11 HackStudio: Update the "remove current editor" action enabled state
This action should not be enabled when there is only one editor open,
since you are not allowed to be editor-less.
2019-11-05 21:08:17 +01:00
Andreas Kling cb627a3ada HackStudio: Allow removing the current editor with Alt+Shift+E
Note that you are not allowed to remove the very last editor.

These keybinds are all temporary while I figure out what the right ones
should be. I'm not exactly sure how, but it'll reveal itself. :^)
2019-11-05 21:02:31 +01:00
Andreas Kling 538d5f82c1 HackStudio: Allow switching between editors with Ctrl+E / Ctrl+Shift+E 2019-11-05 20:56:36 +01:00
Andreas Kling f844715106 HackStudio: Allow adding more editors by pressing Ctrl+Alt+E
We also now start out with a single editor, instead of two. :^)
2019-11-05 20:56:30 +01:00
Andreas Kling d3558b6137 LibCore+LibGUI: Allow inserting a CObject/GWidget before another
When adding a widget to a parent, you don't always want to append it to
the set of existing children, but instead insert it before one of them.

This patch makes that possible by adding CObject::insert_child_before()
which also produces a ChildAdded event with an additional before_child
pointer. This pointer is then used by GWidget to make sure that any
layout present maintains the correct order. (Without doing that, newly
added children would still be appended into the layout order, despite
having a different widget sibling order.)
2019-11-05 20:41:27 +01:00
Andreas Kling 0f81eaf8a2 HackStudio: Put annoying debug spam behind EDITOR_DEBUG 2019-11-05 20:09:06 +01:00
Till Mayer ac9907ee61 SoundPlayer: Changed some small cosmetic things
Renamed "Position" to "Elapsed". "channel/channels" automatically
changes now when more than one channel exist. The current file name
is now displayed in the window title.
2019-11-05 19:50:11 +01:00
Till Mayer 94a9649945 AWavLoader: Fixed incorrect computation of m_loaded_samples
m_loaded_samples was incremented with the value of the processed
buffer. This causes m_loaded_samples to be bigger at some point
than m_total_samples when downsampling, as the buffer would contain
more samples than actually loaded.
2019-11-05 19:50:11 +01:00
Andreas Kling 173ae370db disk_benchmark: Add a -c flag to enable use of disk caches
By default, disk_benchmark will now use the O_DIRECT flag, causing it
to bypass the kernel's disk caches. This gives you "disk performance"
numbers rather than "disk cache performance" numbers.

You can use "disk_benchmark -c" to enable the caches.

Fixes #703.
2019-11-05 19:37:23 +01:00
Andreas Kling 59ed235c85 Kernel: Implement O_DIRECT open() flag to bypass disk caches
Files opened with O_DIRECT will now bypass the disk cache in read/write
operations (though metadata operations will still hit the disk cache.)

This will allow us to test actual disk performance instead of testing
disk *cache* performance, if that's what we want. :^)

There's room for improvment here, we're very aggressively flushing any
dirty cache entries for the specific block before reading/writing that
block. This is done by walking the entire cache, which may be slow.
2019-11-05 19:35:12 +01:00
Andreas Kling 3de3daf765 run: Unbreak the run script 2019-11-05 18:56:43 +01:00
Andreas Kling 1466a7364c LibHTML: Add TreeNode::next_in_pre_order()
This function allows you to traverse in pre-order without recursing.
2019-11-05 18:36:06 +01:00
Dan MacDonald 17752b2973 run: Comment out qemu packet capture 2019-11-05 18:07:49 +01:00
João Paulo Pulga 4d3be45ff4 HackStudio: Don't parse documentation if already parsed 2019-11-05 07:06:15 +01:00
Till Mayer 77f3c12dc9 SoundPlayer: Added playback controls
The playback of a file can now be paused, stopped, continued and the
user can seek to any part of the file.
2019-11-04 20:55:46 +01:00
Till Mayer 2f13517a1a LibAudio: Added playback control features to audio server
LibAudio now supports pausing playback, clearing the buffer queue,
retrieving the played samples since the last clear and retrieving
the currently playing shared buffer id
2019-11-04 20:55:46 +01:00
Till Mayer e7ccbdbe30 SoundPlayer: Added playback control icons and application icon 2019-11-04 20:55:46 +01:00
Till Mayer 4c9fdad1bf LibGUI: Added getter for m_dragging 2019-11-04 20:55:46 +01:00
Till Mayer 112d36bfa0 SoundPlayer: Make sample widget display contents of the whole buffer
The SampleWidget now displays the contents of the whole buffer.
2019-11-04 20:55:46 +01:00