Fix force-dark-mode not working on first time page loading.
For few url schemes, the light color scheme is forced as they don't have dark mode theme yet. This was done by calling UpdatePreferredColorSchemesBasedOnURLIfNeeded(). This function gets called from OverrideWebkitPrefs() and OverrideWebPreferencesAfterNavigation(). The prior function sets the prefs preferred color scheme based on IsNightModeEnabled() for Android or native theme scheme for other platforms, but the later function does not set it. This patch now sets preferred color scheme for all platforms at one place in UpdatePreferredColorScheme(). As --force-dark-mode switch works only for preferred color scheme, until dark scheme is detected in page, default background is white which causes flicker once dark content is rendered. However this is a separate issue. Bug: 1137213 Change-Id: I5567149a5644a6d3d30ceabd65fb1f25e1971ad4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494296Reviewed-by:Rune Lillesveen <futhark@chromium.org> Reviewed-by:
Avi Drissman <avi@chromium.org> Commit-Queue: Prashant Nevase <prashant.n@samsung.com> Cr-Commit-Position: refs/heads/master@{#822741}
Showing
Please register or sign in to comment