Commit graph

13719 commits

Author SHA1 Message Date
Lenny Maiorani
151b8b5984 Endian: constexpr constructors and conversion operators
Problem:
- Constructors and conversion operators are not `constexpr`,
  but they can be.
- `constexpr` is needed here so that other classes can add `constexpr`
  evaluation.

Solution:
- Add the `constexpr` keyword to the constructors and
  conversion operators.
- Add `static_assert` tests which ensure the capability works.
2020-10-08 23:28:54 +02:00
Matthew Olsson
e8da5f99b1 LibJS: break or continue with nonexistent label is a syntax error 2020-10-08 23:27:16 +02:00
Matthew Olsson
67f2301150 AK: Make StringView hashable 2020-10-08 23:27:16 +02:00
Matthew Olsson
6e05685ad4 LibJS: Fix return statements not working properly in loops
Previously, when a loop detected an unwind of type ScopeType::Function
(which means a return statement was executed inside of the loop), it
would just return undefined. This set the VM's last_value to undefined,
when it should have been the returned value. This patch makes all loop
statements return the appropriate value in the above case.
2020-10-08 23:23:55 +02:00
Matthew Olsson
d980073122 LibJS: Handle unwinding in while and do-while statements
For some reason, this was never added. So something like "while (true)
{ return }" would loop infinitely.
2020-10-08 23:23:55 +02:00
Nico Weber
397e5766ff LibGUI: Make arrow-left/right with selection move cursor to edge of selection
This matches behavior on Linux, macOS, Windows, and it makes it possible
to hit ctrl-L arrow-right ctrl-backspace to edit the last component of
an URL in browser, or of the current path in File Manager.

Also make it so that ctrl-left/right does a word movement that starts
at the edge of the selection. This matches Linux and macOS, but not
Windows (which instead does a word movement relative to the cursor,
not the selection edge).
2020-10-08 23:22:30 +02:00
Andreas Kling
95077f9a5d LibWeb: Apply the CSS background-image property to elements
Previously we'd only pick up background-image when it was part of the
background shorthand.

CSS property application remains hackish, lots of room for improvement
in this area. :^)
2020-10-08 23:21:39 +02:00
Andreas Kling
18b6c47178 LibGUI: Set initial AbstractButton background/foreground color roles
Widgets should respect the background/foreground roles in a way that
makes sense for the widget.
2020-10-08 23:21:39 +02:00
Andreas Kling
48647cc3ed Demos: Stop using Widget::foreground_color() 2020-10-08 23:21:39 +02:00
Linus Groh
e6709e3834 LibWeb: Handle theme change event in OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Linus Groh
870dd44ba9 Help: Replace InProcessWebView with OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Linus Groh
95a6019ff0 LibWeb: Add OutOfProcessWebView::load_empty_document()
This is cheating a little bit as we don't set the document to a nullptr
as in InProcessWebView, but the observable outcome is the same. :^)
2020-10-08 23:20:52 +02:00
Linus Groh
b797de3adf HackStudio: Replace InProcessWebView with OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Linus Groh
f0ba536095 html: Replace InProcessWebView with OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Linus Groh
4ef3a55900 html: Create URL from filename, if any
This makes it possible for the WebView to resolve relative paths in
documents loaded from a file.
2020-10-08 23:20:52 +02:00
Linus Groh
f6af2d747e TextEditor: Replace InProcessWebView with OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Linus Groh
9f3789cdc7 LibWeb: Register the OutOfProcessWebView widget 2020-10-08 23:20:52 +02:00
Linus Groh
e40135fefd LibWeb: Add OutOfProcessWebView::load_html() 2020-10-08 23:20:52 +02:00
Linus Groh
216ccaf805 LibWeb: Handle PageClient::page_did_change_title() in Frame::set_document() 2020-10-08 23:20:52 +02:00
Linus Groh
a2a603d38a LibWeb: Add FrameLoader::load_html()
This moves responsibility for parsing and loading the document
from InProcessWebView to FrameLoader, so can be re-used easily.
2020-10-08 23:20:52 +02:00
Matthew Olsson
e49ea1b520 LibJS: Disallow 'continue' & 'break' outside of their respective scopes
'continue' is no longer allowed outside of a loop, and an unlabeled
'break' is not longer allowed outside of a loop or switch statement.
Labeled 'break' statements are still allowed everywhere, even if the
label does not exist.
2020-10-08 10:20:49 +02:00
Tibor Nagy
b85af075b7 Build: Emit paths in macros and debug sections relative to repo root
To avoid including paths from the build environment in the binaries.
A step towards having reproducible builds.
2020-10-08 10:04:02 +02:00
Matthew Olsson
9a82c22a85 LibJS: Disallow 'return' outside of a function 2020-10-08 10:03:21 +02:00
Linus Groh
5feb7e8d28 LibJS: Use PropertyName::from_value() in MemberExpression::computed_property_name()
No need for duplicating this logic.
2020-10-08 10:02:47 +02:00
Linus Groh
bc78e4b7da LibJS: Fix PropertyName::from_value() for negative and non-int numbers
It was converting *any* number to an i32 index, which obviously is not
correct for negative ints, doubles, infinity and nan.

Fixes #3712.
2020-10-08 10:02:47 +02:00
Lenny Maiorani
44d4423229 TCP: Remove unnecessarily defined constructor and destructor
Problem: Defining the destructor violates the "rule of 0" and prevents
the copy/move constructor/assignment operators from being provided by
the compiler.

