Commit Graph

26778 Commits

Author SHA1 Message Date
Karol Kosek
dabbe4ee27 LibGUI: Add track_margin() to Sliders
Less magic numbers! :^)
2021-09-03 02:32:43 +02:00
Mustafa Quraish
1cbab1c7e6 LibGfx/Color: Add suggested_foreground_color() method
This allows you to ask the color to recommend either white/black
as a contrasting text color if you were using the color as the
background. This uses the previously added luminosity() method.
2021-09-03 01:51:05 +02:00
Mustafa Quraish
882d57326c LibGfx/Color: Use luminosity to compute grayscale value
Issue #9758 discusses this.
2021-09-03 01:51:05 +02:00
Mustafa Quraish
ca6c9be94c PixelPaint: Add actions to rotate image left/right
This also required adding a new hook to `ImageClient`, since there
wasn't a way of telling the ImageEditor that the full rect of the
image has changed (as when we rotate).
2021-09-03 01:50:11 +02:00
Mustafa Quraish
6a8c408856 PixelPaint: Add actions to flip image vertically/horizontally 2021-09-03 01:50:11 +02:00
Mustafa Quraish
0c56f06994 PixelPaint: Draw layers from bottom of panel, adjust spacing
If we don't have enough layers to be able to scroll, the layers
are pushed to be at the top of the layer list. This doesn't make
much sense now that we are correctly drawing the layers in the
right order, so now we draw them justified towards the bottom.

Previously we were also clipping the bottom gadget slightly when
there were enough layers to scroll. Now, I'm adding some offset to
the total height to account for this and give equivalent spacing
from the top and bottom layers.
2021-09-03 01:49:32 +02:00
Mustafa Quraish
339f0d5bca PixelPaint: Add Merge Active Layer Down action
This allows you to merge the active layer with the one below it.
2021-09-03 01:49:32 +02:00
Mustafa Quraish
97cc34c034 PixelPaint: Fix the displayed order of layers in LayerListWidget
Previously the background layer was shown at the top, and layers
in front of it were shown below it. This was really unintuitive.

This patch fixes LayerListWidget to now properly differentiate
between the index of a gadget, and the index of a layer, since they
are essentially mirrored. I chose not to modify the order in which
layers are stored since back-to-front makes it really convenient
there.
2021-09-03 01:49:32 +02:00
Musab Kılıç
432839c2e9 FileManager: Kindly ask the user if they want to delete a file 2021-09-02 23:52:29 +02:00
Luke Wilde
b275b8c87a LibWeb: Check target's root instead of target itself in EventDispatcher
This was accidentally missing ".root()": "or parent is a node and
target’s _root_ is a shadow-including inclusive ancestor of parent"

https://dom.spec.whatwg.org/#concept-event-dispatch Step 5.9.6
2021-09-02 22:53:19 +02:00
Luke Wilde
f7f37eaa0f LibWeb: Make Node::root return a reference
The root of a node can never be null, as "the root of an object is
itself, if its parent is null, or else it is the root of its parent."

https://dom.spec.whatwg.org/#concept-tree-root
2021-09-02 22:53:19 +02:00
Musab Kılıç
7f46022e66 LibVT: Execute DragOperation after resetting active hyperlink 2021-09-02 22:48:10 +02:00
Sam Atkins
724f45c784 Browser: Reload the DOM Inspector's JSON data when loading a new page
Of course, there are other reasons the DOM might change, but one thing
at a time. :^)
2021-09-02 22:16:41 +02:00
Sam Atkins
73c95bcd5f Browser: Reset the DOM Inspector's state when re-opening it
This resets the DOM Inspector to a default state when re-opening it,
instead of it displaying the previous selection and properties, which
may be outdated. This is closer to how Chrome and Firefox behave.
Eventually, it probably makes sense to copy their behavior of selecting
the `<body>` element by default.
2021-09-02 22:16:41 +02:00
Sam Atkins
97379ace25 Browser: Implement "Inspect Element" context menu action
This is finally working for OOPWV! :^)
2021-09-02 22:16:41 +02:00
Sam Atkins
1ccf10789e LibWeb+WebContent: Add query for hovered DOM node to OOPWV
This is needed for the "Inspect Element" context menu action.
2021-09-02 22:16:41 +02:00
Sam Atkins
3b07f49d48 LibWeb+WebContent: Implement asynchronous DOM Node properties call
This lets us "push" a new style-properties list to the DOM Inspector,
for example when JS changes the style of the inspected node.
2021-09-02 22:16:41 +02:00
Sam Atkins
1da07734bb Browser: Display style properties in DOM Inspector
This makes use of the new `inspect_dom_node()` IPC call.
2021-09-02 22:16:41 +02:00
Sam Atkins
f381f8d63e LibWeb+WebContent: Add inspect_dom_node() IPC call
This is the IPC version of `Document::set_inspected_node()`, using a
node ID.

