Commit graph

7679 commits

Author SHA1 Message Date
Andreas Kling
218f082226 LibJS: Print a newline in each console.log() 2020-03-20 14:41:23 +01:00
Andreas Kling
2176a3dd18 Documentation: Tweak document about smart pointers a bit
Add notes about assigning between FooPtr / NonnullFooPtr.
2020-03-20 14:41:02 +01:00
Andreas Kling
03ec57b271 LibWeb: Make hit testing better for blocks with inline children
If we don't hit one of the inline children, we should still report that
we've hit the block itself.
2020-03-20 12:41:31 +01:00
Tibor Nagy
9e6e731a78 LibGUI: Remove G prefix from macros 2020-03-19 23:17:34 +01:00
rhin123
073ac3a22f Calendar: Add license header 2020-03-19 22:54:30 +01:00
rhin123
a0bc6a8f37 Base: Add Calendar.af 2020-03-19 22:54:30 +01:00
rhin123
8bc412c80b Calendar: Add a 16x16 app icon 2020-03-19 22:54:30 +01:00
rhin123
19e1cd9fb8 Calendar: Corrected spacing for widgets and rectangles 2020-03-19 22:54:30 +01:00
Tibor Nagy
fc71b73c37 Applications: Remove G prefixes from comments 2020-03-19 22:52:44 +01:00
Tibor Nagy
120e8028f6 WidgetGallery: Remove G prefixes from components 2020-03-19 22:52:44 +01:00
Tibor Nagy
9570efa698 LibGUI: Remove friend classes of TextDocumentLine
They were unused. Also GTextEditor doesn't exist anymore and GCC
was silently ignoring this declaration.
2020-03-19 22:52:44 +01:00
Tibor Nagy
30964ba7d0 LibGUI: Remove remaining G prefixes 2020-03-19 22:52:44 +01:00
Tibor Nagy
809490dcb6 Solitaire: Use dark green for empty stack outlines
Looks nicer than using dark gray. Derived from the background color.
2020-03-19 22:52:18 +01:00
Tibor Nagy
e0c16d1b43 Ports: Unbreak vttest build by updating package version 2020-03-19 22:52:01 +01:00
Andreas Kling
a37c29e353 LibWeb: Add <canvas> element and start fleshing out CRC2D
This patch adds HTMLCanvasElement along with a LayoutCanvas object.
The DOM and layout parts are very similar to <img> elements.

The <canvas> element holds a Gfx::Bitmap which is sized according to
the "width" and "height" attributes on the element.

Calling .getContext("2d") on a <canvas> element gives you a context
object that draws into the underlying Gfx::Bitmap of the <canvas>.
The context weakly points to the <canvas> which allows it to outlive
the canvas element if needed.

This is really quite cool. :^)
2020-03-19 19:07:56 +01:00
Andreas Kling
73d28a0551 LibJS: Prefer FunctionDeclaration if a statement begins with "function" 2020-03-19 18:07:07 +01:00
Andreas Kling
1a10470c1d LibJS: Implement basic object property assignment
This is pretty naive, we just walk up the prototype chain and call any
NativeProperty setter that we find. If we don't find one, we put/set
the value as an own property of the object itself.
2020-03-19 17:44:06 +01:00
Liav A
7268499c76 LibCore: Use monotonic time when handling timers 2020-03-19 15:48:00 +01:00
Liav A
b536547c52 Process: Use monotonic time for timeouts 2020-03-19 15:48:00 +01:00
Liav A
b4c92c24ee Scheduler: Use monotonic time for blocking threads 2020-03-19 15:48:00 +01:00
Liav A
b2585b3577 Userland: Add functionality of changing system date in date utility 2020-03-19 15:48:00 +01:00
Liav A
64c73d0739 LibC: Add new syscall to allow changing the system date 2020-03-19 15:48:00 +01:00
Liav A
4484513b45 Kernel: Add new syscall to allow changing the system date 2020-03-19 15:48:00 +01:00
Liav A
4fcc10c6c3 Kernel: Delete unnecessary files 2020-03-19 15:48:00 +01:00
Liav A
9db291d885 Kernel: Introduce the new Time management subsystem
This new subsystem includes better abstractions of how time will be
handled in the OS. We take advantage of the existing RTC timer to aid
in keeping time synchronized. This is standing in contrast to how we
handled time-keeping in the kernel, where the PIT was responsible for
that function in addition to update the scheduler about ticks.
With that new advantage, we can easily change the ticking dynamically
and still keep the time synchronized.

In the process context, we no longer use a fixed declaration of
TICKS_PER_SECOND, but we call the TimeManagement singleton class to
provide us the right value. This allows us to use dynamic ticking in
the future, a feature known as tickless kernel.

The scheduler no longer does by himself the calculation of real time
(Unix time), and just calls the TimeManagment singleton class to provide
the value.

Also, we can use 2 new boot arguments:
- the "time" boot argument accpets either the value "modern", or
  "legacy". If "modern" is specified, the time management subsystem will
  try to setup HPET. Otherwise, for "legacy" value, the time subsystem
  will revert to use the PIT & RTC, leaving HPET disabled.
  If this boot argument is not specified, the default pattern is to try
  to setup HPET.
- the "hpet" boot argumet accepts either the value "periodic" or
  "nonperiodic". If "periodic" is specified, the HPET will scan for
  periodic timers, and will assert if none are found. If only one is
  found, that timer will be assigned for the time-keeping task. If more
  than one is found, both time-keeping task & scheduler-ticking task
  will be assigned to periodic timers.
  If this boot argument is not specified, the default pattern is to try
  to scan for HPET periodic timers. This boot argument has no effect if
  HPET is disabled.

In hardware context, PIT & RealTimeClock classes are merely inheriting
from the HardwareTimer class, and they allow to use the old i8254 (PIT)
and RTC devices, managing them via IO ports. By default, the RTC will be
programmed to a frequency of 1024Hz. The PIT will be programmed to a
frequency close to 1000Hz.

About HPET, depending if we need to scan for periodic timers or not,
we try to set a frequency close to 1000Hz for the time-keeping timer
and scheduler-ticking timer. Also, if possible, we try to enable the
Legacy replacement feature of the HPET. This feature if exists,
instructs the chipset to disconnect both i8254 (PIT) and RTC.
This behavior is observable on QEMU, and was verified against the source
code:
ce967e2f33

The HPETComparator class is inheriting from HardwareTimer class, and is
responsible for an individual HPET comparator, which is essentially a
timer. Therefore, it needs to call the singleton HPET class to perform
HPET-related operations.

The new abstraction of Hardware timers brings an opportunity of more new
features in the foreseeable future. For example, we can change the
callback function of each hardware timer, thus it makes it possible to
swap missions between hardware timers, or to allow to use a hardware
timer for other temporary missions (e.g. calibrating the LAPIC timer,
measuring the CPU frequency, etc).
2020-03-19 15:48:00 +01:00
Liav A
5d90e9cfb8 Kernel & LibC: Add CLOCK_REALTIME constant 2020-03-19 15:48:00 +01:00
Liav A
53d6fe8141 ACPI: Delete irrelevant HPET definitions
Also, the definition of the HPET ACPI table is correct now, in
accordance to the HPET specification, revision 1.0a, October 2004.
2020-03-19 15:48:00 +01:00
Liav A
a0a7204915 Interrupts: Add an interface to determine if SMP is enabled 2020-03-19 15:48:00 +01:00
Liav A
e880fe0765 Kernel: Use a const reference to RegisterState in IRQ handling 2020-03-19 15:48:00 +01:00
Liav A
aa43314e8b Kernel: Remove unnecessary include from PATAChannel.cpp 2020-03-19 15:48:00 +01:00
Liav A
9a303cc5a5 Kernel: Add the NonMaskableInterruptDisabler class
This class will be used later to disable NMIs when we
initialize the RTC timer.
2020-03-19 15:48:00 +01:00
Andreas Kling
07679e347c LibJS: Parse FunctionExpressions
FunctionExpression is mostly like FunctionDeclaration, except the name
is optional. Share the parsing logic in parse_function_node<NodeType>.

