Commit Graph

27557 Commits

Author SHA1 Message Date
Andreas Kling
daead75e9c LibGfx/TTF: Ignore unsupported composite glyph flags
Replace some program-stopping TODO()'s with FIXME comments, since many
fonts actually render mostly fine without support for all features.
2021-09-13 20:12:58 +02:00
Linus Groh
7c39a5860d LibJS: Convert Temporal.ZonedDateTime.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
297bf19508 LibJS: Convert Temporal.TimeZone.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
fdd26567c1 LibJS: Convert Temporal.PlainYearMonth.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
06f3defcf5 LibJS: Convert Temporal.PlainTime.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
6e5d6060fa LibJS: Convert Temporal.PlainMonthDay.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
c47c660477 LibJS: Convert Temporal.PlainDateTime.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
0a30705cf2 LibJS: Convert Temporal.PlainDate.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
7314d05ca7 LibJS: Convert Temporal.Instant.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
a5f559f38a LibJS: Convert Temporal.Duration.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
47bbdd157f LibJS: Convert Temporal.Calendar.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
8253e14818 LibJS: Convert Intl.NumberFormat.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
b0c1179ff8 LibJS: Convert Intl.Locale.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
c277658ca6 LibJS: Convert Intl.ListFormat.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
b256b50476 LibJS: Convert Intl.DisplayNames.prototype to be a PrototypeObject 2021-09-13 19:07:26 +01:00
Linus Groh
a9c33b5bbd LibJS: Remove leftover typed_this() declarations 2021-09-13 19:07:26 +01:00
Andreas Kling
5b19e9239a LibC: Upgrade memmove() to memcpy() when possible
We were missing out on opportunities to use memcpy() instead of
memmove() when the source and destination don't overlap.
2021-09-13 19:11:33 +02:00
Andreas Kling
af8732435c Browser: Add some UI padding in the Inspector widget 2021-09-13 19:11:33 +02:00
Linus Groh
99f9609e45 LibJS: Evaluate function arguments before checking callee type
In the spec, this happens in the EvaluateCall abstract operation
(https://tc39.es/ecma262/#sec-evaluatecall), and the order is defined
as:

    3. Let argList be ? ArgumentListEvaluation of arguments.
    4. If Type(func) is not Object, throw a TypeError exception.
    5. If IsCallable(func) is false, throw a TypeError exception.

In LibJS this is handled by CallExpression::execute(), which had the
callee function check first and would therefore never evaluate the
arguments for a non-function callee.
2021-09-13 17:44:08 +01:00
Brian Gianforcaro
7852b0fbc3 LibWeb: Identical sub-expression bug in URLSearchParams::set
Flagged by sonarcloud, we appear to want to make sure the entry.name
matches the name we are searching for duplicates of.

Link:
https://sonarcloud.io/project/issues?fileUuids=AXvdC606QRvsO1F91p5C&id=SerenityOS_serenity&open=AXvdC_NEQRvsO1F91p6j
2021-09-13 14:05:22 +00:00
Brian Gianforcaro
fc1b9288bc LibJS: Extract exception check duplication in iso_month_day_from_fields
Flagged by sonarcloud.
2021-09-13 14:05:22 +00:00
Tetsui Ohkubo
eb326db028 FileOperation: Deduplicate destination file names on copy
When there is a file with the same name in the destination directory,
FileManager overwrites that file without any warning. With this change,
such a file will be automatically renamed to "emoji-2.txt", for example.

Also, currently there is a check in FileManager that makes copy and
paste of a file in the same directory no-op. This change removes that
check, because it is no longer a problem.
2021-09-13 18:08:34 +04:30
Andreas Kling
09087b8f8e LibWeb: Add handful of CSS properties and identifiers
This is just to make the CSS parser stop whining when it encounters some
very common properties and identifiers. More work will be required to
actually support these things. :^)
2021-09-13 15:25:53 +02:00
Mustafa Quraish
1d47d41c01 PixelPaint: Fix Line/Rectangle second paint alignment with pixels
The problem was a bit more complex than originally anticipated,
and the root of the problem is that the "coordinates" of a pixel
are actually the top left of the pixel, and when we're really
zoomed in, the difference in editor coordinates of the top-left
and the center of the pixel is significant.

So, we need to offset the "start" point when we are painting on
the editor to account for this, based on the current scale. This
patch adds a `editor_stroke_position` in `Tool` which can be used
to compute what point (in editor coords) we should use for a given
pixel and it's corresponding stroke thickness.

Note that this doesn't really work well with the ellipse, since that
is drawn with a different mechanism. Using this new method with the
`EllipseTool` seems to give the same (or slightly worse) results, so
I have not changed anything there for now.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
9097f86e51 PixelPaint: Call Layer::did_modify_bitmap() after drawing Ellipse
Previously, Any potential ImageClients would not have received an
update about the layer bitmap having been modified. This is similar
to what the other shape tools do upon completion.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
a5c8d1f7dd PixelPaint: Update editor after drawing shapes to clear outside
Previously, we didn't ask the editor to update after drawing a
Rectangle/Line. This meant that if any part of your shape went
outside the bounds of the image, that part would not be cleared out
until the next update of the editor.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
36bcd63c0c PixelPaint: Ensure thickness of shapes is never 0 when drawing
When drawing a line/rectangle/ellipse in `Tool::on_second_paint()`,
if `m_thickness * m_editor->scale()` was less than one, it would
get converted to 0 because of truncation. This was causing infinite
loops somewhere in the painter code and causing the application to
freeze.

