Commit graph

14741 commits

Author SHA1 Message Date
Andreas Kling
d1479aef56 LibWeb: Layout absolutely positioned children *after* computing height
This is required for CSS "bottom" to work correctly on absolutely
positioned elements.
2020-12-14 11:33:11 +01:00
Andreas Kling
8b9f2c41fa LibWeb: Don't replace selection on key press in non-editable content 2020-12-14 10:58:10 +01:00
Andreas Kling
19144b753a LibWeb: Make StyleProperties::length_box() default to auto values
Undefined length values can default to auto in all length boxes and
we'll get the values we need. This saves us from having to deal with
undefined lengths later on in layout.

At some point we should break the style application process into
a few more formal steps, but this at least simplifies some things.
2020-12-14 10:53:40 +01:00
Andreas Kling
3c9dcec442 LibWeb: Merge Document::layout() and Document::update_layout()
There is now only Document::update_layout().
2020-12-14 10:39:57 +01:00
AnotherTest
dbfce38c90 LibTLS: Read subjectAltName from certificates and use it
As quite a few certificates use this extension, reading and using it to
find matching certificates is fairly useful :^)
2020-12-13 20:24:58 +01:00
Andreas Kling
48589db3aa Kernel/Net: Socket connected state change should reevaluate blocks
This fixes an issue where TCP sockets could get into the Established
state too quickly and fail to unblock a subsequent sys$select() call.

This makes websites load *significantly* faster. :^)
2020-12-13 19:15:42 +01:00
Andreas Kling
7b735b55e1 LibWeb: Set the encoding of HTML documents
Now that we attach the document to the frame before parsing, we have
to make sure we set the encoding on the document before parsing, or
things may not turn out well.
2020-12-13 18:21:52 +01:00
Andreas Kling
024059b49b LibTextCodec: Normalize incoming encodings in decoder_for()
Instead of asserting when you call TextCoded::decoder_for() with a
non-standard encoding name, let's be nice and see if we can't find a
decoder for the standardized version of the encoding name.
2020-12-13 18:20:50 +01:00
Andreas Kling
986ce57be9 LibTLS: TLSv12::read_line() should chomp result string
Match the Core::IODevice::read_line() API change and return a chomped
string from here as well.
2020-12-13 18:19:32 +01:00
Andreas Kling
b73d0bb6c8 LibWeb: Update stale #includes for HTML/TagNames.* move 2020-12-13 17:54:40 +01:00
Andreas Kling
1eee6716e0 LibWeb: Attach DOM::Document to its frame before parsing
FrameLoader now begins by constructing a DOM::Document, and then builds
a document tree inside it based on the MIME type. For text/html we pass
control to the HTMLDocumentParser as before.

This gives us access to things like window.alert() during parsing.

Fixes #3973.
2020-12-13 17:40:48 +01:00
Andreas Kling
22c582a887 LibWeb: Make HTMLDocumentParser take an existing document
We shouldn't really be creating the document objects inside the parser,
since that makes it hard to hook up e.g JavaScript bindings early on.
2020-12-13 16:59:22 +01:00
Andreas Kling
4dbecf0b65 LibWeb: Move DOM/TagNames.* => HTML/TagNames.* 2020-12-13 15:57:09 +01:00
Andreas Kling
59afcddcfe LibWeb: Mark element style dirty on style/id attribute change too 2020-12-13 15:22:41 +01:00
Andreas Kling
294ec3b6a5 LibWeb: Mark element style dirty when class attribute changes
Fixes #4403.
2020-12-13 15:22:22 +01:00
Andreas Kling
6af55a234f LibWeb: Make DOM::Node::set_needs_style_update() schedule the update
After you mark a node as needing new style, there's no situation in
which we don't want a style update to happen, so just take care of
scheduling it automatically.
2020-12-13 15:19:42 +01:00
Andreas Kling
b9b7b2b28a LibCore: Make IODevice::read_line() return a String
Almost everyone using this API actually wanted String instead of a
ByteBuffer anyway, and there were a bunch of slightly different ways
clients would convert to String.

