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

Side by Side Diff: Source/devtools/front_end/ui/SplitView.js

Issue 727823002: [DevTools] Ban getSelection, requestAnimationFrame, cancelAnimationFrame global functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } else if (window.performance.now() < startTime + animationTime) { 520 } else if (window.performance.now() < startTime + animationTime) {
521 // Process regular animation frame. 521 // Process regular animation frame.
522 this._mainView.doResize(); 522 this._mainView.doResize();
523 } else { 523 } else {
524 // Complete animation. 524 // Complete animation.
525 this._cancelAnimation(); 525 this._cancelAnimation();
526 this._mainView.doResize(); 526 this._mainView.doResize();
527 this.dispatchEventToListeners(WebInspector.SplitView.Events.Side barSizeChanged, this.sidebarSize()); 527 this.dispatchEventToListeners(WebInspector.SplitView.Events.Side barSizeChanged, this.sidebarSize());
528 return; 528 return;
529 } 529 }
530 this._animationFrameHandle = window.requestAnimationFrame(boundAnima tionFrame); 530 this._animationFrameHandle = this.element.window().requestAnimationF rame(boundAnimationFrame);
531 } 531 }
532 boundAnimationFrame = animationFrame.bind(this); 532 boundAnimationFrame = animationFrame.bind(this);
533 this._animationFrameHandle = window.requestAnimationFrame(boundAnimation Frame); 533 this._animationFrameHandle = this.element.window().requestAnimationFrame (boundAnimationFrame);
534 }, 534 },
535 535
536 _cancelAnimation: function() 536 _cancelAnimation: function()
537 { 537 {
538 this.element.style.removeProperty("margin-top"); 538 this.element.style.removeProperty("margin-top");
539 this.element.style.removeProperty("margin-right"); 539 this.element.style.removeProperty("margin-right");
540 this.element.style.removeProperty("margin-bottom"); 540 this.element.style.removeProperty("margin-bottom");
541 this.element.style.removeProperty("margin-left"); 541 this.element.style.removeProperty("margin-left");
542 this.element.style.removeProperty("transition"); 542 this.element.style.removeProperty("transition");
543 543
544 if (this._animationFrameHandle) { 544 if (this._animationFrameHandle) {
545 window.cancelAnimationFrame(this._animationFrameHandle); 545 this.element.window().cancelAnimationFrame(this._animationFrameHandl e);
546 delete this._animationFrameHandle; 546 delete this._animationFrameHandle;
547 } 547 }
548 if (this._animationCallback) { 548 if (this._animationCallback) {
549 this._animationCallback(); 549 this._animationCallback();
550 delete this._animationCallback; 550 delete this._animationCallback;
551 } 551 }
552 }, 552 },
553 553
554 /** 554 /**
555 * @param {number} sidebarSize 555 * @param {number} sidebarSize
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 this._showHideSidebarButton.setState(sidebarHidden ? "show" : "hide"); 869 this._showHideSidebarButton.setState(sidebarHidden ? "show" : "hide");
870 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-h ide-button", !this.isVertical() && !this.isSidebarSecond()); 870 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-h ide-button", !this.isVertical() && !this.isSidebarSecond());
871 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show -hide-button", this.isVertical() && this.isSidebarSecond()); 871 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show -hide-button", this.isVertical() && this.isSidebarSecond());
872 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-sho w-hide-button", !this.isVertical() && this.isSidebarSecond()); 872 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-sho w-hide-button", !this.isVertical() && this.isSidebarSecond());
873 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show- hide-button", this.isVertical() && !this.isSidebarSecond()); 873 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show- hide-button", this.isVertical() && !this.isSidebarSecond());
874 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s ", this._showHideSidebarButtonTitle)); 874 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s ", this._showHideSidebarButtonTitle));
875 }, 875 },
876 876
877 __proto__: WebInspector.View.prototype 877 __proto__: WebInspector.View.prototype
878 } 878 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698