Fixes #9986.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
c0373c3119 PixelPaint: Allowing drawing line from center, like other shapes
You could draw a Rectangle/Ellipse from the center by pressing down
the Alt key, but this was missing for lines. This commit adds it in
to keep consistency among the different shapes.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
c5b14fce54 PixelPaint: Adjust menu ampersand shortcut characters
A few of the menu items were missing shortcut characters completely,
so in the interest of keyboard navigation some have been added (even
if they are not ideal).

In a few menus, severals actions had the same menu shortcut, so the
later ones were not accessible through it. These have also been
differentiated.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
351dee4f8f PixelPaint: Properly transfer active tool to editor on tab close
Previously the code assumed that the active tool had a reference to
the old editor, which is the only way we had to check if it is
active without having a reference to the editor. However, when a
tab in PixelPaint is closed, the editor is destroyed, so the `WeakPtr`
in a tool referencing the old editor is no longer valid.

This made it so that if you closed a tab, the tool would appear to be
selected in the ToolBox, but the editor would not know about it at all.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
ecf8f243a6 PixelPaint: Have ToolboxWidget keep track of active tool
Since there's only one global toolbox, it makes sense to store the
active tool in here, since we don't really have control over the
deletion of an editor.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
ee25e2adc2 PixelPaint: Call Layer::did_modify_bitmap() when applying filters
Previously applying filters was not calling this method, which was
not correctly triggering the `image_did_modify_bitmap` call for
the `ImageClient`s. This patch makes the filter actions call this
method.

It seems that just opening one of the Window menus triggers a repaint
of the entire editor, which is what was causing filters to update
earlier, since we were only accessing them from the menu. Using
the keyboard shortcut added in a previous commit highlighted this issue.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
672c4cdbc2 PixelPaint: Add keyboard shortcut for Invert filter
Many of the popular photo editing applications have Ctrl+I as a
shortcut to invert the colors, so let's get on board :^)
2021-09-13 13:43:53 +02:00
Mustafa Quraish
3dccafb2a0 PixelPaint: Draw layers from the top of LayerList
As pointed out by Andreas, drawing them from the bottom feels odd
since no other list in the UI is bottom-justified. The commit draws
the layers from the top of the list again.
2021-09-13 13:43:53 +02:00
Andreas Kling
449cbd5ecc LibWeb: Implement Node.isEqualNode(Node? otherNode) 2021-09-13 12:54:24 +02:00
Andreas Kling
a0528598b5 LibWeb: Implement Node.isSameNode(Node? otherNode) 2021-09-13 12:49:23 +02:00
Ali Mohammad Pur
25f43ea0a1 AK: Make Span::operator==() comply with the ISO C++ idea of operator==
This should:
- Accept const& on both sides
- Not involve implicit conversions on either side

otherwise the argument order would be deemed significant, and trip this
warning.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
a42c7757d3 AK: Switch Span.h to east-const style 2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
a72eea6408 AK: Give BumpAllocator a single-block cache
This avoid excessive mmap/munmap traffic in normal operation.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
e4b1c0b8b1 LibRegex: Set a signpost on every executed regular expression 2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
246ab432ff LibRegex: Add a basic optimization pass
This currently tries to convert forking loops to atomic groups, and
unify the left side of alternations.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
913382734c AK: Allow RBTree::find_largest_not_above_iterator() to fail
Previously this function would've crashed if the key failed to match any
entry.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
27e3589f61 AK+Kernel: Avoid unescaped control chars in append_escaped_for_json()
Otherwise it could produce invalid JSON.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
e1e91f6c85 Kernel: Deduplicate signpost perf event strings 2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
d600f0d5b3 Kernel: Specialize Traits<(Nonnull)OwnPtr<T>> for KString
To make it behave like a string, since KString is always stored as a
(Nonnull)OwnPtr in the kernel.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
a21a3c2620 AK: Make traits for NonnullOwnPtr use ptr_hash instead of int_hash
Otherwise they'd be truncating the pointer in 64-bit builds.
2021-09-13 14:38:53 +04:30
Andreas Kling
7632cce5e5 LibWeb: Make requestAnimationFrame() work in multi-process mode
Since we don't have a direct connection to WindowServer, this is slighly
more naive implementation than what we were doing for single-process
mode.

Basically, there's a global RequestAnimationFrameDriver object that
has a 16ms single-shot timer. Whenever someone registers for a RAF
callback, we start the timer (if needed).

This is not ideal, but it's better than nothing. :^)
2021-09-13 02:03:06 +02:00
Idan Horowitz
f21041861b LibWeb: Add the URLSearchParams built-in
This is a very partial implementation, as some features (like 2 of the
possible constructor types, iteration and the getAll method) are
missing, and other's are not implemented due to the currently missing
URL built-in.
2021-09-13 01:43:10 +02:00
Idan Horowitz
de19dcf81a LibWeb: Add URL::url_decode for decoding form url encoded parameters 2021-09-13 01:43:10 +02:00
Idan Horowitz
4629f2e4ad LibWeb: Add the Web::URL namespace and move URLEncoder to it
This namespace will be used for all interfaces defined in the URL
specification, like URL and URLSearchParams.

This has the unfortunate side-effect of requiring us to use the fully
qualified AK::URL name whenever we want to refer to the AK class, so
this commit also fixes all such references.
2021-09-13 01:43:10 +02:00