Skip to content

[clang][dataflow] Show triangle in <details> element. #67431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 28, 2023

Conversation

martinboehme
Copy link
Contributor

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.

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.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html clang:analysis labels Sep 26, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2023

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-analysis

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/67431.diff

2 Files Affected:

  • (modified) clang/lib/Analysis/FlowSensitive/HTMLLogger.css (+13-1)
  • (modified) clang/lib/Analysis/FlowSensitive/HTMLLogger.html (+1-1)
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

.value > summary::before {
content: '►';
margin-right: 0.5em;
font-size: 0.9em;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the triangle seemed a bit too big.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no accounting for taste I suppose :-)

@@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if space-between stays, don't you get a big chunk of space between the arrow and the identity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, true! Changed to start, which appears to solve this:

image

.value > summary::before {
content: '►';
margin-right: 0.5em;
font-size: 0.9em;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no accounting for taste I suppose :-)

.value[open] > summary::before {
content: '▼';
}
.value > summary > .location {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the second > here is a little confusing to me, it doesn't seem to solve a problem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it doesn't solve a problem ("space" would work just as well), but as the .location is always a direct child of the <summary>, it seemed more specific to do it this way.

Is "descendant", rather than "child", considered to be the default in CSS? The former is syntactically shorter, but "child" is arguably the simpler concept. Or is "child" problematic because it makes the CSS more brittle (i.e. less resilient in the fact of changes to the HTML)?

@martinboehme martinboehme merged commit fb933fc into llvm:main Sep 28, 2023
martinboehme added a commit that referenced this pull request Sep 28, 2023
…)"

This reverts commit fb933fc.

The commit broke buildbots due to non-ASCII characters in
HTMLLogger.css.
martinboehme added a commit to martinboehme/llvm-project that referenced this pull request Sep 28, 2023
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.
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
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.
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
…#67431)"

This reverts commit fb933fc.

The commit broke buildbots due to non-ASCII characters in
HTMLLogger.css.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:analysis clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants