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

Side by Side Diff: Source/devtools/front_end/ScreencastView.js

Issue 340513003: DevTools: Add JSDoc for static methods, fix JSDoc types and induced errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 var dimensions = this._viewportDimensions(); 242 var dimensions = this._viewportDimensions();
243 this._screenZoom = Math.min(dimensions.width / screenWidthDIP, dimension s.height / screenHeightDIP); 243 this._screenZoom = Math.min(dimensions.width / screenWidthDIP, dimension s.height / screenHeightDIP);
244 244
245 var bordersSize = WebInspector.ScreencastView._bordersSize; 245 var bordersSize = WebInspector.ScreencastView._bordersSize;
246 this._viewportElement.classList.remove("hidden"); 246 this._viewportElement.classList.remove("hidden");
247 this._viewportElement.style.width = screenWidthDIP * this._screenZoom + bordersSize + "px"; 247 this._viewportElement.style.width = screenWidthDIP * this._screenZoom + bordersSize + "px";
248 this._viewportElement.style.height = screenHeightDIP * this._screenZoom + bordersSize + "px"; 248 this._viewportElement.style.height = screenHeightDIP * this._screenZoom + bordersSize + "px";
249 }, 249 },
250 250
251 /** 251 /**
252 * @param {!Event} event 252 * @param {?Event} event
yurys 2014/06/17 11:32:28 When can event be null?
apavlov 2014/06/17 12:46:03 This is how it is specified in the compiler own ex
253 */ 253 */
254 _handleMouseEvent: function(event) 254 _handleMouseEvent: function(event)
255 { 255 {
256 if (this._isGlassPaneActive()) { 256 if (this._isGlassPaneActive()) {
257 event.consume(); 257 event.consume();
258 return; 258 return;
259 } 259 }
260 260
261 if (!this._viewport) 261 if (!this._viewport)
262 return; 262 return;
(...skipping 18 matching lines...) Expand all
281 if (!node) 281 if (!node)
282 return; 282 return;
283 if (event.type === "mousemove") 283 if (event.type === "mousemove")
284 node.highlight(this._inspectModeConfig); 284 node.highlight(this._inspectModeConfig);
285 else if (event.type === "click") 285 else if (event.type === "click")
286 node.reveal(); 286 node.reveal();
287 } 287 }
288 }, 288 },
289 289
290 /** 290 /**
291 * @param {!KeyboardEvent} event 291 * @param {?Event} event
292 */ 292 */
293 _handleKeyEvent: function(event) 293 _handleKeyEvent: function(event)
294 { 294 {
295 if (this._isGlassPaneActive()) { 295 if (this._isGlassPaneActive()) {
296 event.consume(); 296 event.consume();
297 return; 297 return;
298 } 298 }
299 299
300 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); 300 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(/** @ty pe {!KeyboardEvent} */ (event));
301 var handler = this._shortcuts[shortcutKey]; 301 var handler = this._shortcuts[shortcutKey];
302 if (handler && handler(event)) { 302 if (handler && handler(event)) {
303 event.consume(); 303 event.consume();
304 return; 304 return;
305 } 305 }
306 306
307 var type; 307 var type;
308 switch (event.type) { 308 switch (event.type) {
309 case "keydown": type = "keyDown"; break; 309 case "keydown": type = "keyDown"; break;
310 case "keyup": type = "keyUp"; break; 310 case "keyup": type = "keyUp"; break;
311 case "keypress": type = "char"; break; 311 case "keypress": type = "char"; break;
312 default: return; 312 default: return;
313 } 313 }
314 314
315 var text = event.type === "keypress" ? String.fromCharCode(event.charCod e) : undefined; 315 var text = event.type === "keypress" ? String.fromCharCode(event.charCod e) : undefined;
316 InputAgent.dispatchKeyEvent(type, this._modifiersForEvent(event), event. timeStamp / 1000, text, text ? text.toLowerCase() : undefined, 316 InputAgent.dispatchKeyEvent(type, this._modifiersForEvent(event), event. timeStamp / 1000, text, text ? text.toLowerCase() : undefined,
317 event.keyIdentifier, event.keyCode /* window sVirtualKeyCode */, event.keyCode /* nativeVirtualKeyCode */, false, false, fals e); 317 event.keyIdentifier, event.keyCode /* window sVirtualKeyCode */, event.keyCode /* nativeVirtualKeyCode */, false, false, fals e);
318 event.consume(); 318 event.consume();
319 this._canvasElement.focus(); 319 this._canvasElement.focus();
320 }, 320 },
321 321
322 /** 322 /**
323 * @param {!Event} event 323 * @param {?Event} event
324 */ 324 */
325 _handleContextMenuEvent: function(event) 325 _handleContextMenuEvent: function(event)
326 { 326 {
327 event.consume(true); 327 event.consume(true);
328 }, 328 },
329 329
330 /** 330 /**
331 * @param {!Event} event 331 * @param {?Event} event
332 */ 332 */
333 _simulateTouchGestureForMouseEvent: function(event) 333 _simulateTouchGestureForMouseEvent: function(event)
334 { 334 {
335 var convertedPosition = this._convertIntoScreenSpace(event); 335 var convertedPosition = this._convertIntoScreenSpace(event);
336 var zoomedPosition = this._zoomIntoScreenSpace(event); 336 var zoomedPosition = this._zoomIntoScreenSpace(event);
337 var timeStamp = event.timeStamp / 1000; 337 var timeStamp = event.timeStamp / 1000;
338 338
339 /** 339 /**
340 * @this {!WebInspector.ScreencastView} 340 * @this {!WebInspector.ScreencastView}
341 */ 341 */
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 482 }
483 break; 483 break;
484 484
485 case 3: // Right 485 case 3: // Right
486 case 0: // None 486 case 0: // None
487 default: 487 default:
488 } 488 }
489 }, 489 },
490 490
491 /** 491 /**
492 * @param {!Event} event 492 * @param {?Event} event
493 * @return {!{x: number, y: number}} 493 * @return {!{x: number, y: number}}
494 */ 494 */
495 _zoomIntoScreenSpace: function(event) 495 _zoomIntoScreenSpace: function(event)
496 { 496 {
497 var zoom = this._canvasElement.offsetWidth / this._viewport.width / this ._pageScaleFactor; 497 var zoom = this._canvasElement.offsetWidth / this._viewport.width / this ._pageScaleFactor;
498 var position = {}; 498 var position = {};
499 position.x = Math.round(event.offsetX / zoom); 499 position.x = Math.round(event.offsetX / zoom);
500 position.y = Math.round(event.offsetY / zoom); 500 position.y = Math.round(event.offsetY / zoom);
501 return position; 501 return position;
502 }, 502 },
503 503
504 /** 504 /**
505 * @param {!Event} event 505 * @param {?Event} event
506 * @return {!{x: number, y: number}} 506 * @return {!{x: number, y: number}}
507 */ 507 */
508 _convertIntoScreenSpace: function(event) 508 _convertIntoScreenSpace: function(event)
509 { 509 {
510 var position = this._zoomIntoScreenSpace(event); 510 var position = this._zoomIntoScreenSpace(event);
511 position.y = Math.round(position.y - this._screenOffsetTop); 511 position.y = Math.round(position.y - this._screenOffsetTop);
512 return position; 512 return position;
513 }, 513 },
514 514
515 /** 515 /**
516 * @param {!Event} event 516 * @param {?Event} event
517 * @return {number} 517 * @return {number}
518 */ 518 */
519 _modifiersForEvent: function(event) 519 _modifiersForEvent: function(event)
520 { 520 {
521 var modifiers = 0; 521 var modifiers = 0;
522 if (event.altKey) 522 if (event.altKey)
523 modifiers = 1; 523 modifiers = 1;
524 if (event.ctrlKey) 524 if (event.ctrlKey)
525 modifiers += 2; 525 modifiers += 2;
526 if (event.metaKey) 526 if (event.metaKey)
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 { 936 {
937 this._navigationUrl.focus(); 937 this._navigationUrl.focus();
938 this._navigationUrl.select(); 938 this._navigationUrl.select();
939 return true; 939 return true;
940 }, 940 },
941 941
942 __proto__: WebInspector.VBox.prototype 942 __proto__: WebInspector.VBox.prototype
943 } 943 }
944 944
945 /** 945 /**
946 * @param {!HTMLElement} element 946 * @param {!Element} element
947 * @constructor 947 * @constructor
948 */ 948 */
949 WebInspector.ScreencastView.ProgressTracker = function(element) { 949 WebInspector.ScreencastView.ProgressTracker = function(element) {
950 this._element = element; 950 this._element = element;
951 951
952 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._onMainFrameNavigated, this); 952 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._onMainFrameNavigated, this);
953 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.Load, this._onLoad, this); 953 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.Load, this._onLoad, this);
954 954
955 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestStarted, this._onRequestStarted, this); 955 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestStarted, this._onRequestStarted, this);
956 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestFinished, this._onRequestFinished, this); 956 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestFinished, this._onRequestFinished, this);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 return; 1014 return;
1015 this._maxDisplayedProgress = progress; 1015 this._maxDisplayedProgress = progress;
1016 this._displayProgress(progress); 1016 this._displayProgress(progress);
1017 }, 1017 },
1018 1018
1019 _displayProgress: function(progress) 1019 _displayProgress: function(progress)
1020 { 1020 {
1021 this._element.style.width = (100 * progress) + "%"; 1021 this._element.style.width = (100 * progress) + "%";
1022 } 1022 }
1023 }; 1023 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698