Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 2769843003: DevTools: split text_utils out of common module (Closed)
Patch Set: rebaseline Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 UI.runCSSAnimationOnce(tagNameElement, 'dom-update-highlight'); 1336 UI.runCSSAnimationOnce(tagNameElement, 'dom-update-highlight');
1337 } 1337 }
1338 } 1338 }
1339 1339
1340 tagElement.createTextChild('>'); 1340 tagElement.createTextChild('>');
1341 parentElement.createTextChild('\u200B'); 1341 parentElement.createTextChild('\u200B');
1342 } 1342 }
1343 1343
1344 /** 1344 /**
1345 * @param {string} text 1345 * @param {string} text
1346 * @return {!{text: string, entityRanges: !Array.<!Common.SourceRange>}} 1346 * @return {!{text: string, entityRanges: !Array.<!TextUtils.SourceRange>}}
1347 */ 1347 */
1348 _convertWhitespaceToEntities(text) { 1348 _convertWhitespaceToEntities(text) {
1349 var result = ''; 1349 var result = '';
1350 var lastIndexAfterEntity = 0; 1350 var lastIndexAfterEntity = 0;
1351 var entityRanges = []; 1351 var entityRanges = [];
1352 var charToEntity = Elements.ElementsTreeOutline.MappedCharToEntity; 1352 var charToEntity = Elements.ElementsTreeOutline.MappedCharToEntity;
1353 for (var i = 0, size = text.length; i < size; ++i) { 1353 for (var i = 0, size = text.length; i < size; ++i) {
1354 var char = text.charAt(i); 1354 var char = text.charAt(i);
1355 if (charToEntity[char]) { 1355 if (charToEntity[char]) {
1356 result += text.substring(lastIndexAfterEntity, i); 1356 result += text.substring(lastIndexAfterEntity, i);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 if (!this._searchQuery || !this._searchHighlightsVisible) 1558 if (!this._searchQuery || !this._searchHighlightsVisible)
1559 return; 1559 return;
1560 this._hideSearchHighlight(); 1560 this._hideSearchHighlight();
1561 1561
1562 var text = this.listItemElement.textContent; 1562 var text = this.listItemElement.textContent;
1563 var regexObject = createPlainTextSearchRegex(this._searchQuery, 'gi'); 1563 var regexObject = createPlainTextSearchRegex(this._searchQuery, 'gi');
1564 1564
1565 var match = regexObject.exec(text); 1565 var match = regexObject.exec(text);
1566 var matchRanges = []; 1566 var matchRanges = [];
1567 while (match) { 1567 while (match) {
1568 matchRanges.push(new Common.SourceRange(match.index, match[0].length)); 1568 matchRanges.push(new TextUtils.SourceRange(match.index, match[0].length));
1569 match = regexObject.exec(text); 1569 match = regexObject.exec(text);
1570 } 1570 }
1571 1571
1572 // Fall back for XPath, etc. matches. 1572 // Fall back for XPath, etc. matches.
1573 if (!matchRanges.length) 1573 if (!matchRanges.length)
1574 matchRanges.push(new Common.SourceRange(0, text.length)); 1574 matchRanges.push(new TextUtils.SourceRange(0, text.length));
1575 1575
1576 this._highlightResult = []; 1576 this._highlightResult = [];
1577 UI.highlightSearchResults(this.listItemElement, matchRanges, this._highlight Result); 1577 UI.highlightSearchResults(this.listItemElement, matchRanges, this._highlight Result);
1578 } 1578 }
1579 1579
1580 _scrollIntoView() { 1580 _scrollIntoView() {
1581 function scrollIntoViewCallback(object) { 1581 function scrollIntoViewCallback(object) {
1582 /** 1582 /**
1583 * @suppressReceiverCheck 1583 * @suppressReceiverCheck
1584 * @this {!Element} 1584 * @this {!Element}
(...skipping 24 matching lines...) Expand all
1609 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ 1609 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([
1610 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', 1610 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr',
1611 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' 1611 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'
1612 ]); 1612 ]);
1613 1613
1614 // These tags we do not allow editing their tag name. 1614 // These tags we do not allow editing their tag name.
1615 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); 1615 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] );
1616 1616
1617 /** @typedef {{cancel: function(), commit: function(), resize: function(), edito r:!UI.TextEditor}} */ 1617 /** @typedef {{cancel: function(), commit: function(), resize: function(), edito r:!UI.TextEditor}} */
1618 Elements.MultilineEditorController; 1618 Elements.MultilineEditorController;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698