Commit graph

28010 commits

Author SHA1 Message Date
Jelle Raaijmakers
6f4fbd59d9 Ports: Update PHP to version 8.0.10 2021-09-23 18:51:21 +02:00
Jelle Raaijmakers
36a7091531 Ports: Remove the now superfluous PHP network patch 2021-09-23 18:51:21 +02:00
Tobias Christiansen
0ccde5417b LibWeb: Don't assume the parent is BFC in the IFC 2021-09-23 17:48:11 +02:00
Tobias Christiansen
4560a8b83f LibWeb: Flexbox: Use InlineFormattingContext when needed
Previously any children would be layout using a BlockFormattingContext.
Now we at least differentiate between IFC and BFC if the sizes in
question are not constrained by other things.
2021-09-23 17:48:11 +02:00
Tobias Christiansen
54013ffbe0 LibWeb: Proritize FlexFormattingContext when display: flex is specified
An item with display: flex and overflow: hidden would've caused a
BlockFormattingContext before.
2021-09-23 17:48:11 +02:00
Sam Atkins
e0a727bc76 LibWeb: Remove type checking from set_property_expanding_shorthands()
Now that the Parser checks that StyleValues are valid, we don't need to
do the checks here, since any value here is guaranteed to be acceptable.
2021-09-23 17:47:40 +02:00
Sam Atkins
f574f538d2 LibWeb: Use property_accepts_value() for parsing text-decoration 2021-09-23 17:47:40 +02:00
Sam Atkins
4bc9b9eaaa LibWeb: Use property_accepts_value() for overflow parsing 2021-09-23 17:47:40 +02:00
Sam Atkins
85254ada94 LibWeb: Fix auto conversion to identifier
Calling `is_identifier()` here was wrong, since it just means you can
get an Identifier from it. This meant that an `auto` LengthStyleValue
would return true, then it would get `static_cast` to the wrong class,
and return a garbage value.

Basically, I really need to tidy up the API for StyleValue, so it's
clear whether `is_foo()` means the object is a `FooStyleValue`, or it
can just return a `foo` value.
2021-09-23 17:47:40 +02:00
Sam Atkins
b08094bccc LibWeb: Use property_accepts_value() for list style parsing 2021-09-23 17:47:40 +02:00
Sam Atkins
dcf70ab821 LibWeb: Use property_accepts_value() for font parsing 2021-09-23 17:47:40 +02:00
Sam Atkins
b927972da7 LibWeb: Add range-checking to property_accepts_value()
For `number` and `integer` types, you can add a range afterwards to add
a range check, using similar syntax to that used in the CSS specs. For
example:

```json
"font-weight": {
  ...
  "valid-types": [
    "number [1,1000]"
  ],
  ...
}
```

This limits any numbers to the range `1 <= n <= 1000`.
2021-09-23 17:47:40 +02:00
Sam Atkins
e262596ee1 LibWeb: Use property_accepts_value() for parsing flexbox properties 2021-09-23 17:47:40 +02:00
Sam Atkins
37e69fb286 LibWeb: Use property_accepts_value() when parsing borders 2021-09-23 17:47:40 +02:00
Sam Atkins
5213760e4b LibWeb: Use property_accepts_value() for background parsing
We also get rid of `is_background_{image,repeat}()` since they're no
longer needed. :^)
2021-09-23 17:47:40 +02:00
Sam Atkins
35eb8b0dc2 LibWeb: Add better debug logging for CSS parsing errors
Hidden behind `CSS_PARSER_DEBUG`, so I won't drive everyone else crazy.
:^)
2021-09-23 17:47:40 +02:00
Sam Atkins
5d6a4c5fc2 LibWeb: Check parsed CSS values with property_accepts_value()
This brings us a few nice benefits:

- We only generate a `StyleValueList` for properties that accept
  multiple values.
- We reject declarations that have too many values.
- We check the type of each value that is parsed, to make sure it's
  acceptable to the property.

Probably there are some regressions here, since this is

Later, we can also replace many of the `is_foo()` functions and lambas
inside the Parser with more calls to `property_accepts_value()`. Also we
can remove some checks when resolving styles, since only valid types of
values will get to that point. But one step at a time. :^)
2021-09-23 17:47:40 +02:00
Sam Atkins
11d3098f40 LibWeb: Generate property_accepts_value() function :^)
Previously, we have not been validating the values for CSS declarations
inside the Parser. This causes issues, since we should be discarding
invalid style declarations, so that previous ones are used instead. For
example, in this code:

```css
.foo {
  width: 2em;
  width: orange;
}
```

... the `width: orange` declaration overwrites the `width: 2em` one,
even though it is invalid. According to the spec, `width: orange` should
be rejected at parse time, and discarded, leaving `width: 2em` as the
resulting value.

Many properties (mostly shorthands) are parsed specially, and so they
are already rejected if they are invalid. But for simple properties, we
currently accept any value. With `property_accepts_value()`, we can
check if the value is valid in `parse_css_value()`, and reject it if it
is not.
2021-09-23 17:47:40 +02:00
Sam Atkins
633ede5c6c LibWeb: Add valid-value information to Properties.json 2021-09-23 17:47:40 +02:00
Sam Atkins
57168150aa LibWeb: Add several CSS identifiers to the list
These ones are needed by the value-checking system, coming next.
2021-09-23 17:47:40 +02:00
Sam Atkins
603f611ceb LibWeb: Sort StyleValue enums alphabetically
I was finding it impossible to find them.
2021-09-23 17:47:40 +02:00
Sam Atkins
4a1dbb4f36 LibWeb: Move color identifier checking to StyleValue::is_color()
This allows us to perform this check outside of the CSS Parser.
2021-09-23 17:47:40 +02:00
Sam Atkins
a1bc89b814 LibWeb: Generate property_maximum_value_count()
This will allow the CSS Parser to check if a property has been give too
many arguments, and if so, reject it as invalid.
2021-09-23 17:47:40 +02:00
Sam Atkins
e40ea819d9 LibWeb: Prevent special-case CSS property parsing fallback
We don't want a property like `background` to fall back to parsing as a
single value or StyleValueList if `parse_background_style_value()`
fails. We just want it to fail.
2021-09-23 17:47:40 +02:00
Eric Seifert
8924b1f532 Kernel: Allow PROT_NONE in mmap and mprotect for stack regions
To allow for userspace guard pages (ruby uses this).
Redundant since serenity creates them automatically,
but should be allowed anyway.
2021-09-23 04:14:41 +00:00
Brian Gianforcaro
925f21353e Meta: Exclude LibWasm Parser.cpp from Sonar Cloud Static Analysis
We need to exclude this file from analysis for now, as there is a bug in
the sonar-runner tool where it crashes when trying to understand the use
of AK::Variant in LibWasm/Parser/Parser.cpp

See #10122 for details + link to the bug report to Sonar Cloud.
2021-09-23 01:07:11 +02:00
Brian Gianforcaro
eddccf11da Meta: Remove unused caching from Sonar Cloud configuration
I was experimenting with using caching while doing the initial prototype
of the Sonar Cloud workflow. However the cache size for the static
analysis data ended up being large enough that it would put us over the
git hub actions limit. Given that we currently only run this pipeline
once a day, it seems reasonable to just remove caching.

If in the future we decide to run the pipeline on every PR, caching
would become crucial as the current un-cached analysis time is around
1 hour and 50 minutes. If we did this we would need to move the pipeline
to Azure DevOps where we have effectively infinite cache available.
2021-09-23 01:07:11 +02:00
Karol Kosek
620e4fd0d2 WebContent: Pass an empty bitmap object if the pointer is null
Prior this commit we were always dereferencing the image bitmap pointer,
even if it was null, which resulted in a crash when trying to open
the context menu when an image wasn't loaded.

Closes: #10178
2021-09-22 22:10:11 +02:00
Tobias Christiansen
a501a02851 LibWeb: Ignore negative margins for calculating height in a BFC
Negative margins are a headache anyways, and allowing them to be
negative lead to weird behavior.
This patch avoids vasty wrong height-calculations by limiting the
allowed margins to positive numbers when evaluating the height of a
block.
2021-09-22 22:06:52 +02:00
thankyouverycool
bbaebdcd00 FontEditor: Keep selected glyph in view on resize 2021-09-22 21:35:42 +02:00
thankyouverycool
efe44451ca FontEditor: Make update_{statusbar,preview} member functions
For use outside constructor. Renames demo to preview to make
the UI and code comport.
2021-09-22 21:35:42 +02:00
thankyouverycool
3159e548a5 LibGUI: Calculate unclamped_scrubber_size() as float
Large enough content ranges produced unclamped scrubbers sized zero,
effectively clamped by their integer type. This led to zero sized
page_increments and scrubbers which didn't budge on gutter events.
This fixes broken gutters in FontEditor and TextEditor for large
files.
2021-09-22 21:35:42 +02:00
thankyouverycool
e8f3fda3cf FontEditor: Remove reprobe_font()
This was used to update GlyphMapWidget on Type changes and is
no longer needed since removal of Type enumeration in bb592ae.
2021-09-22 21:35:42 +02:00
thankyouverycool
144d32d537 FontEditor: Sanitize RTL and control glyphs in Clipboard metadata
Fixes display issues in ClipboardHistory.
2021-09-22 21:35:42 +02:00
thankyouverycool
0a4640e892 FontEditor: Put glyph width changes on the undo stack
And select the restored glyph on undo/redo.
2021-09-22 21:35:42 +02:00
thankyouverycool
1ae4caca4b FontEditor: Set width to zero when deleting a glyph
Previously, Delete left a glyph's width maximized.
2021-09-22 21:35:42 +02:00
thankyouverycool
ca6cb6cec3 FontEditor: Simplify initialization by disabling widget callbacks
Reduces some complexity dealing with callback effects and fixes
redundant calls to update_title and erroneously set glyph widths.
2021-09-22 21:35:42 +02:00
thankyouverycool
92fffc3abc LibGUI: Rename CallOnChange => AllowCallback and implement elsewhere
This is a helpful option to prevent unwanted side effects, distinguish
between user and programmatic input, etc. Sliders and SpinBoxes were
implementing it idiosyncratically, so let's generalize the API and
give Buttons and TextEditors the same ability.
2021-09-22 21:35:42 +02:00
Luke Wilde
d47e431d54 LibWeb: Add getElementsByTagNameNS and add support for * in non-NS
This also moves getElementsByTagName to ParentNode to remove the code
duplication between Document and Element. This additionally fixes a bug
where getElementsByTagName did not check if the element was a
descendant, meaning it would also include the context element if the
condition matched.
2021-09-22 20:33:06 +02:00
Sam Atkins
5c7dca3526 LibWeb: Stop rejecting valid values for several CSS properties
In StyleResolver, we were rejecting single values for properties that
take 1-4: `border-color`, `border-style`, and `border-width`. Now, we
handle them correctly. I also added support for `calc()` and `var()` to
`padding` and `margin`.

This fixes the orange border on Acid2, which now correctly appears
black. :^)
2021-09-22 20:32:35 +02:00
Andreas Kling
635ab6db0b LibWeb: Expose the GlobalEventHandlers mixin on the Window object
We now expose all the `onfoo` event handler attributes on the window
object. This makes `window.onload = ...` actually work. :^)
2021-09-22 16:40:24 +02:00
Andreas Kling
fb2f7c7b9c LibWeb: Remove unnecessary WindowObject.h include in DOMException.h 2021-09-22 15:37:50 +02:00
Andreas Kling
1884e2caf1 LibWeb: Add DOM::ExceptionOr<T> to forwarding header 2021-09-22 15:37:21 +02:00
Andreas Kling
fccf0a466b LibWeb: Log resource load success before invoking success callback
The success callback may trigger JavaScript execution, causing resource
load times to appear much longer than they actually are. :^)
2021-09-22 14:35:13 +02:00
Andreas Kling
784ab75d2d LibCoredump: Don't copy uncompressed coredumps into a ByteBuffer
This was completely unnecessary and accounted for 6% of the total time
spent when loading a WebContent coredump into CrashReporter.
2021-09-22 00:40:07 +02:00
Idan Horowitz
1da8faebf5 LibJS: Convert perform_eval to ThrowCompletionOr 2021-09-21 23:28:38 +03:00
Idan Horowitz
e24d4c346d LibJS: Add VM::throw_completion helper for throwing custom Strings 2021-09-21 23:28:38 +03:00
Idan Horowitz
f302b114f3 LibJS: Convert get_substitution to ThrowCompletionOr 2021-09-21 23:28:38 +03:00
Idan Horowitz
69430855e0 LibJS: Remove non-specification compliant exception check 2021-09-21 23:28:38 +03:00
Idan Horowitz
e90e4ac1e2 LibJS: Convert length_of_array_like to ThrowCompletionOr 2021-09-21 23:28:38 +03:00