Commit graph

29543 commits

Author SHA1 Message Date
Andreas Kling 723ea4bcd7 LibWeb: Add Layout::Box::border_box_as_relative_rect()
This helper returns the border box (content+padding+border) of a given
box. Margin not included.
2021-10-28 19:44:21 +02:00
Andreas Kling 37f0bd0a42 LibWeb: Small fix to height computation for block-with-inline-children
We now compute the used height of height:auto by measuring from the top
content edge (y=0) to the bottom of the bottommost line box within the
block container.

This fixes an issue where we'd fail to account for the topmost line box
being taller than any of its fragments (which can happen if the
line-height is greater than the height of all fragments on the line.)
2021-10-28 19:20:40 +02:00
Andreas Kling 76fa57713d LibWeb: Use border edges when computing overflow for the ICB 2021-10-28 18:54:02 +02:00
Andreas Kling 03c3b3b7e5 LibWeb: Null-check document before doing layout in PageHost::paint() 2021-10-28 18:29:49 +02:00
Andreas Kling d413d0557d LibWeb: Remove unused CSS::Length::relative_length_to_px(Layout::Node) 2021-10-28 18:15:15 +02:00
Andreas Kling 23561133aa LibWeb: Always update layout (if needed) before painting 2021-10-28 18:14:38 +02:00
Andreas Kling 7ec7729e1b LibWeb: Don't force line box fragments height to be at least line-height
I don't remember why we did things this way, but it's clearly not right
to stretch fragments vertically. Instead, we should just align their
bottom to the appropriate line (as we already do.)
2021-10-28 18:01:04 +02:00
Andreas Kling 88c32836d8 LibWeb: Make non-absolute values for line-height fall back to font-size
When using bitmap fonts, the computed *font* that we're using may be
smaller than the font-size property asked for. We can still honor the
font-size value in layout calculations.
2021-10-28 17:34:37 +02:00
Andreas Kling ec49c8fefd LibWeb: Clip descendants of boxes with overflow:hidden
This is a very limited implementation of overflow:hidden, but since it's
easy to cover this common scenario, let's do it.
2021-10-28 17:09:51 +02:00
Andreas Kling df3cd2fd56 LibWeb: Treat width:auto on tables as fit-content
Tables, unlike other block-level elements, should not stretch to fit
their containing block by default.
2021-10-28 16:06:08 +02:00
Sam Atkins 52a1be5eae LibWeb: Allow whitespace when parsing "!important" in CSS
This accounts for cases like:
```css
.foo {
    color: blue ! important ;
}
```

That's rare now that minifying is so popular, but does appear on some
websites.

I've added spec comments to `consume_a_declaration()` while I was at it.
2021-10-28 16:05:48 +02:00
Sam Atkins 6f1debaab0 LibWeb: Allow whitespace inside CSS attribute selectors
Noticed this while checking some MediaWiki-based sites. It's not
obvious, but the spec does allow this, by not mentioning it in this list
of places whitespace is forbidden:
https://www.w3.org/TR/selectors-4/#white-space
2021-10-28 16:05:48 +02:00
Timothy Flynn 691e4820ac LibWeb: Remove two lowercase string creations from Element::has_class 2021-10-28 15:09:06 +02:00
Timothy Flynn 7f223e2290 LibWeb: Do not create lowercase strings in NamedNodeMap::get_attribute
Rather than following the spec exactly and creating lowercase strings,
we can simply do a case-insensitive string comparison. The caveat is
that creating attributes must follow the spec by creating the attribute
name with a lowercase string.
2021-10-28 15:09:06 +02:00
Ben Wiederhake 934360583f LibWeb: Remove duplicated auto height computation
Note that these two implementation differ, but the one in
FormattingContext.cpp seems to be more complete. It is also more recent.
2021-10-28 13:33:33 +02:00
Andreas Kling 84b15cc7b1 LibWeb: Remove StyleProperties::set_property(PropertyID, StringView)
This API has no more clients (and the last client that I just removed
wasn't even using it right) so let's get rid of it.
2021-10-28 12:53:31 +02:00
Andreas Kling 5c132724ea LibWeb: Properly handle the <td align> attribute
When valid, this attribute needs to result in an IdentifierStyleValue.
Before this change we were turning it into a StringStyleValue, which
then defaulted to left alignment for all values.

For "center" and "middle", we turn it into -libweb-center. All other
values are passed verbatim to the CSS parser.
2021-10-28 12:53:31 +02:00
Brendan Coles c1511ebbea Ports: Add Fontconfig port 2021-10-28 11:25:56 +02:00
Idan Horowitz a8bd78e634 LibC: Include sys/uio.h in sys/socket.h for struct iovec 2021-10-28 11:24:36 +02:00
Idan Horowitz f12da0af13 LibC+LibELF: Move getauxval and AT_* flags to sys/auxv.h 2021-10-28 11:24:36 +02:00
Idan Horowitz f22787dd39 LibC: Change the type of FBProperties' fields from bool to unsigned char
The bool type is not available in C89.
2021-10-28 11:24:36 +02:00
Idan Horowitz 2882a90dec Kernel: Add the IFF_* SIOCGIFFLAGS flag macros 2021-10-28 11:24:36 +02:00
Idan Horowitz adc9939a7b Kernel+LibC: Add support for the IPv4 TOS field via the IP_TOS sockopt 2021-10-28 11:24:36 +02:00
Idan Horowitz 20c7fcfedf Kernel: Fix accidental memory over-read in getsockopt(IP_TTL)
We were accidentally casting the pointer to m_ttl from an u8* to an int*
which resulted in copying of 3 extra unrelated bytes (which turned out
to be padding in this case).
2021-10-28 11:24:36 +02:00
Idan Horowitz c45b1e1983 LibC: Add IPPROTO_ICMPV6 macro 2021-10-28 11:24:36 +02:00
Sam Atkins c1d26c884d ThemeEditor: Display the theme's window icons in the preview
If the icons could not be loaded, we fall back to the defaults (which
are the bitmaps that were always used before.)
2021-10-28 11:23:44 +02:00
Sam Atkins dbeff9ad84 ThemeEditor: Add PathRole editing
This allows both typing the path, and selecting it with a file-open
dialog.
2021-10-28 11:23:44 +02:00
Sam Atkins e58db5592e ThemeEditor: Update value edit boxes when loading a theme file
Previously, these would continue to show the previously entered values,
until you interacted with the ComboBoxes.
2021-10-28 11:23:44 +02:00
Sam Atkins 684f8a6b15 ThemeEditor: Add MetricRole editing
The editing UI at the bottom is now split into two groups, one for
colors and one for metrics.
2021-10-28 11:23:44 +02:00
Sam Atkins 859975f6bd LibGUI: Add MetricRole and PathRole to GUI::Variant
This is needed for making them editable in the ThemeEditor, like
ColorRole is.
2021-10-28 11:23:44 +02:00
Sam Atkins 31ce4d04b6 LibGfx: Add to_string() functions for MetricRole and PathRole 2021-10-28 11:23:44 +02:00
Sam Atkins c885722a94 ThemeEditor: Convert layout to GML 2021-10-28 11:23:44 +02:00
Sam Atkins daaf5890a6 ThemeEditor: Display window shadows in preview :^) 2021-10-28 11:23:44 +02:00
Sam Atkins 885ca2f968 LibGfx+WindowServer: Move shadow-painting code to StylePainter
Specifically, this is to make it accessible to ThemeEditor, but there's
nothing about it that is especially window-specific.
2021-10-28 11:23:44 +02:00
Sam Atkins cf188df86c LibGfx: Make style painters use east const and virtual specifiers 2021-10-28 11:23:44 +02:00
Sam Atkins ab1ce13eea ThemeEditor: Give both preview windows a background color
The inactive window previously didn't have a background fill, so it
looked odd.
2021-10-28 11:23:44 +02:00
Jelle Raaijmakers 770c1935d4 MouseSettings: Reset the double-click timer after every second click
The old behavior of restarting the timer after every second click could
result in double-click-chains (or triple+ clicks), which does not feel
like the right behavior.

By resetting the double-clicking timer, you need to perform a new full
double-click to make the arrows change color again.
2021-10-28 11:21:18 +02:00
Jelle Raaijmakers 7c939c58b8 LibCore: Add ElapsedTimer::reset() 2021-10-28 11:21:18 +02:00
Jelle Raaijmakers ae405ed2eb Ports: Disable MAME FMOPL emulation in ScummVM
It crashes with an unrecoverable page fault. The DOSBox emulation works
fine however, so let ScummVM default to that engine for now.
2021-10-28 00:23:30 +02:00
Jelle Raaijmakers 5f5fe16d4b Ports: Disable SVG in ScummVM themes
The ScummVM modern remastered theme contains SVG images that are
rendered through NanoSVG. Somehow, the ScummVM logo gets all messed up,
but all other SVGs render nicely.

It takes a lot of time to debug NanoSVG, so disable loading SVGs in
themes for now so BMPs are used instead.
2021-10-28 00:23:30 +02:00
Jelle Raaijmakers 3941e4fe24 Ports: Prevent exporting symbols for ScummVM
Both LibGUI and ScummVM have a GUI::Widget class. This interferes with
normal operation of LibGUI, since the wrong GUI::Widget::~Widget() is
invoked when SerenitySDLWidget (from the SDL2 port) is destructed.

By adding `-fvisibility=hidden` to the compiler flags, we set the
symbol visibility to hidden by default and the correct destructor is
invoked again.
2021-10-28 00:23:30 +02:00
Jelle Raaijmakers 59b2bac3a5 Ports: Update ScummVM to 2.5.0 2021-10-28 00:23:30 +02:00
Filiph Sandström c6247fe414 Everywhere: Rename back-click to backward-click
This matches the current forward-click terminology.
2021-10-27 22:05:58 +03:00
Filiph Sandström d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Ben Wiederhake a6ccf6659a Meta: Reimplement license checker in python
On my machine, this script took about 3.4 seconds, and was responsible
for essentially all of the time taken by the precommit hook.

The script is a faithful 1:1 reimplementation, even the regexes are
identical. And yet, it takes about 0.02 seconds, making the pre-commit
hook lightning fast again. Apparently python is just faster in this
case.

Fun fact:
- Just reading all ~4000 files took bash about 1.2 seconds
- Checking the license took another 1.8 seconds in total
- Checking for math.h took another 0.4 seconds in total
- Checking for '#pragma once' took another 0.4 seconds in total

The timing is highly load-dependent, so they don't exactly add up to 3.4
seconds. However, it's good enough to determine that bash is no longer
fit for the purpose of this script.
2021-10-27 11:35:47 -07:00
Ben Wiederhake 074ce35b37 Piano: Fix typo in Copyright header
This was introduced in 74f1f2b5e2.
I have no idea why the checker script didn't pick it up. Bash bug maybe?
2021-10-27 11:35:47 -07:00
Andreas Kling f6573f5f9d LibWeb: Don't create anonymous table boxes around whitespace
This was confusing table layout by adding empty whitspace table boxes
that wound up stealing a bunch of horizontal space.
2021-10-27 18:22:00 +02:00
Andreas Kling ca154723f7 LibWeb: Remove Layout::Box::width_of_logical_containing_block()
This was a hack to percentages within tables relative to the nearest
table-row ancestor instead of the nearest table container.

That didn't actually make sense, so this patch simply removes the hack
in favor of containing_block()->width().
2021-10-27 18:00:51 +02:00
Andreas Kling 4333d0d639 LibWeb: Add fast_is<T>() for HTML::HTMLHtmlElement
Another one spotted in a scroll-up-and-down profile.
2021-10-27 17:58:57 +02:00
Andreas Kling c908fa83e3 LibWeb: Add fast_is<T>() for Layout::Label
Spotted this in a profile while wheel scrolling up & down.
2021-10-27 17:58:19 +02:00