Fix SVG text selection colors [chromium/src : main]

0 views
Skip to first unread message

Stephen Chenney (Gerrit)

unread,
Aug 27, 2025, 11:37:10 AM (13 days ago) Aug 27
to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Fredrik Söderquist

Stephen Chenney voted and added 1 comment

Votes added by Stephen Chenney

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 9 (Latest):
Stephen Chenney . resolved

This is a mess, but the best solution I could come up with. Note the rebaselines are due to (a) no longer drawing shadows twice when both stroke and fill are used (b) not applying opacity to shadows, matching the regular text path and (c) keeping originating properties when ::selection does not define them. All this matches the HTML behavior, and is not specified for SVG at all.

It's not ready to land because I need more tests.

Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
Gerrit-Change-Number: 6850871
Gerrit-PatchSet: 9
Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Alexis Menard <alexis...@intel.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Wed, 27 Aug 2025 15:37:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Aug 27, 2025, 12:28:23 PM (13 days ago) Aug 27
to Stephen Chenney, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Stephen Chenney

Fredrik Söderquist added 1 comment

Patchset-level comments
Stephen Chenney . resolved

This is a mess, but the best solution I could come up with. Note the rebaselines are due to (a) no longer drawing shadows twice when both stroke and fill are used (b) not applying opacity to shadows, matching the regular text path and (c) keeping originating properties when ::selection does not define them. All this matches the HTML behavior, and is not specified for SVG at all.

It's not ready to land because I need more tests.

Fredrik Söderquist

Ping me when it's ready for review.

Open in Gerrit

Related details

Attention is currently required from:
  • Stephen Chenney
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
Gerrit-Change-Number: 6850871
Gerrit-PatchSet: 9
Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Alexis Menard <alexis...@intel.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Wed, 27 Aug 2025 16:28:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Stephen Chenney <sche...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Stephen Chenney (Gerrit)

unread,
Aug 28, 2025, 5:53:30 PM (12 days ago) Aug 28
to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

Stephen Chenney added 1 comment

Patchset-level comments
File-level comment, Patchset 12 (Latest):
Stephen Chenney . resolved

Ready for review. I've tried to make it more like HTML selection to the extent possible, with the belief that it better represents what authors would like the behavior to be.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
Gerrit-Change-Number: 6850871
Gerrit-PatchSet: 12
Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Alexis Menard <alexis...@intel.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-Comment-Date: Thu, 28 Aug 2025 21:53:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Aug 29, 2025, 7:18:41 AM (11 days ago) Aug 29
to Stephen Chenney, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Stephen Chenney

Fredrik Söderquist added 15 comments

Commit Message
Line 31, Patchset 12 (Latest):Note the SVG spec is silent on how to treat ::selection applied to SVG text. This CL treats SVG text the same as HTML text to the extent possible. https://svgwg.org/svg2-draft/text.html#TextSelection
Fredrik Söderquist . unresolved

Line break

File third_party/blink/renderer/core/css/css_properties.json5
Line 5511, Patchset 12 (Latest): default_value: "SVGPaint::CreateInitialCurrentColor()",
Fredrik Söderquist . unresolved

This name is misleading, because while the `color` field happens to have that value, the general state of the paint is dictated by the `type` field - which is "none". Given that, does marking this paint have any use?

File third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
Line 2899, Patchset 12 (Latest): paint.SetColor(ConvertStyleColor(state, *local_value));
Fredrik Söderquist . unresolved

The `SVGPaint` will never have the initial flag set here, which makes this unnecessary. Keeping the setting of flag to the special `Create...()` functions should also aid with that (maybe it should be documented).

File third_party/blink/renderer/core/layout/svg/svg_layout_support.h
Line 95, Patchset 12 (Latest): const UnzoomedLength* length_override = nullptr);
Fredrik Söderquist . unresolved

`stroke_width_override`?

File third_party/blink/renderer/core/layout/svg/svg_layout_support.cc
Line 311, Patchset 12 (Latest): if (length_override) {
stroke_data.SetThickness(
ValueForLength(*length_override, viewport_resolver));
} else {
stroke_data.SetThickness(
ValueForLength(style.StrokeWidth(), viewport_resolver));
}
Fredrik Söderquist . unresolved
I think I would prefer this as:
```
const UnzoomedLength& effective_stroke_width =
length_override ? *length_override : style.StrokeWidth();
stroke_data.SetThickness(ValueForLength(effective_stroke_width, ...));
```
File third_party/blink/renderer/core/paint/text_painter.cc
Line 87, Patchset 12 (Latest): const ShadowList* selection_shadows =
GetTextShadows(selection_style, layout_object);
if (selection_shadows) {
const ShadowList* text_shadows = GetTextShadows(style, layout_object);
if (text_shadows) {
for (auto& shadow : text_shadows->Shadows()) {
merged_shadow_list.push_back(shadow);
}
}
for (auto& shadow : selection_shadows->Shadows()) {
merged_shadow_list.push_back(shadow);
}
}
Fredrik Söderquist . unresolved

Why do this here and not when it's needed? This seems to just give `SelectionStyleScope` additional responsibilities.

Line 294, Patchset 12 (Latest): !pseudo_selection_style->FillPaint().IsInitial();
Fredrik Söderquist . unresolved

Should context paints be allowed? Paint-servers?

Line 300, Patchset 12 (Latest): // If the ::selection has fill: none or stroke: none we need to respect that,
// and not fall back to the originating element.
if (have_selection_fill &&
!SVGObjectPainter::HasFill(*pseudo_selection_style, context_paints)) {
have_fill = have_selection_fill = false;
}
Fredrik Söderquist . unresolved

I think this could be handled in a more logical way by just trying to apply the paint (if it is non-initial).

