Commit 8eade9d1 authored by Alison Maher's avatar Alison Maher Committed by Commit Bot

Pass the PreferredColorScheme to SVGImage

As a result of  http://crrev.com/c/2079192, the PreferredColorScheme
is stored and accessed through WebSettings instead of WebThemeEngine.
With this change, SVGImage no longer can retrieve the correct
PreferredColorScheme needed to respond to the prefers-color-scheme
media query as it had before.

To fix this, pass the PreferredColorScheme from Settings to
SVGImage via SVGImage::DataChange().

Bug: 1090464,1090660
Change-Id: I0aacd08930fad21f55c9dfa8dd1b8f747912237d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2230909
Commit-Queue: Alison Maher <almaher@microsoft.com>
Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776160}
parent 8b0b2525
...@@ -853,6 +853,11 @@ Image::SizeAvailability SVGImage::DataChanged(bool all_data_received) { ...@@ -853,6 +853,11 @@ Image::SizeAvailability SVGImage::DataChanged(bool all_data_received) {
default_settings.GetDefaultFontSize()); default_settings.GetDefaultFontSize());
page->GetSettings().SetDefaultFixedFontSize( page->GetSettings().SetDefaultFixedFontSize(
default_settings.GetDefaultFixedFontSize()); default_settings.GetDefaultFixedFontSize());
// Also copy the preferred-color-scheme to ensure a responsiveness to
// dark/light color schemes.
page->GetSettings().SetPreferredColorScheme(
default_settings.GetPreferredColorScheme());
} }
} }
......
...@@ -5975,6 +5975,11 @@ crbug.com/970285 external/wpt/forced-colors-mode/* [ Failure ] ...@@ -5975,6 +5975,11 @@ crbug.com/970285 external/wpt/forced-colors-mode/* [ Failure ]
crbug.com/970285 [ Mac ] virtual/forced-high-contrast-cascade/* [ Failure ] crbug.com/970285 [ Mac ] virtual/forced-high-contrast-cascade/* [ Failure ]
crbug.com/970285 [ Mac ] virtual/forced-high-contrast-colors/* [ Failure ] crbug.com/970285 [ Mac ] virtual/forced-high-contrast-colors/* [ Failure ]
# Expected failures for dark mode tests when the corresponding flags
# are not enabled.
crbug.com/1090660 external/wpt/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html [ Skip ]
crbug.com/1090660 virtual/dark-color-scheme/external/wpt/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html [ Pass ]
# Sheriff 2019-08-14 # Sheriff 2019-08-14
crbug.com/993671 [ Win ] http/tests/media/video-frame-size-change.html [ Pass Failure ] crbug.com/993671 [ Win ] http/tests/media/video-frame-size-change.html [ Pass Failure ]
......
<svg xmlns="http://www.w3.org/2000/svg" width='100px' height='100px'>
<style>
@media (prefers-color-scheme: dark) {
rect {
fill: green;
}
}
</style>
<rect fill='blue' width='100px' height='100px' />
</svg>
<!doctype html>
<head>
<title>prefers-color-scheme inside an SVG image</title>
<link rel="help" href="https://www.w3.org/TR/mediaqueries-5/#descdef-media-prefers-color-scheme">
<link rel="match" href="../../../css-layout-api/green-square-ref.html">
</head>
<img src='support/prefers-color-scheme.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