Переглянути джерело

LibWeb: Don't paint text fragments with CSS visibility:hidden

We *could* even skip creating a paintable for hidden nodes, but that
means that dynamic updates to the CSS visibility property would require
mutating the paint tree, so let's keep it simple for now.
Andreas Kling 10 місяців тому
батько
коміт
349b17cc7a

+ 2 - 0
Tests/LibWeb/Ref/inline-visibility-hidden.html

@@ -0,0 +1,2 @@
+<link rel="match" href="reference/inline-visibility-hidden-ref.html" />
+<span>hello friends<span style="visibility: hidden"> and enemies</span></span>

+ 1 - 0
Tests/LibWeb/Ref/reference/inline-visibility-hidden-ref.html

@@ -0,0 +1 @@
+<span>hello friends</span>

+ 3 - 0
Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

@@ -605,6 +605,9 @@ void paint_text_decoration(PaintContext& context, TextPaintable const& paintable
 
 void paint_text_fragment(PaintContext& context, TextPaintable const& paintable, PaintableFragment const& fragment, PaintPhase phase)
 {
+    if (!paintable.is_visible())
+        return;
+
     auto& painter = context.display_list_recorder();
 
     if (phase == PaintPhase::Foreground) {