Update focus ring style.

*** SHERIFFS: if this CL triggers a flaky layout test, PLEASE do not
*** revert this CL. Instead, please disable the offending test(s) and
*** add them to the crbug.com/1035582 section of TestExpectations. I
*** will then take care of them as I fix up the remainder of these
*** tests. Feel free to cc me if you create a bug. Thanks.

This CL updates the focus ring to be made of two borders which have a
2:1 ratio. The new width of the focus ring is 3px: 2px nearly black (#101010),
followed by 1px white.

If the element has a border large enough to have an inset outline (width >= 1px)
then we are going to inset the focus ring by 1px as we want it to be partially
drawn over the border to avoid clipping or strange alignment issues caused by
increasing the width to 3px.

For elements that have not been styled and that have an appearance, the border
radius of the focus ring is updated to be the same as the one used for drawing
the element. For all other cases the current behavior is maintained:
border radius = outline width.

Tests are added to validate the new focus ring for multiple scenarios (see
controls-refresh/focus-rect)

Bug: 1026553
Change-Id: Ibe05cf6b7336198bd9513174493f51da5108339a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975072
Commit-Queue: Ionel Popescu <[email protected]>
Reviewed-by: Elly Fong-Jones <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/master@{#730110}
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc
index ed00da9..f7ce4ce 100644
--- a/chrome/browser/renderer_preferences_util.cc
+++ b/chrome/browser/renderer_preferences_util.cc
@@ -21,6 +21,7 @@
 #include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
 #include "third_party/blink/public/public_buildflags.h"
 #include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/ui_base_features.h"
 
 #if defined(TOOLKIT_VIEWS)
 #include "ui/views/controls/textfield/textfield.h"
@@ -178,6 +179,10 @@
     prefs->allow_cross_origin_auth_prompt =
         local_state->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
   }
+
+  if (::features::IsFormControlsRefreshEnabled()) {
+    prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10);
+  }
 }
 
 }  // namespace renderer_preferences_util