Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 | 294 |
| 295 | 295 |
| 296 /** | 296 /** |
| 297 * @param {!Event} event | 297 * @param {!Event} event |
| 298 * @return {?string} | 298 * @return {?string} |
| 299 */ | 299 */ |
| 300 WebInspector._valueModificationDirection = function(event) | 300 WebInspector._valueModificationDirection = function(event) |
| 301 { | 301 { |
| 302 var direction = null; | 302 var direction = null; |
| 303 if (event.type === "mousewheel") { | 303 if (event.type === "mousewheel") { |
| 304 if (event.wheelDeltaY > 0) | 304 // When shift is pressed while spinning mousewheel, delta comes as wheel DeltaX |
|
lushnikov
2016/03/22 17:21:42
style: comments should end with "."
| |
| 305 if (event.wheelDeltaY > 0 || event.wheelDeltaX > 0) | |
| 305 direction = "Up"; | 306 direction = "Up"; |
| 306 else if (event.wheelDeltaY < 0) | 307 else if (event.wheelDeltaY < 0 || event.wheelDeltaX < 0) |
| 307 direction = "Down"; | 308 direction = "Down"; |
| 308 } else { | 309 } else { |
| 309 if (event.keyIdentifier === "Up" || event.keyIdentifier === "PageUp") | 310 if (event.keyIdentifier === "Up" || event.keyIdentifier === "PageUp") |
| 310 direction = "Up"; | 311 direction = "Up"; |
| 311 else if (event.keyIdentifier === "Down" || event.keyIdentifier === "Page Down") | 312 else if (event.keyIdentifier === "Down" || event.keyIdentifier === "Page Down") |
| 312 direction = "Down"; | 313 direction = "Down"; |
| 313 } | 314 } |
| 314 return direction; | 315 return direction; |
| 315 } | 316 } |
| 316 | 317 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 /** | 357 /** |
| 357 * @param {number} number | 358 * @param {number} number |
| 358 * @param {!Event} event | 359 * @param {!Event} event |
| 359 */ | 360 */ |
| 360 WebInspector._modifiedFloatNumber = function(number, event) | 361 WebInspector._modifiedFloatNumber = function(number, event) |
| 361 { | 362 { |
| 362 var direction = WebInspector._valueModificationDirection(event); | 363 var direction = WebInspector._valueModificationDirection(event); |
| 363 if (!direction) | 364 if (!direction) |
| 364 return number; | 365 return number; |
| 365 | 366 |
| 366 var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.keyId entifier === "Down" || event.type === "mousewheel"); | 367 // Precision modifier keys work with both mousewheel and up/down keys. |
| 367 | 368 // When ctrl is pressed, increase by 100 |
| 368 // Jump by 10 when shift is down or jump by 0.1 when Alt/Option is down. | 369 // When shift is pressed, increase by 10 |
| 369 // Also jump by 10 for page up and down, or by 100 if shift is held with a p age key. | 370 // When alt is pressed, increase by 0.1 |
| 371 // Otherwise increase by 1 | |
| 370 var changeAmount = 1; | 372 var changeAmount = 1; |
| 371 if (event.shiftKey && !arrowKeyOrMouseWheelEvent) | 373 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) |
| 372 changeAmount = 100; | 374 changeAmount = 100; |
| 373 else if (event.shiftKey || !arrowKeyOrMouseWheelEvent) | 375 else if (event.shiftKey) |
| 374 changeAmount = 10; | 376 changeAmount = 10; |
| 375 else if (event.altKey) | 377 else if (event.altKey) |
| 376 changeAmount = 0.1; | 378 changeAmount = 0.1; |
| 377 | 379 |
| 378 if (direction === "Down") | 380 if (direction === "Down") |
| 379 changeAmount *= -1; | 381 changeAmount *= -1; |
| 380 | 382 |
| 381 // Make the new number and constrain it to a precision of 6, this matches nu mbers the engine returns. | 383 // Make the new number and constrain it to a precision of 6, this matches nu mbers the engine returns. |
| 382 // Use the Number constructor to forget the fixed precision, so 1.100000 wil l print as 1.1. | 384 // Use the Number constructor to forget the fixed precision, so 1.100000 wil l print as 1.1. |
| 383 var result = Number((number + changeAmount).toFixed(6)); | 385 var result = Number((number + changeAmount).toFixed(6)); |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1830 [NetworkAgent.ResourcePriority.High, WebInspector.UIString("High")], | 1832 [NetworkAgent.ResourcePriority.High, WebInspector.UIString("High")], |
| 1831 [NetworkAgent.ResourcePriority.VeryHigh, WebInspector.UIString("High est")] | 1833 [NetworkAgent.ResourcePriority.VeryHigh, WebInspector.UIString("High est")] |
| 1832 ]); | 1834 ]); |
| 1833 WebInspector.uiLabelForPriority._priorityToUILabel = labelMap; | 1835 WebInspector.uiLabelForPriority._priorityToUILabel = labelMap; |
| 1834 } | 1836 } |
| 1835 return labelMap.get(priority) || WebInspector.UIString("Unknown"); | 1837 return labelMap.get(priority) || WebInspector.UIString("Unknown"); |
| 1836 } | 1838 } |
| 1837 | 1839 |
| 1838 /** @type {!WebInspector.ThemeSupport} */ | 1840 /** @type {!WebInspector.ThemeSupport} */ |
| 1839 WebInspector.themeSupport; | 1841 WebInspector.themeSupport; |
| OLD | NEW |