Changeset 83951 in webkit


Ignore:
Timestamp:
Apr 14, 2011 11:29:40 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-14 Andrey Adaikin <aandrey@google.com>

Reviewed by Pavel Feldman.

Web Inspector: Ctrl+Left/Right switch panels during live editing
https://bugs.webkit.org/show_bug.cgi?id=58521

Disable Ctrl+Left/Right keyboard shortcuts while in live edit.

  • inspector/front-end/SourceFrame.js: (WebInspector.SourceFrame.prototype.readOnlyStateChanged):
  • inspector/front-end/TextViewer.js: (WebInspector.TextViewer.prototype.set readOnly): (WebInspector.TextViewer.prototype.get readOnly): (WebInspector.TextViewer.prototype._doubleClick): (WebInspector.TextViewer.prototype._commitEditing.didCommitEditing): (WebInspector.TextViewer.prototype._commitEditing): (WebInspector.TextViewer.prototype._cancelEditing): (WebInspector.TextViewerDelegate.prototype.readOnlyStateChanged): (WebInspector.TextEditorMainPanel.prototype.set readOnly):
  • inspector/front-end/inspector.js: (WebInspector.markBeingEdited): (WebInspector.isEditingAnyField): (WebInspector.startEditing.cleanUpAfterEditing):
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83950 r83951  
     12011-04-14  Andrey Adaikin  <aandrey@google.com>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Ctrl+Left/Right switch panels during live editing
     6        https://bugs.webkit.org/show_bug.cgi?id=58521
     7
     8        Disable Ctrl+Left/Right keyboard shortcuts while in live edit.
     9
     10        * inspector/front-end/SourceFrame.js:
     11        (WebInspector.SourceFrame.prototype.readOnlyStateChanged):
     12        * inspector/front-end/TextViewer.js:
     13        (WebInspector.TextViewer.prototype.set readOnly):
     14        (WebInspector.TextViewer.prototype.get readOnly):
     15        (WebInspector.TextViewer.prototype._doubleClick):
     16        (WebInspector.TextViewer.prototype._commitEditing.didCommitEditing):
     17        (WebInspector.TextViewer.prototype._commitEditing):
     18        (WebInspector.TextViewer.prototype._cancelEditing):
     19        (WebInspector.TextViewerDelegate.prototype.readOnlyStateChanged):
     20        (WebInspector.TextEditorMainPanel.prototype.set readOnly):
     21        * inspector/front-end/inspector.js:
     22        (WebInspector.markBeingEdited):
     23        (WebInspector.isEditingAnyField):
     24        (WebInspector.startEditing.cleanUpAfterEditing):
     25
    1262011-04-14  Vsevolod Vlasov  <vsevik@chromium.org>
    227
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r83843 r83951  
    239239    },
    240240
     241    readOnlyStateChanged: function(readOnly)
     242    {
     243        WebInspector.markBeingEdited(this._textViewer.element, !readOnly);
     244    },
     245
    241246    startEditing: function()
    242247    {
  • trunk/Source/WebCore/inspector/front-end/TextViewer.js

    r83725 r83951  
    6767    },
    6868
     69    set readOnly(readOnly)
     70    {
     71        if (this._mainPanel.readOnly === readOnly)
     72            return;
     73        this._mainPanel.readOnly = readOnly;
     74        this._delegate.readOnlyStateChanged(readOnly);
     75    },
     76
     77    get readOnly()
     78    {
     79        return this._mainPanel.readOnly;
     80    },
     81
    6982    get textModel()
    7083    {
     
    215228    _doubleClick: function(event)
    216229    {
    217         if (!this._mainPanel.readOnly || this._commitEditingInProgress)
     230        if (!this.readOnly || this._commitEditingInProgress)
    218231            return;
    219232
     
    225238            return;
    226239
    227         this._mainPanel.readOnly = false;
     240        this.readOnly = false;
    228241        window.getSelection().collapseToStart();
    229242    },
     
    259272    _commitEditing: function()
    260273    {
    261         if (this._mainPanel.readOnly)
     274        if (this.readOnly)
    262275            return false;
    263276
    264         this._mainPanel.readOnly = true;
     277        this.readOnly = true;
    265278        function didCommitEditing(error)
    266279        {
    267280            this._commitEditingInProgress = false;
    268281            if (error)
    269                 this._mainPanel.readOnly = false;
     282                this.readOnly = false;
    270283        }
    271284        this._commitEditingInProgress = true;
     
    276289    _cancelEditing: function()
    277290    {
    278         if (this._mainPanel.readOnly)
     291        if (this.readOnly)
    279292            return false;
    280293
    281         this._mainPanel.readOnly = true;
     294        this.readOnly = true;
    282295        this._delegate.cancelEditing();
    283296        return true;
     
    298311WebInspector.TextViewerDelegate.prototype = {
    299312    isContentEditable: function()
     313    {
     314        // Should be implemented by subclasses.
     315    },
     316
     317    readOnlyStateChanged: function(readOnly)
    300318    {
    301319        // Should be implemented by subclasses.
     
    836854    set readOnly(readOnly)
    837855    {
     856        if (this._readOnly === readOnly)
     857            return;
     858
    838859        this.beginDomUpdates();
    839860        this._readOnly = readOnly;
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r83864 r83951  
    14331433}
    14341434
     1435WebInspector.markBeingEdited = function(element, value)
     1436{
     1437    if (value) {
     1438        if (element.__editing)
     1439            return false;
     1440        element.__editing = true;
     1441        WebInspector.__editingCount = (WebInspector.__editingCount || 0) + 1;
     1442    } else {
     1443        if (!element.__editing)
     1444            return false;
     1445        delete element.__editing;
     1446        --WebInspector.__editingCount;
     1447    }
     1448    return true;
     1449}
     1450
    14351451WebInspector.isEditingAnyField = function()
    14361452{
    1437     return this.__editing;
     1453    return !!WebInspector.__editingCount;
    14381454}
    14391455
     
    14471463WebInspector.startEditing = function(element, config)
    14481464{
    1449     if (element.__editing)
     1465    if (!WebInspector.markBeingEdited(element, true))
    14501466        return;
    1451     element.__editing = true;
    1452     WebInspector.__editing = true;
    14531467
    14541468    config = config || {};
     
    14781492
    14791493    function cleanUpAfterEditing() {
    1480         delete this.__editing;
    1481         delete WebInspector.__editing;
     1494        WebInspector.markBeingEdited(element, false);
    14821495
    14831496        this.removeStyleClass("editing");
Note: See TracChangeset for help on using the changeset viewer.