Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions docs/validation/css-details-content-static-237-235.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Bounded details-content pseudo-element layout

Issues: WebScene #237, parent #235

Base: `8a58690f8a4059affa4b3caa0ba0e4340e4c9c52`

Unchanged Code OSS: `645f29cc3176500b4b5762ba887cf2a7f0ffdf2c`

## Selected inventory gap

The pinned unchanged Code OSS core CSS has ten `::details-content` selector
occurrences in the chat workbench. They style two disclosure components. The
two base selectors author `block-size: 0`, `overflow: hidden`, `opacity: 0`,
and transitions. Their `[open]` selectors author `block-size: auto` and
`opacity: 1`. One base selector also authors `box-sizing: border-box`, inline
start margin and padding, a one-pixel inline-start border, and a border-image
gradient. The remaining six selectors disable transitions for reduced motion.

This slice gives `::details-content` an independent compiled pseudo kind and a
compact record in the existing lazy pseudo allocation. It retains the observed
static zero/auto block-size, overflow, opacity, inline-start margin/padding,
and solid border components. The observed `box-sizing: border-box` value is
recognized, but has no separate static geometry effect because closed content
is suppressed and open content uses automatic block size. Closed `<details>`
elements expose only their first `<summary>` element. Open content participates
in ordinary bounded retained layout with one inline inset and one retained
group bound for border and opacity paint. Inherited `dir` resolves that inset
and border at the logical inline start, including the right edge for RTL. No
anonymous DOM node or visual-tree node is added.

Code OSS assigns `HTMLDetailsElement.open` directly. WebScene previously
exposed that reflection only for dialogs, so this slice adds the generated
details interface mirror and routes the property through the existing bounded
boolean-attribute recascade. Cancelable summary clicks toggle only when the
clicked summary is the first summary child, publish one noncancelable `toggle`
event, and synchronously invalidate the affected details subtree.
Interactive descendants such as buttons and links retain their nearer native
activation and do not also toggle the disclosure; inert descendants still
delegate activation to the first summary.

## Lifecycle and performance

Closing clears retained geometry, text fragments, and scroll extents only for
the disclosure content subtree. Opening reuses normal layout and compiled
`[open]` selector invalidation. Detach and navigation use existing node and
pseudo-state teardown. Static closed, open, and filled states request no idle
frames; paint performs no parsing, selector matching, cascade, polling, or DOM
mutation.

The source contract checks pseudo classification and bounded values. The V8
scene contract checks closed suppression, `open` reflection, inline geometry,
inherited RTL logical geometry, solid border paint, interactive-descendant
activation isolation, inert-descendant first-summary activation, exactly-once
toggle dispatch, and cleanup. The browser candidate mirrors these disclosure
semantics.

## Explicit remainder

This implementation does not claim interpolation between zero and the `auto`
keyword, transition timing, discrete `content-visibility` transitions, or the
`interpolate-size: allow-keywords` host property. Those require a retained
details-content animation track and deadline integration. The Code OSS
border-image linear gradient remains deferred; this slice paints the authored
solid border color underneath it. General details name-group exclusivity,
programmatic-open toggle-event task coalescing, an implicit summary when none
is authored, and non-Code pseudo properties also remain outside this bounded
slice. No Code OSS source changes.
9 changes: 5 additions & 4 deletions docs/validation/css-placeholder-pseudo-paint-237-235.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ The unchanged Code OSS core pseudo-class forms in its authored CSS are already
covered by the compiled matcher; `:visited` remains deliberately privacy-closed.
The remaining core pseudo-element inventory is:

