Andreas Kling
c4a6d6ae9f
AK: Add FlyString::to_lowercase() and LogStream operator<<(FlyString)
2020-03-22 19:07:02 +01:00
Andreas Kling
7f8dc347b5
LibGUI: Allow constructing Variant from FlyString
2020-03-22 19:06:31 +01:00
Andreas Kling
7f83f77377
LibWeb: Use FlyString for element attribute names
...
Attribute names occur again and again.
2020-03-22 13:10:04 +01:00
Andreas Kling
26bc3d4ea0
AK: Add FlyString::equals_ignoring_case(StringView)
...
And share the code with String by moving the logic to StringUtils. :^)
2020-03-22 13:07:45 +01:00
Andreas Kling
0efa47b7ef
AK: Run clang-format on StringUtils.{cpp,h}
2020-03-22 13:04:04 +01:00
Andreas Kling
cccbe43056
LibJS: Use FlyString for identifiers
...
This makes variable and property lookups a lot faster since comparing
two FlyStrings is O(1).
2020-03-22 13:03:43 +01:00
Andreas Kling
4f72f6b886
AK: Add FlyString, a simple flyweight string class
...
FlyString is a flyweight string class that wraps a RefPtr<StringImpl>
known to be unique among the set of FlyStrings. The class is very
unoptimized at the moment.
When to use FlyString:
- When you want O(1) string comparison
- When you want to deduplicate a lot of identical strings
When not to use FlyString:
- For strings that don't need either of the above features
- For strings that are likely to be unique
2020-03-22 13:03:43 +01:00
Andreas Kling
0395b25e3f
LibWeb: Put selection-related debug spam behind an #ifdef
2020-03-22 13:03:43 +01:00
Shannon Booth
d7133ea326
Kernel: Fix compilation error with ACPI_DEBUG enabled
2020-03-22 08:51:40 +01:00
Shannon Booth
83425b1ac0
LibCore: Wrap commented out debug messages in a preprocessor define
...
We can also remove an outdated FIXME as dbg() does now support unsigned
longs :^)
2020-03-22 08:51:40 +01:00
Shannon Booth
757c14650f
Kernel: Simplify process assertion checking if region is in range
...
Let's use the helper function for this :)
2020-03-22 08:51:40 +01:00
Shannon Booth
81adefef27
Kernel: Run clang-format on files
...
Let's rip off the band-aid
2020-03-22 01:22:32 +01:00
Shannon Booth
d0629d0a8c
Shell: More general tilde expansion
...
Now expanding a tilde isn't hardcoded to just work for `cd`. It is instead
expanded while processing shell arguments. Autocompletion still doesn't
work, but this is definitely an improvement over the last iteration.
2020-03-22 01:15:33 +01:00
Shannon Booth
1ef3d4af69
Shell: Use starts_with() in expand_parameters
...
This reads a little nicer, and makes us care less about an empty String
2020-03-22 01:15:33 +01:00
Shannon Booth
d806dfe801
Shell: Use size_t for SH_DEBUG vector iteration
...
We missed this when switching to size_t for vector sizing as this
code is not normally compiled.
2020-03-22 01:15:33 +01:00
Andreas Kling
ec6e55cfc6
LibGUI: Don't spam WindowServer with SetWindowOverrideCursor messages
...
Remember the override cursor in GUI::Window and avoid sending a message
to WindowServer when possible.
This removes a lot of synchronous IPC between Browser and WindowServer,
which noticeably improves DOM event responsiveness. :^)
2020-03-22 01:07:07 +01:00
Andreas Kling
065db26d7c
Base: Add a demo web page for canvas+setInterval+randomness
...
Click somewhere in the black area and drag for colorful effect! :^)
2020-03-21 19:07:21 +01:00
Andreas Kling
fd5a3b3c39
LibGfx: Parse "rgb(r,g,b)" style color strings
...
This parser is not very lenient, but it does the basic job. :^)
2020-03-21 19:06:38 +01:00
Andreas Kling
e2a38f3aba
LibWeb: Add a naive implementation of setInterval()
...
This implementation leaks a Core::Timer whenever you call setInterval()
so it will definitely need some improvements, but it does kinda work!
2020-03-21 18:55:37 +01:00
Andreas Kling
81e18a9b26
LibWeb: Silence some debug spam about JS event handler invocations
2020-03-21 18:55:12 +01:00
Andreas Kling
7c48c3c8e1
LibJS: Parse "if" statements
...
This patch implements basic parsing of "if" statements. We don't yet
support parsing "else", so I added a FIXME about that.
2020-03-21 18:40:17 +01:00
Andreas Kling
55c845713a
LibWeb: Give MouseEvents the correct offsetX and offsetY values
2020-03-21 18:27:06 +01:00
Andreas Kling
4dde36844b
LibWeb: Add a DOM Event class (instead of events being simple strings)
...
This patch adds the Event base class, along with a MouseEvent subclass.
We now dispatch MouseEvent objects for mousedown, mouseup and mousemove
and these objects have the .offsetX and .offsetY properties.
Both of those properties are hard-coded at the moment. This will be
fixed in the next patch. :^)
2020-03-21 18:17:18 +01:00
Andreas Kling
b196665131
LibWeb: Dispatch "mouseup" event
...
This is a very naive implementation that doesn't account for where the
mousedown happened.
2020-03-21 17:55:41 +01:00
Andreas Kling
8b18674229
LibJS: Add Math.random() :^)
2020-03-21 17:52:12 +01:00
Andreas Kling
c4c549625f
LibWeb: Add HTMLCanvasElement.{width,height} properties
2020-03-21 17:44:01 +01:00
Andreas Kling
f1715bbd5e
LibWeb: Make the "document" global a native property
...
This defers construction of the document wrapper until actually needed.
2020-03-21 14:54:33 +01:00
Andreas Kling
a7d458f76a
Base: Tidy up the events.html test page a little bit
2020-03-21 14:53:13 +01:00
Andreas Kling
08b17d70af
LibJS+LibWeb: Fix some inconsistencies in NativeFunction callbacks
...
These should always pass the arguments in a const Vector<JS::Value>&.
2020-03-21 14:43:44 +01:00
Andreas Kling
324b92fd06
LibJS: Virtualize access to an Object's own properties
...
Object now has virtual get_own_property() and put_own_property() member
functions that can be overridden to provide custom behavior.
We use these virtuals to move Array-specific access behavior to Array.
2020-03-21 14:37:34 +01:00
Andreas Kling
2a7dbac0c5
LibJS: Include the cell size in HeapBlock mmap names
...
HeapBlocks now show up in SystemMonitor as "LibJS: HeapBlock(32)" :^)
2020-03-21 13:12:16 +01:00
Andreas Kling
00feef8642
LibJS: Some optimizations for ObjectExpression
...
- move() the property map when constructing ObjectExpression instead of
making a copy.
- Use key+value iterators to traverse the property map in the execute()
and dump() functions.
2020-03-21 13:11:51 +01:00
Andreas Kling
6c3afca686
LibJS: Round cell sizes up to a multiple of 16 bytes
...
This increases HeapBlock utilization significantly (and reduces overall
memory usage.)
2020-03-21 11:49:18 +01:00
Andreas Kling
2106dafd62
LibJS: Delete fully-empty HeapBlocks after garbage collection
...
We now deallocate GC blocks when they are found to have no live cells
inside them.
2020-03-21 11:46:47 +01:00
0xtechnobabble
bc002f807a
LibJS: Parse object expressions
2020-03-21 10:08:58 +01:00
BenJilks
c64b5e73f5
Build: Add FreeBSD support ( #1492 )
2020-03-21 09:46:30 +01:00
Andreas Kling
bceabd7c4b
LibJS: Add ArrayPrototype and implement Array.prototype.push()
...
This function is ultimately supposed to be generic and allow any |this|
that has a length property, but for now it only works on our own Array
object type.
2020-03-20 21:56:40 +01:00
Andreas Kling
8f7d4f67a4
LibJS: Support reading/writing elements in an Array via Object get/put
...
I'm not completely thrilled about Object::get() and Object::put() doing
special-case stuff for arrays, and we should probably come up with a
better abstraction for it.
But at least it works for now, which is really nice. :^)
2020-03-20 21:56:40 +01:00
Andreas Kling
a3d2e07446
LibJS: Parse computed MemberExpressions
...
MemberExpression comes in two flavors:
computed: a[b]
non-computed: a.b
We can now parse both of the types. :^)
2020-03-20 21:56:40 +01:00
Andreas Kling
86642add2f
LibJS: Allow default-constructing a JS::Value (undefined)
2020-03-20 21:56:40 +01:00
Andreas Kling
a82f64d3d6
LibJS: Parse ArrayExpression and start implementing Array objects
...
Note that property lookup is not functional yet.
2020-03-20 21:56:40 +01:00
myphs
0891f860f7
LibWeb: Add CSS property 'border'
...
This makes it possible to write shorter CSS. Instead of writing
.foo {
border-width: 3px;
border-style: solid;
border-color: blue;
}
it is now possible to write
.foo {
border: 3px solid blue;
}
while the order of values is irrelevant.
Currently only the basic values are supported. More values should be
added in the future.
Three more value specific parse functions were added:
parse_line_width, parse_color, and parse_line_style
Additionally a few test cases were added to borders.html.
2020-03-20 21:40:55 +01:00
Elisée Maurer
12e8efd74e
LibWeb: Fix HTMLCanvasElement::preferred_height() default value ( #1490 )
...
The correct height is 150px rather than 300px.
2020-03-20 15:19:38 +01:00
Andreas Kling
12b8cd8c10
js: Make printing of the last result optional
2020-03-20 14:52:27 +01:00
Andreas Kling
0bc6bcc2ed
js: Ignore the first line of input if it starts with "#!"
...
This allows us to create executable programs in JavaScript :^)
2020-03-20 14:49:17 +01:00
Andreas Kling
3823d13e21
copy: Use StringBuilder::join()
2020-03-20 14:41:23 +01:00
Andreas Kling
5db8940c9e
LibJS: Use StringBuilder::join()
2020-03-20 14:41:23 +01:00
Andreas Kling
4eef3e5a09
AK: Add StringBuilder::join() for joining collections with a separator
...
This patch adds a generic StringBuilder::join(separator, collection):
Vector<String> strings = { "well", "hello", "friends" };
StringBuilder builder;
builder.join("+ ", strings);
builder.to_string(); // "well + hello + friends"
2020-03-20 14:41:23 +01:00
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