Commit graph

10664 commits

Author SHA1 Message Date
Nico Weber
afb03dd249 Ports: Make ninja use ppoll instead of pselect 2020-06-23 14:12:20 +02:00
Nico Weber
d2684a8645 LibC+Kernel: Implement ppoll
ppoll() is similar() to poll(), but it takes its timeout
as timespec instead of as int, and it takes an additional
sigmask parameter.

Change the sys$poll parameters to match ppoll() and implement
poll() in terms of ppoll().
2020-06-23 14:12:20 +02:00
devashish
4b19b99b36 JPGLoader: Move JPGLoader internal structs and #defines to JPGLoader.cpp 2020-06-23 13:51:19 +02:00
devashish
a8b00780a8 LibGfx: Integrate JPEG decoder with rest of the system
This patch adds functions like `load_jpeg` to JPGLoader to make the
JPEG decoder conform to the API that bitmap loader uses :^)
2020-06-23 13:51:19 +02:00
Devashish
8b71b839fa LibGfx+LibWeb: Add JPEG decoder and integrate with LibWeb
This patch adds support for JPEG decoding. The JPEG decoder is capable
of handling standard 2x1 horizontal, 2x1 vertical and quartered chroma
subsampling. The implemented Inverse DCT performs with a decent speed.

As of interchange formats, since we tend to ignore the metadata in APPn
markers, the decoder can handle any format compatible with JFIF, which
includes EXIFs and sometimes WebMs too. The decoder does not support
progressive JPEGs yet.
2020-06-23 13:51:19 +02:00
Andreas Kling
10255bc5c6 LibWeb+Browser: Decode non-animated images out-of-process :^)
We now use the ImageDecoder service in LibWeb for everything except
GIF images (we'll have to deal with them later, ofc.)

This has a little bit of overhead but we should be able to optimize
it until it becomes negligible.
2020-06-22 21:47:01 +02:00
Andreas Kling
b273b31c7d LibIPC: Silence some debug spam 2020-06-22 21:47:01 +02:00
Andreas Kling
e3782a7f99 ImageDecoder: Add a new service for out-of-process image decoding :^)
The new ImageDecoder service (available for members of "image" via
/tmp/portal/image) allows you to decode images in a separate process.

This will allow programs to confidently load untrusted images, since
the bulk of the security concerns are sandboxed to a separate process.

The only API right now is a synchronous IPC DecodeImage() call that
takes a shbuf with encoded image data and returns a shared buffer and
metadata for the decoded image.

It also comes with a very simple library for interfacing with the
ImageDecoder service: LibImageDecoderClient. The name is a bit of a
mouthful but I guess we can rename it later if we think of something
nicer to call it.

There's obviously a bit of overhead to spawning a separate process
for every image decode, so this is mostly only appropriate for
untrusted images (e.g stuff downloaded from the web) and not necessary
for trusted local images (e.g stuff in /res)
2020-06-22 21:47:00 +02:00
Andreas Kling
b191f24f05 LibCore: Remove some debug spam in Local{Server,Socket} 2020-06-22 21:21:38 +02:00
Andreas Kling
32dfde746a LibCore: Put safe_syscall() debug spam behind #ifdef 2020-06-22 21:19:10 +02:00
Andreas Kling
79d3c5723f SystemServer: Put some debug spam behind #ifdefs 2020-06-22 21:18:55 +02:00
Andreas Kling
4dbbe1885f Kernel: Silence debug spam on exec 2020-06-22 21:18:25 +02:00
Andreas Kling
8a1dbe5483 Kernel: Silence some debug spam in Scheduler 2020-06-22 21:18:16 +02:00
Andreas Kling
9ce25bbf1d LibWeb: Generate CanvasRenderingContext2D bindings from IDL :^)
We're still missing optional argument support, so this implementation
doesn't support fill(), only fill(fill_rule).

