WebUI Dark Mode: fix user manager shared styles scope
Dark mode overrides of shared variables weren't working:
:root {...}
:host-context([dark]) {...}
After much headbashing, I figured out Polymer was magically rewriting
the first (:root) rule to:
:host > * {...}
inside custom elements only.
https://github.com/Polymer/polymer/commit/fea64b9b6a75bb39b7644fdfdd56e1224f43bf3d
So I changed :root to :host > *, which broke the copious amounts of
styled light DOM the user manager uses (it's not in Shadow DOM so :host
doesn't match). So instead, let's avoid :root and just use:
html, :host {...}
html[dark], :host-context([dark]) {...}
R=hcarmona@chromium.org
BUG=928674
Change-Id: I262572215e7f481b44d9a4af20645b06a2480041
Reviewed-on: https://chromium-review.googlesource.com/c/1455274
Auto-Submit: Dan Beam <dbeam@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Reviewed-by: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629421}
diff --git a/chrome/browser/resources/md_user_manager/shared_styles.html b/chrome/browser/resources/md_user_manager/shared_styles.html
index 48aa3ac..6822e6b 100644
--- a/chrome/browser/resources/md_user_manager/shared_styles.html
+++ b/chrome/browser/resources/md_user_manager/shared_styles.html
@@ -5,14 +5,16 @@
<dom-module id="shared-styles">
<template>
<style include="paper-button-style">
- :host > * {
+ html,
+ :host {
--error-color: var(--google-red-700);
--page-width: 624px;
--title-icon-color: var(--paper-grey-500);
--user-manager-separator-line: 1px solid rgba(0, 0, 0, .12);
}
- :host-context([dark]) > * {
+ html[dark],
+ :host-context([dark]) {
--error-color: var(--google-red-refresh-300);
--user-manager-separator-line: var(--cr-separator-line);
}