Support closest-corner/farthest-corner in clip-path circle()/ellipse() [chromium/src : main]

2 views
Skip to first unread message

Hyowon Kim (Gerrit)

unread,
Apr 14, 2026, 2:27:51 AM (5 days ago) Apr 14
to Daniil Sakhapov, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
Attention needed from Daniil Sakhapov

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Daniil Sakhapov
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
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: I87d757813ea0c1065a8cbcca9f46396af217a8aa
Gerrit-Change-Number: 7754379
Gerrit-PatchSet: 4
Gerrit-Owner: Hyowon Kim <hyo...@igalia.com>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Hyowon Kim <hyo...@igalia.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Comment-Date: Tue, 14 Apr 2026 06:27:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniil Sakhapov (Gerrit)

unread,
Apr 14, 2026, 4:51:03 AM (5 days ago) Apr 14
to Hyowon Kim, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
Attention needed from Hyowon Kim

Daniil Sakhapov added 2 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Daniil Sakhapov . unresolved

I think we need a feature flag for this one

File third_party/blink/renderer/core/style/basic_shapes.cc
Line 109, Patchset 4 (Latest):float CornerDistance(const gfx::PointF& center,
const gfx::SizeF& box_size,
bool closest) {
const gfx::RectF rect(box_size);
const std::array<gfx::PointF, 4> corners = {
rect.origin(), rect.top_right(), rect.bottom_right(), rect.bottom_left()};

float distance = (center - corners[0]).Length();
for (unsigned i = 1; i < std::size(corners); ++i) {
float new_distance = (center - corners[i]).Length();
if (closest ? new_distance < distance : new_distance > distance) {
distance = new_distance;
}
}
return distance;
}
Daniil Sakhapov . unresolved

looking at - https://drafts.csswg.org/css-images-3/#valdef-radial-extent-closest-corner - it seems to be wrong for the circle()/ellipse() case?

Open in Gerrit

Related details

Attention is currently required from:
  • Hyowon Kim
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: I87d757813ea0c1065a8cbcca9f46396af217a8aa
    Gerrit-Change-Number: 7754379
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Hyowon Kim <hyo...@igalia.com>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Comment-Date: Tue, 14 Apr 2026 08:50:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hyowon Kim (Gerrit)

    unread,
    Apr 15, 2026, 3:57:05 AM (4 days ago) Apr 15
    to Daniil Sakhapov, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
    Attention needed from Daniil Sakhapov

    Hyowon Kim added 1 comment

    File third_party/blink/renderer/core/style/basic_shapes.cc
    Line 109, Patchset 4 (Latest):float CornerDistance(const gfx::PointF& center,
    const gfx::SizeF& box_size,
    bool closest) {
    const gfx::RectF rect(box_size);
    const std::array<gfx::PointF, 4> corners = {
    rect.origin(), rect.top_right(), rect.bottom_right(), rect.bottom_left()};

    float distance = (center - corners[0]).Length();
    for (unsigned i = 1; i < std::size(corners); ++i) {
    float new_distance = (center - corners[i]).Length();
    if (closest ? new_distance < distance : new_distance > distance) {
    distance = new_distance;
    }
    }
    return distance;
    }
    Daniil Sakhapov . unresolved

    looking at - https://drafts.csswg.org/css-images-3/#valdef-radial-extent-closest-corner - it seems to be wrong for the circle()/ellipse() case?

    Hyowon Kim

    Good point. The spec says ellipse closest-corner/farthest-corner should
    preserve the aspect ratio from closest-side/farthest-side.

    But Blink's parser for ellipse() accepts <shape-radius>{2} (two independent radius values), not a single <radial-size>. The WPT test also uses this form: [ellipse(farthest-corner closest-corner at ...)](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/css/css-masking/clip-path/clip-path-ellipse-closest-farthest-corner.html;l=19).
    With two independent radii, each resolves to the euclidean corner distance, and the WPT reference (rx=247.487, ry=125) matches this.

    On wpt.fyi, these three tests are red for Chrome, Edge, and Firefox, and green only for Safari.
    What do you think?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniil Sakhapov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: I87d757813ea0c1065a8cbcca9f46396af217a8aa
    Gerrit-Change-Number: 7754379
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Hyowon Kim <hyo...@igalia.com>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Comment-Date: Wed, 15 Apr 2026 07:56:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniil Sakhapov (Gerrit)

    unread,
    Apr 15, 2026, 5:26:25 AM (4 days ago) Apr 15
    to Hyowon Kim, Fredrik Söderquist, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
    Attention needed from Hyowon Kim

    Daniil Sakhapov added 1 comment

    File third_party/blink/renderer/core/style/basic_shapes.cc
    Line 109, Patchset 4 (Latest):float CornerDistance(const gfx::PointF& center,
    const gfx::SizeF& box_size,
    bool closest) {
    const gfx::RectF rect(box_size);
    const std::array<gfx::PointF, 4> corners = {
    rect.origin(), rect.top_right(), rect.bottom_right(), rect.bottom_left()};

    float distance = (center - corners[0]).Length();
    for (unsigned i = 1; i < std::size(corners); ++i) {
    float new_distance = (center - corners[i]).Length();
    if (closest ? new_distance < distance : new_distance > distance) {
    distance = new_distance;
    }
    }
    return distance;
    }
    Daniil Sakhapov . unresolved

    looking at - https://drafts.csswg.org/css-images-3/#valdef-radial-extent-closest-corner - it seems to be wrong for the circle()/ellipse() case?

    Hyowon Kim

    Good point. The spec says ellipse closest-corner/farthest-corner should
    preserve the aspect ratio from closest-side/farthest-side.

    But Blink's parser for ellipse() accepts <shape-radius>{2} (two independent radius values), not a single <radial-size>. The WPT test also uses this form: [ellipse(farthest-corner closest-corner at ...)](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/css/css-masking/clip-path/clip-path-ellipse-closest-farthest-corner.html;l=19).
    With two independent radii, each resolves to the euclidean corner distance, and the WPT reference (rx=247.487, ry=125) matches this.

    On wpt.fyi, these three tests are red for Chrome, Edge, and Firefox, and green only for Safari.
    What do you think?

    Daniil Sakhapov

    Hm, I can't find a spec saying that we should accept two <shape-radius> though...
    Maybe there is a bug in current spec and it should be `[ <radial-extent> | <length [0,∞]> | <length-percentage [0,∞]> ]{2}` instead? (added `[` and `]`).
    fs@, do you know anything about it?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hyowon Kim
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: I87d757813ea0c1065a8cbcca9f46396af217a8aa
    Gerrit-Change-Number: 7754379
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Hyowon Kim <hyo...@igalia.com>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-Attention: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Comment-Date: Wed, 15 Apr 2026 09:26:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Hyowon Kim <hyo...@igalia.com>
    Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Apr 15, 2026, 8:13:29 AM (4 days ago) Apr 15
    to Hyowon Kim, Daniil Sakhapov, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
    Attention needed from Hyowon Kim

    Fredrik Söderquist added 3 comments

    File third_party/blink/renderer/core/style/basic_shapes.cc
    Line 109, Patchset 4 (Latest):float CornerDistance(const gfx::PointF& center,
    Fredrik Söderquist . resolved

    Yay! Another copy of this code. Perhaps consider naming it similar to the one I assuem you copied this from (`RadiusToCorner` in `css_gradient_value.cc`) to make it a bit more discoverable in case someone decides to consolidate?

    Fredrik Söderquist

    Yes, this ought to behave like radial gradients (which is where `<radial-size>` is defined, c.f `ConsumeRadialGradient`) - i.e accept only one `<radial-extent>` but one or two `<length-percentage>` - but it looks like this has been inconsistently implemented everywhere (always fun!). Should probably raise an issue for this, because the spec is out of sync with implementations (and one or the other would need to change).

    Line 226, Patchset 4 (Latest): auto ResolveRadius = [&](const BasicShapeRadius& radius, float center_coord,
    float box_dimension) -> float {
    if (radius.GetType() == BasicShapeRadius::kClosestCorner ||
    radius.GetType() == BasicShapeRadius::kFarthestCorner) {
    return CornerDistance(
    center, bounding_box.size(),
    radius.GetType() == BasicShapeRadius::kClosestCorner);
    }
    return FloatValueForRadiusInBox(radius, center_coord, box_dimension);
    };
    Fredrik Söderquist . unresolved

    This probably ought to go in `FloatValueForRadiusInBox()`, because that function is also called by the `shape-outside` code. (Maybe the result can be shared between circle and ellipse by moving it to the shared base class?)

    Gerrit-Comment-Date: Wed, 15 Apr 2026 12:13:16 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hyowon Kim (Gerrit)

    unread,
    Apr 15, 2026, 9:47:00 PM (3 days ago) Apr 15
    to Fredrik Söderquist, Daniil Sakhapov, Chromium LUCI CQ, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
    Attention needed from Daniil Sakhapov and Fredrik Söderquist

    Hyowon Kim added 1 comment

    File third_party/blink/renderer/core/style/basic_shapes.cc
    float CornerDistance(const gfx::PointF& center,
    Hyowon Kim

    I filed a spec issue for this: https://github.com/w3c/csswg-drafts/issues/13814
    It would be great if you could comment on the issue about which direction it should go.

    I'll keep this CL as-is for now until the spec discussion is resolved.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniil Sakhapov
    • Fredrik Söderquist
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: I87d757813ea0c1065a8cbcca9f46396af217a8aa
    Gerrit-Change-Number: 7754379
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Thu, 16 Apr 2026 01:46:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Hyowon Kim <hyo...@igalia.com>
    Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
    Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Apr 16, 2026, 7:16:11 AM (3 days ago) Apr 16
    to Hyowon Kim, Daniil Sakhapov, Chromium LUCI CQ, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
    Attention needed from Daniil Sakhapov and Hyowon Kim

    Fredrik Söderquist added 1 comment

    File third_party/blink/renderer/core/style/basic_shapes.cc
    Fredrik Söderquist

    So, it's been a known issue for 1.5y... Maybe someone has the power to get on an agenda? Using our current "interpretation" seems fine (changing it would come with risks).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniil Sakhapov
    • Hyowon Kim
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: I87d757813ea0c1065a8cbcca9f46396af217a8aa
    Gerrit-Change-Number: 7754379
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Hyowon Kim <hyo...@igalia.com>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Hyowon Kim <hyo...@igalia.com>
    Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Comment-Date: Thu, 16 Apr 2026 11:15:56 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Apr 17, 2026, 7:18:04 AM (yesterday) Apr 17
    to Hyowon Kim, Daniil Sakhapov, Chromium LUCI CQ, chromium...@chromium.org, Menard, Alexis, android-bu...@system.gserviceaccount.com, apavlo...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org
    Attention needed from Daniil Sakhapov and Hyowon Kim

    Fredrik Söderquist added 1 comment

    Patchset-level comments
    Fredrik Söderquist . resolved

    You should probably have assigned the bug to you (it looks like someone else assigned it now).

    Gerrit-Comment-Date: Fri, 17 Apr 2026 11:17:56 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages