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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/EditingLocationHistoryManager.js

Issue 1564113003: DevTools: merge uisourcecode's url-alike members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 11 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 this._historyManager.push(entry); 115 this._historyManager.push(entry);
116 }, 116 },
117 117
118 /** 118 /**
119 * @param {!WebInspector.UISourceCode} uiSourceCode 119 * @param {!WebInspector.UISourceCode} uiSourceCode
120 */ 120 */
121 removeHistoryForSourceCode: function(uiSourceCode) 121 removeHistoryForSourceCode: function(uiSourceCode)
122 { 122 {
123 function filterOut(entry) 123 function filterOut(entry)
124 { 124 {
125 return entry._projectId === uiSourceCode.project().id() && entry._pa th === uiSourceCode.path(); 125 return entry._projectId === uiSourceCode.project().id() && entry._ur l === uiSourceCode.url();
126 } 126 }
127 127
128 this._historyManager.filterOut(filterOut); 128 this._historyManager.filterOut(filterOut);
129 }, 129 },
130 } 130 }
131 131
132 132
133 /** 133 /**
134 * @constructor 134 * @constructor
135 * @implements {WebInspector.HistoryEntry} 135 * @implements {WebInspector.HistoryEntry}
136 * @param {!WebInspector.SourcesView} sourcesView 136 * @param {!WebInspector.SourcesView} sourcesView
137 * @param {!WebInspector.EditingLocationHistoryManager} editingLocationManager 137 * @param {!WebInspector.EditingLocationHistoryManager} editingLocationManager
138 * @param {!WebInspector.SourceFrame} sourceFrame 138 * @param {!WebInspector.SourceFrame} sourceFrame
139 * @param {!WebInspector.TextRange} selection 139 * @param {!WebInspector.TextRange} selection
140 */ 140 */
141 WebInspector.EditingLocationHistoryEntry = function(sourcesView, editingLocation Manager, sourceFrame, selection) 141 WebInspector.EditingLocationHistoryEntry = function(sourcesView, editingLocation Manager, sourceFrame, selection)
142 { 142 {
143 this._sourcesView = sourcesView; 143 this._sourcesView = sourcesView;
144 this._editingLocationManager = editingLocationManager; 144 this._editingLocationManager = editingLocationManager;
145 var uiSourceCode = sourceFrame.uiSourceCode(); 145 var uiSourceCode = sourceFrame.uiSourceCode();
146 this._projectId = uiSourceCode.project().id(); 146 this._projectId = uiSourceCode.project().id();
147 this._path = uiSourceCode.path(); 147 this._url = uiSourceCode.url();
148 148
149 var position = this._positionFromSelection(selection); 149 var position = this._positionFromSelection(selection);
150 this._positionHandle = sourceFrame.textEditor.textEditorPositionHandle(posit ion.lineNumber, position.columnNumber); 150 this._positionHandle = sourceFrame.textEditor.textEditorPositionHandle(posit ion.lineNumber, position.columnNumber);
151 } 151 }
152 152
153 WebInspector.EditingLocationHistoryEntry.prototype = { 153 WebInspector.EditingLocationHistoryEntry.prototype = {
154 /** 154 /**
155 * @param {!WebInspector.HistoryEntry} entry 155 * @param {!WebInspector.HistoryEntry} entry
156 */ 156 */
157 merge: function(entry) 157 merge: function(entry)
158 { 158 {
159 if (this._projectId !== entry._projectId || this._path !== entry._path) 159 if (this._projectId !== entry._projectId || this._url !== entry._url)
160 return; 160 return;
161 this._positionHandle = entry._positionHandle; 161 this._positionHandle = entry._positionHandle;
162 }, 162 },
163 163
164 /** 164 /**
165 * @param {!WebInspector.TextRange} selection 165 * @param {!WebInspector.TextRange} selection
166 * @return {!{lineNumber: number, columnNumber: number}} 166 * @return {!{lineNumber: number, columnNumber: number}}
167 */ 167 */
168 _positionFromSelection: function(selection) 168 _positionFromSelection: function(selection)
169 { 169 {
170 return { 170 return {
171 lineNumber: selection.endLine, 171 lineNumber: selection.endLine,
172 columnNumber: selection.endColumn 172 columnNumber: selection.endColumn
173 }; 173 };
174 }, 174 },
175 175
176 /** 176 /**
177 * @override 177 * @override
178 * @return {boolean} 178 * @return {boolean}
179 */ 179 */
180 valid: function() 180 valid: function()
181 { 181 {
182 var position = this._positionHandle.resolve(); 182 var position = this._positionHandle.resolve();
183 var uiSourceCode = WebInspector.workspace.project(this._projectId).uiSou rceCode(this._path); 183 var uiSourceCode = WebInspector.workspace.uiSourceCode(this._projectId, this._url);
184 return !!(position && uiSourceCode); 184 return !!(position && uiSourceCode);
185 }, 185 },
186 186
187 /** 187 /**
188 * @override 188 * @override
189 */ 189 */
190 reveal: function() 190 reveal: function()
191 { 191 {
192 var position = this._positionHandle.resolve(); 192 var position = this._positionHandle.resolve();
193 var uiSourceCode = WebInspector.workspace.project(this._projectId).uiSou rceCode(this._path); 193 var uiSourceCode = WebInspector.workspace.uiSourceCode(this._projectId, this._url);
194 if (!position || !uiSourceCode) 194 if (!position || !uiSourceCode)
195 return; 195 return;
196 196
197 this._editingLocationManager.updateCurrentState(); 197 this._editingLocationManager.updateCurrentState();
198 this._sourcesView.showSourceLocation(uiSourceCode, position.lineNumber, position.columnNumber); 198 this._sourcesView.showSourceLocation(uiSourceCode, position.lineNumber, position.columnNumber);
199 } 199 }
200 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698