mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:17:35 +00:00
LibWeb: Skip large stacking context in gpu painter only if it allocates
Skipping all stacking contexts with a size larger than 10000px in one dimension was a mistake because it also affects pages that are simply tall due to having a lot of content. Instead, we only need to skip if the stacking context requires the allocation of a framebuffer that could possibly fail. Fixes https://github.com/SerenityOS/serenity/issues/23397
This commit is contained in:
parent
d8e8293b7e
commit
1bd20a4595
1 changed files with 7 additions and 7 deletions
|
@ -103,13 +103,6 @@ CommandResult CommandExecutorGPU::push_stacking_context(float opacity, bool is_f
|
||||||
if (source_paintable_rect.is_empty())
|
if (source_paintable_rect.is_empty())
|
||||||
return CommandResult::SkipStackingContext;
|
return CommandResult::SkipStackingContext;
|
||||||
|
|
||||||
// If, due to layout mistakes, we encounter an excessively large rectangle here, it must be skipped to prevent
|
|
||||||
// framebuffer allocation failure.
|
|
||||||
if (source_paintable_rect.width() > 10000 || source_paintable_rect.height() > 10000) {
|
|
||||||
dbgln("FIXME: Skipping stacking context with excessively large paintable rect: {}", source_paintable_rect);
|
|
||||||
return CommandResult::SkipStackingContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_stacking_contexts.last().stacking_context_depth++;
|
m_stacking_contexts.last().stacking_context_depth++;
|
||||||
painter().save();
|
painter().save();
|
||||||
if (is_fixed_position) {
|
if (is_fixed_position) {
|
||||||
|
@ -128,6 +121,13 @@ CommandResult CommandExecutorGPU::push_stacking_context(float opacity, bool is_f
|
||||||
final_transform.multiply(stacking_context_transform);
|
final_transform.multiply(stacking_context_transform);
|
||||||
final_transform.multiply(inverse_origin_translation);
|
final_transform.multiply(inverse_origin_translation);
|
||||||
if (opacity < 1 || !stacking_context_transform.is_identity_or_translation()) {
|
if (opacity < 1 || !stacking_context_transform.is_identity_or_translation()) {
|
||||||
|
// If, due to layout mistakes, we encounter an excessively large rectangle here, it must be skipped to prevent
|
||||||
|
// framebuffer allocation failure.
|
||||||
|
if (source_paintable_rect.width() > 10000 || source_paintable_rect.height() > 10000) {
|
||||||
|
dbgln("FIXME: Skipping stacking context with excessively large paintable rect: {}", source_paintable_rect);
|
||||||
|
return CommandResult::SkipStackingContext;
|
||||||
|
}
|
||||||
|
|
||||||
auto canvas = AccelGfx::Canvas::create(source_paintable_rect.size());
|
auto canvas = AccelGfx::Canvas::create(source_paintable_rect.size());
|
||||||
auto painter = AccelGfx::Painter::create(m_context, canvas);
|
auto painter = AccelGfx::Painter::create(m_context, canvas);
|
||||||
painter->translate(-source_paintable_rect.location().to_type<float>());
|
painter->translate(-source_paintable_rect.location().to_type<float>());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue