Commit Graph

5560 Commits

Author SHA1 Message Date
Andreas Kling
54bd322881 LibHTML: Mark image bitmaps outside the visible viewport as volatile
When the visible viewport rect changes, we walk the layout tree and
check where each LayoutImage is in relation to the viewport rect.
Images outside have their bitmaps marked as volatile.

Note that the bitmaps are managed by ImageDecoder objects. If a bitmap
is purged by the kernel while volatile, we construct a new ImageDecoder
next time we need pixels for the image.
2019-12-18 21:19:04 +01:00
Andreas Kling
7e068565bc LibHTML: Push the visible viewport rect from HtmlView to Frame
This will allow various mechanisms and optimizations based on the
currently visible viewport rect.
2019-12-18 20:54:23 +01:00
Andreas Kling
85ac9705ba LibHTML: Add LayoutNode::is_image() and is<LayoutImage> helper 2019-12-18 20:52:36 +01:00
Andreas Kling
7cc4b90b16 LibDraw: Create purgeable GraphicsBitmap in the PNG decoder
Also add ImageDecoder APIs for controlling the volatile flag.
2019-12-18 20:50:58 +01:00
Andreas Kling
77ae98a9b6 LibDraw: Add GraphicsBitmap::create_purgeable()
This allows you to create a process-private purgeable GraphicsBitmap.
The volatile flag is controlled via set_volatile() / set_nonvolatile().
2019-12-18 20:50:05 +01:00
Andreas Kling
72ec2fae6e Kernel: Ignore MADV_SET_NONVOLATILE if already non-volatile
Just return 0 right away without changing any region flags.
2019-12-18 20:48:58 +01:00
Andreas Kling
487f9b373b Kernel: Add MADV_GET_VOLATILE for checking the volatile flag
Sometimes you might want to know if a purgeable region is volatile.
2019-12-18 20:48:24 +01:00
Sergey Bugaev
1ad5568759 LibC: Store empty malloc blocks in an array instead of a linked list 2019-12-18 19:02:25 +01:00
Andreas Kling
0d6f186397 LibHTML: Insert a new linebox for every newline in "white-space: pre" 2019-12-18 12:44:16 +01:00
Andreas Kling
1fda417f4f LibHTML: Ignore case of presentation attribute names 2019-12-18 12:44:13 +01:00
Andreas Kling
4d81bc20d8 LibHTML: Don't insert line breaks between multiple <pre>'s on a line
When iterating lines for "white-space: pre", we should only break when
there is an actual line break character.
2019-12-18 12:44:09 +01:00
Andreas Kling
152c31c5c6 LibHTML: Let's display <basefont> as block-level elements for now 2019-12-18 12:44:06 +01:00
Andreas Kling
33daa80bf0 LibHTML: Use a fixed-width font for <pre> tags, duh! 2019-12-18 12:44:02 +01:00
Andreas Kling
e3c0e75055 AK: Add String::equals_ignoring_case(StringView) 2019-12-18 12:43:53 +01:00
Zyper
413618454b PaintBrush: Shift key constrains LineTool angle
Holding Shift key will constrain the LineTool's line angle to 15 degrees
increments. Many graphics editors have similar feature.
2019-12-17 21:21:24 +01:00
Zyper
b185c7f58a PaintBrush: Tools can receive KeyUp events 2019-12-17 21:21:24 +01:00
Andreas Kling
7301db4f9a GTextEditor: Fix broken rendering of selection on wrapped lines
This logic broke when converting String::length() to return size_t.
2019-12-17 21:15:10 +01:00
Jesse Buhagiar
cdb00530f8 Shell: Tab completion now gives suggestions
Pushing the TAB key in the shell now prints suggestions to terminal.
This makes it easier to the user to actually see what files are
available before executing the command they currently have typed.
2019-12-17 10:28:22 +01:00
Ohad Rau
3809da4abb ProfileViewer: Make initial invert checkbox match initial tree view
The "Invert tree" checkbox was accidentally defaulted to display true when the actual tree wasn't being inverted, causing the checkbox to say the opposite of the tree state initially. This change just brings the visual indicator in line with what the code is actually doing.
2019-12-17 07:25:50 +01:00
Andreas Kling
3b76f2502a ProfileViewer: Ignore empty samples
Sometimes we get empty samples in a profile. I'm not sure why that
happens, but let's just ignore them for now.
2019-12-16 20:38:30 +01:00
Andreas Kling
91ba94fbd4 LibHTML: Support the :only-child pseudo class 2019-12-16 19:52:11 +01:00
Andreas Kling
085cafd80a LibHTML: Support the :empty pseudo class 2019-12-16 19:46:02 +01:00
Andreas Kling
a32cae4c3b LibDraw: Parse the color name "pink" to #ffc0cb 2019-12-16 19:45:21 +01:00
Andreas Kling
c1474e594e LibHTML: Support the :first-child and :last-child pseudo classes 2019-12-16 19:34:52 +01:00
Andreas Kling
870df4a8c6 LibGUI: Fix GTreeView crash on pressing Left/Right without selection 2019-12-16 18:26:26 +01:00
Andreas Kling
fe421bd7b4 ProfileViewer: Add the ability to invert the profile tree
Inverting the tree turns all of the innermost stack frames into roots,
allowing them to accumulate their total sample counts with other
instances of the same frame being innermost. This is an essential
feature of any cool profiler, and now we have it. :^)
2019-12-16 18:26:24 +01:00
Andreas Kling
5ddb747038 Audio.MenuApplet: Remove debug spam about muting 2019-12-16 17:48:31 +01:00
Andreas Kling
72bdf595cc LibIPC: Make sure we always process unhandled messages
A client that only ever does synchronous IPC calls from its side would
never actually process incoming asynchronous messages since they would
arrive while waiting for a synchronous response and then end up sitting
forever in the "unhandled messages" queue.