We return the inspected node's style properties as JSON, so that the DOM
Inspector can immediately display them.
2021-09-02 22:16:41 +02:00
Sam Atkins
e824454ab4 LibWeb: Implement DOMTreeModel::index_for_node()
This will be used to find the index to select when the DOM Inspector is
told to inspect a specific node.
2021-09-02 22:16:41 +02:00
Sam Atkins
fe820f6d5a LibWeb: Replace unused DOMTreeModel with DOMTreeJSONModel
The direct-Document-access DOMTreeModel is no longer used, since the DOM
Inspector has to access the Document remotely over IPC. This commit
removes it, and renames DOMTreeJSONModel to take its place, since it no
longer has to differentiate itself from the non-JSON one.

In case that didn't make sense:
- Delete DOMTreeModel
- Rename DOMTreeJSONModel -> DOMTreeModel
2021-09-02 22:16:41 +02:00
Sam Atkins
57ee7b3d56 LibWeb: Modify StylePropertiesModel to work with JSON
Now that the DOM Inspector communicates remotely with the web content,
we can't read the `StyleProperties` object from a `Node` directly, but
will receive JSON over IPC. This updates the model to match.
2021-09-02 22:16:41 +02:00
Sam Atkins
08aa7b77a7 Browser: Remove residual InProcessWebView code from DOM Inspector
This is no longer useful, and has to go before I can change how the
Models work.
2021-09-02 22:16:41 +02:00
Sam Atkins
1159eefff3 LibWeb: Include DOM Node ID in serialized JSON
This will be used in the DOM Inspector to communicate which node is
being inspected.
2021-09-02 22:16:41 +02:00
Sam Atkins
2d6a02f03b Browser: Prevent opening multiple DOM Inspectors for the same Tab
Also simplify the logic by removing `Tab::view_dom_tree()`, and making
the Tab keep a pointer to the InspectorWidget instead of its Window,
since that's more often what we want to access.
2021-09-02 22:16:41 +02:00
Sam Atkins
d7485df928 LibWeb: Give each Node a unique ID
We maintain a directory of ID -> Node. Nodes add themselves to this
directory when they are created, receiving a random ID. When a Node is
destroyed, it removes itself from this directory. Anyone can request a
Node from the directory by its ID using `Node::from_id()`.

We reserve the `0` ID to mean "none".

These IDs allow different processes to communicate about a given Node
over IPC, for example the DOM Inspector.
2021-09-02 22:16:41 +02:00
Sam Atkins
48a2239f60 LibWeb: Remove commented-out dbgln
This is unrelated to the PR I'm working on, but keeps getting
reformatted because clang-format wants comments to start with a space.
2021-09-02 22:16:41 +02:00
Linus Groh
3492fbf9cf LibJS: Account for negative numbers in ToTemporalDurationRecord
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fa9d547
2021-09-02 20:16:44 +01:00
Linus Groh
0e6d503317 LibJS: Throw RangeError for non-integral values in ToPartialDuration
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/895c8e5
2021-09-02 20:16:44 +01:00
Linus Groh
7acd174c85 LibJS: Reflect normative changes in ParseTemporalInstantString
Most of it doesn't affect us yet as the parsing code and additional AOs
are not implemented yet.

