Commit 244ff236 authored by Harley Li's avatar Harley Li Committed by Commit Bot

[DevTools] Handle long string in service worker list's script name and clients

If the name string of the service worker script or a service worker
client is too long, this patch restricts its width and denote the
overflow with ellipsis. Users can still get the string by hovering
above it, and the string is still clickable.

Bug: 847801
Change-Id: I9d3a07c410af6bb98ae42046894ea3d7223afcbc
Reviewed-on: https://chromium-review.googlesource.com/c/1312973
Commit-Queue: Haihong Li (Harley) <hhli@chromium.org>
Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604760}
parent 9d00b88f
...@@ -534,12 +534,14 @@ Resources.ServiceWorkersView.Section = class { ...@@ -534,12 +534,14 @@ Resources.ServiceWorkersView.Section = class {
*/ */
_updateClientInfo(element, targetInfo) { _updateClientInfo(element, targetInfo) {
if (targetInfo.type !== 'page' && targetInfo.type === 'iframe') { if (targetInfo.type !== 'page' && targetInfo.type === 'iframe') {
element.createTextChild(Common.UIString('Worker: %s', targetInfo.url)); const clientString = element.createChild('span', 'service-worker-client-string');
clientString.createTextChild(ls`Worker: ` + targetInfo.url);
return; return;
} }
element.removeChildren(); element.removeChildren();
element.createTextChild(targetInfo.url); const clientString = element.createChild('span', 'service-worker-client-string');
const focusLabel = element.createChild('label', 'link'); clientString.createTextChild(targetInfo.url);
const focusLabel = element.createChild('label', 'link service-worker-client-focus-link');
focusLabel.createTextChild('focus'); focusLabel.createTextChild('focus');
focusLabel.addEventListener('click', this._activateTarget.bind(this, targetInfo.targetId), true); focusLabel.addEventListener('click', this._activateTarget.bind(this, targetInfo.targetId), true);
} }
......
...@@ -107,6 +107,22 @@ ...@@ -107,6 +107,22 @@
min-width: 80px; min-width: 80px;
} }
.report-field-value-filename,
.service-worker-client-string {
max-width: 400px;
overflow: hidden;
text-overflow: ellipsis;
}
.service-worker-client {
display: flex;
}
.service-worker-client-focus-link {
flex: none;
margin-right: 5px;
}
.service-worker-notification-editor.source-code { .service-worker-notification-editor.source-code {
/** Simulate CodeMirror that is shown above */ /** Simulate CodeMirror that is shown above */
padding: 4px; padding: 4px;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment