mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1486870 - Adapt SmartTrace component to the modified Frames component; r=bgrins.
The Frames component changed significantly on Github, which means we need to do some adjustments in the SmartTrace component (pass the `selectable` prop, change CSS rules, …). For now, we also hide the Framework icons as we need to find a way to properly share the underlying CSS from the debugger (See https://github.com/devtools-html/debugger.html/issues/7782). Differential Revision: https://phabricator.services.mozilla.com/D17376 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e53bfe1ec6
commit
f23bb47fc8
@ -7,12 +7,20 @@
|
||||
* Styles for React component at `devtools/client/shared/components/SmartTrace.js`
|
||||
*/
|
||||
|
||||
.frames ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.frames-group .frame{
|
||||
display: block;
|
||||
padding-inline-start: 16px;
|
||||
}
|
||||
|
||||
.img.annotation-logo{
|
||||
background-color: var(--theme-body-color);
|
||||
}
|
||||
|
||||
|
||||
.frames [role="list"]{
|
||||
display: inline-grid;
|
||||
grid-template-columns: auto auto 1fr;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-column-gap: 8px;
|
||||
}
|
||||
|
||||
@ -36,56 +44,57 @@
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
direction: rtl;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.frames .location .line {
|
||||
color: var(--frame-link-line-color);
|
||||
}
|
||||
|
||||
.frames ul .frame:hover .location {
|
||||
.frames .frames-list .frame:hover .location {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/******* Group styles *******/
|
||||
.frames .frames-group,
|
||||
.frames .frames-group .group {
|
||||
display: contents;
|
||||
.frames-group {
|
||||
grid-column:1 / -1;
|
||||
}
|
||||
|
||||
.frames-group .frames-list .frame {
|
||||
.frames .frames-group .group {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.group-description {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: var(--console-output-color);
|
||||
}
|
||||
|
||||
.frames .frames-group .frames-list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.frames .frames-group .frames-list .frame {
|
||||
padding-inline-start: 16px;
|
||||
display: block;
|
||||
grid-column: 1 / -1;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.frames-list {
|
||||
.frames .frames-group .frames-list {
|
||||
grid-column: 1 / -1;
|
||||
margin-block-start: 2px;
|
||||
}
|
||||
|
||||
.frames .frames-list .frame:first-of-type {
|
||||
.frames .frames-group .frames-list .frame:first-of-type {
|
||||
border-top: 1px solid var(--theme-splitter-color);
|
||||
padding-block-start: 4px;
|
||||
}
|
||||
|
||||
.frames .frames-list .frame:last-of-type {
|
||||
.frames .frames-group .frames-list .frame:last-of-type {
|
||||
margin-block-end: 4px;
|
||||
border-bottom: 1px solid var(--theme-splitter-color);
|
||||
}
|
||||
|
||||
.frames ul .frames-group.expanded,
|
||||
.frames ul .frames-group.expanded .location {
|
||||
color: var(--theme-highlight-blue);
|
||||
}
|
||||
|
||||
.frames ul .frames-group.expanded .react path {
|
||||
fill: var(--theme-highlight-blue);
|
||||
}
|
||||
|
||||
.frames ul .frames-group.expanded .badge {
|
||||
color: var(--theme-highlight-blue);
|
||||
}
|
||||
|
||||
.badge {
|
||||
background: var(--theme-toolbar-background-hover);
|
||||
color: var(--theme-body-color);
|
||||
@ -95,15 +104,54 @@
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
cursor: default;
|
||||
margin-inline-start: 4px;
|
||||
}
|
||||
|
||||
.annotation-logo {
|
||||
.frames .frames-group.expanded .group-description,
|
||||
.frames .frames-group.expanded .badge {
|
||||
color: var(--theme-highlight-blue);
|
||||
}
|
||||
|
||||
/** Images **/
|
||||
|
||||
.frames .img.annotation-logo {
|
||||
/* FIXME: In order to display the Framework icons, we need to find a way to share CSS
|
||||
* from the debugger, where the background images are defined.
|
||||
* See https://github.com/devtools-html/debugger.html/issues/7782.
|
||||
*/
|
||||
display: none;
|
||||
/*
|
||||
background-color:var(--theme-body-color);
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
margin-inline-start: 4px;
|
||||
height:12px;
|
||||
vertical-align: middle;
|
||||
margin-inline-end:4px;
|
||||
*/
|
||||
}
|
||||
|
||||
:root.theme-dark .annotation-logo:not(.angular) svg path {
|
||||
fill: var(--theme-highlight-blue);
|
||||
.expanded .img.annotation-logo {
|
||||
background-color: currentColor;
|
||||
}
|
||||
|
||||
.group .img.arrow {
|
||||
mask: url("resource://devtools/client/debugger/new/images/arrow.svg");
|
||||
mask-size: auto;
|
||||
margin-inline-end: 4px;
|
||||
background-color: var(--theme-icon-dimmed-color);
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
mask-size: 100%;
|
||||
display: inline-block;
|
||||
transform: rotate(-90deg);
|
||||
transition: transform 0.18s ease;
|
||||
}
|
||||
|
||||
.group .img.arrow.expanded {
|
||||
transform: rotate(0);
|
||||
}
|
||||
|
||||
/* Frameworks */
|
||||
:root.theme-dark .annotation-logo:not(.angular) {
|
||||
background-color: var(--theme-highlight-blue);
|
||||
}
|
||||
|
@ -221,6 +221,7 @@ class SmartTrace extends Component {
|
||||
disableContextMenu: true,
|
||||
frameworkGroupingOn: true,
|
||||
displayFullUrl: !this.state || !this.state.isSourceMapped,
|
||||
selectable: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -76,21 +76,21 @@ window.onload = function() {
|
||||
`<anonymous> http://myfile.com/mahscripts.js:55`,
|
||||
`rootReducer Redux`,
|
||||
`loadFunc http://myfile.com/loadee.js:10`,
|
||||
`▶︎ internalReact10 React`,
|
||||
`▶︎ React 10`,
|
||||
`onClick http://myfile.com/mahscripts.js:10`,
|
||||
], "React frames are grouped - Redux frame is not");
|
||||
|
||||
info("Expand React group");
|
||||
let onReactGroupExpanded = waitFor(() =>
|
||||
traceEl.querySelector(".frames-group.expanded"));
|
||||
traceEl.querySelector(".group .location").click();
|
||||
traceEl.querySelector(".group").click();
|
||||
await onReactGroupExpanded;
|
||||
|
||||
isDeeply(getStacktraceText(traceEl), [
|
||||
`<anonymous> http://myfile.com/mahscripts.js:55`,
|
||||
`rootReducer Redux`,
|
||||
`loadFunc http://myfile.com/loadee.js:10`,
|
||||
`▼ internalReact10 React`,
|
||||
`▼ React 10`,
|
||||
`| internalReact10`,
|
||||
`| internalReact9`,
|
||||
`| internalReact8`,
|
||||
@ -107,34 +107,33 @@ window.onload = function() {
|
||||
info("Collapse React group");
|
||||
onReactGroupExpanded = waitFor(() =>
|
||||
!traceEl.querySelector(".frames-group.expanded"));
|
||||
traceEl.querySelector(".group .location").click();
|
||||
traceEl.querySelector(".group").click();
|
||||
await onReactGroupExpanded;
|
||||
|
||||
isDeeply(getStacktraceText(traceEl), [
|
||||
`<anonymous> http://myfile.com/mahscripts.js:55`,
|
||||
`rootReducer Redux`,
|
||||
`loadFunc http://myfile.com/loadee.js:10`,
|
||||
`▶︎ internalReact10 React`,
|
||||
`▶︎ React 10`,
|
||||
`onClick http://myfile.com/mahscripts.js:10`,
|
||||
], "React frames can be collapsed");
|
||||
});
|
||||
|
||||
function getStacktraceText(traceElement) {
|
||||
return Array.from(traceElement.querySelectorAll(".frame, .frames-group"))
|
||||
.map(el => {
|
||||
const title = el.querySelector(".title");
|
||||
const location = el.querySelector(".location");
|
||||
|
||||
return Array.from(traceElement.querySelectorAll(".frame, .frames-group")).map(el => {
|
||||
// If it's a group, we want to append an arrow representing the group state
|
||||
if (el.classList.contains("frames-group")) {
|
||||
const arrow = el.classList.contains("expanded") ? "▼" : "▶︎";
|
||||
return `${arrow} ${title.textContent} ${location.textContent}`;
|
||||
const content = el.querySelector(".group").textContent.trim();
|
||||
return `${arrow} ${content}`;
|
||||
}
|
||||
|
||||
const title = el.querySelector(".title");
|
||||
if (el.closest(".frames-group")) {
|
||||
return `| ${title.textContent}`;
|
||||
}
|
||||
|
||||
const location = el.querySelector(".location");
|
||||
return `${title.textContent} ${location.textContent}`;
|
||||
});
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ window.onload = function() {
|
||||
|
||||
const groups = Array.from(traceEl.querySelectorAll(".group"));
|
||||
is(groups.length, 1, "SmartTrace has a group");
|
||||
is(groups[0].textContent, "last2React", "A collapsed React group is displayed");
|
||||
is(groups[0].textContent.trim(), "React 2", "A collapsed React group is displayed");
|
||||
|
||||
is(onReadyCount, 1, "onReady was only called once");
|
||||
});
|
||||
|
@ -1019,3 +1019,11 @@ body {
|
||||
.sidebar-contents .object-inspector {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
/** Utils **/
|
||||
.clipboard-only {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user