Commit graph

10366 commits

Author SHA1 Message Date
Sergey Bugaev
5624f8d8ee AK: ALWAYS_INLINE most Atomic<T> methods 2020-06-12 16:08:45 +02:00
Sergey Bugaev
4d65466f02 AK: Fix missing ptrdiff_t in non-Serenity builds
We have to include <stddef.h> to get its definition.
2020-06-12 16:08:45 +02:00
Andreas Kling
08f29be87a LibWeb: Remove absolutely positioned elements from the normal flow
Skip over absolutely positioned children when laying out the inline
children of a block. This takes them out of the flow and allows them
to be positioned correctly relative to the (absolute) containing block.
2020-06-12 15:27:52 +02:00
Andreas Kling
f3ea8d49a9 LibWeb: Remove absolute positioning logic from LayoutReplaced
Absolutely positioned elements are placed by their containing block.
Instead of trying to compute its own position, LayoutReplaced will
now simply add itself as an absolutely positioned descendant of its
containing block.
2020-06-12 15:24:33 +02:00
Andreas Kling
137f6d44ec LibWeb: Add basic support for position:fixed
Fixed position elements have the ICB as their containing block.
The magic of fixed positioning is implemented at the rendering stage,
where we temporarily translate painting by the current scroll offset.

Note that "absolutely positioned" includes both position:absolute
and position:fixed.
2020-06-12 14:20:07 +02:00
Andreas Kling
bd33bfd120 LibWeb: Whine about unrecognized CSS properties in debug log 2020-06-12 14:15:55 +02:00
Andreas Kling
9cbef10bdd LibWeb: Rename BoxModelMetrics::full_margin() => margin_box()
This matches the other member names (padding_box() and border_box().)
2020-06-12 13:44:11 +02:00
Andreas Kling
260427f0ad LibWeb: Some improvements to absolute positioning
Absolutely positioned blocks now register themselves with their
containing block (and note that the containing block of an absolutely
positioned box is the nearest non-statically positioned block ancestor
or the ICB as fallback.)

Containing blocks then drive the layout of their tracked absolutely
positioned descendants as a separate layout pass.

This is very far from perfect but the general direction seems good.
2020-06-12 13:43:46 +02:00
Andreas Kling
ff2c949d70 LibWeb: Include class names in layout tree dumps
This makes it a lot easier to see which layout node is which DOM node.
2020-06-12 13:23:07 +02:00
Andreas Kling
6f1b5fc0ab LibIPC: Actually use the new Core::Timer::restart() I just added
Thanks @brynet for noticing. :^)
2020-06-12 09:13:27 +02:00
Andreas Kling
2ce2c4810a LibIPC+WindowServer+LibGUI: Detect and highlight unresponsive GUI apps
IPC::ClientConnection now tracks the time since the last time we got
a message from the client and calls a virtual function on itself after
3 seconds: may_have_become_unresponsive().

Subclasses of ClientConnection can then react to this if they like.

We use this mechanism in WindowServer to send out a friendly Ping
message to the client. If he doesn't Pong within 1 second, we mark
the client as "unresponsive" and recompose all of his windows with
a darkened appearance and amended title until he Pongs us.

This is a little on the aggressive side and we should figure out a way
to wake up less often. Perhaps this could only be done to windows the
user is currently interacting with, for example.

Anyways, this is pretty cool! :^)
2020-06-11 22:46:49 +02:00
Andreas Kling
940fbea3a7 LibCore: Fix typo in Forward.h 2020-06-11 22:44:54 +02:00
Andreas Kling
7bb4f3764c LibCore: Add Timer::restart() convenience API
This simply restarts the timer with the existing millisecond interval.
2020-06-11 22:35:37 +02:00
thankyouverycool
5a71a57435 LibGfx: Return paint_button() earlier and replace overdrawn rect
Return StylePainter::paint_button() before color initializations
when possible and replace an overdrawn rect in paint_button_new()
with more explicit shadow lines. Also standardize some comments.
2020-06-11 16:56:17 +02:00
Andreas Kling
fea77abcf6 LibGfx: Fail PNG decoding on invalid scanline filter
Only filter types 0 thru 4 are valid.
2020-06-11 16:27:54 +02:00
Andreas Kling
d59a308c7e LibGfx: Minor tweaks in PNG decoder 2020-06-11 16:27:54 +02:00
Matthew Olsson
78155a6668 LibJS: Consolidate error messages into ErrorTypes.h
Now, exceptions can be thrown with
interpreter.throw_exception<T>(ErrorType:TYPE, "format", "args",
"here").
2020-06-11 07:46:20 +02:00
thankyouverycool
9940a7f6de LibGfx: Return correct color for palette.hover_highlight()
Now correctly returns HoverHighlight instead of ThreedHighlight.
2020-06-10 21:50:33 +02:00
Andreas Kling
01bb6f0249 LibWeb: Don't try to expand shorthands from non-string CSS values
If something is already e.g a length or a color value, we don't need
to try to expand it by stringifying and looking at the parts.
2020-06-10 19:34:49 +02:00
thankyouverycool
c8acd7d5bf LibGfx: Visual enhancement to buttons
This adds a "shine" effect to the bottom-right edges of pressed
and checked buttons, complementing the sunken shadow already
present at top-left and creating greater illusion of depth.

It is similar to the effect used in classic Windows and is
theme agnostic in Serenity, but produces the best result when
ThreedHighlight is a radiant color of Button.
2020-06-10 19:21:43 +02:00
Andreas Kling
3aca84a299 LibGfx: Use size_t for the Streamer offset and sizes 2020-06-10 18:59:58 +02:00
Andreas Kling
9c786cd7e0 LibWeb: Expand "background: url()" into "background-image: url()"
This gives us a yellow forehead on ACID2! :^)
2020-06-10 17:47:04 +02:00
Andreas Kling
ff6de8a169 AK: URL should urldecode data: URL payloads
Otherwise we can end up with percent-encoded nonsense in base64 data
which does not decode correctly.
2020-06-10 17:45:34 +02:00
Andreas Kling
2622ead6c6 LibWeb: Expand 2-part border-width shorthand CSS properties 2020-06-10 16:42:58 +02:00
Andreas Kling
7fe2f5f170 LibWeb: Apply style rules in order of specificity (kinda)
We now sort the matched rules by the specificity of the first selector
in them. This is not perfect, since a rule can have multiple selectors,
but it is a nice chin-related progression on ACID2. :^)
2020-06-10 16:42:36 +02:00
Andreas Kling
4e1939c635 LibWeb: Expand border-{top,right,bottom-left} CSS shorthand properties
This code is pretty rough, but it's something that will also improve
with the eventual new CSS parser.
2020-06-10 16:14:31 +02:00
Andreas Kling
2b489f492d Base: Put the ACID2 test on the browser bookmarks bar :^) 2020-06-10 16:14:09 +02:00
Andreas Kling
03da686aa2 LibWeb: Ignore backslashes (\) in attribute selectors
This makes us at least parse selectors like [foo=bar\ baz] correctly.
The current solution here is quite hackish but the real fix will come
when we implement a spec-compliant CSS parser.
2020-06-10 15:50:07 +02:00
Andreas Kling
65c4e5cacf LibWeb: Parse and match basic "contains" attribute selectors (~=) 2020-06-10 15:43:41 +02:00
Andreas Kling
a38a5d50ab LibWeb: Constrain block height by the max-height if specified 2020-06-10 15:29:11 +02:00
Andreas Kling
116cf92156 LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
2020-06-10 10:59:04 +02:00
Andreas Kling
656b01eb0f LibWeb: Rework the layout engine to use relative offsets
The box tree and line boxes now all store a relative offset from their
containing block, instead of an absolute (document-relative) position.

This removes a huge pain point from the layout system which was having
to adjust offsets recursively when something moved. It also makes some
layout logic significantly simpler.

Every box can still find its absolute position by walking its chain
of containing blocks and accumulating the translation from the root.
This is currently what we do both for rendering and hit testing.
2020-06-10 10:46:57 +02:00
Andreas Kling
e836f09094 LibWeb: Fix parser interpreting "&quot;" as "&quot"
There was a logic mistake in the entity parser that chose the shorter
matching entity instead of the longer. Fix this and make the entity
lists constexpr while we're here.
2020-06-10 10:34:28 +02:00
Andreas Kling
43951f18e7 LibGfx: Add FloatSize::to_int_size() 2020-06-10 08:49:41 +02:00
Andreas Kling
28dcef4757 LibWeb: Add LayoutTableRowGroup to implement display: table-row-group 2020-06-09 21:53:16 +02:00
Andreas Kling
b4d4d6b32a LibWeb: Add some iteration helpers to LayoutNode
- for_each_child_of_type<T>
- previous_sibling_of_type<T>
2020-06-09 21:13:16 +02:00
Sergey Bugaev
f2d40ac2b2 Base: Document new SystemServer abilities 2020-06-09 21:12:34 +02:00
Sergey Bugaev
701994bfd1 SystemServer: Add support for accepting socket connections :^)
You can now ask SystemServer to not only listen for connections on the socket,
but to actually accept them, and to spawn an instance of the service for each
client connection. In this case, it's the accepted, not listening, socket that
the service processes will receive using socket takeover.

This mode obviously requires the service to be a multi-instance service.
2020-06-09 21:12:34 +02:00
Sergey Bugaev
ac4c2f890f SystemServer: Add support for multi-instance services
For this kind of services, there's no single PID of a running instance;
there may be multiple, or no instances of the service running at any time.
No keepalive functionality is available in this mode, since "alive" doesn't
make sense for multi-instance services.

At the moment, there's no way to actually create multiple instances of
a service; this is going to be added in the next commit.
2020-06-09 21:12:34 +02:00
Sergey Bugaev
31b025fcfc Kernel: Allow sys$accept(address = nullptr) 2020-06-09 21:12:34 +02:00
Nico Weber
33d6d640d3
Ports: Use keyserver.ubuntu.com as .sig keyserver (#2535)
Increases the number of successfully building ports from
27 to 36 (of 56) on my system.
2020-06-09 21:10:00 +02:00
Andreas Kling
a85506009f LibC: Don't assert on unknown mode character in fopen()
Just carry on with some debug log whining.
Gets rid of one dropbear patch. :^)
2020-06-08 21:57:13 +02:00
Andreas Kling
c88ea2f54a LibC: Add nanosleep() wrapper around clock_nanosleep(CLOCK_REALTIME)
Gets rid of one dropbear patch. :^)
2020-06-08 21:53:41 +02:00
Andreas Kling
57b6f51137 LibC: Add IPPORT_RESERVED and IPPORT_USERRESERVED
Gets rid of one dropbear patch. :^)
2020-06-08 21:50:45 +02:00
Andreas Kling
5448a670c0 Base: Symlink /dev/urandom to /dev/random
Some software expects to find /dev/urandom so we might as well provide.
Gets rid of one dropbear patch. :^)
2020-06-08 21:42:33 +02:00
Andreas Kling
3ee1b3cbd4 LibC: Add ws_xpixel and ws_ypixel members to struct winsize
This matches what other systems have, although we don't use them.
Gets rid of one dropbear patch. :^)
2020-06-08 21:40:22 +02:00
Stephen Gregoratto
53d4c7e207
Ports: Add editline library (#2532) 2020-06-08 21:38:13 +02:00
Andreas Kling
883dc9260d LibWeb: Unbreak favicon notifications after Page refactoring
Favicon updates now get plumbed from FrameLoader to the PageClient.
2020-06-08 21:35:31 +02:00
Andreas Kling
e04d68a03a LibWeb: Remove unnecessary on_foo hooks from Frame
Frame can just call through the PageClient instead of using hooks.
2020-06-08 21:31:53 +02:00
Andreas Kling
5042e560ef LibJS: Make more Interpreter functions take a GlobalObject& 2020-06-08 21:25:16 +02:00