mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibWeb: Verify that save and restore are balanced within StackingContext
Unbalanced save and restore means that effects only relevant to a stacking context leak outside, which is never expected behavior. Having a `VERIFY()` for that makes it much easier to catch such issues.
This commit is contained in:
parent
9e3a476890
commit
8f39aa0d4a
Notes:
github-actions[bot]
2025-07-06 20:19:35 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 8f39aa0d4a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5332
2 changed files with 9 additions and 0 deletions
|
@ -291,6 +291,11 @@ void StackingContext::paint(PaintContext& context) const
|
|||
if (opacity == 0.0f)
|
||||
return;
|
||||
|
||||
TemporaryChange save_nesting_level(context.display_list_recorder().m_save_nesting_level, 0);
|
||||
ScopeGuard verify_save_and_restore_are_balanced([&] {
|
||||
VERIFY(context.display_list_recorder().m_save_nesting_level == 0);
|
||||
});
|
||||
|
||||
DisplayListRecorderStateSaver saver(context.display_list_recorder());
|
||||
|
||||
auto to_device_pixels_scale = float(context.device_pixels_per_css_pixel());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue