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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 case WebInspector.CSSMedia.Source.MEDIA_RULE: | 1180 case WebInspector.CSSMedia.Source.MEDIA_RULE: |
1181 mediaText = "@media " + media.text; | 1181 mediaText = "@media " + media.text; |
1182 break; | 1182 break; |
1183 case WebInspector.CSSMedia.Source.IMPORT_RULE: | 1183 case WebInspector.CSSMedia.Source.IMPORT_RULE: |
1184 mediaText = "@import " + media.text; | 1184 mediaText = "@import " + media.text; |
1185 break; | 1185 break; |
1186 } | 1186 } |
1187 | 1187 |
1188 if (media.sourceURL) { | 1188 if (media.sourceURL) { |
1189 var refElement = mediaDataElement.createChild("div", "subtitle")
; | 1189 var refElement = mediaDataElement.createChild("div", "subtitle")
; |
1190 var rawLocation; | 1190 var anchor = this._parentPane._linkifier.linkifyMedia(media); |
1191 var mediaHeader; | |
1192 if (media.range) { | |
1193 mediaHeader = media.header(); | |
1194 if (mediaHeader) { | |
1195 var lineNumber = media.lineNumberInSource(); | |
1196 var columnNumber = media.columnNumberInSource(); | |
1197 console.assert(typeof lineNumber !== "undefined" && type
of columnNumber !== "undefined"); | |
1198 rawLocation = new WebInspector.CSSLocation(this._parentP
ane._target, media.sourceURL, lineNumber, columnNumber); | |
1199 } | |
1200 } | |
1201 | |
1202 var anchor; | |
1203 if (rawLocation) | |
1204 anchor = this._parentPane._linkifier.linkifyCSSLocation(medi
aHeader.id, rawLocation); | |
1205 else { | |
1206 // The "linkedStylesheet" case. | |
1207 anchor = WebInspector.linkifyResourceAsNode(media.sourceURL,
undefined, "subtitle", media.sourceURL); | |
1208 } | |
1209 anchor.style.float = "right"; | 1191 anchor.style.float = "right"; |
1210 refElement.appendChild(anchor); | 1192 refElement.appendChild(anchor); |
1211 } | 1193 } |
1212 | 1194 |
1213 var mediaTextElement = mediaDataElement.createChild("span"); | 1195 var mediaTextElement = mediaDataElement.createChild("span"); |
1214 mediaTextElement.textContent = mediaText; | 1196 mediaTextElement.textContent = mediaText; |
1215 mediaTextElement.title = media.text; | 1197 mediaTextElement.title = media.text; |
1216 } | 1198 } |
1217 }, | 1199 }, |
1218 | 1200 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 | 1423 |
1442 var selectors = rule.selectors; | 1424 var selectors = rule.selectors; |
1443 var fragment = document.createDocumentFragment(); | 1425 var fragment = document.createDocumentFragment(); |
1444 var currentMatch = 0; | 1426 var currentMatch = 0; |
1445 for (var i = 0; i < selectors.length ; ++i) { | 1427 for (var i = 0; i < selectors.length ; ++i) { |
1446 if (i) | 1428 if (i) |
1447 fragment.appendChild(document.createTextNode(", ")); | 1429 fragment.appendChild(document.createTextNode(", ")); |
1448 var isSelectorMatching = matchingSelectors[currentMatch] === i; | 1430 var isSelectorMatching = matchingSelectors[currentMatch] === i; |
1449 if (isSelectorMatching) | 1431 if (isSelectorMatching) |
1450 ++currentMatch; | 1432 ++currentMatch; |
1451 var rawLocation = new WebInspector.CSSLocation(this._parentPane._tar
get, rule.sourceURL, rule.lineNumberInSource(i), rule.columnNumberInSource(i)); | |
1452 var matchingSelectorClass = isSelectorMatching ? " selector-matches"
: ""; | 1433 var matchingSelectorClass = isSelectorMatching ? " selector-matches"
: ""; |
1453 var selectorElement = document.createElement("span"); | 1434 var selectorElement = document.createElement("span"); |
1454 selectorElement.className = "simple-selector" + matchingSelectorClas
s; | 1435 selectorElement.className = "simple-selector" + matchingSelectorClas
s; |
1455 if (rule.styleSheetId) | 1436 if (rule.styleSheetId) |
1456 selectorElement._selectorIndex = i; | 1437 selectorElement._selectorIndex = i; |
1457 selectorElement.textContent = selectors[i].value; | 1438 selectorElement.textContent = selectors[i].value; |
1458 | 1439 |
1459 fragment.appendChild(selectorElement); | 1440 fragment.appendChild(selectorElement); |
1460 } | 1441 } |
1461 | 1442 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 { | 1497 { |
1517 var link = WebInspector.linkifyResourceAsNode(url, line, "", url + "
:" + (line + 1)); | 1498 var link = WebInspector.linkifyResourceAsNode(url, line, "", url + "
:" + (line + 1)); |
1518 link.classList.add("webkit-html-resource-link"); | 1499 link.classList.add("webkit-html-resource-link"); |
1519 link.setAttribute("data-uncopyable", link.textContent); | 1500 link.setAttribute("data-uncopyable", link.textContent); |
1520 link.textContent = ""; | 1501 link.textContent = ""; |
1521 return link; | 1502 return link; |
1522 } | 1503 } |
1523 | 1504 |
1524 if (this.styleRule.sourceURL) { | 1505 if (this.styleRule.sourceURL) { |
1525 var firstMatchingIndex = this.styleRule.rule.matchingSelectors && th
is.rule.matchingSelectors.length ? this.rule.matchingSelectors[0] : 0; | 1506 var firstMatchingIndex = this.styleRule.rule.matchingSelectors && th
is.rule.matchingSelectors.length ? this.rule.matchingSelectors[0] : 0; |
1526 var matchingSelectorLocation = new WebInspector.CSSLocation(this._pa
rentPane._target, this.styleRule.sourceURL, this.rule.lineNumberInSource(firstMa
tchingIndex), this.rule.columnNumberInSource(firstMatchingIndex)); | 1507 var matchingSelectorLocation = new WebInspector.CSSLocation(this._pa
rentPane._target, this.rule.styleSheetId, this.styleRule.sourceURL, this.rule.li
neNumberInSource(firstMatchingIndex), this.rule.columnNumberInSource(firstMatchi
ngIndex)); |
1527 return this._parentPane._linkifier.linkifyCSSLocation(this.rule.styl
eSheetId, matchingSelectorLocation) || linkifyUncopyable(this.styleRule.sourceUR
L, this.rule.lineNumberInSource()); | 1508 return this._parentPane._linkifier.linkifyCSSLocation(matchingSelect
orLocation) || linkifyUncopyable(this.styleRule.sourceURL, this.rule.lineNumberI
nSource()); |
1528 } | 1509 } |
1529 | 1510 |
1530 if (!this.rule) | 1511 if (!this.rule) |
1531 return document.createTextNode(""); | 1512 return document.createTextNode(""); |
1532 | 1513 |
1533 if (this.rule.isUserAgent) | 1514 if (this.rule.isUserAgent) |
1534 return document.createTextNode(WebInspector.UIString("user agent sty
lesheet")); | 1515 return document.createTextNode(WebInspector.UIString("user agent sty
lesheet")); |
1535 if (this.rule.isUser) | 1516 if (this.rule.isUser) |
1536 return document.createTextNode(WebInspector.UIString("user styleshee
t")); | 1517 return document.createTextNode(WebInspector.UIString("user styleshee
t")); |
1537 if (this.rule.isViaInspector) | 1518 if (this.rule.isViaInspector) |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase(
))) { | 3310 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase(
))) { |
3330 for (var i = 0; i < results.length; ++i) | 3311 for (var i = 0; i < results.length; ++i) |
3331 results[i] = results[i].toUpperCase(); | 3312 results[i] = results[i].toUpperCase(); |
3332 } | 3313 } |
3333 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3314 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
3334 completionsReadyCallback(results, selectedIndex); | 3315 completionsReadyCallback(results, selectedIndex); |
3335 }, | 3316 }, |
3336 | 3317 |
3337 __proto__: WebInspector.TextPrompt.prototype | 3318 __proto__: WebInspector.TextPrompt.prototype |
3338 } | 3319 } |
OLD | NEW |