tvl-depot/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch
Luke Granger-Brown a5c7e03dbd fix(gerrit): fix hovercards under Firefox
Firefox doesn't implement the IE6 fromElement/toElement, and it's
not in the MouseEvent spec (at the moment).

Replace with the worse-named but better-specified target and
relatedTarget attributes instead.

Upstream change: https://gerrit-review.googlesource.com/q/I9eeb26c032a38de9d7185749373c7982c796acb2

Change-Id: I9f9a1eb9342bc80b91b5b364a04cc5fa9a7ccaeb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1442
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-26 11:29:28 +00:00

44 lines
1.4 KiB
Diff

From a8dad8e63a1be32f473e96c6c7530a70d368369f Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 2 Jul 2020 23:02:43 +0100
Subject: [PATCH 3/7] Syntax highlight rules.pl
---
.../elements/diff/gr-syntax-layer/gr-syntax-layer.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
index 480d2946c3..b2020c24bd 100644
--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
@@ -103,6 +103,10 @@ const LANGUAGE_MAP = {
};
const ASYNC_DELAY = 10;
+const FILENAME_OVERRIDES = {
+ 'rules.pl': 'prolog',
+};
+
const CLASS_SAFELIST = {
'gr-diff gr-syntax gr-syntax-attr': true,
'gr-diff gr-syntax gr-syntax-attribute': true,
@@ -234,10 +238,16 @@ class GrSyntaxLayer extends GestureEventListeners(
}
}
+ _basename(filename) {
+ const pieces = filename.split(/\//);
+ return pieces[pieces.length-1];
+ }
+
_getLanguage(diffFileMetaInfo) {
// The Gerrit API provides only content-type, but for other users of
// gr-diff it may be more convenient to specify the language directly.
return diffFileMetaInfo.language ||
+ FILENAME_OVERRIDES[this._basename(diffFileMetaInfo.name)] ||
LANGUAGE_MAP[diffFileMetaInfo.content_type];
}
--
2.27.0