Changeset 76941 in webkit


Ignore:
Timestamp:
Jan 28, 2011 7:07:09 AM (13 years ago)
Author:
apavlov@chromium.org
Message:

2011-01-28 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: [STYLES] Up/Down-suggestion breaks an existing keyword
https://bugs.webkit.org/show_bug.cgi?id=53295

Select the current word suffix before switching to the next suggestion.

  • inspector/front-end/StylesSidebarPane.js: ():
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76936 r76941  
     12011-01-28  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: [STYLES] Up/Down-suggestion breaks an existing keyword
     6        https://bugs.webkit.org/show_bug.cgi?id=53295
     7
     8        Select the current word suffix before switching to the next suggestion.
     9
     10        * inspector/front-end/StylesSidebarPane.js:
     11        ():
     12
    1132011-01-28  Alejandro G. Castro  <alex@igalia.com>
    214
  • trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js

    r76913 r76941  
    19301930        if (this.autoCompleteElement)
    19311931            this.complete(false, reverse); // Accept the current suggestion, if any.
     1932        else {
     1933            // Select the word suffix to affect it when computing the subsequent suggestion.
     1934            this._selectCurrentWordSuffix();
     1935        }
     1936
    19321937        this.complete(false, reverse); // Actually increment/decrement the suggestion.
    19331938        event.handled = true;
     1939    },
     1940
     1941    _selectCurrentWordSuffix: function()
     1942    {
     1943        var selection = window.getSelection();
     1944        if (!selection.rangeCount)
     1945            return;
     1946
     1947        var selectionRange = selection.getRangeAt(0);
     1948        if (!selectionRange.commonAncestorContainer.isDescendant(this.element))
     1949            return;
     1950        var wordSuffixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WebInspector.StylesSidebarPane.StyleValueDelimiters, this.element, "forward");
     1951        if (!wordSuffixRange.toString())
     1952            return;
     1953        selection.removeAllRanges();
     1954        selection.addRange(wordSuffixRange);
    19341955    },
    19351956
Note: See TracChangeset for help on using the changeset viewer.