Commit graph

5393 commits

Author SHA1 Message Date
Andreas Kling
4a9dcd974a LibWeb: Remove unused Element::set_attributes() 2020-12-15 19:33:53 +01:00
Andreas Kling
9c76c4f0cf LibWeb: Use IdentifierStyleValue for CSS 'list-style-type' 2020-12-15 19:33:53 +01:00
Andreas Kling
c630ae517e LibWeb: Put final foreground/background colors in LayoutStyle
This way we don't have to look them up in the CSS::StyleProperties
every time we want to paint with them.
2020-12-15 19:33:53 +01:00
Andreas Kling
78a51933ad LibWeb: Use IdentifierStyleValue for CSS 'text-transform' 2020-12-15 19:33:53 +01:00
Andreas Kling
4d7ce81835 LibWeb: Use IdentifierStyleValue for CSS 'text-decoration-line'
Also 'text-decoration' is actually a shorthand, so treat it that way.
2020-12-15 19:33:53 +01:00
Andreas Kling
7e78e4b232 LibWeb: Make CSS "background: none" work again
This broke since "none" is now always going to be an identifier value.
2020-12-15 19:33:53 +01:00
Linus Groh
5e7945e26f LibWeb: Add a simple StyleInvalidator class
This patch adds a simple, naive & inefficient class for document-wide
style invalidation, e.g. after element attribute updates. During
construction it collects a HashMap of a document's elements and their
matching rules, during destruction it does the same and then compares
the results; dirtying all elements that have a different number or order
of matching rules afterwards.

Much room for improvement, but it solves the problem of stale element
styling after attribute updates for now :^)

Fixes #4404.
2020-12-14 23:38:08 +01:00
Itamar
9a9d655abe Chess: Add LibCore as a dependency
This fixes Dynamic Loader crash because of an unresolved LibCore symbol
2020-12-14 23:05:53 +01:00
Itamar
93b68f5566 LibELF: Move the implementation of find_demangled_function to ELF::Image 2020-12-14 23:05:53 +01:00
Itamar
0220b5361e LibC: Also build a static version of libc 2020-12-14 23:05:53 +01:00
Itamar
dfdd977a82 LibC: Link statically with libstdc++
This allows us to have the implementation of __cxa_demangle in libc.so.
2020-12-14 23:05:53 +01:00
Itamar
a74dad14a8 LibCoreDump: Add library for parsing coredump files 2020-12-14 23:05:53 +01:00
Itamar
50219429fd LibELF: Allow using ELF::Loader for ET_CORE objects 2020-12-14 23:05:53 +01:00
Itamar
5a2e68d699 LibELF: Temporarily disable name demangling
Demangling is currently not supported with shared libraries, but we will fix this soon :)
2020-12-14 23:05:53 +01:00
Itamar
349c6780ce LibELF: Refactor coredump notes section structures 2020-12-14 23:05:53 +01:00
Itamar
0b0c09e647 LibCore: Add DirectoryWatcher
DirectoryWatcher is a wrapper around watch_file, and can be used to
watch for changes in directories.
2020-12-14 23:05:53 +01:00
Itamar
b4842d33bb Kernel: Generate a coredump file when a process crashes
When a process crashes, we generate a coredump file and write it in
/tmp/coredumps/.

The coredump file is an ELF file of type ET_CORE.
It contains a segment for every userspace memory region of the process,
and an additional PT_NOTE segment that contains the registers state for
each thread, and a additional data about memory regions
(e.g their name).
2020-12-14 23:05:53 +01:00
Itamar
efe4da57df Loader: Stabilize loader & Use shared libraries everywhere :^)
The dynamic loader is now stable enough to be used everywhere in the
system - so this commit does just that.
No More .a Files, Long Live .so's!
2020-12-14 23:05:53 +01:00
Itamar
58c583f584 LibC: Add libc.so
We now compile everything with -static flag so libc.a would be use
2020-12-14 23:05:53 +01:00
Itamar
09ccdc697b Demos: Add "DynamicObjectDemo" to demo the dynamic loader 2020-12-14 23:05:53 +01:00
Itamar
79769ee74e LibELF: Allow elf files with no section header to pass validation 2020-12-14 23:05:53 +01:00
Itamar
07b4957361 Loader: Add dynamic loader program
The dynamic loader exists as /usr/lib/Loader.so and is loaded by the
kernel when ET_DYN programs are executed.

The dynamic loader is responsible for loading the dependencies of the
main program, allocating TLS storage, preparing all loaded objects for
execution and finally jumping to the entry of the main program.
2020-12-14 23:05:53 +01:00
Itamar
781aa424a9 LibC: Add NO_TLS preprocessor flag
When this flag is defined, LibC does not use TLS.
It will be useful for the dynamic loader.
2020-12-14 23:05:53 +01:00
Itamar
65ee2f07b7 LibC: Make it possible to use ASSERTs without initializing stdio 2020-12-14 23:05:53 +01:00
Itamar
9ca1a0731f Kernel: Support TLS allocation from userspace
This adds an allocate_tls syscall through which a userspace process
can request the allocation of a TLS region with a given size.

This will be used by the dynamic loader to allocate TLS for the main
executable & its libraries.
2020-12-14 23:05:53 +01:00
Itamar
5b87904ab5 Kernel: Add ability to load interpreter instead of main program
When the main executable needs an interpreter, we load the requested
interpreter program, and pass to it an open file decsriptor to the main
executable via the auxiliary vector.

Note that we do not allocate a TLS region for the interpreter.
2020-12-14 23:05:53 +01:00
Linus Groh
0974991d05 LibJS: Don't treat '?.' followed by decimal digit as QuestionMarkPeriod
From the spec: https://tc39.es/ecma262/#sec-punctuators

    OptionalChainingPunctuator ::
        ?. [lookahead ∉ DecimalDigit]

We were missing the lookahead and therefore incorrectly treating any
'?.' as TokenType::QuestionMarkPeriod.

Fixes #4409.
2020-12-14 22:25:46 +01:00
Andreas Kling
6e7edd6e77 LibWeb: Convert remaining CSS identifiers to use IdentifierStyleValue 2020-12-14 22:22:35 +01:00
Andreas Kling
96233bfc53 LibGfx: Draw checked buttons with a dithered base background
This looks just so right in the taskbar. :^)
2020-12-14 21:47:07 +01:00
Andreas Kling
396b09a1ec LibGUI: Don't focus BreadcrumbBar segments on click 2020-12-14 21:44:03 +01:00
Andreas Kling
818f7777c8 LibGUI: Add a basic BreadcrumbBar widget! :^)
This can be used to implement segmented path bars in FileManager and
wherever else wanted.
2020-12-14 20:43:42 +01:00
Andreas Kling
b00a347ac5 LibGUI: Protect GUI::Button across firing the on_click hook
If a hook triggers the deletion of the GUI::Button, we would be unable
to proceed in a well-defined manner here, so let's protect ourselves.

This probably needs to be done in a whole lot of places, since GUI
widgets are just ref-counted Core::Objects and running arbitrary code
can mean that they get deleted.
2020-12-14 20:43:42 +01:00
Andreas Kling
dd2e8b7dd0 LibWeb: Use IdentifierStyleValue for CSS 'position' 2020-12-14 20:43:25 +01:00
Andreas Kling
3247ea3581 LibWeb: Use CSS::ValueID for 'text-align' values
Let's start moving away from using raw strings for CSS identifiers.
The idea here is to use IdentifierStyleValue with a CSS::ValueID inside
for all CSS identifier values.
2020-12-14 20:43:25 +01:00
Andreas Kling
08517daa5a LibWeb: Improvements to font lookup
Parse out the font-family, font-size and font-weight values from CSS
and use them to perform a kinda-best-effort lookup against the system
font library.

We also now handle standard font names like "sans-serif", "monospace"
and others.
2020-12-14 20:43:25 +01:00
Andreas Kling
861d22838d LibWeb: Virtualize StyleValue equality check
And use this to simplify comparing two IdentifierStyleValues.
2020-12-14 20:43:25 +01:00
Andreas Kling
bceb5b60f7 LibWeb: Add a little assertion in Document::detach_from_frame()
Let's just assert that we're detaching from the frame we thought we
were in.. just in case.
2020-12-14 13:47:07 +01:00
Andreas Kling
34d0141da3 LibWeb: Simplify <iframe> content frame construction
Now that documents are attached to their frame *before* parsing, we can
create the content frame of <iframe> elements right away, instead of
waiting for the host frame attachment.

Fixes #4408.
2020-12-14 13:45:57 +01:00
Andreas Kling
b861de0a13 LibWeb: Use final box model metrics for absolute 'right' and 'bottom'
We've already converted these to floats, so no need to do it again.
2020-12-14 12:49:35 +01:00
Andreas Kling
6809be436b LibWeb: Limit style update tree traversal to dirty subtrees
This patch adds a second style dirty bit that tracks whether a DOM node
has one or more children with dirty style. This allows the style update
to skip over entire subtrees where all nodes are clean.
2020-12-14 12:04:30 +01:00
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
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