servo/components
Kingsley Yung be7efc94a3
Refactoring HTMLOptionElement::Text into iterative style (#37167)
The original implementation of `HTMLOptionElement::Text` is recursive,
and the program may run out of stack space for a sufficiently large
number of iterations. The patch switches to an iterative implementation,
with `TreeIterator`.

Note that, instead of the usual `while let Some(node) = iterator.next()`
approach, we use `while let Some(node) = iterator.peek()` with the newly
added `TreeIterator::peek` function. This is because the choice of the
next node depends on some checks performed inside the `while` block,
whereas the `next` function determines the next node before entering the
block.

Moreover, the `TreeIterator::peek` function is added, instead of
wrapping the iterator into `Peekable`. This is because we will lose
access to the `TreeIterator::next_skipping_children` function if we wrap
it into `Peekable`.

Testing: This refactoring has to pass the existing tests.
Fixes: #36959

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-05-28 17:58:33 +00:00
..
allocator Organize component Cargo.toml dependencies (#36224) 2025-03-30 19:03:54 +00:00
background_hang_monitor Organize component Cargo.toml dependencies (#36224) 2025-03-30 19:03:54 +00:00
bluetooth Replace bluetooth Readme with corrected version from devices repository (#36429) 2025-04-10 18:02:45 +00:00
canvas Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00
compositing Add support for static SVG images using resvg crate (#36721) 2025-05-27 11:02:40 +00:00
config Unconditionally enable the URLPattern API (#37116) 2025-05-24 13:20:45 +00:00
constellation constellation: Pass system theme to new Pipelines (#37132) 2025-05-26 12:05:38 +00:00
deny_public_fields
devtools DevTools: Improve resource_available to handle multiple connections (#36933) 2025-05-09 12:06:33 +00:00
dom_struct
domobject_derive Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
fonts chore: fix warnings for Windows-specific fonts code (#37063) 2025-05-21 16:30:43 +00:00
geometry
hyper_serde Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
jstraceable_derive
layout layout: Fix logic for transforms with non-invertible matrix (#37147) 2025-05-27 18:36:33 +00:00
malloc_size_of Add support for static SVG images using resvg crate (#36721) 2025-05-27 11:02:40 +00:00
media compositing: Combine webrender_traits and compositing_traits (#36372) 2025-04-06 17:34:18 +00:00
metrics Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00
net Add support for static SVG images using resvg crate (#36721) 2025-05-27 11:02:40 +00:00
pixels Add support for static SVG images using resvg crate (#36721) 2025-05-27 11:02:40 +00:00
profile Refactor the memory profiler code to return the struct. (#37155) 2025-05-28 00:58:05 +00:00
rand Migrate to the 2024 edition (#35755) 2025-03-13 10:28:11 +00:00
range
script Refactoring HTMLOptionElement::Text into iterative style (#37167) 2025-05-28 17:58:33 +00:00
script_bindings canvas: Add HTMLVideoElement to CanvasImageSource union type (#37135) 2025-05-28 12:04:01 +00:00
servo constellation: Pass system theme to new Pipelines (#37132) 2025-05-26 12:05:38 +00:00
servo_tracing [tracing] Add convenience macro for function tracing (#36573) 2025-04-22 19:58:20 +00:00
shared Refactor the memory profiler code to return the struct. (#37155) 2025-05-28 00:58:05 +00:00
timers Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
url Various memory measurement improvements (#36834) 2025-05-07 04:00:12 +00:00
webdriver_server Add support for static SVG images using resvg crate (#36721) 2025-05-27 11:02:40 +00:00
webgl webgl: Use glow::Context::supported_extensions() to implement getSupportedExtensions() (#36911) 2025-05-08 08:34:52 +00:00
webgpu Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00
webxr Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00