Commit 3fec4be4 authored by Alison Maher's avatar Alison Maher Committed by Commit Bot

SVG default forced colors

This change adds the default color and fill forced colors for SVG
elements (WindowText). Before this change, SVG fill and color
would default to black in forced colors mode, making certain elements
un-readable.

Bug: 970285
Change-Id: I68ecb4769a502fbb1c4ceb27ba0b3d21205aeb45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026147Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Alison Maher <almaher@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#736418}
parent a3a5e474
...@@ -96,11 +96,12 @@ foreignObject { ...@@ -96,11 +96,12 @@ foreignObject {
*/ */
@media forced-colors { @media forced-colors {
svg { svg {
color: WindowText;
fill: WindowText;
forced-color-adjust: none; forced-color-adjust: none;
} }
text, foreignObject { text, foreignObject {
fill: WindowText;
forced-color-adjust: auto; forced-color-adjust: auto;
} }
} }
<!DOCTYPE html>
<meta charset="utf-8">
<title>Forced colors mode - svg defaults reference.
Tests that the default colors for svg elements are correct in high contrast.
</title>
<style>
svg, text, path {
forced-color-adjust: none;
}
</style>
<body>
<svg height="600" width="600">
<text x="0" y="15" fill="WindowText">
This text and the triangle below should have a WindowText fill in forced colors mode.
</text>
<path fill="WindowText" d="M150 0 L75 200 L225 200 Z" />
</svg>
</body>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Forced colors mode - svg defaults.
Tests that the default colors for svg elements are correct in high contrast.
</title>
<link rel="help" href="https://www.w3.org/TR/css-color-adjust-1/#forced-colors-properties">
<link rel=match href="forced-colors-mode-26-ref.html">
<body>
<svg height="600" width="600">
<text x="0" y="15" fill="currentcolor">
This text and the triangle below should have a WindowText fill in forced colors mode.
</text>
<path d="M150 0 L75 200 L225 200 Z" />
</svg>
</body>
<?xml version="1.0" encoding="UTF-8"?>
<svg width="600" height="600" xmlns="http://www.w3.org/2000/svg">
<foreignObject x="20" y="100" width="160" height="160">
<div xmlns="http://www.w3.org/1999/xhtml" style="forced-color-adjust: none; color: WindowText;">
This text should be WindowText color in forced colors mode.
</div>
</foreignObject>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg width="600" height="600" xmlns="http://www.w3.org/2000/svg">
<foreignObject x="20" y="100" width="160" height="160">
<div xmlns="http://www.w3.org/1999/xhtml">
This text should be WindowText color in forced colors mode.
</div>
</foreignObject>
</svg>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment