OLD | NEW |
1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. */ | 3 * found in the LICENSE file. */ |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Caret browsing content script, runs in each frame. | 6 * @fileoverview Caret browsing content script, runs in each frame. |
7 * | 7 * |
8 * The behavior is based on Mozilla's spec whenever possible: | 8 * The behavior is based on Mozilla's spec whenever possible: |
9 * http://www.mozilla.org/access/keyboard/proposal | 9 * http://www.mozilla.org/access/keyboard/proposal |
10 * | 10 * |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 element.style.height = (CaretBrowsing.caretHeight + 200) + 'px'; | 397 element.style.height = (CaretBrowsing.caretHeight + 200) + 'px'; |
398 element.className = 'CaretBrowsing_AnimateCaret'; | 398 element.className = 'CaretBrowsing_AnimateCaret'; |
399 | 399 |
400 // Start the animation. The setTimeout is so that the old values will get | 400 // Start the animation. The setTimeout is so that the old values will get |
401 // applied first, so we can animate to the new values. | 401 // applied first, so we can animate to the new values. |
402 window.setTimeout(function() { | 402 window.setTimeout(function() { |
403 if (!CaretBrowsing.caretElement) { | 403 if (!CaretBrowsing.caretElement) { |
404 return; | 404 return; |
405 } | 405 } |
406 CaretBrowsing.setCaretElementNormalStyle(); | 406 CaretBrowsing.setCaretElementNormalStyle(); |
407 element.style['-webkit-transition'] = 'all 0.8s ease-in'; | 407 element.style['transition'] = 'all 0.8s ease-in'; |
408 function listener() { | 408 function listener() { |
409 element.removeEventListener( | 409 element.removeEventListener( |
410 'webkitTransitionEnd', listener, false); | 410 'transitionend', listener, false); |
411 element.style['-webkit-transition'] = 'none'; | 411 element.style['transition'] = 'none'; |
412 } | 412 } |
413 element.addEventListener( | 413 element.addEventListener( |
414 'webkitTransitionEnd', listener, false); | 414 'transitionend', listener, false); |
415 }, 0); | 415 }, 0); |
416 }; | 416 }; |
417 | 417 |
418 /** | 418 /** |
419 * Quick flash and then show the normal caret style. | 419 * Quick flash and then show the normal caret style. |
420 */ | 420 */ |
421 CaretBrowsing.flashCaretElement = function() { | 421 CaretBrowsing.flashCaretElement = function() { |
422 var x = CaretBrowsing.caretX; | 422 var x = CaretBrowsing.caretX; |
423 var y = CaretBrowsing.caretY; | 423 var y = CaretBrowsing.caretY; |
424 var height = CaretBrowsing.caretHeight; | 424 var height = CaretBrowsing.caretHeight; |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 CaretBrowsing.updateIsCaretVisible(); | 1415 CaretBrowsing.updateIsCaretVisible(); |
1416 } | 1416 } |
1417 | 1417 |
1418 chrome.storage.onChanged.addListener(function() { | 1418 chrome.storage.onChanged.addListener(function() { |
1419 CaretBrowsing.onPrefsUpdated(); | 1419 CaretBrowsing.onPrefsUpdated(); |
1420 }); | 1420 }); |
1421 CaretBrowsing.onPrefsUpdated(); | 1421 CaretBrowsing.onPrefsUpdated(); |
1422 } | 1422 } |
1423 | 1423 |
1424 }, 0); | 1424 }, 0); |
OLD | NEW |