Changeset 228645 in webkit
- Timestamp:
- Feb 19, 2018 3:24:12 AM (6 years ago)
- Location:
- releases/WebKitGTK/webkit-2.20
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog
r228644 r228645 1 2018-02-06 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Rename String.prototype.trimEnd to avoid conflicts with native trimEnd 4 https://bugs.webkit.org/show_bug.cgi?id=182545 5 6 Reviewed by Brian Burg. 7 8 * inspector/unit-tests/string-utilities-expected.txt: 9 * inspector/unit-tests/string-utilities.html: 10 1 11 2018-02-06 Said Abou-Hallawa <sabouhallawa@apple.com> 2 12 -
releases/WebKitGTK/webkit-2.20/LayoutTests/inspector/unit-tests/string-utilities-expected.txt
r222137 r228645 47 47 PASS: Last line of an empty string is the same empty string. 48 48 49 -- Running test case: String.prototype.truncateMiddle 50 PASS: String stays the same. 51 PASS: Ellipsis is inserted in the middle. 52 PASS: Ellipsis is inserted after the second character. 53 54 -- Running test case: String.prototype.truncateEnd 55 PASS: String stays the same. 56 PASS: Ellipsis is inserted in the middle. 57 PASS: Ellipsis is inserted after the third character. 58 -
releases/WebKitGTK/webkit-2.20/LayoutTests/inspector/unit-tests/string-utilities.html
r222137 r228645 2 2 <html> 3 3 <head> 4 <meta charset="utf-8"> 4 5 <script src="../../http/tests/inspector/resources/inspector-test.js"></script> 5 6 <script> … … 79 80 }); 80 81 82 suite.addTestCase({ 83 name: "String.prototype.truncateMiddle", 84 test() { 85 const ellipsis = "\u2026"; 86 InspectorTest.expectEqual("abcdef".truncateMiddle(6), "abcdef", "String stays the same."); 87 InspectorTest.expectEqual("abcdef".truncateMiddle(5), `ab${ellipsis}ef`, "Ellipsis is inserted in the middle."); 88 InspectorTest.expectEqual("abcdef".truncateMiddle(4), `ab${ellipsis}f`, "Ellipsis is inserted after the second character."); 89 return true; 90 } 91 }); 92 93 suite.addTestCase({ 94 name: "String.prototype.truncateEnd", 95 test() { 96 const ellipsis = "\u2026"; 97 InspectorTest.expectEqual("abcdef".truncateEnd(6), "abcdef", "String stays the same."); 98 InspectorTest.expectEqual("abcdef".truncateEnd(5), "abcd" + ellipsis, "Ellipsis is inserted in the middle."); 99 InspectorTest.expectEqual("abcdef".truncateEnd(4), "abc" + ellipsis, "Ellipsis is inserted after the third character."); 100 return true; 101 } 102 }); 103 81 104 suite.runTestCasesAndFinish(); 82 105 } -
releases/WebKitGTK/webkit-2.20/Source/WebInspectorUI/ChangeLog
r228030 r228645 1 2018-02-06 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Rename String.prototype.trimEnd to avoid conflicts with native trimEnd 4 https://bugs.webkit.org/show_bug.cgi?id=182545 5 6 Reviewed by Brian Burg. 7 8 Rename: 9 - trimEnd to truncateEnd 10 - trimMiddle to truncateMiddle 11 12 * UserInterface/Base/Utilities.js: 13 (String.prototype.trimMiddle): Deleted. 14 (String.prototype.trimEnd): Deleted. 15 (String.prototype.truncateMiddle): Added. 16 (String.prototype.truncateEnd): Added. 17 Use strict mode. Scrict mode allows `this` to be a primitive (a string, in our case). 18 In non-strict mode, `this` is always an object. Without the strict mode, 19 "a".truncateEnd(42) !== "a", because truncateEnd returns a string object. 20 21 * UserInterface/Views/DOMTreeElement.js: 22 (WI.DOMTreeElement.prototype._buildAttributeDOM): 23 * UserInterface/Views/DOMTreeElementPathComponent.js: 24 (WI.DOMTreeElementPathComponent): 25 * UserInterface/Views/SearchResultTreeElement.js: 26 Remove an obvious comment. 27 28 (WI.SearchResultTreeElement.truncateAndHighlightTitle): 29 * UserInterface/Views/SpreadsheetStyleProperty.js: 30 (WI.SpreadsheetStyleProperty.prototype._renderValue): 31 1 32 2018-02-02 Devin Rousso <webkit@devinrousso.com> 2 33 -
releases/WebKitGTK/webkit-2.20/Source/WebInspectorUI/UserInterface/Base/Utilities.js
r227864 r228645 580 580 }); 581 581 582 Object.defineProperty(String.prototype, "tr imMiddle",582 Object.defineProperty(String.prototype, "truncateMiddle", 583 583 { 584 584 value(maxLength) 585 585 { 586 "use strict"; 587 586 588 if (this.length <= maxLength) 587 589 return this; … … 592 594 }); 593 595 594 Object.defineProperty(String.prototype, "tr imEnd",596 Object.defineProperty(String.prototype, "truncateEnd", 595 597 { 596 598 value(maxLength) 597 599 { 600 "use strict"; 601 598 602 if (this.length <= maxLength) 599 603 return this; -
releases/WebKitGTK/webkit-2.20/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
r227864 r228645 1272 1272 } else { 1273 1273 if (value.startsWith("data:")) 1274 value = value.tr imMiddle(60);1274 value = value.truncateMiddle(60); 1275 1275 1276 1276 attrValueElement = document.createElement("a"); -
releases/WebKitGTK/webkit-2.20/Source/WebInspectorUI/UserInterface/Views/DOMTreeElementPathComponent.js
r220119 r228645 46 46 case Node.TEXT_NODE: 47 47 className = WI.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName; 48 title = "\"" + node.nodeValue().tr imEnd(32) + "\"";48 title = "\"" + node.nodeValue().truncateEnd(32) + "\""; 49 49 break; 50 50 51 51 case Node.COMMENT_NODE: 52 52 className = WI.DOMTreeElementPathComponent.DOMCommentIconStyleClassName; 53 title = "<!--" + node.nodeValue().tr imEnd(32) + "-->";53 title = "<!--" + node.nodeValue().truncateEnd(32) + "-->"; 54 54 break; 55 55 … … 66 66 case Node.CDATA_SECTION_NODE: 67 67 className = WI.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName; 68 title = "<![CDATA[" + node.tr imEnd(32) + "]]>";68 title = "<![CDATA[" + node.truncateEnd(32) + "]]>"; 69 69 break; 70 70 -
releases/WebKitGTK/webkit-2.20/Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js
r224499 r228645 60 60 modifiedTitle = title; 61 61 62 // Truncate the tail of the title so the tooltip isn't so large. 63 modifiedTitle = modifiedTitle.trimEnd(searchTermIndex + searchTerm.length + charactersToShowAfterSearchMatch); 62 modifiedTitle = modifiedTitle.truncateEnd(searchTermIndex + searchTerm.length + charactersToShowAfterSearchMatch); 64 63 65 64 console.assert(modifiedTitle.substring(searchTermIndex, searchTermIndex + searchTerm.length).toLowerCase() === searchTerm.toLowerCase()); -
releases/WebKitGTK/webkit-2.20/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r228030 r228645 337 337 let span = document.createElement("span"); 338 338 span.classList.add(className); 339 span.textContent = token.value.tr imMiddle(maxValueLength);339 span.textContent = token.value.truncateMiddle(maxValueLength); 340 340 return span; 341 341 }
Note: See TracChangeset
for help on using the changeset viewer.