Line 311, Patchset 12 (Latest): // If the selection stroke is not visible we still do not want to draw it,
// but we do want to fall back to the originating stroke.
Fredrik Söderquist . unresolved

This seems to be making the assumption that a `stroke-width` won't be set to 0 in a selection style? Given that the initial stroke width is 1, if the selection style contains a stroke width of 0, it seems we should just apply that? Maybe this means that we should be tracking if stroke-width is initial too though?

Line 327, Patchset 12 (Latest): have_selection_fill = false; // Use the originating fill instead.
Fredrik Söderquist . unresolved

Given that we've handled `none` already, this would only happen for missing/broken paint-servers - I don't see why we'd drop back to originating style in that case (given the restrictions in the spec one might argue that we should just directly fall-back if a paint-server is used).

Line 346, Patchset 12 (Latest): // Note that ::selection does not allow the SVG stroke properties, so
// use the originating element style. Except for stroke-width.
Fredrik Söderquist . unresolved

Given how the spec frames this restriction, we should probably just apply all the stroke properties from the selection style (i.e defaults for everything else). There's not really any analog to HTML here because there we only have stroke width.

File third_party/blink/renderer/core/style/paint_order_array.h
Line 77, Patchset 12 (Latest): return paint_order == kPaintOrderFillStrokeMarkers ||
paint_order == kPaintOrderMarkersFillStroke ||
paint_order == kPaintOrderFillMarkersStroke ||
paint_order == kPaintOrderNormal;
Fredrik Söderquist . unresolved
```suggestion
return PaintOrderArray(paint_order, PaintOrderArray::Type::kNoMarkers)[0] == PT_FILL;
```
Can probably just do that at the single call-site though.
File third_party/blink/renderer/core/style/svg_paint.h
Line 84, Patchset 12 (Parent): StyleColor color;
Fredrik Söderquist . unresolved

I think I'd rather just keep this ordered as it was than introduce some semi-hiding. See also note elsewhere.

File third_party/blink/renderer/core/style/svg_paint.cc
Line 49, Patchset 12 (Latest): SVGPaint result = SVGPaint(Color::kBlack);
Fredrik Söderquist . unresolved
```suggestion
SVGPaint result(Color::kBlack);
```
Line 55, Patchset 12 (Latest): SVGPaint result = SVGPaint();
Fredrik Söderquist . unresolved
```suggestion
SVGPaint result;
```
Open in Gerrit

Related details

Attention is currently required from:
  • Stephen Chenney
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 12
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 Aug 2025 11:18:25 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen Chenney (Gerrit)

    unread,
    Aug 29, 2025, 12:00:54 PM (11 days ago) Aug 29
    to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fredrik Söderquist

    Stephen Chenney added 16 comments

    Patchset-level comments
    File-level comment, Patchset 13 (Latest):
    Stephen Chenney . resolved

    Thanks for taking on this complex review.

    Commit Message
    Line 31, Patchset 12:Note the SVG spec is silent on how to treat ::selection applied to SVG text. This CL treats SVG text the same as HTML text to the extent possible. https://svgwg.org/svg2-draft/text.html#TextSelection
    Fredrik Söderquist . resolved

    Line break

    Stephen Chenney

    Done

    File third_party/blink/renderer/core/css/css_properties.json5
    Line 5511, Patchset 12: default_value: "SVGPaint::CreateInitialCurrentColor()",
    Fredrik Söderquist . unresolved

    This name is misleading, because while the `color` field happens to have that value, the general state of the paint is dictated by the `type` field - which is "none". Given that, does marking this paint have any use?

    Stephen Chenney

    Right. Initially I left this as it was and considered using an IsNone check instead of IsInitial. The problem then would be that the code can't distinguish "Set by author to none" vs "was initially none". In the former we should respect the author and not stroke the text, but in the latter we should fall back to the originating element value.

    So I can rename to CreateInitial to avoid confusion. What do you think?

    File third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
    Line 2899, Patchset 12: paint.SetColor(ConvertStyleColor(state, *local_value));
    Fredrik Söderquist . unresolved

    The `SVGPaint` will never have the initial flag set here, which makes this unnecessary. Keeping the setting of flag to the special `Create...()` functions should also aid with that (maybe it should be documented).

    Stephen Chenney

    No sure what you mean here. As I understand it the code right here is the case when some style sets the color, so removing initial is exactly what I want. But I'm not very confident in my understanding.

    File third_party/blink/renderer/core/layout/svg/svg_layout_support.h
    Line 95, Patchset 12: const UnzoomedLength* length_override = nullptr);
    Fredrik Söderquist . resolved

    `stroke_width_override`?

    Stephen Chenney

    Done

    File third_party/blink/renderer/core/layout/svg/svg_layout_support.cc
    Line 311, Patchset 12: if (length_override) {

    stroke_data.SetThickness(
    ValueForLength(*length_override, viewport_resolver));
    } else {
    stroke_data.SetThickness(
    ValueForLength(style.StrokeWidth(), viewport_resolver));
    }
    Fredrik Söderquist . resolved
    I think I would prefer this as:
    ```
    const UnzoomedLength& effective_stroke_width =
    length_override ? *length_override : style.StrokeWidth();
    stroke_data.SetThickness(ValueForLength(effective_stroke_width, ...));
    ```
    Stephen Chenney

    Done

    File third_party/blink/renderer/core/paint/text_painter.cc
    Line 87, Patchset 12: const ShadowList* selection_shadows =

    GetTextShadows(selection_style, layout_object);
    if (selection_shadows) {
    const ShadowList* text_shadows = GetTextShadows(style, layout_object);
    if (text_shadows) {
    for (auto& shadow : text_shadows->Shadows()) {
    merged_shadow_list.push_back(shadow);
    }
    }
    for (auto& shadow : selection_shadows->Shadows()) {
    merged_shadow_list.push_back(shadow);
    }
    }
    Fredrik Söderquist . resolved

    Why do this here and not when it's needed? This seems to just give `SelectionStyleScope` additional responsibilities.

    Stephen Chenney

    Yes, I agree it can be moved out.

    Line 294, Patchset 12: !pseudo_selection_style->FillPaint().IsInitial();
    Fredrik Söderquist . unresolved

    Should context paints be allowed? Paint-servers?

    Stephen Chenney

    According to the CSS pseudo spec, any valid CSS "stroke" or "fill" is allowed, so yes. I think that allows context_paint but not paint servers. I'm not testing it, however because it seems super unlikely in practice and I have no reason to doubt it would work.

    Line 300, Patchset 12: // If the ::selection has fill: none or stroke: none we need to respect that,

    // and not fall back to the originating element.
    if (have_selection_fill &&
    !SVGObjectPainter::HasFill(*pseudo_selection_style, context_paints)) {
    have_fill = have_selection_fill = false;
    }
    Fredrik Söderquist . unresolved

    I think this could be handled in a more logical way by just trying to apply the paint (if it is non-initial).

    Stephen Chenney

    I added this because tests were failing when the selection style set stroke and fill to none. Without this it painted the originating style rather than the one expected. I'd rather leave it as is.

    Line 311, Patchset 12: // If the selection stroke is not visible we still do not want to draw it,

    // but we do want to fall back to the originating stroke.
    Fredrik Söderquist . resolved

    This seems to be making the assumption that a `stroke-width` won't be set to 0 in a selection style? Given that the initial stroke width is 1, if the selection style contains a stroke width of 0, it seems we should just apply that? Maybe this means that we should be tracking if stroke-width is initial too though?

    Stephen Chenney

    This one I was somewhat undecided on. If the author sets a non-visible stroke on the selection I suppose that is still saying something about the stroke, though I think it would likely be an error. Rethinking it, I do believe we should respect a 0 width.

    I don't think it's worth tracking initial value on stroke width. It seems super confusing to have the stroke color come from one place and the width from another.

    Line 327, Patchset 12: have_selection_fill = false; // Use the originating fill instead.
    Fredrik Söderquist . resolved

    Given that we've handled `none` already, this would only happen for missing/broken paint-servers - I don't see why we'd drop back to originating style in that case (given the restrictions in the spec one might argue that we should just directly fall-back if a paint-server is used).

    Stephen Chenney

    Good point. I'll change it here and below.

    Line 346, Patchset 12: // Note that ::selection does not allow the SVG stroke properties, so

    // use the originating element style. Except for stroke-width.
    Fredrik Söderquist . resolved

    Given how the spec frames this restriction, we should probably just apply all the stroke properties from the selection style (i.e defaults for everything else). There's not really any analog to HTML here because there we only have stroke width.

    Stephen Chenney

    Yeah, let's do that. Means I don't need the stroke width override either.

    File third_party/blink/renderer/core/style/paint_order_array.h
    Line 77, Patchset 12: return paint_order == kPaintOrderFillStrokeMarkers ||

    paint_order == kPaintOrderMarkersFillStroke ||
    paint_order == kPaintOrderFillMarkersStroke ||
    paint_order == kPaintOrderNormal;
    Fredrik Söderquist . resolved
    ```suggestion
    return PaintOrderArray(paint_order, PaintOrderArray::Type::kNoMarkers)[0] == PT_FILL;
    ```
    Can probably just do that at the single call-site though.
    Stephen Chenney

    Done

    File third_party/blink/renderer/core/style/svg_paint.h
    Fredrik Söderquist . resolved

    I think I'd rather just keep this ordered as it was than introduce some semi-hiding. See also note elsewhere.

    Stephen Chenney

    Done

    File third_party/blink/renderer/core/style/svg_paint.cc
    Line 49, Patchset 12: SVGPaint result = SVGPaint(Color::kBlack);
    Fredrik Söderquist . resolved
    ```suggestion
    SVGPaint result(Color::kBlack);
    ```
    Stephen Chenney

    Done

    Line 55, Patchset 12: SVGPaint result = SVGPaint();
    Fredrik Söderquist . resolved
    ```suggestion
    SVGPaint result;
    ```
    Stephen Chenney

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fredrik Söderquist
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 13
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Fri, 29 Aug 2025 16:00:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen Chenney (Gerrit)

    unread,
    Aug 29, 2025, 12:12:33 PM (11 days ago) Aug 29
    to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fredrik Söderquist

    Stephen Chenney added 1 comment

    Patchset-level comments
    File-level comment, Patchset 14 (Latest):
    Stephen Chenney . resolved

    Updated version up.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fredrik Söderquist
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 14
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Fri, 29 Aug 2025 16:12:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Sep 1, 2025, 8:14:54 AM (8 days ago) Sep 1
    to Stephen Chenney, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Stephen Chenney

    Fredrik Söderquist added 12 comments

    Commit Message
    Line 15, Patchset 14 (Latest):HighlightStyleUtils methods for resolving colors, but this fails because
    Fredrik Söderquist . resolved

    I had a look at moving the setup out of `TextPainter`-land (which looks doable) - I think that would be a step towards being able to do this (but there would probably be quite a few steps after that...).

    File third_party/blink/renderer/core/css/css_properties.json5
    Line 5511, Patchset 12: default_value: "SVGPaint::CreateInitialCurrentColor()",
    Fredrik Söderquist . unresolved

    This name is misleading, because while the `color` field happens to have that value, the general state of the paint is dictated by the `type` field - which is "none". Given that, does marking this paint have any use?

    Stephen Chenney

    Right. Initially I left this as it was and considered using an IsNone check instead of IsInitial. The problem then would be that the code can't distinguish "Set by author to none" vs "was initially none". In the former we should respect the author and not stroke the text, but in the latter we should fall back to the originating element value.

    So I can rename to CreateInitial to avoid confusion. What do you think?

    Fredrik Söderquist

    Yes, just `CreateInitial()` should work I think - being an analog to the regular constructor but with the "is initial" flag set.

    File third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
    Line 2899, Patchset 12: paint.SetColor(ConvertStyleColor(state, *local_value));
    Fredrik Söderquist . unresolved

    The `SVGPaint` will never have the initial flag set here, which makes this unnecessary. Keeping the setting of flag to the special `Create...()` functions should also aid with that (maybe it should be documented).

    Stephen Chenney

    No sure what you mean here. As I understand it the code right here is the case when some style sets the color, so removing initial is exactly what I want. But I'm not very confident in my understanding.

    Fredrik Söderquist

    The `SVGPaint` object here (from line 2861) is one which has the default state of the is initial flag - i.e it is already false - and it should always be false here. So this is always a false -> false transition. It seems that what needs isolation is rather the setting of the flag to true - which is what we have the `CreateInitial...()` helpers for.

    File third_party/blink/renderer/core/paint/text_painter.cc
    Line 294, Patchset 12: !pseudo_selection_style->FillPaint().IsInitial();
    Fredrik Söderquist . unresolved

    Should context paints be allowed? Paint-servers?

    Stephen Chenney

    According to the CSS pseudo spec, any valid CSS "stroke" or "fill" is allowed, so yes. I think that allows context_paint but not paint servers. I'm not testing it, however because it seems super unlikely in practice and I have no reason to doubt it would work.

    Fredrik Söderquist

    Well, a context paint could be a paint-server, so we get a form of transitive-ness here. Not allowing paint-servers directly while allowing them indirectly I feel is a bit of a weird situation.

    Line 300, Patchset 12: // If the ::selection has fill: none or stroke: none we need to respect that,
    // and not fall back to the originating element.
    if (have_selection_fill &&
    !SVGObjectPainter::HasFill(*pseudo_selection_style, context_paints)) {
    have_fill = have_selection_fill = false;
    }
    Fredrik Söderquist . unresolved

    I think this could be handled in a more logical way by just trying to apply the paint (if it is non-initial).

    Stephen Chenney

    I added this because tests were failing when the selection style set stroke and fill to none. Without this it painted the originating style rather than the one expected. I'd rather leave it as is.

    Fredrik Söderquist
    ```
    if (pseudo_selection_style &&
    !pseudo_selection_style->FillPaint().IsInitial()) {
    if (SVGObjectPainter::HasFill(*pseudo_selection_style, ...)) {
    ...apply paint...
    }
    } else {
    if (SVGObjectPainter::HasFill(style, ...)) {
    ...apply paint...
    }
    }
    ```
    which would lend itself to just picking one style or the other:
    ```
    const ComputedStyle& fill_style_to_use =
    condition_for_using_selection_style ? selection_style : style;
    if (SVGObjectPainter::HasFill(fill_style_to_use, ...)) {
    ...apply paint...
    }
    ```
    This should allow eliminating the "flag soup". I don't think `PreparePaint()` returning false should trigger a fallback.
    Line 354, Patchset 14 (Latest): bool fill_paints_first = PaintOrderArray(style.PaintOrder())[0] == PT_FILL;
    Fredrik Söderquist . unresolved

    You want to pass `PaintOrderArray::Type::kNoMarkers` as the second argument here to ignore the markers keyword.

    File third_party/blink/web_tests/external/wpt/css/css-pseudo/reference/svg-text-selection-ref.html
    Line 2, Patchset 14 (Latest):<meta charset="utf-8" />
    Fredrik Söderquist . unresolved

    We don't need these in regular HTML. Ditto below in the second `<link>`.

    File third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-fill-only.html
    Line 6, Patchset 14 (Latest):<meta name="assert" content="Verify that ::selection with only fill specificed uses selection fill and originating stroke.">
    Fredrik Söderquist . unresolved

    typo

    File third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-stroke-only.html
    Line 6, Patchset 14 (Latest):<meta name="assert" content="Verify that ::selection with only stroke specificed uses selection stroke and originating fill.">
    Fredrik Söderquist . unresolved

    typo

    Line 20, Patchset 14 (Latest): fill: lightgreen;
    Fredrik Söderquist . unresolved

    Should this be `stroke` to match the name?

    File third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-01.html
    Line 5, Patchset 14 (Latest):<meta name="assert" content="Verify correct painting of SVG shadows with filled">
    Fredrik Söderquist . unresolved

    ...filled text

    ?

    File third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-03.html
    Line 5, Patchset 14 (Latest):<meta name="assert" content="Verify correct painting of SVG shadows with filled">
    Fredrik Söderquist . unresolved

    ...filled and stroke text (with non-default paint-order)

    ?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Stephen Chenney
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 14
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Sep 2025 12:14:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
    Comment-In-Reply-To: Stephen Chenney <sche...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen Chenney (Gerrit)

    unread,
    Sep 1, 2025, 9:32:34 AM (8 days ago) Sep 1
    to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fredrik Söderquist

    Stephen Chenney added 6 comments

    Patchset-level comments
    Stephen Chenney . resolved

    I'll iterate again from here and let you know when it's ready.

    File third_party/blink/renderer/core/css/css_properties.json5
    Line 5511, Patchset 12: default_value: "SVGPaint::CreateInitialCurrentColor()",
    Fredrik Söderquist . resolved

    This name is misleading, because while the `color` field happens to have that value, the general state of the paint is dictated by the `type` field - which is "none". Given that, does marking this paint have any use?

    Stephen Chenney

    Right. Initially I left this as it was and considered using an IsNone check instead of IsInitial. The problem then would be that the code can't distinguish "Set by author to none" vs "was initially none". In the former we should respect the author and not stroke the text, but in the latter we should fall back to the originating element value.

    So I can rename to CreateInitial to avoid confusion. What do you think?

    Fredrik Söderquist

    Yes, just `CreateInitial()` should work I think - being an analog to the regular constructor but with the "is initial" flag set.

    Stephen Chenney

    Done

    File third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
    Line 2899, Patchset 12: paint.SetColor(ConvertStyleColor(state, *local_value));
    Fredrik Söderquist . unresolved

    The `SVGPaint` will never have the initial flag set here, which makes this unnecessary. Keeping the setting of flag to the special `Create...()` functions should also aid with that (maybe it should be documented).

    Stephen Chenney

    No sure what you mean here. As I understand it the code right here is the case when some style sets the color, so removing initial is exactly what I want. But I'm not very confident in my understanding.

    Fredrik Söderquist

    The `SVGPaint` object here (from line 2861) is one which has the default state of the is initial flag - i.e it is already false - and it should always be false here. So this is always a false -> false transition. It seems that what needs isolation is rather the setting of the flag to true - which is what we have the `CreateInitial...()` helpers for.

    Stephen Chenney

    I get it now. I would tend to leave the code here as it is just to demonstrate good practice for setting the color. What do you think?

    File third_party/blink/renderer/core/paint/text_painter.cc
    Line 294, Patchset 12: !pseudo_selection_style->FillPaint().IsInitial();
    Fredrik Söderquist . unresolved

    Should context paints be allowed? Paint-servers?

    Stephen Chenney

    According to the CSS pseudo spec, any valid CSS "stroke" or "fill" is allowed, so yes. I think that allows context_paint but not paint servers. I'm not testing it, however because it seems super unlikely in practice and I have no reason to doubt it would work.

    Fredrik Söderquist

    Well, a context paint could be a paint-server, so we get a form of transitive-ness here. Not allowing paint-servers directly while allowing them indirectly I feel is a bit of a weird situation.

    Stephen Chenney

    Yeah, it is weird. Typical CSS not understanding all the situations, I suspect. I guess I'll add some tests and verify the behavior, and then we can figure out how to proceed.

    Line 300, Patchset 12: // If the ::selection has fill: none or stroke: none we need to respect that,
    // and not fall back to the originating element.
    if (have_selection_fill &&
    !SVGObjectPainter::HasFill(*pseudo_selection_style, context_paints)) {
    have_fill = have_selection_fill = false;
    }
    Fredrik Söderquist . unresolved

    I think this could be handled in a more logical way by just trying to apply the paint (if it is non-initial).

    Stephen Chenney

    I added this because tests were failing when the selection style set stroke and fill to none. Without this it painted the originating style rather than the one expected. I'd rather leave it as is.

    Fredrik Söderquist
    ```
    if (pseudo_selection_style &&
    !pseudo_selection_style->FillPaint().IsInitial()) {
    if (SVGObjectPainter::HasFill(*pseudo_selection_style, ...)) {
    ...apply paint...
    }
    } else {
    if (SVGObjectPainter::HasFill(style, ...)) {
    ...apply paint...
    }
    }
    ```
    which would lend itself to just picking one style or the other:
    ```
    const ComputedStyle& fill_style_to_use =
    condition_for_using_selection_style ? selection_style : style;
    if (SVGObjectPainter::HasFill(fill_style_to_use, ...)) {
    ...apply paint...
    }
    ```
    This should allow eliminating the "flag soup". I don't think `PreparePaint()` returning false should trigger a fallback.
    Stephen Chenney

    Yes. Now that I have moved the shadow code out I think that is viable. I tried it initially and it didn't work for some reason, but I'm guessing it will now.

    Line 354, Patchset 14 (Latest): bool fill_paints_first = PaintOrderArray(style.PaintOrder())[0] == PT_FILL;
    Fredrik Söderquist . unresolved

    You want to pass `PaintOrderArray::Type::kNoMarkers` as the second argument here to ignore the markers keyword.

    Stephen Chenney

    OK. Will do.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fredrik Söderquist
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 14
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Mon, 01 Sep 2025 13:32:27 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Sep 1, 2025, 9:47:22 AM (8 days ago) Sep 1
    to Stephen Chenney, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Stephen Chenney

    Fredrik Söderquist added 1 comment

    File third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
    Line 2899, Patchset 12: paint.SetColor(ConvertStyleColor(state, *local_value));
    Fredrik Söderquist . unresolved

    The `SVGPaint` will never have the initial flag set here, which makes this unnecessary. Keeping the setting of flag to the special `Create...()` functions should also aid with that (maybe it should be documented).

    Stephen Chenney

    No sure what you mean here. As I understand it the code right here is the case when some style sets the color, so removing initial is exactly what I want. But I'm not very confident in my understanding.

    Fredrik Söderquist

    The `SVGPaint` object here (from line 2861) is one which has the default state of the is initial flag - i.e it is already false - and it should always be false here. So this is always a false -> false transition. It seems that what needs isolation is rather the setting of the flag to true - which is what we have the `CreateInitial...()` helpers for.

    Stephen Chenney

    I get it now. I would tend to leave the code here as it is just to demonstrate good practice for setting the color. What do you think?

    Fredrik Söderquist

    Well, setting the color outside of this function would not be "good practice" 😄 (that's why we have a constructor for that case), so that's a bit of a misnomer... It would be better if the object was immutable - which is also why I'd prefer to not have setters.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Stephen Chenney
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 14
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Sep 2025 13:47:04 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen Chenney (Gerrit)

    unread,
    Sep 2, 2025, 2:31:04 PM (7 days ago) Sep 2
    to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fredrik Söderquist

    Stephen Chenney voted and added 12 comments

    Votes added by Stephen Chenney

    Commit-Queue+1

    12 comments

    Patchset-level comments
    File-level comment, Patchset 14:
    Stephen Chenney . resolved

    New CL up. I think we're all set.

    File third_party/blink/renderer/core/css/css_properties.json5
    Line 5511, Patchset 12: default_value: "SVGPaint::CreateInitialCurrentColor()",
    Fredrik Söderquist . resolved

    This name is misleading, because while the `color` field happens to have that value, the general state of the paint is dictated by the `type` field - which is "none". Given that, does marking this paint have any use?

    Stephen Chenney

    Right. Initially I left this as it was and considered using an IsNone check instead of IsInitial. The problem then would be that the code can't distinguish "Set by author to none" vs "was initially none". In the former we should respect the author and not stroke the text, but in the latter we should fall back to the originating element value.

    So I can rename to CreateInitial to avoid confusion. What do you think?

    Fredrik Söderquist

    Yes, just `CreateInitial()` should work I think - being an analog to the regular constructor but with the "is initial" flag set.

    Stephen Chenney

    Done

    File third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
    Line 2899, Patchset 12: paint.SetColor(ConvertStyleColor(state, *local_value));
    Fredrik Söderquist . resolved

    The `SVGPaint` will never have the initial flag set here, which makes this unnecessary. Keeping the setting of flag to the special `Create...()` functions should also aid with that (maybe it should be documented).

    Stephen Chenney

    No sure what you mean here. As I understand it the code right here is the case when some style sets the color, so removing initial is exactly what I want. But I'm not very confident in my understanding.

    Fredrik Söderquist

    The `SVGPaint` object here (from line 2861) is one which has the default state of the is initial flag - i.e it is already false - and it should always be false here. So this is always a false -> false transition. It seems that what needs isolation is rather the setting of the flag to true - which is what we have the `CreateInitial...()` helpers for.

    Stephen Chenney

    OK. I've removed the SVGPaint::SetColor method and reverted this back to paint.color = ...

    File third_party/blink/renderer/core/paint/text_painter.cc
    Line 294, Patchset 12: !pseudo_selection_style->FillPaint().IsInitial();
    Fredrik Söderquist . unresolved

    Should context paints be allowed? Paint-servers?

    Stephen Chenney

    According to the CSS pseudo spec, any valid CSS "stroke" or "fill" is allowed, so yes. I think that allows context_paint but not paint servers. I'm not testing it, however because it seems super unlikely in practice and I have no reason to doubt it would work.

    Fredrik Söderquist

    Well, a context paint could be a paint-server, so we get a form of transitive-ness here. Not allowing paint-servers directly while allowing them indirectly I feel is a bit of a weird situation.

    Stephen Chenney

    OK, I looked some more at the spec. There's a note at https://drafts.fxtf.org/fill-stroke-3/#svg-paint saying that more spec work needs to be done to incorporate context-fill and context-stroke, so the MDN page is a bit misleading. I don't want to write tests for things that are not in a spec yet. Are you OK landing as it is now?

    Line 300, Patchset 12: // If the ::selection has fill: none or stroke: none we need to respect that,
    // and not fall back to the originating element.
    if (have_selection_fill &&
    !SVGObjectPainter::HasFill(*pseudo_selection_style, context_paints)) {
    have_fill = have_selection_fill = false;
    }
    Fredrik Söderquist . resolved

    I think this could be handled in a more logical way by just trying to apply the paint (if it is non-initial).

    Stephen Chenney

    I added this because tests were failing when the selection style set stroke and fill to none. Without this it painted the originating style rather than the one expected. I'd rather leave it as is.

    Fredrik Söderquist
    ```
    if (pseudo_selection_style &&
    !pseudo_selection_style->FillPaint().IsInitial()) {
    if (SVGObjectPainter::HasFill(*pseudo_selection_style, ...)) {
    ...apply paint...
    }
    } else {
    if (SVGObjectPainter::HasFill(style, ...)) {
    ...apply paint...
    }
    }
    ```
    which would lend itself to just picking one style or the other:
    ```
    const ComputedStyle& fill_style_to_use =
    condition_for_using_selection_style ? selection_style : style;
    if (SVGObjectPainter::HasFill(fill_style_to_use, ...)) {
    ...apply paint...
    }
    ```
    This should allow eliminating the "flag soup". I don't think `PreparePaint()` returning false should trigger a fallback.
    Stephen Chenney

    Done

    Line 354, Patchset 14: bool fill_paints_first = PaintOrderArray(style.PaintOrder())[0] == PT_FILL;
    Fredrik Söderquist . resolved

    You want to pass `PaintOrderArray::Type::kNoMarkers` as the second argument here to ignore the markers keyword.

    Stephen Chenney

    Done

    File third_party/blink/web_tests/external/wpt/css/css-pseudo/reference/svg-text-selection-ref.html
    Line 2, Patchset 14:<meta charset="utf-8" />
    Fredrik Söderquist . resolved

    We don't need these in regular HTML. Ditto below in the second `<link>`.

    Stephen Chenney

    Done. But we do need the /fonts/ahem.css to avoid presubmit errors.

    File third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-fill-only.html
    Line 6, Patchset 14:<meta name="assert" content="Verify that ::selection with only fill specificed uses selection fill and originating stroke.">
    Fredrik Söderquist . resolved

    typo

    Stephen Chenney

    Done

    File third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-stroke-only.html
    Line 6, Patchset 14:<meta name="assert" content="Verify that ::selection with only stroke specificed uses selection stroke and originating fill.">
    Fredrik Söderquist . resolved

    typo

    Stephen Chenney

    Done

    Line 20, Patchset 14: fill: lightgreen;
    Fredrik Söderquist . resolved

    Should this be `stroke` to match the name?

    Stephen Chenney

    Done

    File third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-01.html
    Line 5, Patchset 14:<meta name="assert" content="Verify correct painting of SVG shadows with filled">
    Fredrik Söderquist . resolved

    ...filled text

    ?

    Stephen Chenney

    Done

    File third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-03.html
    Line 5, Patchset 14:<meta name="assert" content="Verify correct painting of SVG shadows with filled">
    Fredrik Söderquist . resolved

    ...filled and stroke text (with non-default paint-order)

    ?

    Stephen Chenney

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fredrik Söderquist
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
    Gerrit-Change-Number: 6850871
    Gerrit-PatchSet: 14
    Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Tue, 02 Sep 2025 18:30:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Sep 3, 2025, 7:23:46 AM (6 days ago) Sep 3
    to Stephen Chenney, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Stephen Chenney

    Fredrik Söderquist voted and added 3 comments

    Votes added by Fredrik Söderquist

    Code-Review+1

    3 comments

    Patchset-level comments
    File-level comment, Patchset 15 (Latest):
    Fredrik Söderquist . resolved

    LGTM w/ nit

    File third_party/blink/renderer/core/paint/svg_object_painter.h
    Line 30, Patchset 15 (Latest): static bool HasStroke(const ComputedStyle&, const SvgContextPaints*);
    Fredrik Söderquist . unresolved

    This is no longer used?

    File third_party/blink/renderer/core/paint/text_painter.cc
    Line 294, Patchset 12: !pseudo_selection_style->FillPaint().IsInitial();
    Fredrik Söderquist . resolved

    Should context paints be allowed? Paint-servers?

    Stephen Chenney

    According to the CSS pseudo spec, any valid CSS "stroke" or "fill" is allowed, so yes. I think that allows context_paint but not paint servers. I'm not testing it, however because it seems super unlikely in practice and I have no reason to doubt it would work.

    Fredrik Söderquist

    Well, a context paint could be a paint-server, so we get a form of transitive-ness here. Not allowing paint-servers directly while allowing them indirectly I feel is a bit of a weird situation.

    Stephen Chenney

    OK, I looked some more at the spec. There's a note at https://drafts.fxtf.org/fill-stroke-3/#svg-paint saying that more spec work needs to be done to incorporate context-fill and context-stroke, so the MDN page is a bit misleading. I don't want to write tests for things that are not in a spec yet. Are you OK landing as it is now?

    Fredrik Söderquist

    I guess that basically says that a `fill-color: context-stroke` would work, but (probably only) pick up the color. I guess the status quo is the closest we get to that without adding additional code.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Stephen Chenney
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
      Gerrit-Change-Number: 6850871
      Gerrit-PatchSet: 15
      Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
      Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
      Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
      Gerrit-CC: Alexis Menard <alexis...@intel.com>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
      Gerrit-Comment-Date: Wed, 03 Sep 2025 11:23:27 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Stephen Chenney (Gerrit)

      unread,
      Sep 3, 2025, 11:28:23 AM (6 days ago) Sep 3
      to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
      Attention needed from Fredrik Söderquist

      Stephen Chenney voted and added 2 comments

      Votes added by Stephen Chenney

      Commit-Queue+1

      2 comments

      Patchset-level comments
      File-level comment, Patchset 16 (Latest):
      Stephen Chenney . resolved

      Thanks again. Looks like I need another +1. I think there's an error in the Gerrit vote copy system but I'm yet to prove it with a truly trivial change.

      File third_party/blink/renderer/core/paint/svg_object_painter.h
      Line 30, Patchset 15: static bool HasStroke(const ComputedStyle&, const SvgContextPaints*);
      Fredrik Söderquist . resolved

      This is no longer used?

      Stephen Chenney

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fredrik Söderquist
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
        Gerrit-Change-Number: 6850871
        Gerrit-PatchSet: 16
        Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
        Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
        Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
        Gerrit-CC: Alexis Menard <alexis...@intel.com>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
        Gerrit-Comment-Date: Wed, 03 Sep 2025 15:28:17 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Fredrik Söderquist (Gerrit)

        unread,
        Sep 3, 2025, 11:58:54 AM (6 days ago) Sep 3
        to Stephen Chenney, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
        Attention needed from Stephen Chenney

        Fredrik Söderquist voted Code-Review+1

        Code-Review+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Stephen Chenney
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
          Gerrit-Change-Number: 6850871
          Gerrit-PatchSet: 16
          Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
          Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
          Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
          Gerrit-CC: Alexis Menard <alexis...@intel.com>
          Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
          Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
          Gerrit-Comment-Date: Wed, 03 Sep 2025 15:58:38 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Stephen Chenney (Gerrit)

          unread,
          Sep 3, 2025, 12:03:30 PM (6 days ago) Sep 3
          to Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

          Stephen Chenney voted Commit-Queue+2

          Commit-Queue+2
          Open in Gerrit

          Related details

          Attention set is empty
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
          Gerrit-Change-Number: 6850871
          Gerrit-PatchSet: 16
          Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
          Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
          Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
          Gerrit-CC: Alexis Menard <alexis...@intel.com>
          Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
          Gerrit-Comment-Date: Wed, 03 Sep 2025 16:03:16 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Blink W3C Test Autoroller (Gerrit)

          unread,
          Sep 3, 2025, 12:03:46 PM (6 days ago) Sep 3
          to Stephen Chenney, Fredrik Söderquist, Dirk Schulze, Chromium LUCI CQ, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

          Message from Blink W3C Test Autoroller

          Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/54671.

          When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.

          WPT Export docs:
          https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process

          Open in Gerrit

          Related details

          Attention set is empty
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
          Gerrit-Change-Number: 6850871
          Gerrit-PatchSet: 16
          Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
          Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
          Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
          Gerrit-CC: Alexis Menard <alexis...@intel.com>
          Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
          Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
          Gerrit-Comment-Date: Wed, 03 Sep 2025 16:03:38 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: No
          satisfied_requirement
          open
          diffy

          Chromium LUCI CQ (Gerrit)

          unread,
          Sep 3, 2025, 12:58:08 PM (6 days ago) Sep 3
          to Stephen Chenney, Blink W3C Test Autoroller, Fredrik Söderquist, Dirk Schulze, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

          Chromium LUCI CQ submitted the change

          Change information

          Commit message:
          Fix SVG text selection colors

          When selecting SVG text, the current behavior relies on the selection
          styling having all of the color information, which it does not always
          have. Colors not specified in the ::selection should use the
          non-selected colors, as happens for HTML content.

          The ideal solution would be for SVG selection to use the

          HighlightStyleUtils methods for resolving colors, but this fails because
          the initial value for the CSS fill property is black (rather than
          currentColor) so the color will never resolve to currentColor leading to
          the fallback color being used. While the spec has been updated to use
          currentColor for the initial fill value, that change appears to break
          the world because all existing SVG content assumes the initial value for
          fill is black.

          So keep track of whether SVGPaint is using the initial value for its
          colors and if so ignore the ::selection colors when painting SVG
          selection.

          Also refactor shadow selection to correctly layer selection shadows
          according to spec and to avoid double painting shadows when both fill
          and stroke are given.


          Note the SVG spec is silent on how to treat ::selection applied to SVG
          text. This CL treats SVG text the same as HTML text to the extent
          possible. https://svgwg.org/svg2-draft/text.html#TextSelection
          Bug: 436810963
          Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
          Commit-Queue: Stephen Chenney <sche...@chromium.org>
          Reviewed-by: Fredrik Söderquist <f...@opera.com>
          Cr-Commit-Position: refs/heads/main@{#1510335}
          Files:
          • M third_party/blink/renderer/core/css/css_properties.json5
          • M third_party/blink/renderer/core/paint/text_painter.cc
          • M third_party/blink/renderer/core/style/svg_paint.cc
          • M third_party/blink/renderer/core/style/svg_paint.h
          • A third_party/blink/web_tests/external/wpt/css/css-pseudo/reference/svg-text-selection-ref.html
          • A third_party/blink/web_tests/external/wpt/css/css-pseudo/reference/svg-text-selection-shadow-ref.html
          • A third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-fill-only.html
          • A third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-shadow.html
          • A third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-stroke-only.html
          • A third_party/blink/web_tests/external/wpt/css/css-pseudo/svg-text-selection-transparent-background.html
          • A third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-01.html
          • A third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-02.html
          • A third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-03.html
          • A third_party/blink/web_tests/external/wpt/svg/painting/reftests/text-shadow-ref.html
          • M third_party/blink/web_tests/platform/linux/svg/css/text-shadow-multiple-expected.png
          • M third_party/blink/web_tests/platform/linux/svg/text/selection-background-color-expected.png
          • M third_party/blink/web_tests/platform/mac/svg/css/text-shadow-multiple-expected.png
          • M third_party/blink/web_tests/platform/mac/svg/text/selection-background-color-expected.png
          • A third_party/blink/web_tests/platform/win10/svg/css/text-shadow-multiple-expected.png
          • A third_party/blink/web_tests/platform/win10/svg/text/selection-background-color-expected.png
          • A third_party/blink/web_tests/platform/win11-arm64/svg/css/text-shadow-multiple-expected.png
          • A third_party/blink/web_tests/platform/win11-arm64/svg/text/selection-background-color-expected.png
          Change size: L
          Delta: 22 files changed, 305 insertions(+), 43 deletions(-)
          Branch: refs/heads/main
          Submit Requirements:
          • requirement satisfiedCode-Review: +1 by Fredrik Söderquist
          Open in Gerrit
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: merged
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
          Gerrit-Change-Number: 6850871
          Gerrit-PatchSet: 17
          Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
          Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
          Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
          Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
          Gerrit-CC: Alexis Menard <alexis...@intel.com>
          Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
          open
          diffy
          satisfied_requirement

          Blink W3C Test Autoroller (Gerrit)

          unread,
          Sep 3, 2025, 1:21:34 PM (6 days ago) Sep 3
          to Stephen Chenney, Chromium LUCI CQ, Fredrik Söderquist, Dirk Schulze, Alexis Menard, AyeAye, chromium...@chromium.org, mac-r...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, zol...@webkit.org, pdr+svgw...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

          Message from Blink W3C Test Autoroller

          The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/54671

          Open in Gerrit

          Related details

          Attention set is empty
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I33aeda70dec9d992a10ede5057fa0163b783b1c9
          Gerrit-Change-Number: 6850871
          Gerrit-PatchSet: 17
          Gerrit-Owner: Stephen Chenney <sche...@chromium.org>
          Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
          Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
          Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
          Gerrit-CC: Alexis Menard <alexis...@intel.com>
          Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
          Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
          Gerrit-Comment-Date: Wed, 03 Sep 2025 17:21:29 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: No
          satisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages