Skip to content

Truly independent web browser

LibWeb: Correct style engine docs about machinery that is gone

Andreas Kling2cc337292f28
diff --git a/Libraries/LibWeb/Rust/src/css/absolutize.rs b/Libraries/LibWeb/Rust/src/css/absolutize.rs
index e8ab730746e..19518cc5438 100644
--- a/Libraries/LibWeb/Rust/src/css/absolutize.rs
+++ b/Libraries/LibWeb/Rust/src/css/absolutize.rs
@@ -9,10 +9,8 @@
//! Mirrors the C++ `StyleValue::absolutized(ComputationContext const&)` dispatch: structural
//! values recurse into their children and rebuild only when a child changed, dimensions convert
//! to their canonical units, and lengths resolve through the shared length-resolution context.
-//! Types whose absolutization has not been ported (or that need C++-only state not captured in the
-//! computation environment) decline, and the caller routes the whole value through the C++ fallback. Preserving
-//! identity for unchanged values is a real contract: the store batch reuses wrappers and shared
-//! allocations based on pointer equality.
+//! Preserving identity for unchanged values is a real contract: the store batch reuses wrappers
+//! and shared allocations based on pointer equality.
// Style value data allocations are thread-confined, like style_value.rs.
@@ -1578,7 +1576,7 @@ fn canonicalized_dimension(value: f64, unit: u8, ratios: &[f64]) -> Option<(f64,
Some((value * ratios[unit as usize], canonical))
}
-/// Absolutizes a style value. None means the C++ fallback must handle the whole value.
+/// Absolutizes a style value. None means the value has no absolutized form in this context.
pub(crate) fn absolutize(value: &StyleValueData, context: &AbsolutizationContext) -> Option<Absolutized> {
use crate::css::calc::{
ANGLE_UNIT_CANONICAL_RATIOS, FREQUENCY_UNIT_CANONICAL_RATIOS, RESOLUTION_UNIT_CANONICAL_RATIOS,
diff --git a/Libraries/LibWeb/Rust/src/css/style/bridge.rs b/Libraries/LibWeb/Rust/src/css/style/bridge.rs
index 630a58e6624..0a4dfd820ea 100644
--- a/Libraries/LibWeb/Rust/src/css/style/bridge.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/bridge.rs
@@ -463,7 +463,7 @@ pub struct FfiStyleRecordView {
pub present: bool,
}
-// NB: Every element and pseudo-element the host styles holds one of these.
+// NB: Every styled element and pseudo-element holds one of these.
const _: () = assert!(size_of::<FfiStyleRecordView>() == 32);
impl FfiStyleRecordView {
diff --git a/Libraries/LibWeb/Rust/src/css/style/container_queries.rs b/Libraries/LibWeb/Rust/src/css/style/container_queries.rs
index 01e65e96461..c7ba137ce05 100644
--- a/Libraries/LibWeb/Rust/src/css/style/container_queries.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/container_queries.rs
@@ -137,8 +137,8 @@ impl ContainerRecords for RetainedState {
self.container_query_inputs(node)
}
- /// One holding no record yet is one the host styles in this update, which decides it. One
- /// this batch settled is read as the host will leave it, as a query container is.
+ /// One holding no record yet is one this update styles, which decides it. One this batch
+ /// settled is read as the install will leave it, as a query container is.
fn any_element_row(&self, node: StyleNodeID) -> Option<tree::ContainerQueryInputs<'_>> {
self.container_query_input_row(node, self.container_style_record(node)?, true)
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/input_types.rs b/Libraries/LibWeb/Rust/src/css/style/input_types.rs
index 16c88cadb21..1698b0e1d75 100644
--- a/Libraries/LibWeb/Rust/src/css/style/input_types.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/input_types.rs
@@ -99,7 +99,7 @@ impl ElementDeclarationKind {
/// The tree relations of one style node, as of one side of a mutation.
///
-/// This is the minimum old-side information the applicable transpose rules need. It is not a
+/// This is the minimum old-side information invalidation needs. It is not a
/// traversable old DOM and does not copy unchanged descendant fields: old-side facts exist to
/// establish a complete impact region, not to reconstruct history.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
diff --git a/Libraries/LibWeb/Rust/src/css/style/mod.rs b/Libraries/LibWeb/Rust/src/css/style/mod.rs
index 9b159f6074c..b2492bc7d4e 100644
--- a/Libraries/LibWeb/Rust/src/css/style/mod.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/mod.rs
@@ -8,22 +8,14 @@
//! memory-bounded incremental computation.
//!
//! DOM structure, element state, stylesheets, CSSOM mutations, cascade topology, and environment
-//! values are versioned inputs. Selectors, cascade decisions, and computed values form a shared
-//! logical dependency program. A style flush discovers and propagates exact changes through that
-//! program and stops as soon as a semantic value is unchanged.
-//!
-//! The cache-free exact matcher is part of the architecture rather than a fallback bolted on:
-//! optional incremental state may accelerate matching but is never required to answer a style read
-//! correctly. Derived state lives as long as the node or rule it describes.
+//! values are versioned inputs. A style flush propagates exact changes through selectors, cascade
+//! decisions, and computed values, and stops as soon as a semantic value is unchanged. Derived state
+//! lives as long as the node or rule it describes.
//!
//! Everything between a style input and a computed value is authoritative here, on the Rust side.
//! C++ remains authoritative for DOM and CSSOM object identity, mutation semantics, document
//! lifecycle, loading order, style-observation barriers, layout, and paint - and holds no second
//! copy of the state this engine owns.
-//!
-//! A few modules exist that the original module sketch did not name, because the concepts they hold
-//! did not belong in any of the modules it did name: [`tree`] for style node identity and the
-//! relation columns, and [`order`] for cascade order maintenance.
macro_rules! define_id {
($(#[$attribute:meta])* $visibility:vis struct $name:ident();) => {
@@ -328,9 +320,9 @@ pub struct RetainedState {
/// The elements a style() container query asked as containers with a value counting their place among their
/// siblings. A fork shares them, as too many only walk more. An element's identity used again stays here too.
containers_counted_by_style_queries: Arc<Mutex<HashSet<StyleNodeID>>>,
- /// What the last the engine cold pass measured.
+ /// What the last cold pass measured.
cold_pass_report: pipeline::Report,
- /// The engine kept live beside this engine, when asked for, which a fork goes on keeping.
+ /// What the engine keeps of the document it owns, which a fork goes on keeping.
live_style: Option<Box<pipeline::Live>>,
/// Whether this is the state the host writes, on which alone the engine starts.
live_style_may_start: crate::fork::ForkReset<crate::fork::IsOriginal>,
@@ -409,8 +401,8 @@ pub struct HostState {
/// Whether the deferred element style inputs are owed to the next transaction, as opposed to
/// held back by a flush without a document root.
deferred_element_style_inputs_are_pending: bool,
- /// The custom properties that changed between pairs of environments during this transaction.
- /// Program-family before/after rows retained until the transaction is released.
+ /// The rule edits this transaction staged, with their before and after values, until it is
+ /// released.
program_staging: ProgramStaging,
sheet_occurrences: HashMap<TreeScopeID, pipeline::rule_store::ScopeSheetOccurrences>,
/// The old dense rule sequence while one sheet is synchronously reparsed.
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/write_once.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/write_once.rs
index 473b8110f2f..02e318a970d 100644
--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/write_once.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/write_once.rs
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-//! A slot one thread writes once, which other threads read after it is written: what a the engine
-//! pass keeps per element, written by the thread styling the element and read by those styling its
+//! A slot one thread writes once, which other threads read after it is written: what a pass keeps
+//! per element, written by the thread styling the element and read by those styling its
//! descendants. Writing it takes one atomic compare-exchange and one store, where a `OnceLock` goes
//! through `Once`.
diff --git a/Libraries/LibWeb/Rust/src/css/style/tree.rs b/Libraries/LibWeb/Rust/src/css/style/tree.rs
index fac28ba94e5..fdffb64eafd 100644
--- a/Libraries/LibWeb/Rust/src/css/style/tree.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/tree.rs
@@ -10,12 +10,11 @@
//! native pointer in every index and handle that mentions it.
//!
//! The parent, first-element-child, and next-element-sibling columns are dense, required, and
-//! Rust-owned. That is not an acceleration choice. A transpose program starting from a changed
-//! input has to traverse inverse selector relations to reach possible subjects - "descendants that
-//! can satisfy `B`" is not in a tree delta - and `StyleNodeID` is deliberately not a tree-order
-//! label, so proving that a posting candidate lies inside a subtree costs relation steps per
-//! candidate. If those steps left the evaluator, the hot path would degenerate into per-element FFI
-//! or reverse cold requests. Keeping the columns resident is what makes the selective plan viable.
+//! Rust-owned. That is not an acceleration choice. Invalidation starting from a changed input has
+//! to walk selector relations to reach possible subjects - "descendants that can satisfy `B`" is
+//! not in a tree delta - and `StyleNodeID` is deliberately not a tree-order label, so proving that
+//! a candidate lies inside a subtree costs relation steps per candidate. If those steps left the
+//! engine, the hot path would degenerate into per-element FFI.
//!
//! The columns are **not** semantically authoritative. They are a derived projection that must agree
//! with the live tree at every epoch boundary, maintained from the same tree delta that reports the