This allows us to do nice things like:

    document.addEventListener("DOMContentLoaded", function() {
        alert("Hello friends!");
    });
2020-03-19 11:54:11 +01:00
Andreas Kling
b1b4c9844e LibJS: Add FunctionExpression AST node
Most of the code is shared with FunctionDeclaration, so the shared bits
are moved up into a common base called FunctionNode.
2020-03-19 11:12:08 +01:00
Andreas Kling
f0b49ae04b LibJS: Fix reference leak in ASTNode::append()
Using make<T> like this would create an unadopted object whose refcount
would never reach zero.
2020-03-19 11:02:20 +01:00
Alex Muscar
d013753f83
Kernel: Resolve relative paths when there is a veil (#1474) 2020-03-19 09:57:34 +01:00
rhin123
6d26714ded Calendar: Allow the widget to resize with the window 2020-03-19 09:55:14 +01:00
rhin123
5744049b74 Calendar: Make const arrays static as well 2020-03-19 09:55:14 +01:00
rhin123
dc680d57aa Calendar: Don't assign next_month button variable to add_event button 2020-03-19 09:55:14 +01:00
Andreas Kling
961b4f2577 LibJS: Add missing copyright headers 2020-03-18 20:21:06 +01:00
Andreas Kling
0a9bd817bf LibWeb: Add missing copyright headers 2020-03-18 20:20:35 +01:00
Andreas Kling
41f3817b36 LibWeb: Use a JS::Handle to keep the EventListener function alive 2020-03-18 20:05:52 +01:00
Andreas Kling
a119b61782 LibJS: Add Handle<T>, a strong C++ handle for keeping GC objects alive
This is pretty heavy and unoptimized, but it will do the trick for now.
Basically, Heap now has a HashTable<HandleImpl*> and you can call
JS::make_handle(T*) to construct a Handle<T> that guarantees that the
pointee will always survive GC until the Handle<T> is destroyed.
2020-03-18 20:03:17 +01:00
Andreas Kling
e265058768 LibWeb: Fire "mousedown" and "mousemove" events in the DOM :^) 2020-03-18 17:13:22 +01:00
Andreas Kling
f39e5352f0 LibWeb: Start working on DOM event support
This patch adds the EventTarget class and makes Node inherit from it.

You can register event listeners on an EventTarget, and when you call
dispatch_event() on it, the event listeners will get invoked.

An event listener is basically a wrapper around a JS::Function*.

This is pretty far from how DOM events should eventually work, but it's
a place to start and we'll build more on top of this. :^)
2020-03-18 17:13:22 +01:00
Andreas Kling
97674da502 LibJS: Tolerate NativeFunction::call() with non-object 'this' for now
I'm not exactly sure why we end up in this situation, we'll have to
look into it.
2020-03-18 17:13:22 +01:00
Andreas Kling
f64f7a4787 LibJS: Add Function to Forward.h 2020-03-18 17:13:22 +01:00
Andreas Kling
e96ef450f6 LibJS: Add Interpreter::call(Function*, this_value, arguments)
This helper function takes care of pushing/popping a call frame so you
don't need to worry about it.
2020-03-18 17:13:22 +01:00
Andreas Kling
47fdac7cea Browser: Fix unintentional Web::Element copy 2020-03-18 17:13:22 +01:00
Oriko
a115702746 HackStudio: Expand project tree view by default 2020-03-18 16:33:54 +01:00
Andreas Kling
01408a511f LibWeb: Don't try to repaint frameless documents in CSSStyleValue 2020-03-18 11:26:31 +01:00