Still it's really nice to get rid of so much hand-written wrapper code.
2020-06-22 19:07:25 +02:00
Hüseyin ASLITÜRK
f361d25ec8 Base: Test web page and images for PPM image file type 2020-06-22 18:11:22 +02:00
Hüseyin ASLITÜRK
326032b138 LibGfx: Add PPM image file type support 2020-06-22 18:11:22 +02:00
Hüseyin ASLITÜRK
97aca8f251 LibWeb: Add "image/x‑portable‑pixmap" mime type for pbm file extension 2020-06-22 18:11:22 +02:00
Hüseyin ASLITÜRK
7f30d933b5 Base: Add PPM file type to QuickShow file type list 2020-06-22 18:11:22 +02:00
Nico Weber
7f73f0300c Ports: Add ninja
- 1.8.2 for now, newer versions need high-res timestamp file APIs
  which serenity doesn't have yet
- pselect() instead of ppoll() for now, same reason (depends on #2609)
- no good default for -j yet (see nproc.patch)
- `-l` probably doesn't work yet (see loadavg.patch), but I've never
  used that anyways
- some minor include patches that I've also sent upstream

Other than that, this seems to work reasonably well. It currently
produces some spam on stdout from probably the shell.
2020-06-22 16:10:06 +02:00
Nico Weber
d23e655c83 LibC: Implement pselect
pselect() is similar() to select(), but it takes its timeout
as timespec instead of as timeval, and it takes an additional
sigmask parameter.

Change the sys$select parameters to match pselect() and implement
select() in terms of pselect().
2020-06-22 16:00:20 +02:00
Nico Weber
29f509a2a0 LibC: Add timespec functions to sys/time.h
And rewrite the timeval functions as inline functions.

Also add the non-standard but fairly common and useful
TIMEVAL_TO_TIMESPEC / TIMESPEC_TO_TIMEVAL functions.
2020-06-22 16:00:20 +02:00
Nico Weber
9256757b59 AK: Add timespec_add and timespec_sub 2020-06-22 16:00:20 +02:00
stelar7
9e18005c64 LibJS: expose some more math functions 2020-06-22 10:33:50 +02:00
stelar7
b97da17b90 LibM: Add some more math functions 2020-06-22 10:33:50 +02:00
Andreas Kling
07d976716f LibWeb: Remove most uses of the old HTML parser
The only remaining client of the old parser is the fragment parser used
by the Element.innerHTML setter. We'll need to implement a bit more
stuff in the new parser before we can switch that over.
2020-06-21 22:29:05 +02:00
Andreas Kling
c9d55e3b80 Userland: Use Web::PageView::load_html() in the "html" utility 2020-06-21 22:04:26 +02:00
Andreas Kling
2ba9e9b9c9 HackStudio: Use Web::PageView::load_html() for the documentation popup
Also simplify the way we change the background color a little bit.
2020-06-21 21:54:30 +02:00
Andreas Kling
1f97897b40 TextEditor: Use Web::PageView::load_html() for the markdown preview 2020-06-21 21:54:30 +02:00
Andreas Kling
1c54272b41 Help: Use Web::PageView::load_html()
Instead of invoking the HTML parser directly.
2020-06-21 21:54:30 +02:00
Andreas Kling
6e27efe6c6 LibWeb: Add PageView::load_html() for loading HTML directly
When you're using Web::PageView as a GUI widget, you'll often just have
a chunk of HTML you want to show. So let's have an API for that.
2020-06-21 21:54:30 +02:00
Andreas Kling
59537cf257 WebContent: Turn it into a MultiInstance service :^)
Port the WebContent service to the new MultiInstance mechanism that
Sergey added. This means that every new WebContentView gets its very
own segregated WebContent process.
2020-06-21 21:54:30 +02:00
Andreas Kling
ed351c7493 LibIPC: Add setters for overriding the client/server PID if needed
Since SO_PEERCRED can only tell us who originally accepted the socket
on the other side, we'll sometimes need to negotiate PID info manually.
2020-06-21 21:54:30 +02:00
Andreas Kling
6bc40b20b8 LibCore: Add API for taking over an accepted socket from SystemServer
Core::LocalSocket::take_over_accepted_socket_from_system_server() now
allows you to construct a Core::LocalSocket for a pre-accepted socket
when using SystemServer's new AcceptSocketConnections mode.
2020-06-21 21:54:30 +02:00
Andreas Kling
457a687050 Userland: Remove "ht" test utility
The new HTML parser is well integrated into Browser now and we don't
need a separate tool for testing it. :^)
2020-06-21 21:54:30 +02:00
Linus Groh
4684e9a80f Build: Support GENERATED_SOURCES in serenity_{bin,libc}() as well 2020-06-21 20:24:28 +02:00
Andreas Kling
dd7cd92de4 LibWeb: Fix two typo bugs in table parsing
These were flushed out by the earlier fix to "table scope". Without the
bad implementation of table scopes, ACID2 stopped parsing correctly.
2020-06-21 17:49:02 +02:00
Andreas Kling
15b5dfc794 LibWeb: A </table> inside <tbody> is not a parse error
This condition was backwards. Fixes parsing of google.com.
2020-06-21 17:42:00 +02:00
Andreas Kling
1c2b6b074e LibWeb: Fix misunderstood implementation of "table" and "select" scopes
These "stack of open elements" scopes are not supposed to include the
base list of element types.
2020-06-21 17:42:00 +02:00
Andreas Kling
966bc05fef LibWeb: Implement more of the foster parenting algorithm in the parser 2020-06-21 17:42:00 +02:00
Andreas Kling
213e2793bd LibWeb: Add Node.insertBefore(Node node, Node? child) 2020-06-21 17:42:00 +02:00
Paul Roukema
82a75bcf5f LibGfx: Prefer the largest image in the file when loading an ICO
Since the current image handling APIs don't provide a way to handle a
file which can contain multiple images, we just pick the largest one.
This gives the best chance of a good looking result.
2020-06-21 17:41:52 +02:00
Paul Roukema
b1e3f728a1 LibGfx: Add support for uncompressed/classic ICO files
This add support to the ICO file decoder for loading uncompressed bitmap icon files.
 It is limited to 32-bit color icons, no 4/8/16 bit or paletted formats yet.
 This is in addition to the PNG compressed ICO format support  added previously.
 With this we can now load the favicons for github, google and twitter.
2020-06-21 17:41:52 +02:00
Paul Roukema
140581d0c3 LibGfx: Initial support for ICO image files.
This adds support for loading the first image from ICO format images only if they are PNG encoded.
This is useful for loading favicons, which are sometimes PNGs with an ICO extension and sometimes actual ICO files.
In particular we can now load the favicon from new.ycombinator.com
2020-06-21 17:41:52 +02:00
Matthew Olsson
ce574d62f6
Meta: Add CLion directories to .gitignore (#2607) 2020-06-21 16:46:50 +02:00
Hüseyin ASLITÜRK
5d0734d9ea Base: Test web page and images for PBM image file type 2020-06-21 16:42:46 +02:00
Hüseyin ASLITÜRK
9ab82c0ee5 LibGfx: Add PBM image file type support 2020-06-21 16:42:46 +02:00
Hüseyin ASLITÜRK
41d5531624 LibWeb: Add "image/x‑portable‑bitmap" mime type for pbm file extension 2020-06-21 16:42:46 +02:00
Hüseyin ASLITÜRK
58c3356472 Base: Add pbm file type to QuickShow file type list 2020-06-21 16:42:46 +02:00
Hüseyin ASLITÜRK
671560a844 LibGUI: Bug fix on GUI::Image when image is nullptr
This bug cause to FilePicker crash when second image selected for preview. FilePicker sets bitmap to "nullptr" clear preview.
2020-06-21 16:42:46 +02:00
Andreas Kling
e1bd815a6a LibWeb: Generate Event and MouseEvent bindings from IDL :^)
We still have to hand-write a function to turn an Event& into a wrapper
but this is still a hue improvement. Eventually we'll find a way to
auto-generate that function as well.
2020-06-21 16:12:28 +02:00