mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Don't search non-visible text for find in page results
Elements which are `display: none` or `visibility: hidden` are no longer included in find in page results.
This commit is contained in:
parent
23166b85d2
commit
a3a7a65b1c
Notes:
sideshowbarker
2024-07-17 03:05:16 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a3a7a65b1c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/216
@ -5129,6 +5129,9 @@ Vector<JS::Handle<DOM::Range>> Document::find_matching_text(String const& query,
|
||||
Vector<TextPosition> text_positions;
|
||||
Vector<TextBlock> text_blocks;
|
||||
document_element()->layout_node()->for_each_in_inclusive_subtree([&](auto const& layout_node) {
|
||||
if (layout_node.display().is_none() || !layout_node.paintable() || !layout_node.paintable()->is_visible())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
if (layout_node.is_block_container()) {
|
||||
if (!builder.is_empty()) {
|
||||
text_blocks.append({ builder.to_string_without_validation(), text_positions });
|
||||
|
Loading…
Reference in New Issue
Block a user