Skip to content
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

StmtViz: Search for tooltip only in the child node #7754

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/StmtToViz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,14 +1260,14 @@ class HTMLCodePrinter : public IRVisitor {
}

stream << "<div id='" << id << "' class='cost-btn CostColor" << line_costc << "'"
<< " aria-describedby='tooltip-" << id << "'"
<< " line-cost='" << line_cost << "' block-cost='" << block_cost << "'"
<< " line-cost-color='" << line_costc << "' block-cost-color='" << block_costc << "'>"
<< "</div>";
<< " line-cost-color='" << line_costc << "' block-cost-color='" << block_costc << "'>";

stream << "<span id='tooltip-" << id << "' class='tooltip cond-tooltop' role='tooltip-" << id << "'>"
<< prefix << line_cost
<< "</span>";

stream << "</div>";
}

/* Misc utility methods */
Expand Down Expand Up @@ -2367,14 +2367,14 @@ class HTMLVisualizationPrinter : public IRVisitor {
}

stream << "<div id='" << id << "' class='cost-btn CostColor" << line_costc << "'"
<< " aria-describedby='tooltip-" << id << "'"
<< " line-cost='" << line_cost << "' block-cost='" << block_cost << "'"
<< " line-cost-color='" << line_costc << "' block-cost-color='" << block_costc << "'>"
<< "</div>";
<< " line-cost-color='" << line_costc << "' block-cost-color='" << block_costc << "'>";

stream << "<span id='tooltip-" << id << "' class='tooltip cond-tooltop' role='tooltip-" << id << "'>"
<< prefix << line_cost
<< "</span>";

stream << "</div>";
}

// Prints the box .box-header within div.box
Expand Down Expand Up @@ -2439,15 +2439,16 @@ class HTMLVisualizationPrinter : public IRVisitor {
std::ostringstream ss;

// Show condition expression button
ss << "<button title='Click to see path condition' id='cond-" << id << "' aria-describedby='cond-tooltip-" << id << "' class='trunc-cond' role='button'>"
<< "..."
<< "</button>";
ss << "<button title='Click to see path condition' id='cond-" << id << "' class='trunc-cond' role='button'>"
<< "...";

// Tooltip that shows condition expression
ss << "<span id='cond-tooltip-" << id << "' class='tooltip cond-tooltop' role='cond-tooltip-" << id << "'>"
<< cond
<< "</span>";

ss << "</button>";

return ss.str();
}

Expand Down
4 changes: 1 addition & 3 deletions src/irvisualizer/StmtToViz_javascript.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,9 @@
}

function init_tooltips(btns, prefix) {
var re = /(?:\-([^-]+))?$/;
for (var i = 0; i < btns.size(); i++) {
const button = btns[i];
//const tooltip = $(prefix + re.exec(button.id)[1])[0];
const tooltip = document.getElementById(prefix + re.exec(button.id)[1]);
const tooltip = button.firstElementChild;
button.is_clicked = false;
button.addEventListener('mouseenter', () => {
if (!button.is_clicked)
Expand Down