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

Unified Diff: Source/devtools/front_end/platform/DOMExtension.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/platform/DOMExtension.js
diff --git a/Source/devtools/front_end/platform/DOMExtension.js b/Source/devtools/front_end/platform/DOMExtension.js
index d05900beebcba75503b0278729a234e2445fc911..fb6306a29bec47127d9890b635a22f9862b9da33 100644
--- a/Source/devtools/front_end/platform/DOMExtension.js
+++ b/Source/devtools/front_end/platform/DOMExtension.js
@@ -275,6 +275,14 @@ Node.prototype.parentNodeOrShadowHost = function()
}
/**
+ * @return {!Window}
+ */
+Node.prototype.window = function()
+{
+ return this.ownerDocument.defaultView;
+}
+
+/**
* @param {string} query
* @return {?Node}
*/
@@ -294,7 +302,7 @@ Element.prototype.removeChildren = function()
*/
Element.prototype.isInsertionCaretInside = function()
{
- var selection = window.getSelection();
+ var selection = this.window().getSelection();
if (!selection.rangeCount || !selection.isCollapsed)
return false;
var selectionRange = selection.getRangeAt(0);
@@ -588,7 +596,7 @@ Element.prototype.selectionLeftOffset = function()
{
// Calculate selection offset relative to the current element.
- var selection = window.getSelection();
+ var selection = this.window().getSelection();
if (!selection.containsNode(this, true))
return null;

Powered by Google App Engine
This is Rietveld 408576698