⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 109348 in webkit


Ignore:
Timestamp:
Mar 1, 2012, 8:16:54 AM (15 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: hide color picker on Esc and Enter.
​https://bugs.webkit.org/show_bug.cgi?id=79915

Reviewed by Vsevolod Vlasov.

  • inspector/front-end/Spectrum.js:

(WebInspector.Spectrum.prototype.reposition):
(WebInspector.Spectrum.prototype.hide):
(WebInspector.Spectrum.prototype._onKeyDown):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109347 r109348  
     12012-03-01  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: hide color picker on Esc and Enter.
     4        https://bugs.webkit.org/show_bug.cgi?id=79915
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        * inspector/front-end/Spectrum.js:
     9        (WebInspector.Spectrum.prototype.reposition):
     10        (WebInspector.Spectrum.prototype.hide):
     11        (WebInspector.Spectrum.prototype._onKeyDown):
     12
    1132012-03-01  Huang Dongsung  <luxtella@company100.net>
    214
  • trunk/Source/WebCore/inspector/front-end/PropertiesSection.js

    r96816 r109348  
    4040    this.propertiesElement = document.createElement("ol");
    4141    this.propertiesElement.className = "properties properties-tree monospace";
    42     this.propertiesElement.tabIndex = 0;
    43     this.propertiesTreeOutline = new TreeOutline(this.propertiesElement);
     42    this.propertiesTreeOutline = new TreeOutline(this.propertiesElement, true);
     43    this.propertiesTreeOutline.setFocusable(false);
    4444    this.propertiesTreeOutline.section = this;
    4545
  • trunk/Source/WebCore/inspector/front-end/Spectrum.js

    r108734 r109348  
    3939    this._containerElement = document.createElement('div');
    4040    this._containerElement.className = "spectrum-container";
     41    this._containerElement.tabIndex = 0;
     42    this._containerElement.addEventListener("keydown", this._onKeyDown.bind(this), false);
    4143
    4244    var topElement = this._containerElement.createChild("div", "spectrum-top");
    … …  
    406408    reposition: function(element)
    407409    {
     410        if (!this._previousFocusElement)
     411            this._previousFocusElement = WebInspector.currentFocusElement();
    408412        this._popover.show(this._containerElement, element);
     413        WebInspector.markBeingEdited(this._containerElement, true);   
     414        WebInspector.setCurrentFocusElement(this._containerElement);
    409415    },
    410416
    411417    hide: function()
    412418    {
     419        WebInspector.markBeingEdited(this._containerElement, false);
    413420        this._popover.hide();
    414421
    … …  
    418425        this.dispatchEventToListeners(WebInspector.Spectrum.Events.Hidden);
    419426
     427        WebInspector.setCurrentFocusElement(this._previousFocusElement);
     428        delete this._previousFocusElement;
     429
    420430        delete this.anchorElement;
    421     }
    422 };
     431    },
     432
     433    _onKeyDown: function(event)
     434    {
     435        if (event.keyIdentifier === "Enter" || event.keyIdentifier === "U+001B") { // Escape key
     436            this.hide();
     437            event.stopPropagation();
     438            event.preventDefault();
     439        }
     440    }
     441}
    423442
    424443WebInspector.Spectrum.prototype.__proto__ = WebInspector.Object.prototype;
  • trunk/Source/WebCore/inspector/front-end/treeoutline.js

    r107933 r109348  
    2929/**
    3030 * @constructor
     31 * @param {boolean=} nonFocusable
    3132 */
    32 function TreeOutline(listNode)
     33function TreeOutline(listNode, nonFocusable)
    3334{
    3435    /**
    … …  
    4950    this.searchInputElement = null;
    5051
    51     this._childrenListNode.tabIndex = 0;
     52    this.setFocusable(!nonFocusable);
    5253    this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
    5354    this._childrenListNode.addEventListener("keypress", this._treeKeyPress.bind(this), true);
    … …  
    5556    this._treeElementsMap = new Map();
    5657    this._expandedStateMap = new Map();
     58}
     59
     60TreeOutline.prototype.setFocusable = function(focusable)
     61{
     62    if (focusable)
     63        this._childrenListNode.setAttribute("tabIndex", 0);
     64    else
     65        this._childrenListNode.removeAttribute("tabIndex");
    5766}
    5867
Note: See TracChangeset for help on using the changeset viewer.