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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js

Issue 1879163003: DevTools: cleanup occurences of selection.getRangeAt to avoid NPE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@selection-exception
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 296
297 /** 297 /**
298 * @return {boolean} 298 * @return {boolean}
299 */ 299 */
300 Node.prototype.isComponentSelectionCollapsed = function() 300 Node.prototype.isComponentSelectionCollapsed = function()
301 { 301 {
302 // FIXME: crbug.com/447523, use selection.isCollapsed when it is fixed for s hadow dom. 302 // FIXME: crbug.com/447523, use selection.isCollapsed when it is fixed for s hadow dom.
303 var selection = this.getComponentSelection(); 303 var selection = this.getComponentSelection();
304 return selection && selection.rangeCount ? selection.getRangeAt(0).collapsed : true; 304 var range = selection && selection.rangeCount ? selection.getRangeAt(0) : nu ll;
305 return range ? range.collapsed : true;
305 } 306 }
306 307
307 /** 308 /**
308 * @return {!Selection} 309 * @return {!Selection}
309 */ 310 */
310 Node.prototype.getDeepSelection = function() 311 Node.prototype.getDeepSelection = function()
311 { 312 {
312 var activeElement = this.ownerDocument.activeElement; 313 var activeElement = this.ownerDocument.activeElement;
313 var shadowRoot = null; 314 var shadowRoot = null;
314 while (activeElement && activeElement.shadowRoot) { 315 while (activeElement && activeElement.shadowRoot) {
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 { 986 {
986 window.removeEventListener("DOMContentLoaded", windowLoaded, false); 987 window.removeEventListener("DOMContentLoaded", windowLoaded, false);
987 callback(); 988 callback();
988 } 989 }
989 990
990 if (document.readyState === "complete" || document.readyState === "interacti ve") 991 if (document.readyState === "complete" || document.readyState === "interacti ve")
991 callback(); 992 callback();
992 else 993 else
993 window.addEventListener("DOMContentLoaded", windowLoaded, false); 994 window.addEventListener("DOMContentLoaded", windowLoaded, false);
994 } 995 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698