Commit Graph

21365 Commits

Author SHA1 Message Date
Andreas Kling
8887766607 LibGfx: Remove bogus rounding in FontPixelMetrics::line_spacing() 2023-01-06 12:02:20 +01:00
Andreas Kling
bb0c5f8ab4 LibGfx/OpenType: Use typographic metrics when asked to by the OS/2 table 2023-01-06 12:02:20 +01:00
Andreas Kling
c3018f8beb LibVT: Simplify TerminalWidget::widget_size_for_font()
Reuse the base size calculation from compute_base_size() instead of
duplicating it.
2023-01-06 12:02:20 +01:00
Andreas Kling
ddc0c13007 LibVT: Use font pixel height (pixel_size) when calculating line heights 2023-01-06 12:02:20 +01:00
Andreas Kling
2e1b8b90f4 LibVT: Compute the font metrics once and cache them
The height of a line or column doesn't change unless the font changes,
and we were already caching the line height. This patch extends it so
we also cache the column width.
2023-01-06 12:02:20 +01:00
Andreas Kling
b4946eac6e LibVT: Fix bug where terminal size got lost on font size change
When changing the font size, we now resize the terminal widget *before*
setting the font. This ensures that we keep the same logical terminal
size after the font change.
2023-01-06 12:02:20 +01:00
Timothy Flynn
4cbdc747ab LibCards+Solitaire: Elevate card highlight management to the card stack
Instead of indicating which individual cards should be highlighted, card
games now indicate which stack is highlighted. This lets the stack draw
empty stacks with a highlight (e.g. the Foundation stack in Solitaire).
If the stack is non-empty, the stack can delegate highlighting to the
top-most card.
2023-01-06 12:02:10 +01:00
Timothy Flynn
8d8fcd0d64 LibCards: Draw the inside of card highlight rects with rounded corners
Currently, the outside of the card highlight has rounded corners, but
the inside has square corners. It looks a bit more polished if they are
both rounded.
2023-01-06 12:02:10 +01:00
Aliaksandr Kalenik
b2a04ff48a LibWeb: Consider percent and fixed widths in table column distribution
Change column distribution to take in account is_length() and
is_percentage() width values instead of treating all cells like
they have auto width by implementing it in the way described
in CSS Tables 3 spec:
https://www.w3.org/TR/css-tables-3/#width-distribution-algorithm

distribute_width_to_column() is structured to follow schema:
w3.org/TR/css-tables-3/images/CSS-Tables-Column-Width-Assignment.svg
2023-01-06 12:01:46 +01:00
Aliaksandr Kalenik
21d89a2153 LibWeb: Use available space to resolve table cells width
It is not possible to use width of containing block to resolve
cells width because by the time compute_table_measures() is
called row width is not known yet.
2023-01-06 12:01:46 +01:00
BodilessSleeper
90b43712e6 LibJS: Rename ToIntegerThrowOnInfinity to ToIntegerWithTruncation
This commit ticks away two of the boxes in #15525
Temporal commits: tc39/proposal-temporal@f274678 and
tc39/proposal-temporal@a63a0fb
2023-01-06 11:16:55 +01:00
BodilessSleeper
18122c0368 LibJS: Replace "is not zero" language in Temporal comments
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@9cd448a
2023-01-06 11:16:55 +01:00
Tim Ledbetter
fc5bcd8476 PixelPaint: Allow repeated zooming with the zoom tool
Previously, the zoom tool only allowed the user to zoom in or out
once, as it didn't take account of the current zoom level.
2023-01-06 00:34:38 +01:00
Timothy Flynn
76b9d06b19 LibJS: Add and begin using a completion-compatible string builder
ThrowableStringBuilder is a thin wrapper around StringBuilder to map
results from the try_* methods to a throw completion. This will let us
try to throw on OOM conditions rather than just blowing up.
2023-01-05 22:07:44 +01:00
VayuDev
fab8ef3dfc LibWeb: Pass FloatRect to Painter::draw_text in fill_text
Don't round float values to int values in
CanvasRenderingContext2D::fill_text when passing them to
Painter::draw_text.

This also fixes a fixme.
2023-01-05 15:47:40 -05:00
MacDue
93737a4b00 LibWeb: Return floats from color stop resolution functions
These don't deal with pixels so should not return CSSPixels. This
removes one suspicious looking cast.
2023-01-05 19:56:43 +01:00
BodilessSleeper
8e6920a18d LibJS: Convert calendar operation results to floats
This commit ticks away one of the boxes in #15525
Temporal commit:  tc39/proposal-temporal@11aad40
2023-01-05 19:49:09 +01:00
Sam Atkins
3b682e885e GMLPlayground: Fill preview window with background color
Without this, the "Widget not registered" error stays visible if the
widgets defined by the GML do not themselves fill with their background
color.

Also tidied up some unused includes.
2023-01-05 18:58:08 +01:00
Sam Atkins
4084c66ad2 LibWeb: Use CSS Pixels for viewport rects 2023-01-05 17:42:31 +01:00
Sam Atkins
8cc0bdf777 LibWeb: Resolve Lengths to CSSPixels 2023-01-05 17:42:31 +01:00
Sam Atkins
7d40e3eb0d LibWeb: Replace all px Length creation with Length::make_px(CSSPixels) 2023-01-05 17:42:31 +01:00
Sam Atkins
13b1952929 LibWeb: Convert AbstractImageStyleValue to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
02cd853eee LibWeb+Browser+WebContent: Convert BoxModelMetrics to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
5d8e3f5122 LibWeb: Convert Layout::Node to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
65cdf89a8b LibWeb: Convert Layout Boxes to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
c70dcaefcd LibWeb: Convert LayoutState to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
76047d1932 LibWeb: Convert InlineLevelIterator/LineBox/LineBuilder to new px units 2023-01-05 17:42:31 +01:00
Sam Atkins
700ba0007f LibWeb: Convert TableFormattingContext to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
ec336c9bc5 LibWeb: Convert SVGFormattingContext to new pixel units
This is a tiny change but I'm doing it now for the sake of completeness.
2023-01-05 17:42:31 +01:00
Sam Atkins
056acb5ebf LibWeb: Convert InlineFormattingContext to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
55ddfa9348 LibWeb: Convert GridFormattingContext to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
f2c977251b LibWeb: Convert FlexFormattingContext to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
ace66d4a3e LibWeb: Convert BlockFormattingContext to new pixel units 2023-01-05 17:42:31 +01:00
Sam Atkins
f5f25562d1 LibWeb: Convert FormattingContext to new pixel units
Just FormattingContext and AvailableSpace, and the minor adjustments to
make everything else work.
2023-01-05 17:42:31 +01:00
Sam Atkins
4754204f01 LibWeb: Create CSS::Sizes from CSSPixels 2023-01-05 17:42:31 +01:00
Sam Atkins
affc8a22ca LibWeb+WebContent: Convert BrowsingContext to new pixel units
This fixes a few glitches. We no longer give the page double the width
it should have, and we mark the correct area of the page as needing
repainting.
2023-01-05 17:42:31 +01:00
Timothy Flynn
8c7f6abf58 Games: Add a Cards Settings menu item to Hearts, Solitaire, and Spider 2023-01-05 13:05:13 +00:00
Timothy Flynn
33fd2c1af9 LibCards: Add a helper to create an action to open Cards Settings
This is a useful shortcut to open the settings from within the game
rather than having to go through the system menu.
2023-01-05 13:05:13 +00:00
Timothy Flynn
a2277655c0 Solitaire: Highlight cards beneath dragged cards that are valid targets
If the card beneath the card currently being dragged is a valid drop
target, we will highlight it to indicate this to the user.
2023-01-05 13:05:13 +00:00
Timothy Flynn
2a09807f2e LibCards: Support highlighting cards of interest
For example, in Solitaire, when dragging a card around, it's common for
other implementations to highlight the card underneath the dragged card
if that other card is a valid drop target. This implementation will draw
a rounded rectangle within the edges of the highlighted card, using a
rudimentary complementary color of the board background color.
2023-01-05 13:05:13 +00:00
MacDue
eeb6072f15 LibGfx+LibPDF: Apply subpixel offset in affine transformation 2023-01-05 13:50:26 +01:00
MacDue
91db49f7b3 LibPDF: Use subpixel accurate text rendering
This just enables the new tricks from LibGfx with the same nice
improvements :^)
2023-01-05 12:09:35 +01:00
MacDue
6632023498 LibGfx: Enable subpixel accurate text rendering in Painter::draw_text()
This improves kerning and alignment jittering quite a bit :^)
2023-01-05 12:09:35 +01:00
MacDue
ada48a1daf LibGfx: Add ability to request glyphs at subpixel offsets to fonts
This adds the option to pass a subpixel offset when fetching a glyph
from a font, this offset is currently snapped to thirds of a pixel
(i.e. 0, 0.33, 0.66). This is then used when rasterizing the glyph,
which is then cached like usual.

Note that when using subpixel offsets you're trading a bit of space
for accuracy. With the current third of a pixel offsets you can end
up with up to 9 bitmaps per glyph.
2023-01-05 12:09:35 +01:00
MacDue
a1726b1ba5 LibGfx: Avoid rounding/truncating glyph positions till blitting
This keeps some overloads that accept ints to avoid adding calls to
.to_type<float>() all over the place.
2023-01-05 12:09:35 +01:00
Nico Weber
68f678f566 LibGfx+icc: Print if profile id is valid 2023-01-05 10:54:35 +01:00
Nico Weber
fafacbb87b LibCrypto: Add equality operators for Crypto::Hash::Digest<> 2023-01-05 10:54:35 +01:00
Nico Weber
7080aac84f LibGfx: Remove useless name from try_load_from_externally_owned_memory() 2023-01-05 10:54:35 +01:00
Nico Weber
5d4ffd5580 icc: Print profile id 2023-01-05 10:54:35 +01:00
Nico Weber
34a21efef6 LibGfx: East-const-ify ICCProfile::pcs_illuminant() 2023-01-05 10:54:35 +01:00