diff --git a/css-highlight-api-1/Overview.bs b/css-highlight-api-1/Overview.bs index 64ff912dd2b..de98b233110 100644 --- a/css-highlight-api-1/Overview.bs +++ b/css-highlight-api-1/Overview.bs @@ -319,9 +319,12 @@ Applicable Properties

Default Styles

- UAs must not define any styles for [=custom highlight pseudo-elements=] in the default UA - stylesheet. A [=custom highlight pseudo-element=] inherits the styles of its - [=originating element=]. + UAs must not define any default UA stylesheet rules + or default highlight colors + for any [=custom highlight pseudo-elements=]. + In other words, + when some content is highlighted by an unstyled custom highlight, + its presentation must not change.

Cascading and Inheritance

diff --git a/css-pseudo-4/Overview.bs b/css-pseudo-4/Overview.bs index 90ba2635996..b9478420e44 100644 --- a/css-pseudo-4/Overview.bs +++ b/css-pseudo-4/Overview.bs @@ -696,7 +696,8 @@ Styling Highlights Issue: Are there any other properties that should be included here? - The 'color' property specifies the color of both the text + Note: The 'color' property sets the color of + both the text and all line decorations (underline, overline, line-through) and emphasis marks ('text-emphasis') applied to the text @@ -724,16 +725,68 @@ Default UA Styles /* Represent default spelling/grammar error styling in an adjustable way */ :root::spelling-error { text-decoration-line: spelling-error; } :root::grammar-error { text-decoration-line: grammar-error; } - /* Highlight targeted text */ - :root::target-text { color: MarkText; background: Mark; } + Some [=highlight pseudo-elements=] + should have paired default highlight colors-- + a default 'color' and 'background-color' + provided by the UA + that are either used or overridden together, + see [[#paired-defaults]]. + For ''::selection'' they should correspond to + ''HighlightText'' and ''Highlight'', + while for ''::target-text'' they should correspond to + ''MarkText'' and ''Mark''. + UAs may apply additional effects to enhance the presentation of highlighted content, for example dimming content other than the highlighted text or transitioning out a highlight style based on user interactions or timing. These are not controlled by CSS. + ISSUE: UA tweaks to the presentation of highlights + in ways that are controlled by CSS + are currently under discussion + in Issue 6853. + +

+Paired Defaults

+ + For compatibility reasons, + [=paired default highlight colors=] + must only be [=used value|used=] + when neither 'color' nor 'background-color' + yield a [=cascaded value=] + from the [=author origin=] + (or inherit their value from the author origin). + When a highlight color is ''revert'' or ''revert-layer'', + the origin after rolling back the cascade + determines the [=cascaded value=]’s [=cascade origin|origin=]. + + Note: Because this rule is for compatibility reasons, + it does not apply to other similar properties + like 'fill-color' or 'stroke-color'. + +
+ For example, + given the following markup: +
+      <p>Highlight this <em>and this</em>.</p>
+    
+ Any of the following rules + would suppress the default 'background-color' + for ''::selection'' + in the <em> element + if given by the author: +
+      em::selection { color: initial; }
+      em::selection { color: inherit; }
+      em::selection { color: unset; }
+      em::selection { color: green; }
+      p::selection { color: green; }
+    
+
+

Area of a Highlight

@@ -788,13 +841,21 @@ Cascading and Per-Element Highlight Styles for which that element is the originating element. When multiple styles conflict, the winning style is determined by the cascade. + When any supported property is not given a value by the cascade, - its value is determined by inheritance from + or given a value of ''inherit'' or ''unset'', + its [=specified value=] is determined by inheritance from the corresponding highlight pseudo-element of its originating element's parent element. This occurs regardless of whether that property is an inherited property, including [=registered custom properties=] where the [=inherits descriptor=] is false. + Additionally, + for [=highlight pseudo-elements=] originating from the root element, + the [=inherited value=] of 'color' + is ''currentColor'', + not the [=initial value=]. + css/css-pseudo/active-selection-051.html css/css-pseudo/active-selection-052.html @@ -857,17 +918,6 @@ Cascading and Per-Element Highlight Styles css/css-pseudo/cascade-highlight-002.html - - The UA must use its own highlight colors for ''::selection'' only - when neither 'color' nor 'background-color' has been specified by the author. - - Note: This paired-cascading behavior - does not allow using the normal cascade - (e.g. '':root::selection'' rules in the UA style sheet) - to represent the OS default selection colors. - However it has been interoperably implemented in browsers - and is thus probably a Web-compatibility requirement. -

Painting the Highlight