Commit graph

8993 commits

Author SHA1 Message Date
Idan Horowitz
d6cfa34667 AK: Make URL::m_port an Optional<u16>, Expose raw port getter
Our current way of signalling a missing port with m_port == 0 was
lacking, as 0 is a valid port number in URLs.
2021-09-14 00:14:45 +02:00
Idan Horowitz
af5b62d8cd LibWeb: Move url_{encode, decode} to URL/URLSearchParams.{h, cpp}
The new URL built-in that will reside in URL.{h, cpp} will have an
URLSearchParams member, which means it has to include its header, and
as such URLSearchParams.h can't include URL's header, which it needs as
it uses the url_{encode, decode} functions.
2021-09-14 00:14:45 +02:00
Mustafa Quraish
0f749681a9 Everywhere: Use my fancy new serenityos.org email :^) 2021-09-13 20:51:50 +00:00
Andreas Kling
bf86419979 LibWeb: Use ComputedCSSStyleDeclaration to generate data for inspector 2021-09-13 22:21:57 +02:00
Andreas Kling
3ca2e701e6 LibJS: Log scripts parsed by JS::Script::parse() and how long it took 2021-09-13 22:21:57 +02:00
Andreas Kling
7f71f54fc3 Browser: Rename "DOM Inspector" to just "Inspector"
It inspects more than the DOM, after all. :^)
2021-09-13 22:21:57 +02:00
Tobias Christiansen
416559414c LibWeb: Use right dimension when positioning flex-items
Previously the cross-size was used to determine the position along the
main axis which is obviously wrong.
2021-09-13 21:20:35 +01:00
Linus Groh
8cd4a889fe LibWeb: Stop dumping selectors in ParentNode::query_selector{,_all}()
This isn't particularly useful (anymore), especially without any context
about _why_ this output suddenly appears in the debug console.
2021-09-13 21:16:33 +01:00
Mustafa Quraish
f28b2a875a PixelPaint: Make CloneTool change cursor temporarily while selecting
This just provides some nice visual feedback when you are in the
middle of selecting a color. An eyedropper might not be the ideal
choice here, but among the cursors we already have it is the
best one.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
11263beaca PixelPaint: Add ImageEditor::update_tool_cursor() method
This just allows us to ask the image editor to update the tool's
current cursor. This is useful in cases where a tool may want to
change it's cursor for some operation, and wants to invalidate the
active cursor cached in the ImageEditor.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
0472063b96 PixelPaint: Add a marker for CloneTool's selected position
Now we add a little marker to show the current sample position of
the CloneTool. The current implementation for updating the cursor
location is really dumb since it just updates the whole editor,
but that's a yak on the stack to fix.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
fafbe417d1 PixelPaint: Incorporate CloneTool into toolbox 2021-09-13 22:13:22 +02:00
Mustafa Quraish
22b78226b3 PixelPaint: Add Clone Tool :^)
There's still a lot to be desired in terms of functionality and
usability, but this is a start. When using the clone tool, you
can press Alt to sample a location, and then the brush will clone
the color from there.
2021-09-13 22:13:22 +02:00
Linus Groh
35cc579264 LibJS: Also set ExecutionContext::realm in Bytecode::Interpreter::run()
I forgot to consider the bytecode Interpreter when adding a Realm to the
ExecutionContext. This should make it a lot less crashy again :^)
2021-09-13 21:06:18 +01:00
Tobias Christiansen
1d47ec380f LibWeb: FlexBox: Use correct source when querying for the main size
This was an error in understanding what calculated_values are and that
those are not what is wanted when getting the main available size of the
box in the FlexFormattingContext.
The calculation around the size calculation is still a bit wonky, but
this is definietly better.
2021-09-13 21:37:16 +02:00
Tobias Christiansen
4c1da4d43a LibWeb: Fix opacity ComputedCSSStyleDeclaration
There was a classic copy&paste error, opacity wasn't getting the right
computed value to convert.
2021-09-13 21:26:31 +02:00
Mohsan Ali
102d345a8f ImageViewer: Enable and disable navigation
Before there was dialogs to indicate if
current file is last or first.

So in this commit, I added functionality to enable
and disable forward and backward navigation based
on if the next file is avialable or not and if the
pervious file is avialable or not, respectively.

ImageViewer: Refactor code and init data

Data intialization was not happening properly, now I did
Initializations properly so that navigation can work from
the very first image.
2021-09-13 23:46:16 +04:30
Tobias Christiansen
f160fe0407 LibWeb: Add support for a bunch of ComputedCSSStyleDeclarations
This patch adds support for a whole lot of other more easy
ComputedCSSStyleDeclararions.
2021-09-13 20:31:06 +02:00
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