ladybird/Libraries/LibWeb/Painting
Jelle Raaijmakers 9e9db9a9dd LibWeb: Store correct text offsets in PaintableFragment
Previously, we were collapsing whitespace in Layout::TextNode and then
passed the resulting string for further processing through ChunkIterator
-> InlineLevelIterator -> InlineFormattingContext -> LineBuilder ->
LineBoxFragment -> PaintableFragment. Our painting tree is where we deal
with things like range offsets into the underlying text nodes, but since
we modified the original string, the offsets were wrong.

This changes the way we generate fragments:

  * Layout::TextNode no longer collapses whitespace as part of its
    stored "text for rendering", but moves this logic to ChunkIterator
    which splits up this text into separate views whenever whitespace
    needs to be collapsed.

  * Layout::LineBox now only extends the last fragment if its end offset
    is equal to the new fragment's start offset. Otherwise, there's a
    gap caused by collapsing whitespace and we need to generate a
    separate fragment for that in order to have a correct start offset.

Some tests need new baselines because of the fixed start offsets.

Fixes #566.
2025-09-12 15:34:09 -04:00
..
AudioPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
AudioPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
BackgroundPainting.cpp LibWeb/CSS: Use LengthPercentageOrAuto for background sizes 2025-09-04 13:31:24 +01:00
BackgroundPainting.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
BackingStoreManager.cpp LibWeb: Skip backing store allocation for traversables created for SVG 2025-07-13 00:06:30 +02:00
BackingStoreManager.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
Blending.h LibWeb/CSS: Improved implementation of background-blend-mode 2025-04-01 13:38:00 +02:00
BorderPainting.cpp LibWeb/Painting: Paint ridge and groove border styles 2025-08-11 11:07:15 +01:00
BorderPainting.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
BorderRadiiData.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
BorderRadiiData.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
BorderRadiusCornerClipper.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
BorderRadiusCornerClipper.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
BordersData.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
BordersData.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
BoxModelMetrics.cpp LibWeb: Store final box model metrics in paint tree, not layout tree 2025-02-17 18:28:29 +01:00
BoxModelMetrics.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
CanvasPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
CanvasPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
CheckBoxPaintable.cpp LibWeb: Simplify filling rects with rounded corners 2025-08-19 21:53:46 +02:00
CheckBoxPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
ClipFrame.cpp LibWeb: Use scroll state from snapshot while applying clip rectangles 2025-07-24 13:03:23 -04:00
ClipFrame.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
DevicePixelConverter.h LibWeb: Maintain rect positioning when rounding to device pixel rects 2025-08-19 21:53:46 +02:00
DisplayList.cpp LibWeb: Merge FillPathUsingPaintStyle and FillPathUsingColor 2025-08-03 10:42:33 +02:00
DisplayList.h LibWeb: Merge FillPathUsingPaintStyle and FillPathUsingColor 2025-08-03 10:42:33 +02:00
DisplayListCommand.cpp LibWeb: Merge FillPathUsingPaintStyle and FillPathUsingColor 2025-08-03 10:42:33 +02:00
DisplayListCommand.h LibWeb: Use shape-rendering to control anti aliasing for SVG paths 2025-08-19 09:47:28 +01:00
DisplayListPlayerSkia.cpp LibWeb: Use shape-rendering to control anti aliasing for SVG paths 2025-08-19 09:47:28 +01:00
DisplayListPlayerSkia.h LibWeb: Merge FillPathUsingPaintStyle and FillPathUsingColor 2025-08-03 10:42:33 +02:00
DisplayListRecorder.cpp LibWeb: Simplify filling rects with rounded corners 2025-08-19 21:53:46 +02:00
DisplayListRecorder.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
DisplayListRecordingContext.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
DisplayListRecordingContext.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
FieldSetPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
FieldSetPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
GradientData.h LibWeb: Implement css gradient-interpolation-method 2025-03-06 11:33:12 +00:00
GradientPainting.cpp LibWeb/CSS: Use generated FooUnit types instead of Foo::Type 2025-09-11 17:06:44 +01:00
GradientPainting.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
ImagePaintable.cpp LibWeb: Use intrinsic size for current_image_bitmap 2025-08-30 15:49:11 +02:00
ImagePaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
InputColors.h LibWeb/CSS: Implement the color-scheme CSS property 2025-01-08 11:18:13 +00:00
LabelablePaintable.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
LabelablePaintable.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
MarkerPaintable.cpp LibWeb: Merge FillPathUsingPaintStyle and FillPathUsingColor 2025-08-03 10:42:33 +02:00
MarkerPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
MediaPaintable.cpp LibWeb: Merge FillPathUsingPaintStyle and FillPathUsingColor 2025-08-03 10:42:33 +02:00
MediaPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
NavigableContainerViewportPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
NavigableContainerViewportPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
Paintable.cpp LibWeb: Detach paint tree from layout tree in one go 2025-09-01 11:20:43 +01:00
Paintable.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
PaintableBox.cpp LibWeb: Remove PWL::layout_node_with_style_and_box_metrics() 2025-09-12 15:34:09 -04:00
PaintableBox.h LibWeb: Store correct text offsets in PaintableFragment 2025-09-12 15:34:09 -04:00
PaintableFragment.cpp LibWeb: Store correct text offsets in PaintableFragment 2025-09-12 15:34:09 -04:00
PaintableFragment.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
PaintBoxShadowParams.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
PaintStyle.h LibWeb: Implement the color-interpolation property for SVG gradients 2025-08-17 10:51:05 +02:00
RadioButtonPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
RadioButtonPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
ScrollFrame.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
ScrollFrame.h LibWeb: Save ScrollState snapshot in DisplayList to avoid race condition 2025-04-12 02:55:18 +02:00
ScrollState.cpp LibWeb: Save ScrollState snapshot in DisplayList to avoid race condition 2025-04-12 02:55:18 +02:00
ScrollState.h LibWeb: Save ScrollState snapshot in DisplayList to avoid race condition 2025-04-12 02:55:18 +02:00
ShadowData.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
ShadowPainting.cpp LibWeb: Remove params suffix from paint_{inner}outer_box_shadow 2025-08-01 13:00:41 +02:00
ShadowPainting.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
ShouldAntiAlias.h LibWeb: Use shape-rendering to control anti aliasing for SVG paths 2025-08-19 09:47:28 +01:00
StackingContext.cpp LibWeb: Prevent StackingContext from hit testing when not visible 2025-09-08 15:36:27 +02:00
StackingContext.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
SVGClipPaintable.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SVGClipPaintable.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SVGForeignObjectPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
SVGForeignObjectPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
SVGGraphicsPaintable.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SVGGraphicsPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
SVGMaskable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
SVGMaskable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
SVGMaskPaintable.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SVGMaskPaintable.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SVGPaintable.cpp LibWeb: Use shape-rendering to control anti aliasing for SVG paths 2025-08-19 09:47:28 +01:00
SVGPaintable.h LibWeb: Use shape-rendering to control anti aliasing for SVG paths 2025-08-19 09:47:28 +01:00
SVGPathPaintable.cpp LibWeb/SVG: Respect paint-order when painting SVG paths 2025-08-28 10:31:09 +01:00
SVGPathPaintable.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
SVGSVGPaintable.cpp LibWeb: Construct filter chain at paint time 2025-08-29 10:15:24 +01:00
SVGSVGPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
TableBordersPainting.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
TableBordersPainting.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
TextPaintable.cpp LibWeb: Remove text storage from TextPaintable 2025-09-12 15:34:09 -04:00
TextPaintable.h LibWeb: Remove text storage from TextPaintable 2025-09-12 15:34:09 -04:00
VideoPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
VideoPaintable.h LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
ViewportPaintable.cpp LibWeb: Rename PaintContext to DisplayListRecordingContext 2025-08-01 05:25:56 -04:00
ViewportPaintable.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00