Commit 5147740c authored by luoe's avatar luoe Committed by Commit bot

DevTools: move repeatCountElement from contentElement into wrapperElement

Currently, a ConsoleViewMessage's element() returns a wrapper whose only
children are nesting level marker div's and a contentElement() with the actual
message. This CL extracts the repeatCountElement, shown for repeated messages,
out of the contentElement(). By doing so, we isolate the actual message content.

BUG=

Review-Url: https://codereview.chromium.org/2349973005
Cr-Commit-Position: refs/heads/master@{#419914}
parent a6027ccd
......@@ -100,7 +100,7 @@ InspectorTest.dumpConsoleMessagesIntoArray = function(printOriginatingCommand, d
for (var i = 0; i < viewMessages.length; ++i) {
var uiMessage = viewMessages[i];
var message = uiMessage.consoleMessage();
var element = uiMessage.contentElement();
var element = uiMessage.element();
if (dumpClassNames) {
var classNames = [];
......@@ -158,7 +158,7 @@ InspectorTest.dumpConsoleTableMessage = function(viewMessage, forceInvalidate, r
{
if (forceInvalidate)
WebInspector.ConsoleView.instance()._viewport.invalidate();
var table = viewMessage.contentElement();
var table = viewMessage.element();
var headers = table.querySelectorAll("th > div:first-child");
if (!headers.length)
return false;
......@@ -198,8 +198,8 @@ InspectorTest.dumpConsoleMessagesWithStyles = function(sortMessages)
var result = [];
var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages;
for (var i = 0; i < messageViews.length; ++i) {
var element = messageViews[i].contentElement();
var messageText = InspectorTest.prepareConsoleMessageText(element)
var element = messageViews[i].element();
var messageText = InspectorTest.prepareConsoleMessageText(element);
InspectorTest.addResult(messageText);
var spans = element.querySelectorAll(".console-message-text > span *");
for (var j = 0; j < spans.length; ++j)
......@@ -211,9 +211,10 @@ InspectorTest.dumpConsoleMessagesWithClasses = function(sortMessages) {
var result = [];
var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages;
for (var i = 0; i < messageViews.length; ++i) {
var element = messageViews[i].contentElement();
var element = messageViews[i].element();
var contentElement = messageViews[i].contentElement();
var messageText = InspectorTest.prepareConsoleMessageText(element);
result.push(messageText + " " + messageViews[i].toMessageElement().getAttribute("class") + " > " + element.getAttribute("class"));
result.push(messageText + " " + element.getAttribute("class") + " > " + contentElement.getAttribute("class"));
}
if (sortMessages)
result.sort();
......@@ -243,14 +244,14 @@ InspectorTest.expandConsoleMessages = function(callback, deepFilter, sectionFilt
// Initiate round-trips to fetch necessary data for further rendering.
for (var i = 0; i < messageViews.length; ++i)
messageViews[i].contentElement();
messageViews[i].element();
InspectorTest.deprecatedRunAfterPendingDispatches(expandTreeElements);
function expandTreeElements()
{
for (var i = 0; i < messageViews.length; ++i) {
var element = messageViews[i].contentElement();
var element = messageViews[i].element();
for (var node = element; node; node = node.traverseNextNode(element)) {
if (node.treeElementForTest)
node.treeElementForTest.expand();
......@@ -284,7 +285,7 @@ InspectorTest.expandGettersInConsoleMessages = function(callback)
var propertiesCount = 0;
InspectorTest.addSniffer(WebInspector.ObjectPropertyTreeElement.prototype, "_updateExpandable", propertyExpandableUpdated);
for (var i = 0; i < messageViews.length; ++i) {
var element = messageViews[i].contentElement();
var element = messageViews[i].element();
for (var node = element; node; node = node.traverseNextNode(element)) {
if (node.classList && node.classList.contains("object-value-calculate-value-button")) {
++propertiesCount;
......@@ -312,7 +313,7 @@ InspectorTest.expandConsoleMessagesErrorParameters = function(callback)
var messageViews = WebInspector.ConsoleView.instance()._visibleViewMessages;
// Initiate round-trips to fetch necessary data for further rendering.
for (var i = 0; i < messageViews.length; ++i)
messageViews[i].contentElement();
messageViews[i].element();
InspectorTest.deprecatedRunAfterPendingDispatches(callback);
}
......
......@@ -641,8 +641,6 @@ InspectorTest.textContentWithLineBreaks = function(node)
} else if (currentNode.nodeName === "STYLE") {
currentNode = currentNode.traverseNextNode(node);
continue;
} else if (currentNode.classList && currentNode.classList.contains("console-message")) {
buffer += "\n\n";
} else if (currentNode.classList && currentNode.classList.contains("object-properties-section")) {
ignoreFirst = true;
}
......
......@@ -5,11 +5,11 @@ CONSOLE MESSAGE: line 9: 123
CONSOLE MESSAGE: line 10: http://www.chromium.org/some?v=114:56:57
Test that console.log() would linkify the links. Bug 231074.
console-log-linkify-links.html:6 http://www.chromium.org/ console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:7 follow http://www.chromium.org/ console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:8 string http://www.chromium.org/ console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:9 123 "http://www.chromium.org/" console-message-text source-code > console-message-url webkit-html-resource-link > object-value-number source-code > source-code > object-value-string source-code > webkit-html-external-link
console-log-linkify-links.html:10 http://www.chromium.org/some?v=114:56:57 console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:6 http://www.chromium.org/ console-message > console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:7 follow http://www.chromium.org/ console-message > console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:8 string http://www.chromium.org/ console-message > console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
console-log-linkify-links.html:9 123 "http://www.chromium.org/" console-message > console-message-text source-code > console-message-url webkit-html-resource-link > object-value-number source-code > source-code > object-value-string source-code > webkit-html-external-link
console-log-linkify-links.html:10 http://www.chromium.org/some?v=114:56:57 console-message > console-message-text source-code > console-message-url webkit-html-resource-link > webkit-html-external-link
Dump urls in messages
linked url:http://www.chromium.org/
linked url:http://www.chromium.org/
......
......@@ -2,11 +2,11 @@ CONSOLE MESSAGE: line 21: [object Proxy]
CONSOLE MESSAGE: line 23: [object Proxy]
Tests that console logging dumps proxy properly.
console-proxy.html:21 Proxy {boo: 42, foo: 43} console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > children
console-proxy.html:23 Proxy {boo: 42, foo: 43} console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > children
console-proxy.html:21 Proxy {boo: 42, foo: 43} console-message > console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > children
console-proxy.html:23 Proxy {boo: 42, foo: 43} console-message > console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > children
window.accessedGet = false
info-note display: inline-block
console-proxy.html:21 Proxy[[Handler]]: Object[[Target]]: Object[[IsRevoked]]: false console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent > selection fill > name > object-properties-section-separator > value object-value-object > children > parent > selection fill > name > object-properties-section-separator > value object-value-object > children > selection fill > name > object-properties-section-separator > value object-value-boolean > children
console-proxy.html:23 Proxy[[Handler]]: Object[[Target]]: Proxy[[IsRevoked]]: false console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent > selection fill > name > object-properties-section-separator > value object-value-object > children > parent > selection fill > name > object-properties-section-separator > value object-value-proxy > children > selection fill > name > object-properties-section-separator > value object-value-boolean > children
console-proxy.html:21 Proxy[[Handler]]: Object[[Target]]: Object[[IsRevoked]]: false console-message > console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent > selection fill > name > object-properties-section-separator > value object-value-object > children > parent > selection fill > name > object-properties-section-separator > value object-value-object > children > selection fill > name > object-properties-section-separator > value object-value-boolean > children
console-proxy.html:23 Proxy[[Handler]]: Object[[Target]]: Proxy[[IsRevoked]]: false console-message > console-message-text source-code > console-message-url webkit-html-resource-link > object-value-proxy source-code > console-view-object-properties-section expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent > selection fill > name > object-properties-section-separator > value object-value-object > children > parent > selection fill > name > object-properties-section-separator > value object-value-proxy > children > selection fill > name > object-properties-section-separator > value object-value-boolean > children
window.accessedGet = false
......@@ -958,9 +958,6 @@ WebInspector.ConsoleViewMessage.prototype = {
element.appendChild(this.formattedMessage());
if (this._repeatCount > 1)
this._showRepeatCountElement();
this.updateTimestamp(WebInspector.moduleSetting("consoleTimestampsEnabled").get());
return this._element;
......@@ -1015,6 +1012,8 @@ WebInspector.ConsoleViewMessage.prototype = {
}
this._wrapperElement.appendChild(this.contentElement());
if (this._repeatCount > 1)
this._showRepeatCountElement();
},
/**
......@@ -1061,7 +1060,7 @@ WebInspector.ConsoleViewMessage.prototype = {
default:
this._repeatCountElement.type = "info";
}
this._element.insertBefore(this._repeatCountElement, this._element.firstChild);
this._wrapperElement.insertBefore(this._repeatCountElement, this._element);
this._element.classList.add("repeated-message");
}
this._repeatCountElement.textContent = this._repeatCount;
......
......@@ -132,12 +132,15 @@
}
} /* media */
.console-message .console-message-repeat-count {
margin-right: 4px;
margin-left: -18px;
.console-message-repeat-count {
margin: 2px 0 0 10px;
flex: none;
}
.repeated-message {
margin-left: 4px;
}
.console-error-level .repeated-message::before,
.console-revokedError-level .repeated-message::before,
.console-warning-level .repeated-message::before,
......
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