Commit graph

5206 commits

Author SHA1 Message Date
Andreas Kling 5a04472470 LibHTML: Fix bug in removal of trailing whitespace from line boxes
This code was using the text from the DOM as a reference for how much
whitespace to remove from the end of a line box.

Since the DOM may contain uncollapsed whitespace, it would sometimes
be out of sync with the collapsed text used by the rest of the layout
system.
2019-11-19 19:21:47 +01:00
Andreas Kling 1fe2cca439 LibHTML: Use LayoutText::text_for_rendering() in layout tree dumps
This way the fragment offsets make a lot more sense, since they assume
whitespace has already been collapsed.
2019-11-19 18:36:33 +01:00
Andreas Kling dce7646882 LibHTML: Failed font lookups should use a bold fallback when fitting
If we fail to find the font specified by a page, but we do have some
font-weight information, use a bold fallback font for bold weights.
2019-11-19 18:23:58 +01:00
Andreas Kling 1fd5869490 LibHTML: Tolerate empty CSS rules
A rule that contains nothing but whitespace is still a valid rule.
2019-11-19 18:23:18 +01:00
Andreas Kling 56dad2272c LibHTML: Implement the universal selector ("*") 2019-11-19 18:23:09 +01:00
Andreas Kling 516708aab2 LibHTML: Don't crash when stringifying an unknown CSS property
Instead, just log that it happened, and then we can track it down.
2019-11-19 18:21:12 +01:00
Andreas Kling e87b9e2d7c LibHTML: Add the CSS "position" property to CSS/Properties.json 2019-11-19 18:20:54 +01:00
Andreas Kling 0405ab91aa LibHTML+AK: Move URL completion from Document to AK::URL
Completing a relative URL based on a base URL seems like generally
useful functionality.
2019-11-19 17:46:36 +01:00
Sergey Bugaev 47326042c5 Ports: Make sure Bash loads its built-in commands statically
Bash's configure script is checking whether the system has dlopen().
We do, but it doesn't actually work (yet). So patch the check out.
2019-11-19 16:03:25 +01:00
Sergey Bugaev 63cef4bd5f Ports: Fix ignoring patches
According to gitignore docs,

> It is not possible to re-include a file if a parent directory of that file is excluded.

So make sure to re-include "*/patches" before trying to re-include "*/patches/*".
This commit also converts the .gitignore file to have Unix line endings.
2019-11-19 16:03:25 +01:00
Sergey Bugaev 16b9b3f228 Kernel: Don't interrupt short writes
Remove explicit checking for pending signals from writing code paths,
since this is handled automatically when blocking, and should not
happen if the write() call is "short", i.e. doesn't block. All the
other syscalls already work like this.

Fixes https://github.com/SerenityOS/serenity/issues/797
2019-11-19 14:07:24 +01:00
Andreas Kling 0ddde627b1 Lagom: Fix build 2019-11-19 11:14:26 +01:00
Andreas Kling a12292bd03 LibHTML: LayoutImage should not dereference a null bitmap
This was happening when trying to render a bitmap that we couldn't
decode properly.
2019-11-18 20:26:32 +01:00
Andreas Kling 89a0d873ba LibHTML: Update tree dumping code now that everything is floating point 2019-11-18 20:26:15 +01:00
Andreas Kling 15fb341eb4 HackStudio: Always re-match curlies/parens after a re-highlight
While you are typing in HackStudio, we re-lex the C++ as you type,
so this means we also need to keep re-checking for matching curlies and
parentheses at the cursor.

Fixes #769 (although it's not optional, because it's too cool. :^)
2019-11-18 19:21:18 +01:00
Andreas Kling d5afc58744 HackStudio: Highlight maching parentheses as well
This can just piggyback on the code I just wrote for curly braces.
2019-11-18 19:13:46 +01:00
Andreas Kling c8e02e60a6 HackStudio+LibGUI: Implement matching curly brace highlighting
This works for C++ syntax highlighted text documents by caching the C++
token type in a new "arbitrary data" member of GTextDocumentSpan.

When the cursor is placed immediately before a '{' or immediately after
a '}', we highlight both of these brace buddies by changing their
corresponding spans to have a different background color.

..and spans can also now have a custom background color. :^)
2019-11-18 19:10:06 +01:00
Andreas Kling 5f7f97355e LibDraw: Add named colors "MidCyan" and "DarkCyan"
I need these for .. a thing. :^)
2019-11-18 19:02:10 +01:00
Andreas Kling 7b3f1218be little: Make this build by default, and add some curlies 2019-11-18 19:01:50 +01:00
Andreas Kling 0e9e70ca4f IPv4: Disconnected non-blocking sockets were not signalling EOF
After a socket has disconnected, we shouldn't return -EAGAIN. Instead
we should allow userspace to read/recvfrom the socket until its packet
queue has been exhausted.

At that point, we now return 0, signalling EOF.

It might be even better to start returning -ENOTCONN after signalling
EOF once. I'm not sure how that should work, needs looking into.
2019-11-18 17:37:54 +01:00
Andreas Kling b7a840fd0d LibHTML: Respect the line-height property if set
It's now possible to override the line-height via CSS. It will still
default to 1.4 if not specified.
2019-11-18 16:54:20 +01:00
Andreas Kling a14cc573b0 LibHTML: Implement some basic floating point CSS value parsing 2019-11-18 16:54:03 +01:00
Andreas Kling b0f38c1733 Build: Oops, typo in the path to LibHTML code generators in makeall.sh
This worked locally because I already had the built generators lying
around, but failed for other people who hadn't built them yet. Oops!
2019-11-18 16:45:14 +01:00
Andreas Kling c628ebda0f LibHTML: Use floating point numbers throughout the layout tree 2019-11-18 16:30:18 +01:00
Andreas Kling da23864c8d LibHTML: Let's just build host-side tools in makeall.sh instead
Instead of trying to build the host-side code generator helpers right
before we need them in the LibHTML build process, just build them ahead
of time in makeall.sh, like we already do for {IPC,Form}Compiler.
2019-11-18 16:30:18 +01:00
Andreas Kling 85d7afb6df LibHTML: Make all .cpp files implicitly depend on the generated sources
Hopefully this will make Travis generate sources before building all
the other files.
2019-11-18 15:36:30 +01:00
Andreas Kling a116a4a180 LibHTML: Get rid of dual Makefile setup
It's no longer possible to build LibHTML on the host machine since it
depends on LibGUI now. This patch gets rid of the dual Makefiles in
LibHTML since we only support Serenity builds anyway.

Also clean the code generator directory before building it.
2019-11-18 14:51:46 +01:00
Andreas Kling 1309c45cc6 LibHTML: Fix code generator dependencies for initial build
Fixes #796.
2019-11-18 13:09:33 +01:00
Andreas Kling c23addd1fb Kernel: When userspaces calls a removed syscall, fail with ENOSYS
This is a bit gentler than jumping to 0x0, which always crashes the
whole process. Also log a debug message about what happened, and let
the user know that it's probably time to rebuild the program.
2019-11-18 12:35:14 +01:00
Andreas Kling 040fee370d LibHTML: Expand the "padding" shorthand property
This expands in the same way as "margin".
2019-11-18 12:34:52 +01:00
Andreas Kling b08de46480 LibHTML: Implement basic 'max-width' and 'min-width' support
These CSS properties constrain the computed width of a block-level box
to a maximum, followed by a minimum value.

This makes the "better mother fricken website" look more like it's
intended to (which helps makes the author's point, I suppose.)
2019-11-18 12:26:08 +01:00
Andreas Kling df16c9676b LibHTML: Tolerate "px" suffix on CSS lengths
We only support "px" units (and "auto") but we shouldn't choke just
because someone actually says "10px" instead of just "10"
2019-11-18 12:15:23 +01:00
Andreas Kling 00d171e4d6 LibHTML: Implement the "margin" shorthand property
This is a very bulky way of doing this, and doesn't seem sustainable to
implement every shorthand property this way, but it's a place to start.

The "margin" CSS property now expands into its four longhands as far as
my understanding of the specs.

Note that shorthand expansion happens when we *resolve* style, not when
we parse CSS. I'm not sure this is correct anymore, I think other UA's
may actually expand shorthands into the declaration directly at parse
these days. If so, we should do this at parsing as well.
2019-11-18 11:51:02 +01:00
Andreas Kling e6e41e4fb8 LibHTML: Start building a simple code generator for CSS properties
Code for parsing and stringifying CSS properties is now generated based
on LibHTML/CSS/Properties.json

At the moment, the file tells us three things:

- The name of a property
- Its initial value
- Whether it's inherited

Also, for shorthand properties, it provides a list of all the longhand
properties it may expand too. This is not actually used in the engine
yet though.

This *finally* makes layout tree dumps show the names of CSS properties
in effect, instead of "CSS::PropertyID(32)" and such. :^)
2019-11-18 11:48:41 +01:00
Andreas Kling dcd10149fe Lagom: Move this into Meta/
This is more of a meta thing, since it's not seeing active development,
but is just a way for me to build some Serenity parts and include them
in other projects. Move it out of the root to keep things tidy.
2019-11-18 09:07:05 +01:00
Andrew Kaster 618aebdd8a Kernel+LibPthread: pthread_create handles pthread_attr_t
Add an initial implementation of pthread attributes for:
  * detach state (joinable, detached)
  * schedule params (just priority)
  * guard page size (as skeleton) (requires kernel support maybe?)
  * stack size and user-provided stack location (4 or 8 MB only, must be aligned)

Add some tests too, to the thread test program.

Also, LibC: Move pthread declarations to sys/types.h, where they belong.
2019-11-18 09:04:32 +01:00
Dan MacDonald aae26a3a1e LibC: Add O_ACCMODE to fcntl.h 2019-11-18 08:55:45 +01:00
Andreas Kling 39190402e4 Ports: Upgrade the vim port to build with more features :^)
Previously we were only able to build with --with-features=small.
Thanks to all the compatibility work done in the kernel and LibC over
the last couple of months, we can now build --with-features=normal.

It's not the biggest deal in the world, but it's pretty nice to see
this kind of progress!
2019-11-17 21:03:41 +01:00
Andreas Kling 9c35feb14c LibC: jmp_buf and sigjmp_buf should be distinct types
This makes it possible to build 'vim' with more features enabled.
2019-11-17 21:01:26 +01:00
Andreas Kling 5eef2f78b0 LibC: isatty() should return 1 for success, 0 for error 2019-11-17 20:11:56 +01:00
Andreas Kling 70e220a81f Docs: Add note about EINVAL to isatty(3) 2019-11-17 20:09:12 +01:00
Andreas Kling 1bb296ea70 Docs: Add isatty(3) man page 2019-11-17 20:03:42 +01:00
Andreas Kling 3da6d89d1f Kernel+LibC: Remove the isatty() syscall
This can be implemented entirely in userspace by calling tcgetattr().
To avoid screwing up the syscall indexes, this patch also adds a
mechanism for removing a syscall without shifting the index of other
syscalls.

Note that ports will still have to be rebuilt after this change,
as their LibC code will try to make the isatty() syscall on startup.
2019-11-17 20:03:42 +01:00
Andreas Kling 3d558f47b0 Docs: Add uname(1) and uname(2) man pages 2019-11-17 19:48:11 +01:00
Andreas Kling 3093b019d0 Kernel: Let's have sys$uname() report "i686" instead of "i386"
We wouldn't be able to run on an 80386 without considerable changes,
so let's be honest here and call it i686.
2019-11-17 19:39:12 +01:00
Andreas Kling 189f234b47 Docs: Add info about -T and -t to crash(1) 2019-11-17 19:23:35 +01:00
Andreas Kling 8ccbd7002b Ext2FS: Rename allocate_inode() => find_a_free_inode()
Since this function doesn't actually mark the inode as allocated,
let's tone down the name a little bit.
2019-11-17 19:19:02 +01:00
Andreas Kling a712d4ac0c Ext2FS: Writing to a slow symlink should not treat it like a fast one
We would misinterpret short writes to the first 60 bytes of a slow
symlink as writes to a fast symlink.
2019-11-17 19:19:00 +01:00
Andreas Kling 5d08665d9a Ext2FS: Remove unnecessary extra cache lookup in get_inode() 2019-11-17 19:11:19 +01:00
Andreas Kling ba997c0a72 Ext2FS: Add some FIXME's while browsing this code 2019-11-17 18:59:14 +01:00