Let's just cut out all the confusion and make it return String. :^)
2020-12-13 11:54:11 +01:00
Andreas Kling
4da327d650 DisplaySettings: Allow unsetting the wallpaper
It was previously not possible to unset the wallpaper once set,
since loading an image from the path "" would always fail.
2020-12-13 11:49:18 +01:00
Andreas Kling
545ed01e7d DisplaySettings: Remove a bunch of unnecessary "this->" 2020-12-13 11:49:18 +01:00
Andreas Kling
919d3dc56f DisplaySettings: Improve contrast of screen resolution label
Since we're putting this on top of the wallpaper preview, let's make
it white with a black shadow to ensure that it's always readable.
2020-12-13 11:49:18 +01:00
Andreas Kling
3ee5694e97 LibGUI: Simplify ComboBox/TextEditor relationship a bit
Instead of TextEditor knowing about the ComboBox button on the right
hand side, we now make ComboBox inherit from GUI::Frame, and make the
inner text editor widget frameless.

This allows us to place the button ourselves inside ComboBox without
any frame artifacts, and TextEditor no longer needs to keep track of
the geometry of that button.
2020-12-13 11:49:18 +01:00
Conrad Pankoff
a01d11ac19 AK: Add {encode,decode}_hex similar to {encode,decode}_base64 2020-12-13 11:00:20 +01:00
Linus Groh
f7bd6e2b34 Welcome: Fix reading of welcome.txt file
The buffer returned by read_line() used to be null-terminated, however
that was changed in 129a58a, resulting in some line strings containing
garbage data. Explicitly telling the String constructor the buffer's
size fixes that.

Fixes #4397.
2020-12-13 11:00:11 +01:00
Daniel Lemos
94c56d16b3
Toolchain: Bump Ubuntu version to 20.10 in the Dockerfile (#4401) 2020-12-13 11:00:00 +01:00
Conrad Pankoff
13f13a9e59 AK: Fix urlencode() with high byte values
Previously urlencode() would encode bytes above 127 incorrectly, printing
them as negative hex values.
2020-12-12 23:50:23 +01:00
Andreas Kling
9d442ba606 LibWeb: Store layout box model metrics as floats
Instead of storing them as CSS::Lengths, we now store the resolved
values for margin/padding/border/offset top/right/bottom/left with
each Layout::NodeWithStyleAndBoxModelMetrics.

This simplifies a lot of code since it's no longer necessary to
resolve values before using them.
2020-12-12 21:28:29 +01:00
Tom
1042762deb Kernel: Fix block recursion
Since the process lock is using the Lock class, re-locking the process
lock may cause another call to Thread::block. This caused some problems
with multiple blockers attempting to be used at the same time. To solve
this problem, remember if the process lock was held, and if it was then
relock after we're done with the blockers, just before returning.
2020-12-12 21:28:12 +01:00
Tom
c455fc2030 Kernel: Change wait blocking to Process-only blocking
This prevents zombies created by multi-threaded applications and brings
our model back to closer to what other OSs do.

This also means that SIGSTOP needs to halt all threads, and SIGCONT needs
to resume those threads.
2020-12-12 21:28:12 +01:00
Tom
47ede74326 Kernel: Execute timer handlers outside of irq handler
This allows us to do things in timer handlers that involve e.g. scheduling,
such as using the Lock class or unblocking threads.
2020-12-12 21:28:12 +01:00
Tom
4bbee00650 Kernel: disown should unblock any potential waiters
This is necessary because if a process changes the state to Stopped
or resumes from that state, a wait entry is created in the parent
process. So, if a child process does this before disown is called,
we need to clear those entries to avoid leaking references/zombies
that won't be cleaned up until the former parent exits.

This also should solve an even more unlikely corner case where another
thread is waiting on a pid that is being disowned by another thread.
2020-12-12 21:28:12 +01:00
Tom
bcb9363a97 LibPthread: Return errors as positive return values
pthread implementations generally return errors as a positive non-zero
value. Our kernel generally returns errors as negative values. If we
receive a negative value from a system call, turn it into a positive
return value to relay the error appropriately.

Also, fix the tt test utility to not rely on errno, as the pthread
library does not use errno.
2020-12-12 21:28:12 +01:00
Tom
da5cc34ebb Kernel: Fix some issues related to fixes and block conditions
Fix some problems with join blocks where the joining thread block
condition was added twice, which lead to a crash when trying to
unblock that condition a second time.

Deferred block condition evaluation by File objects were also not
properly keeping the File object alive, which lead to some random
crashes and corruption problems.

Other problems were caused by the fact that the Queued state didn't
handle signals/interruptions consistently. To solve these issues we
remove this state entirely, along with Thread::wait_on and change
the WaitQueue into a BlockCondition instead.

Also, deliver signals even if there isn't going to be a context switch
to another thread.

Fixes #4336 and #4330
2020-12-12 21:28:12 +01:00
AnotherTest
0918d8b1f8 LibGfx: Make fill_path() less bad at filling paths
This patchset fixes:
- Some parts of the path being skipped and not drawn (often horizontal)
- The filled shape moving around on an int grid depending on the winding
  number
- Winding number mess-up with four-way intersections
2020-12-12 20:10:04 +01:00
Linus Groh
af80d71abc Spreadsheet: Reduce top bar default height
50px is a bit extreme, it's down to 26px high now. Still a bit larger
than a regular GUI::TextBox but enough to look decent, even with the
help button in there.

Closes #3905.
2020-12-12 20:09:55 +01:00
xspager
dd198e1a29 AK::URL: Fix setting the port number in the case it was the last element of the URL 2020-12-12 20:09:42 +01:00
Andreas Kling
2b8c7faee4 LibWeb: Use the margin box of floating elements for flowing around
Inline content flows around the entire margin box of floating elements,
not just the content box.
2020-12-12 19:59:24 +01:00
Andreas Kling
66e9dde86f LibWeb: Don't place floating boxes before everything else
Instead, just handle them as we go about laying out block-level boxes.
2020-12-12 19:31:46 +01:00
Andreas Kling
ec89302fbe LibWeb: Make the ad-hoc CSS parser a little more tolerant
Just bail when encountering some unexpected character. This makes it
much more tolerable to type a stylesheet into TextEditor with live
HTML preview enabled.
2020-12-12 11:47:11 +01:00
Andreas Kling
b60801a9ba LibWeb: Apply 'min-width' and 'max-width' constraints to replaced boxes
This is definitely not 100% correct but I tried implementing the basic
algorithms described in CSS 2.2. It's good enough to render the penguin
on @linusg's homepage at the right size. :^)
2020-12-12 00:29:49 +01:00
Andreas Kling
63067ada68 Meta: Add Luke Wilde to the contributors list :^) 2020-12-11 23:29:30 +01:00
Andreas Kling
97d789c75b Kernel: Fix null dereference when execve'ing ELF without PT_TLS header
Fixes #4387.
2020-12-11 22:59:46 +01:00
Andreas Kling
552ba1b0a3 LibWeb: Remove some unnecessary is_replaced() checks in BFC
BFC::compute_width() has a short-circuit path for replaced elements.
2020-12-11 22:59:46 +01:00
Andreas Kling
67732df034 LibWeb: Move replaced element layout out of Layout::ReplacedBox
Replaced elements are now laid out by the current formatting context.
Since the logic is almost identical in BFC and IFC, it's implemented
by static helpers in FormattingContext.
2020-12-11 22:59:46 +01:00
Andreas Kling
e8d6691470 LibWeb: Fix inline-block width computation with no specified width
Undefined width should be treated the same as width:auto;
2020-12-11 22:59:46 +01:00
Andreas Kling
aec54af04f LibDebug: Clean up DebugSession construction a little bit
No need to wrap MappedFile in a NonnullOwnPtr. Also make the session
constructor private and use adopt_own().
2020-12-11 22:59:46 +01:00
Tom
03fcd02dfd Kernel: Fix leaking Timer instances
When a Timer is queued we add a reference, so whenever we remove
a timer or fire it we should drop that reference.

Fixes #4382
2020-12-11 19:33:15 +01:00
Sahan Fernando
66f9a2d9ec LibDebug: Fix crash when debugging short lived programs 2020-12-11 09:55:31 +01:00
Zac
1851da9c93 FileManager: Added context menu for right-clicks on desktop icons.
Moved the same copy/paste/properties/delete functionality used in the
run_in_windowed_mode() method to the run_in_desktop_mode() method.
2020-12-11 09:36:44 +01:00
Zac
dea399ff08 FileManager: focus_dependent_delete_action is correctly enabled/disabled
The focus_dependent_delete_action that sits in the file manager's
toolbar would always remain enabled, even if nothing was selected,
activating it if nothing was selected would then crash the application.

The action is now correctly enabled/disabled, but due to the way
selection works in TreeViews, something is always selected, what really
matters is if the TreeView has something selected, and it has focus.
As it currently stands, there is no way to know when the TreeView's
is_focused status changes. In order for this to work I added a callback
to the Widget class which fires when a widget receives or looses focus.
In that callback, the focus_dependent_delete_action's enabled value is
recalculated.
2020-12-11 09:36:44 +01:00
Zac
df44ab8599 FileManager: TreeView accepts drags from the DirectoryView. 2020-12-11 09:36:44 +01:00