Solution: Change the constructor and destructor to be the default
compiler-provided definition.
2020-10-08 10:01:10 +02:00
Nico Weber
9d27644b7d DHCPClient: Remove unused UPDSocket.h include 2020-10-08 10:00:39 +02:00
Nico Weber
8a01be4849 Kernel: Add some CPU feature flags related to TSC
In case we want to rely more on TSC in time keeping in the future, idk

This adds:

- RDTSCP, for when the RDTSCP instruction is available

- CONSTANT_TSC, for when the TSC has a constant frequency, invariant
  under things like the CPU boosting its frequency.

- NONSTOP_TSC, for when the TSC doesn't pause when the CPU enters
  sleep states.

AMD cpus and newer intel cpus set the INVSTC bit (bit 8 in edx of
extended cpuid 0x8000000008), which implies both CONSTANT_TSC and
NONSTOP_TSC. Some older intel processors have CONSTANT_TSC but not
NONSTOP_TSC; this is set based on cpu model checks.

There isn't a ton of documentation on this, so this follows Linux
terminology and http://blog.tinola.com/?e=54

CONSTANT_TSC:
39b3a79105

NONSTOP_TSC:
40fb17152c

qemu disables invtsc (bit 8 in edx of extended cpuid 0x8000000008)
by default even if the host cpu supports it. It can be enabled by
running with `SERENITY_QEMU_CPU=host,migratable=off` set.
2020-10-08 10:00:39 +02:00
asynts
1d96d5eea4 AK: Use new format functions. 2020-10-08 09:59:55 +02:00
asynts
560c52989c Demos: Use new format functions. 2020-10-08 09:59:55 +02:00
asynts
d781f3f6b5 AK: Add formatter for StringImpl. 2020-10-08 09:59:55 +02:00
asynts
2be7736010 Kernel: Add KBufferBuilder::appendff.
Why does this class exist anyways? What is wrong with using
StringBuilder?
2020-10-08 09:59:55 +02:00
asynts
d546d31a53 AK+Format: Make it possible to format characters as integers. 2020-10-08 09:59:55 +02:00
asynts
2217d6b560 AK+Format: Add SFINAE wrapper 'FormatIfSupported'. 2020-10-08 09:59:55 +02:00
asynts
afef05ece2 AK+Format: Add overloads with const char* for outln, warnln and dbgln.
This makes it possible to forward declare 'warnln' in TestSuite.h.
2020-10-08 09:59:55 +02:00
asynts
15c3feb351 AK+Format: Add overloads without arguments to outln, warnln and dbgln. 2020-10-08 09:59:55 +02:00
asynts
b94cb02a7f AK+Format: Use pointer mode for pointers by default. 2020-10-08 09:59:55 +02:00
Marcin Gasperowicz
b9316474b7 LibWeb: Make h4, h5 and h6 bold
Some Markdown documents using level 4 and 5 headings were not displayed
in an eye-pleasing manner.
This patch makes those headings bold by default.
2020-10-08 09:55:54 +02:00
Lenny Maiorani
9ae78c50fd VariadicFormatParams: Use initialized data to create parent class
Problem:
- m_data is being passed to the constructor of the parent class before
  it is initialized. This is not really a problem because the compiler
  knows the location and it is only a span being constructed, but it
  triggers a warning in clang for use-before-init.

Solution:
- Initialize using a default constructed array and then overwrite it
  inside the constructor after the member is initialized.
2020-10-08 09:55:39 +02:00
Lenny Maiorani
fcee80dd69 Formatter: Remove extraneous char definition
Formatter is specialized in the header file. The definition in the
implementation file is extraneous and has no effect. Simply removing
it so that there is no confusion.
2020-10-08 09:54:56 +02:00
Lenny Maiorani
9eef5fc446 SinglyLinkedList: Remove unused includes
Several files include `AK/SinglyLinkedList.h` without using
it. Removing it to simplify.
2020-10-08 09:54:41 +02:00
Andreas Kling
c541310e19 LibJS: Use IntrusiveList for Allocator's block lists
This way we don't need to deal with shifting vector storage, and most
operations are upgraded from O(n) to O(1) :^)
2020-10-07 14:07:31 +02:00
Andreas Kling
eeffd5be07 Ext2FS: Fix block allocation ignoring the very last block group
The block group indices are 1-based for some reason. Because of that,
we were forgetting to check in the very last block group when doing
block allocation. This caused block allocation to fail even when the
superblock indicated that we had free blocks.

Fixes #3674.
2020-10-07 13:42:17 +02:00
Andreas Kling
d1592643a6 LibJS: Make sure the HeapBlock cell storage is alignas(Cell) 2020-10-07 13:09:59 +02:00
Andreas Kling
51dbea3a0e LibWeb: Use RefPtrs more in getElementById() and getElementsByName()
Passing around Vector<Element*> is not a great idea long-term.
2020-10-07 12:47:17 +02:00
asynts
9123920a19 Welcome: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
ff3552bb14 TextEditor: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
712e348fad Terminal: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
0dec600a2a SystemMonitor: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
6ed3a4b5fe LibGUI: Add formatters for TextPosition and TextRange. 2020-10-06 20:29:26 +02:00