Helmut Januschka abandoned this change.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
this is the reland, of the revert + fixes on top from http://crrev.com/c/7646168 (that we abandoned)
we now preserve explicit author colors even if the explicit value equals the default dark focus-ring value.
The key change is that we no longer decide based on resolved color equality.
Instead, -webkit-focus-ring-color is preserved as a keyword in computed style, and PaintFocusRing() only applies the dark-mode white override when the outline color actually came from that keyword.
So explicit #101010 is preserved, but default -webkit-focus-ring-color still gets the white override in dark mode.
On platform-specific behavior: this CL intentionally keeps existing non-Mac behavior for default auto focus rings in dark mode (white for visibility). Removing that behavior, as in 7555272, causes real regressions (for example FocusRingBrowserTest.DarkModeButton and multiple dark-color-scheme blink tests), so those failures were valid.
For 7555272 specifically:
The current approach is meant to fix 480978106 narrowly without those regressions.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
sorry, for the ping, could we proceed with this?
@p...@chromium.org could you take a look at the reland? or should i try finding another reviewer?
happy to addresa any given feedback
This relands:Can you include a short summary of what's actually changing in this patch from the end-user's perspective?
(http://crrev.com/c/7633026)In the review of http://crrev.com/c/7633026 I asked why we need to have a platform difference at all. The answer was that we preserve the platform-specific behavior, but I don't understand why. I understand that there are platform differences in colors, but why do we have any platform differences in the overridability of colors?
Which of the fixes in this CL are platform specific?
Why is https://issues.chromium.org/u/1/issues/480978106#comment4 not the right fix?
There are many pixel rebaselines in this patch, and it is difficult to determine if any of these have behavior changes (e.g., whether the new `flag-specific/enable-skia-graphite` expected files are a behavior change or are for the small pixel differences). Are these expected.png updates actually needed? If yes, do you know why the corner pixels are changing? If it's just a tiny color difference, can you adjust the `<meta name=fuzzy ` values in these tests to avoid needing to update the -expected.png files?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
yeah bots came back with 0 pixel diffs 🥳
Can you include a short summary of what's actually changing in this patch from the end-user's perspective?
Done
In the review of http://crrev.com/c/7633026 I asked why we need to have a platform difference at all. The answer was that we preserve the platform-specific behavior, but I don't understand why. I understand that there are platform differences in colors, but why do we have any platform differences in the overridability of colors?
Which of the fixes in this CL are platform specific?
Why is https://issues.chromium.org/u/1/issues/480978106#comment4 not the right fix?
I think the confusion came from mixing two bugs in one run.
here is a sampler: https://static.januschka.com/i-480978106/
hope that solves the doubts, really appreciate challenging it🤗!
There are many pixel rebaselines in this patch, and it is difficult to determine if any of these have behavior changes (e.g., whether the new `flag-specific/enable-skia-graphite` expected files are a behavior change or are for the small pixel differences). Are these expected.png updates actually needed? If yes, do you know why the corner pixels are changing? If it's just a tiny color difference, can you adjust the `<meta name=fuzzy ` values in these tests to avoid needing to update the -expected.png files?
they already have fuzzy, i think i messed up calling rebaseline script :/ - think i cleaned it up down to only a few files
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Helmut JanuschkaIn the review of http://crrev.com/c/7633026 I asked why we need to have a platform difference at all. The answer was that we preserve the platform-specific behavior, but I don't understand why. I understand that there are platform differences in colors, but why do we have any platform differences in the overridability of colors?
Which of the fixes in this CL are platform specific?
Why is https://issues.chromium.org/u/1/issues/480978106#comment4 not the right fix?
I think the confusion came from mixing two bugs in one run.
- Bug 480978106 by itself is straightforward: explicit author `outline-color` in dark mode should not be overridden.
- The first attempt also tried to address 489304736 in the same change, and that is where behavior got entangled.
- *Which parts are platform-specific?**
- Only the pre-existing non-Mac default auto focus-ring visibility behavior in `PaintFocusRing()`.
- Overridability is not platform-specific in this CL: explicit author colors are preserved on all platforms.
- *Why keep any platform difference at all?**
- The remaining platform difference is about default ring appearance policy (historical non-Mac white inner ring vs macOS system-style behavior), not about whether author colors can be overridden.
- *Why is issue 480978106#comment4 not sufficient here?**
- That approach is a good minimal fix for 480978106 alone (remove the unconditional override path).
- But it does not safely cover the coupled 489304736 work, and moving white behavior into `FocusRingColor()` affects other consumers (notably canvas `drawFocusIfNeeded` / `DrawFocusRing`), which caused the regression.
- Current CL keeps `FocusRingColor()` renderer-pref for canvas, and constrains white override to `PaintFocusRing()` for keyword-origin default rings.
here is a sampler: https://static.januschka.com/i-480978106/hope that solves the doubts, really appreciate challenging it🤗!
Why must these two bugs be fixed at the same time? If just 480978106 were fixed with the simple approach, would that make it harder to fix 489304736?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Helmut JanuschkaIn the review of http://crrev.com/c/7633026 I asked why we need to have a platform difference at all. The answer was that we preserve the platform-specific behavior, but I don't understand why. I understand that there are platform differences in colors, but why do we have any platform differences in the overridability of colors?
Which of the fixes in this CL are platform specific?
Why is https://issues.chromium.org/u/1/issues/480978106#comment4 not the right fix?
Philip RogersI think the confusion came from mixing two bugs in one run.
- Bug 480978106 by itself is straightforward: explicit author `outline-color` in dark mode should not be overridden.
- The first attempt also tried to address 489304736 in the same change, and that is where behavior got entangled.
- *Which parts are platform-specific?**
- Only the pre-existing non-Mac default auto focus-ring visibility behavior in `PaintFocusRing()`.
- Overridability is not platform-specific in this CL: explicit author colors are preserved on all platforms.
- *Why keep any platform difference at all?**
- The remaining platform difference is about default ring appearance policy (historical non-Mac white inner ring vs macOS system-style behavior), not about whether author colors can be overridden.
- *Why is issue 480978106#comment4 not sufficient here?**
- That approach is a good minimal fix for 480978106 alone (remove the unconditional override path).
- But it does not safely cover the coupled 489304736 work, and moving white behavior into `FocusRingColor()` affects other consumers (notably canvas `drawFocusIfNeeded` / `DrawFocusRing`), which caused the regression.
- Current CL keeps `FocusRingColor()` renderer-pref for canvas, and constrains white override to `PaintFocusRing()` for keyword-origin default rings.
here is a sampler: https://static.januschka.com/i-480978106/hope that solves the doubts, really appreciate challenging it🤗!
Why must these two bugs be fixed at the same time? If just 480978106 were fixed with the simple approach, would that make it harder to fix 489304736?
They do not strictly have to be fixed together.
480978106 could land alone, but the simple version created an intermediate regression in canvas `drawFocusIfNeeded` (489304736) by changing shared `FocusRingColor()` behavior.
Landing both together avoids that broken state and keeps the split correct: explicit author colors are preserved, while default keyword focus rings keep existing visibility behavior.
Any broader 489304736 policy cleanup is better handled as a follow-up (i am happily going after this issue once this here is landed).
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@p...@chromium.org i dont want to stress on this, but could i ask you for a quick look if we can move on with this?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@p...@chromium.org i know you drown in reviews, yet it would be awesome if we somehow can finish this CL, if i am correct it was sorted out anyway, with the combination of both CLs mentioned in the commit history?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@f...@opera.com could you maybe help unblock this? this was landed, than reverted, and now should be all-in-one, fix, flag, + a fix that came up after landing the first.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@f...@opera.com could you maybe help unblock this? this was landed, than reverted, and now should be all-in-one, fix, flag, + a fix that came up after landing the first.
I don't feel that I have enough background on this to review it properly - there seems to have been some back-and-forth here. For example I don't understand why one platform is allowed to handle it via `LayoutTheme` and others are not. (The "<color>-on-<color>" will always be a issue if the color selection isn't dynamic - maybe the `<canvas>` `drawFocusIfNeeded()` API ought to have an optional color parameter...)
Some opinions has been bestowed though...
if (value_id == CSSValueID::kWebkitFocusRingColor) {
// Keep the keyword so PaintFocusRing() can distinguish
// -webkit-focus-ring-color from explicit author colors that happen to
// resolve to the same numeric value.
return StyleColor(value_id);
}I think it would be better to still resolve the color as well here, to not change the computed value. Not ecstatic about increasing the level of magic ("sometimes resolve later") in play here though. I guess that technically this is a vendor extension though, so we can do what we want (but there may be issues in content).
<div id="webkit"`focus_ring_keyword` or something? This is not a very descriptive name.
// Even if an explicit author color equals the dark default focus-ring color,
// it should stay explicit and not be treated as -webkit-focus-ring-color.
const auto& explicit_match_default_style =
GetLayoutObjectByElementId("explicit_match_default")->StyleRef();
EXPECT_TRUE(explicit_match_default_style.DarkColorScheme());
Color explicit_match_default_color =
explicit_match_default_style.VisitedDependentColor(
GetCSSPropertyOutlineColor());
EXPECT_EQ(Color(0x10, 0x10, 0x10), explicit_match_default_color);This doesn't seem to test this though...? (The "...not be treated as -webkit-focus-ring-color" part.)
TEST_F(OutlinePainterTest, FocusRingDarkModeColorFlagCanDisableFix) {I don't see this disables anything? Nothing in this test seems to depend on the flag?
RuntimeEnabledFeaturesTestHelpers::"Don't use this class directly. Use Scoped*ForTest instead."
-> Drop this qualification
<head>`<head>` and `<body>` can be emove.
var ctx = document.getElementById("canvas").getContext("2d");`const`
var imageData = ctx.getImageData(48, 70, 1, 1);`const`
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Fredrik Söderquist@f...@opera.com could you maybe help unblock this? this was landed, than reverted, and now should be all-in-one, fix, flag, + a fix that came up after landing the first.
I don't feel that I have enough background on this to review it properly - there seems to have been some back-and-forth here. For example I don't understand why one platform is allowed to handle it via `LayoutTheme` and others are not. (The "<color>-on-<color>" will always be a issue if the color selection isn't dynamic - maybe the `<canvas>` `drawFocusIfNeeded()` API ought to have an optional color parameter...)
Some opinions has been bestowed though...
short version of the back-and-forth: first landing put the white override into LayoutTheme::FocusRingColor(), which broke canvas drawFocusIfNeeded (single-color ring drawn straight from FocusRingColor -> white on white), hence the revert.
reland keeps FocusRingColor() alone and does it in PaintFocusRing(), keyed on the outline color actually being the -webkit-focus-ring-color keyword.
on the platform split: mac's FocusRingColor() is scheme-aware (system accent, crrev.com/c/2644337).
the base one ignores color_scheme completely and just returns the renderer-pref #101010, so non-mac got the paint-time white-inner-ring hack instead (crbug.com/40135511). so not really "mac is allowed", more "only mac has a scheme-aware color source". making non-mac scheme-aware too is the follow-up in crbug.com/489304736.
moved test to external-wpt
if (value_id == CSSValueID::kWebkitFocusRingColor) {
// Keep the keyword so PaintFocusRing() can distinguish
// -webkit-focus-ring-color from explicit author colors that happen to
// resolve to the same numeric value.
return StyleColor(value_id);
}I think it would be better to still resolve the color as well here, to not change the computed value. Not ecstatic about increasing the level of magic ("sometimes resolve later") in play here though. I guess that technically this is a vendor extension though, so we can do what we want (but there may be issues in content).
Done. Also relaxed the DCHECK in StyleColor::GetColor() accordingly, since -webkit-focus-ring-color is now a keyword with a stored color.
`focus_ring_keyword` or something? This is not a very descriptive name.
Done
// Even if an explicit author color equals the dark default focus-ring color,
// it should stay explicit and not be treated as -webkit-focus-ring-color.
const auto& explicit_match_default_style =
GetLayoutObjectByElementId("explicit_match_default")->StyleRef();
EXPECT_TRUE(explicit_match_default_style.DarkColorScheme());
Color explicit_match_default_color =
explicit_match_default_style.VisitedDependentColor(
GetCSSPropertyOutlineColor());
EXPECT_EQ(Color(0x10, 0x10, 0x10), explicit_match_default_color);This doesn't seem to test this though...? (The "...not be treated as -webkit-focus-ring-color" part.)
gosh, thanks, added expect's
TEST_F(OutlinePainterTest, FocusRingDarkModeColorFlagCanDisableFix) {I don't see this disables anything? Nothing in this test seems to depend on the flag?
Done, thx.
"Don't use this class directly. Use Scoped*ForTest instead."
-> Drop this qualification
Done
`<head>` and `<body>` can be emove.
Done
var ctx = document.getElementById("canvas").getContext("2d");Helmut Januschka`const`
Done
var imageData = ctx.getImageData(48, 70, 1, 1);Helmut Januschka`const`
Done
var data = imageData.data;Helmut JanuschkaDitto
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Fredrik Söderquist@f...@opera.com could you maybe help unblock this? this was landed, than reverted, and now should be all-in-one, fix, flag, + a fix that came up after landing the first.
Helmut JanuschkaI don't feel that I have enough background on this to review it properly - there seems to have been some back-and-forth here. For example I don't understand why one platform is allowed to handle it via `LayoutTheme` and others are not. (The "<color>-on-<color>" will always be a issue if the color selection isn't dynamic - maybe the `<canvas>` `drawFocusIfNeeded()` API ought to have an optional color parameter...)
Some opinions has been bestowed though...
short version of the back-and-forth: first landing put the white override into LayoutTheme::FocusRingColor(), which broke canvas drawFocusIfNeeded (single-color ring drawn straight from FocusRingColor -> white on white), hence the revert.
reland keeps FocusRingColor() alone and does it in PaintFocusRing(), keyed on the outline color actually being the -webkit-focus-ring-color keyword.
on the platform split: mac's FocusRingColor() is scheme-aware (system accent, crrev.com/c/2644337).
the base one ignores color_scheme completely and just returns the renderer-pref #101010, so non-mac got the paint-time white-inner-ring hack instead (crbug.com/40135511). so not really "mac is allowed", more "only mac has a scheme-aware color source". making non-mac scheme-aware too is the follow-up in crbug.com/489304736.
moved test to external-wpt
None of the above is news to me. IMO a page that has a `dark` `color-scheme` but draws a "white" background (and a focus ring) on a canvas is not a UA issue. Using a specific color _always_ has the potential to backfire - "white" may only be more common in this context (not sure about that actually, transparent may be more common). Switching to "any other color" has the same problem - only potentially with lower probability. For "normal" (read: `light`) `color-scheme`, the focus ring color is "off-black" (#101010), so why wouldn't an "off-white" (#eee or so to be similar to the opposite scheme) be suitable for the `dark` case?
+jarhar since he's been involved in the discussion in at least one of the bugs.
"The focus ring must visibly appear on the white canvas");
}, 'drawFocusIfNeeded draws a visible focus ring in a dark color-scheme.');The spec quoted above does not say anything about this.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
return Color(0xEE, 0xEE, 0xEE);how did you choose this color? can you add a comment explaining it?
name: "FocusRingRespectExplicitOutlineColorInDarkMode",want to add a comment saying what this does and link to a bug and say what milestone its enabled in?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Fredrik Söderquist@f...@opera.com could you maybe help unblock this? this was landed, than reverted, and now should be all-in-one, fix, flag, + a fix that came up after landing the first.
Helmut JanuschkaI don't feel that I have enough background on this to review it properly - there seems to have been some back-and-forth here. For example I don't understand why one platform is allowed to handle it via `LayoutTheme` and others are not. (The "<color>-on-<color>" will always be a issue if the color selection isn't dynamic - maybe the `<canvas>` `drawFocusIfNeeded()` API ought to have an optional color parameter...)
Some opinions has been bestowed though...
Fredrik Söderquistshort version of the back-and-forth: first landing put the white override into LayoutTheme::FocusRingColor(), which broke canvas drawFocusIfNeeded (single-color ring drawn straight from FocusRingColor -> white on white), hence the revert.
reland keeps FocusRingColor() alone and does it in PaintFocusRing(), keyed on the outline color actually being the -webkit-focus-ring-color keyword.
on the platform split: mac's FocusRingColor() is scheme-aware (system accent, crrev.com/c/2644337).
the base one ignores color_scheme completely and just returns the renderer-pref #101010, so non-mac got the paint-time white-inner-ring hack instead (crbug.com/40135511). so not really "mac is allowed", more "only mac has a scheme-aware color source". making non-mac scheme-aware too is the follow-up in crbug.com/489304736.
moved test to external-wpt
None of the above is news to me. IMO a page that has a `dark` `color-scheme` but draws a "white" background (and a focus ring) on a canvas is not a UA issue. Using a specific color _always_ has the potential to backfire - "white" may only be more common in this context (not sure about that actually, transparent may be more common). Switching to "any other color" has the same problem - only potentially with lower probability. For "normal" (read: `light`) `color-scheme`, the focus ring color is "off-black" (#101010), so why wouldn't an "off-white" (#eee or so to be similar to the opposite scheme) be suitable for the `dark` case?
i got too anchored on preserving the pure-white inner ring. updated the dark-scheme default to #eee as suggested, including drawFocusIfNeeded(), and rebaselined the assets
how did you choose this color? can you add a comment explaining it?
#eee is the off-white counterpart to the default off-black focus-ring color (#101010). it also avoids the white-on-white drawFocusIfNeeded() regression that caused the revert. and it was mentioned in https://chromium-review.googlesource.com/c/chromium/src/+/7659602/comments/71facd5d_ad826794
name: "FocusRingRespectExplicitOutlineColorInDarkMode",want to add a comment saying what this does and link to a bug and say what milestone its enabled in?
Done
"The focus ring must visibly appear on the white canvas");
}, 'drawFocusIfNeeded draws a visible focus ring in a dark color-scheme.');The spec quoted above does not say anything about this.
moved the test to /fast/, is this something i should try to get into spec?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
I guess the changes in this file (and in `style_color.*`) are not needed anymore? I'm not convinced that we should add this complexity just for tests.
return Color(0xEE, 0xEE, 0xEE);Please use `Color::FromRGB`.
"The focus ring must visibly appear on the white canvas");
}, 'drawFocusIfNeeded draws a visible focus ring in a dark color-scheme.');Helmut JanuschkaThe spec quoted above does not say anything about this.
moved the test to /fast/, is this something i should try to get into spec?
I suspect it may be intentionally left up to the UAs, but you can ask if you want.
I guess the changes in this file (and in `style_color.*`) are not needed anymore? I'm not convinced that we should add this complexity just for tests.
correct, removed the changes in `style_builder_converter.cc` and `style_color.cc`, along with the test-only helper and assertions.
Please use `Color::FromRGB`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Reland "Respect explicit outline-color for focus rings in dark mode"
In dark color-scheme pages, explicit CSS outline-color on focus rings
(for example, outline: red auto) is now respected instead of being
forced to white on non-Mac.
This relands:
- "Respect explicit outline-color for focus rings in dark mode"
(http://crrev.com/c/7633026)
- "Add a kill switch for dark-mode explicit outline-color focus rings"
(http://crrev.com/c/7644568)
Also include the forward-fix from CL http://crrev.com/c/7646168:
- Move the dark-mode white override back into PaintFocusRing() so
FocusRingColor() keeps returning the renderer-pref color for canvas
DrawFocusRing.
- Add a draw-focus-if-needed dark-mode regression test.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |