| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2011 Google Inc.  All rights reserved. |     2  * Copyright (C) 2011 Google Inc.  All rights reserved. | 
|     3  * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved. |     3  * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved. | 
|     4  * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |     4  * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 
|     5  * Copyright (C) 2009 Joseph Pecoraro |     5  * Copyright (C) 2009 Joseph Pecoraro | 
|     6  * |     6  * | 
|     7  * Redistribution and use in source and binary forms, with or without |     7  * Redistribution and use in source and binary forms, with or without | 
|     8  * modification, are permitted provided that the following conditions |     8  * modification, are permitted provided that the following conditions | 
|     9  * are met: |     9  * are met: | 
|    10  * |    10  * | 
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   197  |   197  | 
|   198 /** |   198 /** | 
|   199  * @constructor |   199  * @constructor | 
|   200  * @param {!Document} document |   200  * @param {!Document} document | 
|   201  * @param {boolean=} dimmed |   201  * @param {boolean=} dimmed | 
|   202  */ |   202  */ | 
|   203 WebInspector.GlassPane = function(document, dimmed) |   203 WebInspector.GlassPane = function(document, dimmed) | 
|   204 { |   204 { | 
|   205     this.element = createElement("div"); |   205     this.element = createElement("div"); | 
|   206     var background = dimmed ? "rgba(255, 255, 255, 0.5)" : "transparent"; |   206     var background = dimmed ? "rgba(255, 255, 255, 0.5)" : "transparent"; | 
|   207     this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:
      0;background-color:" + background + ";z-index:3000;overflow:hidden;"; |   207     this._zIndex = WebInspector._glassPane ? WebInspector._glassPane._zIndex + 1
      000 : 3000; // Deliberately starts with 3000 to hide other z-indexed elements be
      low. | 
 |   208     this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:
      0;background-color:" + background + ";z-index:" + this._zIndex + ";overflow:hidd
      en;"; | 
|   208     document.body.appendChild(this.element); |   209     document.body.appendChild(this.element); | 
|   209     WebInspector._glassPane = this; |   210     WebInspector._glassPane = this; | 
|   210 } |   211 } | 
|   211  |   212  | 
|   212 WebInspector.GlassPane.prototype = { |   213 WebInspector.GlassPane.prototype = { | 
|   213     dispose: function() |   214     dispose: function() | 
|   214     { |   215     { | 
|   215         delete WebInspector._glassPane; |   216         delete WebInspector._glassPane; | 
|   216         if (WebInspector.GlassPane.DefaultFocusedViewStack.length) |   217         if (WebInspector.GlassPane.DefaultFocusedViewStack.length) | 
|   217             WebInspector.GlassPane.DefaultFocusedViewStack.peekLast().focus(); |   218             WebInspector.GlassPane.DefaultFocusedViewStack.peekLast().focus(); | 
|   218         this.element.remove(); |   219         this.element.remove(); | 
|   219     } |   220     } | 
|   220 } |   221 } | 
|   221  |   222  | 
 |   223 /** @type {!WebInspector.GlassPane|undefined} */ | 
 |   224 WebInspector._glassPane; | 
 |   225  | 
|   222 /** |   226 /** | 
|   223  * @type {!Array.<!WebInspector.Widget|!WebInspector.Dialog>} |   227  * @type {!Array.<!WebInspector.Widget|!WebInspector.Dialog>} | 
|   224  */ |   228  */ | 
|   225 WebInspector.GlassPane.DefaultFocusedViewStack = []; |   229 WebInspector.GlassPane.DefaultFocusedViewStack = []; | 
|   226  |   230  | 
|   227 /** |   231 /** | 
|   228  * @param {?Node=} node |   232  * @param {?Node=} node | 
|   229  * @return {boolean} |   233  * @return {boolean} | 
|   230  */ |   234  */ | 
|   231 WebInspector.isBeingEdited = function(node) |   235 WebInspector.isBeingEdited = function(node) | 
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   764  * @param {?Node} x |   768  * @param {?Node} x | 
|   765  */ |   769  */ | 
|   766 WebInspector.setCurrentFocusElement = function(x) |   770 WebInspector.setCurrentFocusElement = function(x) | 
|   767 { |   771 { | 
|   768     if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAnces
      tor(x)) |   772     if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAnces
      tor(x)) | 