We now always handle unhandled messages using a deferred invocation.

This fixes the bug where Audio.MenuApplet didn't learn that the muted
state changed in response to its own request to change it. :^)
2019-12-16 17:45:57 +01:00
Andreas Kling
647a95a812 MenuApplets: Remove accidentally committed executable 2019-12-16 17:44:02 +01:00
Andreas Kling
29e2ad47fd WindowServer: Stop linking with LibAudio
This is no longer necessary, since the audio applet has been moved to
its own process.
2019-12-16 15:36:13 +01:00
Andreas Kling
e1940f365b WindowServer+MenuApplets: Move the "Audio" applet to its own program
This patch introduces the second MenuApplet: Audio. To make this work,
menu applet windows now also receive mouse events.

There's still some problem with mute/unmute via clicking not actually
working, but the call goes from the applet program over IPC to the
AudioServer, where something goes wrong with the state change message.
Need to look at that separately.

Anyways, it's pretty cool to have more applets running in their own
separate processes. :^)
2019-12-16 15:33:42 +01:00
Andreas Kling
df129bbe0e WindowServer+CPUGraph: Make menu applets be "regular" windows
Instead of implementing menu applets as their own thing, they are now
WSWindows of WSWindowType::MenuApplet.

This makes it much easier to work with them on the client side, since
you can just create a GWindow with the right type and you're in the
menubar doing applet stuff :^)
2019-12-16 15:05:45 +01:00
Andreas Kling
648ed76085 ProfileViewer: Add a basic menu bar to make it look proper 2019-12-15 22:55:11 +01:00
Andreas Kling
0a75a46501 Kernel: Make sure the kernel info page is read-only for userspace
To enforce this, we create two separate mappings of the same underlying
physical page. A writable mapping for the kernel, and a read-only one
for userspace (the one returned by sys$get_kernel_info_page.)
2019-12-15 22:21:28 +01:00
Andreas Kling
77cf607cda Kernel+LibC: Publish a "kernel info page" and use it for gettimeofday()
This patch adds a single "kernel info page" that is mappable read-only
by any process and contains the current time of day.

This is then used to implement a version of gettimeofday() that doesn't
have to make a syscall.

To protect against race condition issues, the info page also has a
serial number which is incremented whenever the kernel updates the
contents of the page. Make sure to verify that the serial number is the
same before and after reading the information you want from the page.
2019-12-15 21:29:26 +01:00
Andreas Kling
931e4b7f5e Kernel+SystemMonitor: Prevent userspace access to process ELF image
Every process keeps its own ELF executable mapped in memory in case we
need to do symbol lookup (for backtraces, etc.)

Until now, it was mapped in a way that made it accessible to the
program, despite the program not having mapped it itself.
I don't really see a need for userspace to have access to this right
now, so let's lock things down a little bit.

This patch makes it inaccessible to userspace and exposes that fact
through /proc/PID/vm (per-region "user_accessible" flag.)
2019-12-15 20:11:57 +01:00
Andreas Kling
39a6d29b39 SystemMonitor: Make the memory map the "default view"
The memory map is a lot more interesting than the "open files" view :^)
2019-12-15 20:00:19 +01:00
Hüseyin ASLITÜRK
26c5d26045 WindowServer: Fix MenuManager item postitions after screen resolution change. 2019-12-15 19:50:54 +01:00
Hüseyin ASLITÜRK
22b190e4be DisplayProperties: Start at top left position for full view at low resoluations. 2019-12-15 19:50:54 +01:00
Andreas Kling
5292f6e78f Kernel+FileManager: Disallow watch_file() in unsupported file systems
Currently only Ext2FS and TmpFS supports InodeWatchers. We now fail
with ENOTSUPP if watch_file() is called on e.g ProcFS.

This fixes an issue with FileManager chewing up all the CPU when /proc
was opened. Watchers don't keep the watched Inode open, and when they
close, the watcher FD will EOF.

Since nothing else kept /proc open in FileManager, the watchers created
for it would EOF immediately, causing a refresh over and over.

Fixes #879.
2019-12-15 19:33:39 +01:00
Andreas Kling
7fea25943d LibGUI: Fix GTreeView column headers incorrectly scrolling with content 2019-12-15 18:17:02 +01:00
Andreas Kling
be0b527cfc ProfileViewer: Scale the sample columns by stack depth
From a nice suggestion by Nagy Tibor. :^)
2019-12-15 18:11:10 +01:00
Andreas Kling
7a64f55c0f Kernel: Fix get_register_dump_from_stack() after IRQ entry changes
I had to change the layout of RegisterDump a little bit to make the new
IRQ entry points work. This broke get_register_dump_from_stack() which
was expecting the RegisterDump to be badly aligned due to a goofy extra
16 bits which are no longer there.
2019-12-15 17:58:53 +01:00
Andreas Kling
063fef312e ProfileViewer: Convert the JSON samples into a more efficient format
Only do the conversion from JSON once. This makes it much faster to do
time range filtering with the timeline widget. :^)
2019-12-15 17:26:54 +01:00
Andreas Kling
d4a570d576 LibGUI: Fix GTreeView not showing the context menu
This logic is all taken care of by GAbstractColumnView now, so we can
simply delete GTreeView::context_menu_event(). :^)

Fixes an issue mentioned in #826
2019-12-15 17:02:44 +01:00
Andreas Kling
05a441afb2 Kernel: Don't turn private read-only regions into shared ones on fork
Even if they are read-only now, they can be mprotect(PROT_WRITE)'d in
the future, so we have to make sure they are CoW mapped.
2019-12-15 16:53:46 +01:00
Andreas Kling
3fbc50a350 Kernel+SystemMonitor: Expose the number of set CoW bits in each Region
This number tells us how many more pages in a given region will trigger
a CoW fault if written to.
2019-12-15 16:53:00 +01:00
Andreas Kling
9ad151c665 Kernel: Improve comment about the system virtual memory map a bit 2019-12-15 16:13:08 +01:00
Andreas Kling
f01fd54d1b Kernel: Make separate kernel entry points for each PIC IRQ
Instead of having a common entry point and looking at the PIC ISR to
figure out which IRQ we're servicing, just make a separate entryway
for each IRQ that pushes the IRQ number and jumps to a common routine.

This fixes a weird issue where incoming network packets would sometimes
cause the mouse to stop working. I didn't track it down further than
realizing we were sometimes EOI'ing the wrong IRQ.
2019-12-15 12:47:53 +01:00
gla3dr
12cc518d1e ProfileViewer: Fix copy-paste error :^)
Saw this copy-paste mistake in the ProfileViewer Timeline video
2019-12-15 10:11:48 +01:00