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

Unified Diff: Source/devtools/front_end/elements/StylesSidebarPane.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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/elements/StylesSidebarPane.js
diff --git a/Source/devtools/front_end/elements/StylesSidebarPane.js b/Source/devtools/front_end/elements/StylesSidebarPane.js
index 26a0db4e420fcd42282dc44a3a2f9d54fd154322..0f995f8229022d0f87866a8ea7e7418e5979774f 100644
--- a/Source/devtools/front_end/elements/StylesSidebarPane.js
+++ b/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -1762,7 +1762,7 @@ WebInspector.StylePropertiesSection.prototype = {
if (!this.editable)
return;
- if (!window.getSelection().isCollapsed)
+ if (!event.target.window().getSelection().isCollapsed)
return;
if (this._checkWillCancelEditing())
@@ -1822,7 +1822,7 @@ WebInspector.StylePropertiesSection.prototype = {
var config = new WebInspector.InplaceEditor.Config(this.editingSelectorCommitted.bind(this), this.editingSelectorCancelled.bind(this), undefined, this._editingSelectorBlurHandler.bind(this));
WebInspector.InplaceEditor.startEditing(this._selectorElement, config);
- window.getSelection().setBaseAndExtent(element, 0, element, 1);
+ element.window().getSelection().setBaseAndExtent(element, 0, element, 1);
this._parentPane._isEditingStyle = true;
this._parentPane._startEditingSelector(this);
},
@@ -1833,7 +1833,7 @@ WebInspector.StylePropertiesSection.prototype = {
setSelectorText: function(text)
{
this._selectorElement.textContent = text;
- window.getSelection().setBaseAndExtent(this._selectorElement, 0, this._selectorElement, 1);
+ this._selectorElement.window().getSelection().setBaseAndExtent(this._selectorElement, 0, this._selectorElement, 1);
},
/**
@@ -2935,7 +2935,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
_mouseClick: function(event)
{
- if (!window.getSelection().isCollapsed)
+ if (!event.target.window().getSelection().isCollapsed)
return;
event.consume(true);
@@ -3121,7 +3121,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
if (isEditingName)
proxyElement.addEventListener("paste", pasteHandler.bind(this, context), false);
- window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
+ selectElement.window().getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
},
/**
@@ -3142,7 +3142,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
result = "cancel";
else if (!context.isEditingName && this._newProperty && event.keyCode === WebInspector.KeyboardShortcut.Keys.Backspace.code) {
// For a new property, when Backspace is pressed at the beginning of new property value, move back to the property name.
- var selection = window.getSelection();
+ var selection = event.target.window().getSelection();
if (selection.isCollapsed && !selection.focusOffset) {
event.preventDefault();
result = "backward";

Powered by Google App Engine
This is Rietveld 408576698