Changeset 213187 in webkit


Ignore:
Timestamp:
Feb 28, 2017 3:33:55 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: CSS variable uses that are unresolved should have an error or warning icon
https://bugs.webkit.org/show_bug.cgi?id=168352

Patch by Devin Rousso <Devin Rousso> on 2017-02-28
Reviewed by Brian Burg.

  • Localizations/en.lproj/localizedStrings.js:
  • UserInterface/Views/CSSStyleDeclarationTextEditor.js:

(WebInspector.CSSStyleDeclarationTextEditor.prototype._createInlineSwatches.update):
Insert a warning icon if the variable is not found in the computed style.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r213004 r213187  
     12017-02-28  Devin Rousso  <dcrousso+webkit@gmail.com>
     2
     3        Web Inspector: CSS variable uses that are unresolved should have an error or warning icon
     4        https://bugs.webkit.org/show_bug.cgi?id=168352
     5
     6        Reviewed by Brian Burg.
     7
     8        * Localizations/en.lproj/localizedStrings.js:
     9
     10        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
     11        (WebInspector.CSSStyleDeclarationTextEditor.prototype._createInlineSwatches.update):
     12        Insert a warning icon if the variable is not found in the computed style.
     13
    1142017-02-25  Devin Rousso  <dcrousso+webkit@gmail.com>
    215
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r212702 r213187  
    774774localizedStrings["The value “%s” is not supported for this property.\nClick to delete and open autocomplete."] = "The value “%s” is not supported for this property.\nClick to delete and open autocomplete.";
    775775localizedStrings["The value “%s” needs units.\nClick to add “px” to the value."] = "The value “%s” needs units.\nClick to add “px” to the value.";
     776localizedStrings["The variable “%s” does not exist.\nClick to delete and open autocomplete."] = "The variable “%s” does not exist.\nClick to delete and open autocomplete.";
    776777localizedStrings["The “%s”\ntable is empty."] = "The “%s”\ntable is empty.";
    777778localizedStrings["The “webkit” prefix is needed for this property.\nClick to insert a duplicate with the prefix."] = "The “webkit” prefix is needed for this property.\nClick to insert a duplicate with the prefix.";
  • trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js

    r212761 r213187  
    901901                const dontCreateIfMissing = true;
    902902                let variableProperty = this._style.nodeStyles.computedStyle.propertyForName(variableString, dontCreateIfMissing);
    903                 if (!variableProperty)
     903                if (!variableProperty) {
     904                    let from = {line: marker.range.startLine, ch: marker.range.startColumn};
     905                    let to = {line: marker.range.endLine, ch: marker.range.endColumn};
     906                    this._codeMirror.markText(from, to, {className: "invalid"});
     907
     908                    let invalidMarker = document.createElement("button");
     909                    invalidMarker.classList.add("invalid-warning-marker", "clickable");
     910                    invalidMarker.title = WebInspector.UIString("The variable “%s” does not exist.\nClick to delete and open autocomplete.").format(variableString);
     911                    invalidMarker.addEventListener("click", (event) => {
     912                        this._codeMirror.replaceRange("", from, to);
     913                        this._codeMirror.setCursor(from);
     914                        this._completionController.completeAtCurrentPositionIfNeeded(true);
     915                    });
     916                    this._codeMirror.setBookmark(from, invalidMarker);
    904917                    return;
     918                }
    905919
    906920                let trimmedValue = variableProperty.value.trim();
Note: See TracChangeset for help on using the changeset viewer.