From dab0f8bdff3a730e1a42fbbd7c82f5b81264c989 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 15 Oct 2020 11:30:51 +0200 Subject: [PATCH] Move some custom cm CSS to text_editor instead Although `front_end/cm/codemirror.css` contains some DevTools-specific tweaks, we should generally treat it like a rolled-in upstream dependency. This patch moves some of its custom tweaks to `front_end/text_editor/cmdevtools.css` instead. Bug: chromium:1076825 Change-Id: Ie4c0cad9d0917186bde57b2027254998198e69d5 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2474656 Reviewed-by: Tim van der Lippe Commit-Queue: Mathias Bynens --- front_end/cm/README.md | 3 +++ front_end/cm/codemirror.css | 6 ++---- front_end/text_editor/cmdevtools.css | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 front_end/cm/README.md diff --git a/front_end/cm/README.md b/front_end/cm/README.md new file mode 100644 index 0000000000..890defe552 --- /dev/null +++ b/front_end/cm/README.md @@ -0,0 +1,3 @@ +Treat `codemirror.css` like a rolled-in upstream dependency. Instead of changing it directly, consider changing `front_end/text_editor/cmdevtools.css` instead. + +[Issue #1076825](https://bugs.chromium.org/p/chromium/issues/detail?id=1076825) tracks the effort to use the upstream file more directly. diff --git a/front_end/cm/codemirror.css b/front_end/cm/codemirror.css index c95ec0a422..1dcac08195 100644 --- a/front_end/cm/codemirror.css +++ b/front_end/cm/codemirror.css @@ -191,8 +191,6 @@ div.CodeMirror-dragcursors { .cm-tab-wrap-hack:after { content: ''; } /* Help users use markselection to safely style text background */ -span.CodeMirror-selectedtext { background: none; } - -.-theme-with-dark-background span.CodeMirror-selectedtext { - background: #000; +span.CodeMirror-selectedtext { + background: none; } diff --git a/front_end/text_editor/cmdevtools.css b/front_end/text_editor/cmdevtools.css index b01e194a1d..50ee2bc912 100644 --- a/front_end/text_editor/cmdevtools.css +++ b/front_end/text_editor/cmdevtools.css @@ -628,6 +628,11 @@ div.CodeMirror:focus-within span.CodeMirror-nonmatchingbracket { background-color: #454545; } +.-theme-with-dark-background span.CodeMirror-selectedtext, +:host-context(.-theme-with-dark-background) span.CodeMirror-selectedtext { + background: #000; +} + .CodeMirror .auto-complete-text { color: rgb(128 128 128); }