|   769         return; |   773         return; | 
|   770     if (WebInspector._currentFocusElement !== x) |   774     if (WebInspector._currentFocusElement !== x) | 
|   771         WebInspector._previousFocusElement = WebInspector._currentFocusElement; |   775         WebInspector._previousFocusElement = WebInspector._currentFocusElement; | 
|   772     WebInspector._currentFocusElement = x; |   776     WebInspector._currentFocusElement = x; | 
|   773  |   777  | 
|   774     if (WebInspector._currentFocusElement) { |   778     if (x) { | 
|   775         WebInspector._currentFocusElement.focus(); |   779         x.focus(); | 
|   776  |   780  | 
|   777         // Make a caret selection inside the new element if there isn't a range 
      selection and there isn't already a caret selection inside. |   781         // Make a caret selection inside the new element if there isn't a range 
      selection and there isn't already a caret selection inside. | 
|   778         // This is needed (at least) to remove caret from console when focus is 
      moved to some element in the panel. |   782         // This is needed (at least) to remove caret from console when focus is 
      moved to some element in the panel. | 
|   779         // The code below should not be applied to text fields and text areas, h
      ence _isTextEditingElement check. |   783         // The code below should not be applied to text fields and text areas, h
      ence _isTextEditingElement check. | 
|   780         var selection = x.getComponentSelection(); |   784         var selection = x.getComponentSelection(); | 
|   781         if (!WebInspector._isTextEditingElement(WebInspector._currentFocusElemen
      t) && selection.isCollapsed && !WebInspector._currentFocusElement.isInsertionCar
      etInside()) { |   785         if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && !
      x.isInsertionCaretInside()) { | 
|   782             var selectionRange = WebInspector._currentFocusElement.ownerDocument
      .createRange(); |   786             var selectionRange = x.ownerDocument.createRange(); | 
|   783             selectionRange.setStart(WebInspector._currentFocusElement, 0); |   787             selectionRange.setStart(x, 0); | 
|   784             selectionRange.setEnd(WebInspector._currentFocusElement, 0); |   788             selectionRange.setEnd(x, 0); | 
|   785  |   789  | 
|   786             selection.removeAllRanges(); |   790             selection.removeAllRanges(); | 
|   787             selection.addRange(selectionRange); |   791             selection.addRange(selectionRange); | 
|   788         } |   792         } | 
|   789     } else if (WebInspector._previousFocusElement) |   793     } else if (WebInspector._previousFocusElement) | 
|   790         WebInspector._previousFocusElement.blur(); |   794         WebInspector._previousFocusElement.blur(); | 
|   791 } |   795 } | 
|   792  |   796  | 
|   793 WebInspector.restoreFocusFromElement = function(element) |   797 WebInspector.restoreFocusFromElement = function(element) | 
|   794 { |   798 { | 
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1473         // Due to the nature of regex, |items| array has matched elements on its
       even indexes. |  1477         // Due to the nature of regex, |items| array has matched elements on its
       even indexes. | 
|  1474         var items = text.replace(regex, "\0$1\0").split("\0"); |  1478         var items = text.replace(regex, "\0$1\0").split("\0"); | 
|  1475         for (var i = 0; i < items.length; ++i) { |  1479         for (var i = 0; i < items.length; ++i) { | 
|  1476             var processedNode = i % 2 ? processor(items[i]) : this._runProcessor
      (processorIndex + 1, items[i]); |  1480             var processedNode = i % 2 ? processor(items[i]) : this._runProcessor
      (processorIndex + 1, items[i]); | 
|  1477             container.appendChild(processedNode); |  1481             container.appendChild(processedNode); | 
|  1478         } |  1482         } | 
|  1479  |  1483  | 
|  1480         return container; |  1484         return container; | 
|  1481     } |  1485     } | 
|  1482 } |  1486 } | 
| OLD | NEW |