See: https://github.com/tc39/proposal-temporal/commit/f6ac475
2021-09-02 20:16:44 +01:00
Luke Wilde
c20669328d LibJS: Handle +Infinity, -Infinity, +0 and -0 in modulo operator
Fixes 11 test262 cases.
2021-09-02 18:26:42 +01:00
Timothy Flynn
32825107de LibJS: Implement Intl.Locale.prototype.region 2021-09-02 17:56:42 +01:00
Timothy Flynn
349fd06b86 LibJS: Implement Intl.Locale.prototype.script 2021-09-02 17:56:42 +01:00
Timothy Flynn
c3b6f43641 LibJS: Implement Intl.Locale.prototype.language 2021-09-02 17:56:42 +01:00
Timothy Flynn
bdf36575c8 LibJS: Implement Intl.Locale.prototype.numeric 2021-09-02 17:56:42 +01:00
Timothy Flynn
d7825f3680 LibJS: Implement most Intl.Locale.Prototype.<<keyword>> properties
The keyword accessors all have the same function body in the spec,
except for the Intl.Locale method they invoke. This generates those
properties in the same manner as RegExp.prototype.

    Intl.Locale.prototype.calendar
    Intl.Locale.prototype.caseFirst
    Intl.Locale.prototype.collation
    Intl.Locale.prototype.hourCycle
    Intl.Locale.prototype.numberingSystem

The exception is Intl.Locale.prototype.numeric, which will be defined
separately because it is a boolean value.
2021-09-02 17:56:42 +01:00
Timothy Flynn
21b3c5edba LibJS: Implement Intl.Locale.prototype.baseName 2021-09-02 17:56:42 +01:00
Timothy Flynn
27fc3cfe75 LibJS: Handle existing Intl.Locale objects in CanonicalizeLocaleList 2021-09-02 17:56:42 +01:00
Timothy Flynn
4de05faa8a LibJS: Add test cases for Intl.Locale.prototype.toString
Intl.Locale.prototype.toString wasn't testable before the constructor
was implemented.
2021-09-02 17:56:42 +01:00
Timothy Flynn
17639a42ae LibJS: Implement the Intl.Locale constructor 2021-09-02 17:56:42 +01:00
Timothy Flynn
990dd037d2 LibJS: Implement Intl.Locale.prototype.toString()
This isn't particularly testable yet without the Intl.Locale constructor
but having this defined will make testing the constructor possible. So
more specific tests for this prototype will come later.
2021-09-02 17:56:42 +01:00
Timothy Flynn
940c023e09 LibJS: Compare Unicode locale variants using case-insensitive matching
In the IsStructurallyValidLanguageTag AO, we of course cannot assume the
variants are canonicalized to lower-case yet, because canonicalization
hasn't happened yet.
2021-09-02 17:56:42 +01:00
Timothy Flynn
fdedb3ab33 LibJS: Remove duplicated error message from ErrorTypes.h
ErrorType::IntlInvalidCode has almost exactly the same message as
ErrorType::OptionIsNotValidValue. Remove it, as all uses of the former
are semantically interchangeable with the latter.
2021-09-02 17:56:42 +01:00
Timothy Flynn
21c4922ac0 LibUnicode: Add helper methods to LocaleID and LanguageID for LibJS
Add a method to remove an extension type from the locale's extension set
and methods to convert a locale and language to a string without
canonicalization. Each of these will be used by LibJS.
2021-09-02 17:56:42 +01:00
Timothy Flynn
a05419db55 LibUnicode: Add lexer to test if a string matches the "type" production 2021-09-02 17:56:42 +01:00
Timothy Flynn
113bf4a9dd LibUnicode: Add missing structures to forwarding header 2021-09-02 17:56:42 +01:00
Timothy Flynn
128779938d js: Implement pretty-printing of Intl.Locale 2021-09-02 17:56:42 +01:00
Timothy Flynn
2c10e9fdd3 LibJS: Implement a nearly empty Intl.Locale object
This adds plumbing for the Intl.Locale object, constructor, and
prototype.
2021-09-02 17:56:42 +01:00
Stephan Unverwerth
e7d3483618 LibGL: Implement glTexSubImage2D 2021-09-02 21:00:24 +04:30
Stephan Unverwerth
1aed453d8c LibGL: Add GL_TETXURE*_ARB aliases
These defines were introduced when multitexturing was only supported via
the extension EXT_multitexture. GLQuake makes use of them.
2021-09-02 21:00:24 +04:30