mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1198073 - Introduce a pref to set the max length of attributes or not truncat them; r=pbro
This commit is contained in:
parent
0096020c46
commit
2bf177ccb0
@ -10,7 +10,6 @@ const {Cc, Cu, Ci} = require("chrome");
|
||||
// Page size for pageup/pagedown
|
||||
const PAGE_SIZE = 10;
|
||||
const DEFAULT_MAX_CHILDREN = 100;
|
||||
const COLLAPSE_ATTRIBUTE_LENGTH = 120;
|
||||
const COLLAPSE_DATA_URL_REGEX = /^data.+base64/;
|
||||
const COLLAPSE_DATA_URL_LENGTH = 60;
|
||||
const NEW_SELECTION_HIGHLIGHTER_TIMER = 1000;
|
||||
@ -80,6 +79,9 @@ function MarkupView(aInspector, aFrame, aControllerWindow) {
|
||||
this.maxChildren = DEFAULT_MAX_CHILDREN;
|
||||
}
|
||||
|
||||
this.collapseAttributeLength =
|
||||
Services.prefs.getIntPref("devtools.markup.collapseAttributeLength");
|
||||
|
||||
// Creating the popup to be used to show CSS suggestions.
|
||||
let options = {
|
||||
autoSelect: true,
|
||||
@ -2806,7 +2808,9 @@ ElementEditor.prototype = {
|
||||
if (value && value.match(COLLAPSE_DATA_URL_REGEX)) {
|
||||
return truncateString(value, COLLAPSE_DATA_URL_LENGTH);
|
||||
}
|
||||
return truncateString(value, COLLAPSE_ATTRIBUTE_LENGTH);
|
||||
return this.markup.collapseAttributeLength < 0
|
||||
? value :
|
||||
truncateString(value, this.markup.collapseAttributeLength);
|
||||
};
|
||||
|
||||
val.innerHTML = "";
|
||||
|
@ -72,9 +72,31 @@ var TEST_DATA = [{
|
||||
let visibleAttrText = editor.attrElements.get("src").querySelector(".attr-value").textContent;
|
||||
is (visibleAttrText, DATA_URL_ATTRIBUTE_COLLAPSED);
|
||||
}
|
||||
}, {
|
||||
desc: "Try to add long attribute with collapseAttributeLength == -1" +
|
||||
"to make sure it isn't collapsed in attribute editor.",
|
||||
text: 'data-long="' + LONG_ATTRIBUTE + '"',
|
||||
expectedAttributes: {
|
||||
"data-long": LONG_ATTRIBUTE
|
||||
},
|
||||
setUp: function(inspector) {
|
||||
inspector.markup.collapseAttributeLength = -1;
|
||||
},
|
||||
validate: (element, container, inspector) => {
|
||||
let editor = container.editor;
|
||||
let visibleAttrText = editor.attrElements
|
||||
.get("data-long")
|
||||
.querySelector(".attr-value")
|
||||
.textContent;
|
||||
is(visibleAttrText, LONG_ATTRIBUTE);
|
||||
},
|
||||
tearDown: function(inspector) {
|
||||
inspector.markup.collapseAttributeLength = 120;
|
||||
}
|
||||
}];
|
||||
|
||||
add_task(function*() {
|
||||
let {inspector} = yield addTab(TEST_URL).then(openInspector);
|
||||
yield runAddAttributesTests(TEST_DATA, "div", inspector)
|
||||
});
|
||||
|
||||
|
@ -50,6 +50,9 @@ function runAddAttributesTests(tests, nodeOrSelector, inspector) {
|
||||
* opened
|
||||
*/
|
||||
function* runAddAttributesTest(test, selector, inspector) {
|
||||
if (test.setUp) {
|
||||
test.setUp(inspector);
|
||||
}
|
||||
let element = getNode(selector);
|
||||
|
||||
info("Starting add-attribute test: " + test.desc);
|
||||
@ -68,6 +71,9 @@ function* runAddAttributesTest(test, selector, inspector) {
|
||||
|
||||
info("Assert that the attribute(s) has/have been removed correctly");
|
||||
yield assertAttributes(selector, {});
|
||||
if (test.tearDown) {
|
||||
test.tearDown(inspector);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,6 +66,10 @@ pref("devtools.inspector.showAllAnonymousContent", false);
|
||||
// Enable the MDN docs tooltip
|
||||
pref("devtools.inspector.mdnDocsTooltip.enabled", true);
|
||||
|
||||
// Collapse attributes that are too long.
|
||||
// Use -1 to not collapse attributes at all.
|
||||
pref("devtools.markup.collapseAttributeLength", 120);
|
||||
|
||||
// DevTools default color unit
|
||||
pref("devtools.defaultColorUnit", "authored");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user