- ten `::details-content` rules, which require a disclosure-content pseudo box,
open-state layout and discrete/auto-size transition behavior;
- ten `::details-content` rules. The bounded static disclosure layout is now
implemented by the follow-up details-content candidate; keyword-size and
discrete transition behavior remain open;
- two functional `::highlight()` rules, which require named Highlight ranges,
functional pseudo parsing, range paint, mutation, and teardown;
- two `::-webkit-details-marker` rules and six internal form-control part
Expand All @@ -60,7 +61,7 @@ performance evidence remain outside this slice. No Code OSS source changes.
The remaining parser-recognized but runtime-unmaterialized pseudo-elements are
`::first-letter`, `::first-line`, `::marker`, `::file-selector-button`, `::cue`,
`::cue-region`, `::grammar-error`, `::spelling-error`, and `::target-text`.
Functional `::highlight()`, `::details-content`, `::part()`, and `::slotted()`
also still require parser and ownership work. The inventory diagnostics now
Functional `::highlight()`, `::part()`, and `::slotted()` also still require
parser and ownership work. The inventory diagnostics now
report the already implemented selection, backdrop, and WebKit scrollbar kinds
as supported instead of grouping them with those remaining gaps.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by tools/webidl-v8-bindings/generate.mjs. Do not edit.
// Exposure manifest SHA-256: 2c3530c4eb08cd1b07208459fc96e105a4f770c99db794b459438af2b575602f
// Exposure manifest SHA-256: 1204c7318ba1facf6e719bab2f041278a40fa214c67205458425e0e7e2eeccd6
// Inputs: @webref/idl 3.82.1, webidl2 24.5.0.

enum class generated_dom_interface : uint8_t {
Expand All @@ -20,6 +20,7 @@ enum class generated_dom_interface : uint8_t {
HTMLIFrameElement,
HTMLTableCellElement,
HTMLDialogElement,
HTMLDetailsElement,
HTMLButtonElement,
HTMLInputElement,
HTMLTextAreaElement,
Expand Down Expand Up @@ -128,6 +129,9 @@ static bool generated_dom_receiver_is(
case generated_dom_interface::HTMLDialogElement:
return !self->html_dialog_element_template.IsEmpty()
&& self->html_dialog_element_template.Get(isolate)->HasInstance(receiver);
case generated_dom_interface::HTMLDetailsElement:
return !self->html_details_element_template.IsEmpty()
&& self->html_details_element_template.Get(isolate)->HasInstance(receiver);
case generated_dom_interface::HTMLButtonElement:
return !self->html_button_element_template.IsEmpty()
&& self->html_button_element_template.Get(isolate)->HasInstance(receiver);
Expand Down Expand Up @@ -2271,6 +2275,29 @@ static void generated_HTMLDialogElement_returnValue_set(
set_dialog_return_value(info.Data().As<v8::Name>(), value, info);
}

static void generated_HTMLDetailsElement_open_get(
v8::Local<v8::Name>,
const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!generated_dom_receiver_is(info.GetIsolate(), info.Holder(), generated_dom_interface::HTMLDetailsElement)) {
throw_generated_illegal_invocation(info.GetIsolate());
return;
}
get_dialog_open(info.Data().As<v8::Name>(), info);
}

static void generated_HTMLDetailsElement_open_set(
v8::Local<v8::Name>,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info)
{
if (!generated_dom_receiver_is(info.GetIsolate(), info.Holder(), generated_dom_interface::HTMLDetailsElement)) {
throw_generated_illegal_invocation(info.GetIsolate());
return;
}
set_dialog_open(info.Data().As<v8::Name>(), value, info);
}

static void generated_HTMLButtonElement_labels_get(
v8::Local<v8::Name>,
const v8::PropertyCallbackInfo<v8::Value>& info)
Expand Down Expand Up @@ -5280,6 +5307,33 @@ void install_generated_dom_templates(v8::Local<v8::Context>)
v8::ConstructorBehavior::kThrow));
html_dialog_element_template.Reset(isolate, generated_HTMLDialogElement_template);

auto generated_HTMLDetailsElement_template = v8::FunctionTemplate::New(isolate, illegal_dom_constructor);
generated_HTMLDetailsElement_template->SetClassName(js_string(isolate, "HTMLDetailsElement"));
generated_HTMLDetailsElement_template->SetInterfaceName(js_string(isolate, "HTMLDetailsElement"));
generated_HTMLDetailsElement_template->PrototypeTemplate()->Set(
v8::Symbol::GetToStringTag(isolate), js_string(isolate, "HTMLDetailsElement"),
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
generated_HTMLDetailsElement_template->Inherit(generated_HTMLElement_template);
generated_HTMLDetailsElement_template->InstanceTemplate()->SetInternalFieldCount(2);
auto generated_HTMLDetailsElement_signature =
v8::Signature::New(isolate, generated_HTMLDetailsElement_template);
auto generated_HTMLDetailsElement_open_symbol = v8::Symbol::New(
isolate, js_string(isolate, "WebScene.HTMLDetailsElement.open"));
generated_HTMLDetailsElement_template->InstanceTemplate()->SetNativeDataProperty(
generated_HTMLDetailsElement_open_symbol,
generated_HTMLDetailsElement_open_get,
generated_HTMLDetailsElement_open_set,
js_string(isolate, "open"),
v8::PropertyAttribute::None);
generated_HTMLDetailsElement_template->PrototypeTemplate()->SetAccessorProperty(
js_string(isolate, "open"),
v8::FunctionTemplate::New(
isolate, generated_dom_prototype_attribute_get, generated_HTMLDetailsElement_open_symbol,
generated_HTMLDetailsElement_signature, 0),
v8::FunctionTemplate::New(isolate, generated_dom_prototype_attribute_set, generated_HTMLDetailsElement_open_symbol, generated_HTMLDetailsElement_signature, 1),
v8::PropertyAttribute::None);
html_details_element_template.Reset(isolate, generated_HTMLDetailsElement_template);

auto generated_HTMLButtonElement_template = v8::FunctionTemplate::New(isolate, illegal_dom_constructor);
generated_HTMLButtonElement_template->SetClassName(js_string(isolate, "HTMLButtonElement"));
generated_HTMLButtonElement_template->SetInterfaceName(js_string(isolate, "HTMLButtonElement"));
Expand Down Expand Up @@ -6167,6 +6221,10 @@ void install_generated_dom_constructors(
->GetFunction(local_context).ToLocalChecked();
global->Set(local_context, js_string(isolate, "HTMLDialogElement"),
generated_HTMLDialogElement_constructor).Check();
auto generated_HTMLDetailsElement_constructor = html_details_element_template.Get(isolate)
->GetFunction(local_context).ToLocalChecked();
global->Set(local_context, js_string(isolate, "HTMLDetailsElement"),
generated_HTMLDetailsElement_constructor).Check();
auto generated_HTMLButtonElement_constructor = html_button_element_template.Get(isolate)
->GetFunction(local_context).ToLocalChecked();
global->Set(local_context, js_string(isolate, "HTMLButtonElement"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ bool apply_native_cascade(native_document& document,dom_node& node,
variables,result,[](bool) {});
observe(declaration,result);
}
else if(kind==9) {
property_result result;
apply_details_content_declaration(
node,node.style.mutable_details_content_pseudo(),declaration,
variables,result,[](bool) {});
observe(declaration,result);
}
else if(kind>=3) apply_scrollbar_declaration(node,kind,declaration,variables);
else {
auto& pseudo=kind==1?node.style.mutable_before_pseudo():node.style.mutable_after_pseudo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ inline int split_pseudo_element_selector(const std::string& selector, std::strin
if (const auto kind = split_suffix("::before", 1); kind != 0) return kind;
if (const auto kind = split_suffix("::after", 2); kind != 0) return kind;
if (const auto kind = split_suffix("::placeholder", 8); kind != 0) return kind;
if (const auto kind = split_suffix("::details-content", 9); kind != 0) return kind;
if (const auto kind = split_suffix("::backdrop", 7); kind != 0) return kind;
if (const auto kind = split_suffix("::-webkit-scrollbar-thumb", 4); kind != 0) return kind;
if (const auto kind = split_suffix("::-webkit-scrollbar-track", 5); kind != 0) return kind;
Expand All @@ -38,6 +39,84 @@ inline int split_pseudo_element_selector(const std::string& selector, std::strin
return split_suffix(":after", 2);
}

template<typename Decision,typename Resolved>
void apply_details_content_declaration(
dom_node& node,
node_style::pseudo_element_pair::details_content_element& details_content,
const css_declaration& declaration,
const std::unordered_map<std::string,std::string>& variables,
Decision& decision,
Resolved&& on_resolved)
{
decision.classification = "unsupported";
const auto contains_variable = declaration.value.find("var(") != std::string::npos;
auto resolved_value = std::string{};
const auto& value = contains_variable
? (resolved_value = resolve_value(node,declaration.value,variables))
: declaration.value;
if (value.empty() && contains_variable) {
decision.classification = "invalid-authoring";
decision.semantic_slice = "unresolved custom property at computed-value time";
return;
}
on_resolved(contains_variable);
const auto lower = ascii_lower(trim_value(value));
details_content.present = true;
if (declaration.name == "block-size") {
if (lower == "auto") {
details_content.block_size_zero = false;
decision.classification = "supported";
} else if (lower == "0") {
details_content.block_size_zero = true;
decision.classification = "supported";
} else {
decision.classification = "unsupported";
decision.semantic_slice = "authored zero or auto block-size";
}
} else if (declaration.name == "overflow") {
if (lower == "hidden") {
details_content.overflow_hidden = true;
decision.classification = "supported";
}
} else if (declaration.name == "opacity") {
char* end = nullptr;
const auto parsed = std::strtof(lower.c_str(), &end);
if (end != lower.c_str() && end == lower.c_str() + lower.size()
&& std::isfinite(parsed)) {
details_content.opacity = std::clamp(parsed, 0.0F, 1.0F);
decision.classification = "supported";
} else {
decision.classification = "invalid-authoring";
}
} else if (declaration.name == "margin-inline-start") {
details_content.margin_inline_start = native_document::parse_length(value);
decision.classification = "supported";
} else if (declaration.name == "padding-inline-start") {
details_content.padding_inline_start = native_document::parse_length(value);
decision.classification = "supported";
} else if (declaration.name == "box-sizing") {
decision.classification = lower == "border-box" || lower == "content-box"
? "supported" : "invalid-authoring";
decision.semantic_slice = "recognized compatibility value; collapsed static size is unchanged";
} else if (declaration.name == "border-inline-start") {
node_style border_style{};
border_style.foreground_rgba = node.style.foreground_rgba;
if (apply_border_declaration(border_style, "border-left", value)) {
details_content.border_inline_start_width = border_style.border_left_width;
details_content.border_inline_start_rgba = border_style.border_left_rgba;
details_content.border_inline_start_current_color =
border_style.border_left_current_color;
decision.classification = "supported";
} else {
decision.classification = "invalid-authoring";
}
} else if (declaration.name == "transition"
|| declaration.name == "content-visibility"
|| declaration.name == "border-image") {
decision.semantic_slice = "static details-content paint and layout";
}
}

template<typename Decision,typename Resolved>
void apply_placeholder_declaration(
dom_node& node,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void for_each_cascaded_pseudo_declaration(
// kind prevents a high-priority ::before declaration from affecting
// ::after while reusing the same layer/importance/rollback machinery
// as the originating element.
std::array<std::vector<const css_rule*>, 9> rules_by_kind;
std::array<std::vector<const css_rule*>, 10> rules_by_kind;
for (const auto& [kind, rule] : matched_rules) {
if (kind > 0 && static_cast<size_t>(kind) < rules_by_kind.size())
rules_by_kind[static_cast<size_t>(kind)].push_back(rule);
Expand Down
Loading
Loading