OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 if (media.sourceURL) { | 1081 if (media.sourceURL) { |
1082 var refElement = mediaDataElement.createChild("div", "subtitle")
; | 1082 var refElement = mediaDataElement.createChild("div", "subtitle")
; |
1083 var rawLocation; | 1083 var rawLocation; |
1084 var mediaHeader; | 1084 var mediaHeader; |
1085 if (media.range) { | 1085 if (media.range) { |
1086 mediaHeader = media.header(); | 1086 mediaHeader = media.header(); |
1087 if (mediaHeader) { | 1087 if (mediaHeader) { |
1088 var lineNumber = media.lineNumberInSource(); | 1088 var lineNumber = media.lineNumberInSource(); |
1089 var columnNumber = media.columnNumberInSource(); | 1089 var columnNumber = media.columnNumberInSource(); |
1090 console.assert(typeof lineNumber !== "undefined" && type
of columnNumber !== "undefined"); | 1090 console.assert(typeof lineNumber !== "undefined" && type
of columnNumber !== "undefined"); |
1091 rawLocation = new WebInspector.CSSLocation(media.sourceU
RL, lineNumber, columnNumber); | 1091 rawLocation = new WebInspector.CSSLocation(WebInspector.
cssModel.target(), media.sourceURL, lineNumber, columnNumber); |
1092 } | 1092 } |
1093 } | 1093 } |
1094 | 1094 |
1095 var anchor; | 1095 var anchor; |
1096 if (rawLocation) | 1096 if (rawLocation) |
1097 anchor = this._parentPane._linkifier.linkifyCSSLocation(medi
aHeader.id, rawLocation); | 1097 anchor = this._parentPane._linkifier.linkifyCSSLocation(medi
aHeader.id, rawLocation); |
1098 else { | 1098 else { |
1099 // The "linkedStylesheet" case. | 1099 // The "linkedStylesheet" case. |
1100 anchor = WebInspector.linkifyResourceAsNode(media.sourceURL,
undefined, "subtitle", media.sourceURL); | 1100 anchor = WebInspector.linkifyResourceAsNode(media.sourceURL,
undefined, "subtitle", media.sourceURL); |
1101 } | 1101 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 | 1384 |
1385 var selectors = rule.selectors; | 1385 var selectors = rule.selectors; |
1386 var fragment = document.createDocumentFragment(); | 1386 var fragment = document.createDocumentFragment(); |
1387 var currentMatch = 0; | 1387 var currentMatch = 0; |
1388 for (var i = 0; i < selectors.length ; ++i) { | 1388 for (var i = 0; i < selectors.length ; ++i) { |
1389 if (i) | 1389 if (i) |
1390 fragment.appendChild(document.createTextNode(", ")); | 1390 fragment.appendChild(document.createTextNode(", ")); |
1391 var isSelectorMatching = matchingSelectors[currentMatch] === i; | 1391 var isSelectorMatching = matchingSelectors[currentMatch] === i; |
1392 if (isSelectorMatching) | 1392 if (isSelectorMatching) |
1393 ++currentMatch; | 1393 ++currentMatch; |
1394 var rawLocation = new WebInspector.CSSLocation(rule.sourceURL, rule.
lineNumberInSource(i), rule.columnNumberInSource(i)); | 1394 var rawLocation = new WebInspector.CSSLocation(WebInspector.cssModel
.target(), rule.sourceURL, rule.lineNumberInSource(i), rule.columnNumberInSource
(i)); |
1395 var matchingSelectorClass = isSelectorMatching ? " selector-matches"
: ""; | 1395 var matchingSelectorClass = isSelectorMatching ? " selector-matches"
: ""; |
1396 var selectorElement = document.createElement("span"); | 1396 var selectorElement = document.createElement("span"); |
1397 selectorElement.className = "simple-selector" + matchingSelectorClas
s; | 1397 selectorElement.className = "simple-selector" + matchingSelectorClas
s; |
1398 if (rule.id) | 1398 if (rule.id) |
1399 selectorElement._selectorIndex = i; | 1399 selectorElement._selectorIndex = i; |
1400 selectorElement.textContent = selectors[i].value; | 1400 selectorElement.textContent = selectors[i].value; |
1401 | 1401 |
1402 fragment.appendChild(selectorElement); | 1402 fragment.appendChild(selectorElement); |
1403 } | 1403 } |
1404 | 1404 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 { | 1459 { |
1460 var link = WebInspector.linkifyResourceAsNode(url, line, "", url + "
:" + (line + 1)); | 1460 var link = WebInspector.linkifyResourceAsNode(url, line, "", url + "
:" + (line + 1)); |
1461 link.classList.add("webkit-html-resource-link"); | 1461 link.classList.add("webkit-html-resource-link"); |
1462 link.setAttribute("data-uncopyable", link.textContent); | 1462 link.setAttribute("data-uncopyable", link.textContent); |
1463 link.textContent = ""; | 1463 link.textContent = ""; |
1464 return link; | 1464 return link; |
1465 } | 1465 } |
1466 | 1466 |
1467 if (this.styleRule.sourceURL) { | 1467 if (this.styleRule.sourceURL) { |
1468 var firstMatchingIndex = this.styleRule.rule.matchingSelectors && th
is.rule.matchingSelectors.length ? this.rule.matchingSelectors[0] : 0; | 1468 var firstMatchingIndex = this.styleRule.rule.matchingSelectors && th
is.rule.matchingSelectors.length ? this.rule.matchingSelectors[0] : 0; |
1469 var matchingSelectorLocation = new WebInspector.CSSLocation(this.sty
leRule.sourceURL, this.rule.lineNumberInSource(firstMatchingIndex), this.rule.co
lumnNumberInSource(firstMatchingIndex)); | 1469 var matchingSelectorLocation = new WebInspector.CSSLocation(WebInspe
ctor.cssModel.target(), this.styleRule.sourceURL, this.rule.lineNumberInSource(f
irstMatchingIndex), this.rule.columnNumberInSource(firstMatchingIndex)); |
1470 return this._parentPane._linkifier.linkifyCSSLocation(this.rule.id.s
tyleSheetId, matchingSelectorLocation) || linkifyUncopyable(this.styleRule.sourc
eURL, this.rule.lineNumberInSource()); | 1470 return this._parentPane._linkifier.linkifyCSSLocation(this.rule.id.s
tyleSheetId, matchingSelectorLocation) || linkifyUncopyable(this.styleRule.sourc
eURL, this.rule.lineNumberInSource()); |
1471 } | 1471 } |
1472 | 1472 |
1473 if (!this.rule) | 1473 if (!this.rule) |
1474 return document.createTextNode(""); | 1474 return document.createTextNode(""); |
1475 | 1475 |
1476 if (this.rule.isUserAgent) | 1476 if (this.rule.isUserAgent) |
1477 return document.createTextNode(WebInspector.UIString("user agent sty
lesheet")); | 1477 return document.createTextNode(WebInspector.UIString("user agent sty
lesheet")); |
1478 if (this.rule.isUser) | 1478 if (this.rule.isUser) |
1479 return document.createTextNode(WebInspector.UIString("user styleshee
t")); | 1479 return document.createTextNode(WebInspector.UIString("user styleshee
t")); |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3239 return; | 3239 return; |
3240 } | 3240 } |
3241 | 3241 |
3242 var results = this._cssCompletions.startsWith(prefix); | 3242 var results = this._cssCompletions.startsWith(prefix); |
3243 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3243 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
3244 completionsReadyCallback(results, selectedIndex); | 3244 completionsReadyCallback(results, selectedIndex); |
3245 }, | 3245 }, |
3246 | 3246 |
3247 __proto__: WebInspector.TextPrompt.prototype | 3247 __proto__: WebInspector.TextPrompt.prototype |
3248 } | 3248 } |
OLD | NEW |