Changeset 142351 in webkit
- Timestamp:
- Feb 9, 2013 1:58:10 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142349 r142351 1 2013-02-09 Andrey Lushnikov <lushnikov@chromium.org> 2 3 Web Inspector: show whitespace characters in DTE 4 https://bugs.webkit.org/show_bug.cgi?id=108947 5 6 Reviewed by Pavel Feldman. 7 8 Add layout test to verify whitespace highlight functionality. 9 10 * inspector/editor/text-editor-show-whitespace-expected.txt: Added. 11 * inspector/editor/text-editor-show-whitespace.html: Added. 12 1 13 2013-02-08 Eric Carlson <eric.carlson@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r142349 r142351 1 2013-02-09 Andrey Lushnikov <lushnikov@chromium.org> 2 3 Web Inspector: show whitespace characters in DTE 4 https://bugs.webkit.org/show_bug.cgi?id=108947 5 6 Reviewed by Pavel Feldman. 7 8 New test: inspector/editor/text-editor-show-whitespaces.html 9 10 Split consecutive whitespace characters into groups of 16, 8, 4, 2 and 1 and 11 add ::before pseudoclass for this groups which contains necessary 12 amount of "dots" (u+00b7). Add a setting "Show whitespace" for this 13 option in "Sources" section of "General" tab. 14 15 * English.lproj/localizedStrings.js: 16 * inspector/front-end/DefaultTextEditor.js: 17 (WebInspector.TextEditorMainPanel.prototype.wasShown): 18 (WebInspector.TextEditorMainPanel.prototype.willHide): 19 (WebInspector.TextEditorMainPanel.prototype._renderRanges): 20 (WebInspector.TextEditorMainPanel.prototype._renderWhitespaceCharsWithFixedSizeSpans): 21 (WebInspector.TextEditorMainPanel.prototype._paintLine): 22 * inspector/front-end/Settings.js: 23 * inspector/front-end/SettingsScreen.js: 24 (WebInspector.GenericSettingsTab): 25 * inspector/front-end/inspectorSyntaxHighlight.css: 26 (.webkit-whitespace-1::before): 27 (.webkit-whitespace-2::before): 28 (.webkit-whitespace-4::before): 29 (.webkit-whitespace-8::before): 30 (.webkit-whitespace-16::before): 31 (.webkit-whitespace::before): 32 1 33 2013-02-08 Eric Carlson <eric.carlson@apple.com> 2 34 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r142144 r142351 391 391 localizedStrings["Show times as percentages."] = "Show times as percentages."; 392 392 localizedStrings["Show total and self times as percentages."] = "Show total and self times as percentages."; 393 localizedStrings["Show whitespace"] = "Show whitespace"; 393 394 localizedStrings["Size"] = "Size"; 394 395 localizedStrings["Snapshot %d"] = "Snapshot %d"; -
trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js
r142167 r142351 1365 1365 this.element.addEventListener("cut", this._handleCut.bind(this), false); 1366 1366 1367 this._showWhitespace = WebInspector.settings.showWhitespaceInEditor.get(); 1368 this._handleShowWhitespaceInEditorChange = this._handleShowWhitespaceInEditorChange.bind(this); 1369 1367 1370 this._container.addEventListener("focus", this._handleFocused.bind(this), false); 1368 1371 … … 1378 1381 } 1379 1382 1383 WebInspector.TextEditorMainPanel._ConsecutiveWhitespaceChars = { 1384 1: " ", 1385 2: " ", 1386 4: " ", 1387 8: " ", 1388 16: " " 1389 }; 1390 1380 1391 WebInspector.TextEditorMainPanel.prototype = { 1381 1392 _registerShortcuts: function() … … 1398 1409 this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code)] = handleTabKey; 1399 1410 this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code, modifiers.Shift)] = handleShiftTabKey; 1411 }, 1412 1413 _handleShowWhitespaceInEditorChange: function() 1414 { 1415 this._showWhitespace = WebInspector.settings.showWhitespaceInEditor.get(); 1416 var visibleFrom = this.scrollTop(); 1417 var visibleTo = visibleFrom + this.clientHeight(); 1418 1419 if (!visibleTo) 1420 return; 1421 1422 var result = this.findVisibleChunks(visibleFrom, visibleTo); 1423 var startLine = this._textChunks[result.start].startLine; 1424 var endLine = this._textChunks[result.end - 1].startLine + this._textChunks[result.end - 1].linesCount; 1425 this._paintLines(startLine, endLine + 1); 1400 1426 }, 1401 1427 … … 1475 1501 wasShown: function() 1476 1502 { 1503 WebInspector.settings.showWhitespaceInEditor.addChangeListener(this._handleShowWhitespaceInEditorChange); 1504 1477 1505 this._boundSelectionChangeListener = this._handleSelectionChange.bind(this); 1478 1506 document.addEventListener("selectionchange", this._boundSelectionChangeListener, false); … … 1484 1512 willHide: function() 1485 1513 { 1514 WebInspector.settings.showWhitespaceInEditor.removeChangeListener(this._handleShowWhitespaceInEditorChange); 1515 1486 1516 document.removeEventListener("selectionchange", this._boundSelectionChangeListener, false); 1487 1517 delete this._boundSelectionChangeListener; … … 1971 2001 * @param {string} line 1972 2002 * @param {Array.<{startColumn: number, endColumn: number, token: ?string}>} ranges 1973 */ 1974 _renderRanges: function(lineRow, line, ranges) 2003 * @param {boolean=} splitWhitespaceSequences 2004 */ 2005 _renderRanges: function(lineRow, line, ranges, splitWhitespaceSequences) 1975 2006 { 1976 2007 var decorationsElement = lineRow.decorationsElement; … … 1994 2025 var rangeStart = ranges[i].startColumn; 1995 2026 var rangeEnd = ranges[i].endColumn; 1996 var cssClass = ranges[i].token ? "webkit-" + ranges[i].token : "";1997 2027 1998 2028 if (plainTextStart < rangeStart) { 1999 2029 this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, rangeStart)); 2000 2030 } 2001 this._insertSpanBefore(lineRow, decorationsElement, line.substring(rangeStart, rangeEnd + 1), cssClass); 2031 2032 if (splitWhitespaceSequences && ranges[i].token === "whitespace") 2033 this._renderWhitespaceCharsWithFixedSizeSpans(lineRow, decorationsElement, rangeEnd - rangeStart + 1); 2034 else 2035 this._insertSpanBefore(lineRow, decorationsElement, line.substring(rangeStart, rangeEnd + 1), ranges[i].token ? "webkit-" + ranges[i].token : ""); 2002 2036 plainTextStart = rangeEnd + 1; 2003 2037 } 2004 2038 if (plainTextStart < line.length) { 2005 2039 this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, line.length)); 2040 } 2041 }, 2042 2043 /** 2044 * @param {Element} lineRow 2045 * @param {Element} decorationsElement 2046 * @param {number} length 2047 */ 2048 _renderWhitespaceCharsWithFixedSizeSpans: function(lineRow, decorationsElement, length) 2049 { 2050 for (var whitespaceLength = 16; whitespaceLength > 0; whitespaceLength >>= 1) { 2051 var cssClass = "webkit-whitespace webkit-whitespace-" + whitespaceLength; 2052 for (; length >= whitespaceLength; length -= whitespaceLength) 2053 this._insertSpanBefore(lineRow, decorationsElement, WebInspector.TextEditorMainPanel._ConsecutiveWhitespaceChars[whitespaceLength], cssClass); 2006 2054 } 2007 2055 }, … … 2023 2071 var line = this._textModel.line(lineNumber); 2024 2072 var ranges = syntaxHighlight.ranges; 2025 this._renderRanges(lineRow, line, ranges );2073 this._renderRanges(lineRow, line, ranges, this._showWhitespace); 2026 2074 2027 2075 if (overlayHighlight) -
trunk/Source/WebCore/inspector/front-end/Settings.js
r142144 r142351 112 112 this.showHeapSnapshotObjectsHiddenProperties = this.createSetting("showHeaSnapshotObjectsHiddenProperties", false); 113 113 this.showNativeSnapshotUninstrumentedSize = this.createSetting("showNativeSnapshotUninstrumentedSize", false); 114 this.showWhitespaceInEditor = this.createSetting("showWhitespaceInEditor", false); 114 115 this.searchInContentScripts = this.createSetting("searchInContentScripts", false); 115 116 this.textEditorIndent = this.createSetting("textEditorIndent", " "); -
trunk/Source/WebCore/inspector/front-end/SettingsScreen.js
r142144 r142351 308 308 p = this._appendSection(WebInspector.UIString("Sources")); 309 309 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts)); 310 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show whitespace"), WebInspector.settings.showWhitespaceInEditor)); 310 311 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable source maps"), WebInspector.settings.sourceMapsEnabled)); 311 312 if (WebInspector.experimentsSettings.isEnabled("sass")) -
trunk/Source/WebCore/inspector/front-end/inspectorSyntaxHighlight.css
r127864 r142351 71 71 } 72 72 73 .webkit-whitespace-1::before { 74 content: "·"; 75 } 76 77 .webkit-whitespace-2::before { 78 content: "··"; 79 } 80 81 .webkit-whitespace-4::before { 82 content: "····"; 83 } 84 85 .webkit-whitespace-8::before { 86 content: "········"; 87 } 88 89 .webkit-whitespace-16::before { 90 content: "················"; 91 } 92 93 .webkit-whitespace::before { 94 position: absolute; 95 color: rgb(175, 175, 175); 96 } 97 73 98 .webkit-html-comment { 74 99 /* Keep this in sync with view-source.css (.webkit-html-comment) */
Note: See TracChangeset
for help on using the changeset viewer.