[clang] [clang][dataflow] Show triangle in `<details>` element. (PR #67431)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 00:42:19 PDT 2023


https://github.com/martinboehme updated https://github.com/llvm/llvm-project/pull/67431

>From fe52a064d08bb9e328eafe70ddd7edf21931408e Mon Sep 17 00:00:00 2001
From: Martin Braenne <mboehme at google.com>
Date: Tue, 26 Sep 2023 14:07:14 +0000
Subject: [PATCH 1/2] [clang][dataflow] Show triangle in `<details>` element.

Also, change the mouse cursor into a pointer instead of a text cursor.

This makes it more discoverable that the element can be opened and closed.
---
 clang/lib/Analysis/FlowSensitive/HTMLLogger.css  | 14 +++++++++++++-
 clang/lib/Analysis/FlowSensitive/HTMLLogger.html |  2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.css b/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
index c8212df1f94b81a..73f639eac6836ec 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
@@ -122,10 +122,22 @@ code.line:has(.bb-select):before {
   font-size: x-small;
   flex-grow: 1;
 }
-.value summary {
+.value > summary {
   background-color: #ace;
   display: flex;
   justify-content: space-between;
+  cursor: pointer;
+}
+.value > summary::before {
+  content: '►';
+  margin-right: 0.5em;
+  font-size: 0.9em;
+}
+.value[open] > summary::before {
+  content: '▼';
+}
+.value > summary > .location {
+  margin-left: auto;
 }
 .value .address {
   font-size: xx-small;
diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.html b/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
index 87695623cb318b2..6d866d57e144866 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.html
@@ -18,7 +18,7 @@
         <template data-if="v.value_id"><span class="address">#{{v.value_id}}</span></template>
       </span>
       <template data-if="v.location">
-        <span>{{v.type}} <span class="address">@{{v.location}}</span></span>
+        <span class="location">{{v.type}} <span class="address">@{{v.location}}</span></span>
       </template>
     </summary>
     <template

>From a46b2cda38ea1c913b146621d12f0023dac8d28b Mon Sep 17 00:00:00 2001
From: Martin Braenne <mboehme at google.com>
Date: Thu, 28 Sep 2023 07:41:19 +0000
Subject: [PATCH 2/2] Change `justify-content` from `space-between` to `start`

---
 clang/lib/Analysis/FlowSensitive/HTMLLogger.css | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.css b/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
index 73f639eac6836ec..d8952531bb79582 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.css
@@ -125,7 +125,7 @@ code.line:has(.bb-select):before {
 .value > summary {
   background-color: #ace;
   display: flex;
-  justify-content: space-between;
+  justify-content: start;
   cursor: pointer;
 }
 .value > summary::before {



More information about the cfe-commits mailing list