Changeset 167779 in webkit


Ignore:
Timestamp:
Apr 24, 2014 3:29:16 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: CSS autofill suggests properties instead of values when values are needed
https://bugs.webkit.org/show_bug.cgi?id=132090

Patch by Jonathan Wells <jonowells@apple.com> on 2014-04-24
Reviewed by Joseph Pecoraro.

Updates are required to the CodeMirror helpers to be compatible with
CodeMirror 4. Some of those changes have been made to fix an issue
with CSS autofill, CSS code coloring, and also
https://bugs.webkit.org/show_bug.cgi?id=131859. The main issue is that
CodeMirror 4's CSS mode (css.js) stores its parsing modes in a different
data structure. All references to state.stack are obscelete. Many
are fixed here and more will be in an upcoming patch.

  • Tools/PrettyPrinting/CodeMirrorFormatters.js: Removed exception for checking state.stack properties.
  • UserInterface/Controllers/CodeMirrorCompletionController.js:

(WebInspector.CodeMirrorCompletionController.prototype._generateCSSCompletions): Corrected "block" state detection.

  • UserInterface/External/CodeMirror/less.js: Removed.
  • UserInterface/Views/CodeMirrorAdditions.js: Sets default state of "block" correctly.
  • UserInterface/Views/CodeMirrorFormatters.js: Removed exception for checking state.stack properties.
  • UserInterface/Views/SyntaxHighlightingDefaultTheme.css: Fix styles to match CSS mode changes.
Location:
trunk/Source/WebInspectorUI
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r167756 r167779  
     12014-04-24  Jonathan Wells  <jonowells@apple.com>
     2
     3        Web Inspector: CSS autofill suggests properties instead of values when values are needed
     4        https://bugs.webkit.org/show_bug.cgi?id=132090
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Updates are required to the CodeMirror helpers to be compatible with
     9        CodeMirror 4. Some of those changes have been made to fix an issue
     10        with CSS autofill, CSS code coloring, and also
     11        https://bugs.webkit.org/show_bug.cgi?id=131859. The main issue is that
     12        CodeMirror 4's CSS mode (css.js) stores its parsing modes in a different
     13        data structure. All references to state.stack are obscelete. Many
     14        are fixed here and more will be in an upcoming patch.
     15
     16        * Tools/PrettyPrinting/CodeMirrorFormatters.js: Removed exception for checking state.stack properties.
     17        * UserInterface/Controllers/CodeMirrorCompletionController.js:
     18        (WebInspector.CodeMirrorCompletionController.prototype._generateCSSCompletions): Corrected "block" state detection.
     19        * UserInterface/External/CodeMirror/less.js: Removed.
     20        * UserInterface/Views/CodeMirrorAdditions.js: Sets default state of "block" correctly.
     21        * UserInterface/Views/CodeMirrorFormatters.js: Removed exception for checking state.stack properties.
     22        * UserInterface/Views/SyntaxHighlightingDefaultTheme.css: Fix styles to match CSS mode changes.
     23
    1242014-04-24  Antoine Quint  <graouts@webkit.org>
    225
     
    307330        * UserInterface/Models/DOMNode.js:
    308331        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
    309         * UserInterface/Views/Main.css: 
     332        * UserInterface/Views/Main.css:
    310333
    3113342014-03-28  Joseph Pecoraro  <pecoraro@apple.com>
     
    859882        * UserInterface/Views/DataGrid.js:
    860883        (WebInspector.DataGrid.prototype.removeChild):
    861         Add missing semicolon.       
     884        Add missing semicolon.
    862885
    8638862014-03-12  Brian Burg  <bburg@apple.com>
     
    20502073        sizing information as a string and parse only the gradient stops as the sizing information is only useful to show
    20512074        in an editor if attached to an element with metrics.
    2052        
     2075
    20532076        Since instances of Gradient are used as the .value property of CodeMirrorGradientEditingController, we implement
    20542077        the required .copy() and .toString() methods. The .toString() implementations are aware of default values for angles
     
    21962219        New class meant to be subclassed by any future editing controller, and already subclassed by
    21972220        CodeMirrorColorEditingController. This class exposes several hooks for subclasses to customize its behavior:
    2198        
     2221
    21992222        .initialValue: a value we can revert to if the editing is canceled
    22002223        .cssClassName: a CSS class name that can be added to the editing controller's container
     
    22052228        being added to the DOM and setting of the necessary machinery to update the serialized value in the editor based on interaction
    22062229        within the popover without changing the serialized value upon showing the popover the very first time.
    2207        
     2230
    22082231        Additionally, the .value property must be an object supporting .toString() and .copy() method.
    22092232
    22102233        Finally, the .editingControllerDidStartEditing() and .editingControllerDidFinishEditing() delegate methods are fired
    2211         as editing begins and finishes. 
     2234        as editing begins and finishes.
    22122235
    22132236        (WebInspector.CodeMirrorEditingController):
     
    22542277        We remove the assumption that a HoverMenu is only used to draw a single rounded rect based on a simple
    22552278        Rect and instead support presentation based on an array of Rects where we either:
    2256        
     2279
    22572280        - draw a single rounded rectangle if there is only a single Rect provided
    22582281        - draw two disconnected open-ended rects if we're provided with two non-overlapping Rects
     
    25512574        Reviewed by Timothy Hatcher.
    25522575
    2553         Add a RuntimeManager event that the scope chain details sidebar can 
     2576        Add a RuntimeManager event that the scope chain details sidebar can
    25542577        listen to to trigger refresh.
    25552578
     
    41904213        * UserInterface/DebuggerSidebarPanel.js:
    41914214        (WebInspector.DebuggerSidebarPanel.prototype.restoreStateFromCookie):
    4192         Drive-by fix to pass along relaxedMatchDelay to the superclass. 
     4215        Drive-by fix to pass along relaxedMatchDelay to the superclass.
    41934216
    41944217        * UserInterface/Main.js:
     
    53885411        WebInspector.TextMarker. Additionally, create a WebInspector.TextMarker with type
    53895412        WebInspector.TextMarker.Type.Color in createColorMarkers().
    5390        
     5413
    53915414        * UserInterface/CodeMirrorColorEditingController.js:
    53925415        (WebInspector.CodeMirrorColorEditingController):
     
    57475770        {
    57485771             "regionFlow": <Reference to the ContentFlow object referenced by the -webkit-flow-from property of the node>,
    5749              "contentFlow": <Reference to the ContentFlow object referenced by the -webkit-flow-into property of 
     5772             "contentFlow": <Reference to the ContentFlow object referenced by the -webkit-flow-into property of
    57505773                             the node or a parent of the node>,
    57515774             "regions": [ list of DOMNodes representing the regions containers of the node. The node is split across all these regions. ]
     
    61736196        Automatically dispatch a contextmenu event in case WebInspector.ContextMenu.prototype.show()
    61746197        is called outside of a contextmenu event handler and would therefore not show the expected
    6175         context menu (except in the Remote Web Inspector where this already works). 
     6198        context menu (except in the Remote Web Inspector where this already works).
    61766199
    61776200        * UserInterface/ContextMenu.js:
     
    64266449        shrink the popover instead of shifting it to fit within the container frame. We now first
    64276450        shift the preferred frame before getting its intersection with the container frame to
    6428         avoid such situations. 
     6451        avoid such situations.
    64296452
    64306453        * UserInterface/Popover.js:
     
    659566182013-11-06  Timothy Hatcher  <timothy@apple.com>
    65966619
    6597         Fix the display of query parameters when the value is missing. 
     6620        Fix the display of query parameters when the value is missing.
    65986621
    65996622        https://bugs.webkit.org/show_bug.cgi?id=123920
     
    68226845        Reviewed by Timothy Hatcher.
    68236846
    6824         Moved some global functions out of Main.js, so that they can be used in the 
     6847        Moved some global functions out of Main.js, so that they can be used in the
    68256848        layout tests without including Main.js.
    68266849
     
    72247247        when either the Cmd key is pressed (NonSymbolTokens mode) or when the debugger is paused
    72257248        (JavaScriptExpression mode).
    7226        
     7249
    72277250        The tokenTrackingController is now smarter about how it tracks mouse events when it's enabled,
    72287251        tracking "mouseenter" and "mouseleave" events to enable tracking allowing immediate detection of
  • trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js

    r155659 r167779  
    338338                return 1;
    339339            if (content === ",") { // "a,b,c,...,z{}" rule list at top level or in @media top level and only if the line length will be large.
    340                 if ((!state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) {
     340                if ((!state.stack || !state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) {
    341341                    state._cssPrettyPrint.lineLength = 0;
    342342                    return 1;
     
    396396        // This isn't exact line length, only the builder knows that, but it is good enough to get an idea.
    397397        // If we are at a top level, keep track of the current line length, otherwise we reset to 0.
    398         if (!state.stack.length || state.stack.lastValue === "@media{")
     398        if (!state.stack || !state.stack.length || state.stack.lastValue === "@media{")
    399399            state._cssPrettyPrint.lineLength += content.length;
    400400        else
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js

    r164543 r167779  
    519519    _generateCSSCompletions: function(mainToken, base, suffix)
    520520    {
    521         // We only support completion inside CSS rules.
    522         if (!mainToken.state || !mainToken.state.stack || !mainToken.state.stack.contains("rule"))
     521        // We only support completion inside CSS block context.
     522        if (!mainToken.state || !mainToken.state.state || !mainToken.state.state === "block")
    523523            return [];
    524524
     
    527527
    528528        // Scan backwards looking for the current property.
    529         while (token.state.stack.lastValue === "propertyValue") {
     529        while (token.state.state === "prop") {
    530530            // Found the beginning of the line. Go to the previous line.
    531531            if (!token.start) {
  • trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js

    r164543 r167779  
    234234        var state = this._startState(base);
    235235
    236         // Start the stack off like it has already parsed a rule. This causes everything
     236        // Start off the state stack like it has already parsed a rule. This causes everything
    237237        // after to be parsed as properties in a rule.
    238         state.stack = ["rule"];
     238        state.state = "block";
     239        state.context.type = "block";
    239240
    240241        return state;
  • trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js

    r164543 r167779  
    338338                return 1;
    339339            if (content === ",") { // "a,b,c,...,z{}" rule list at top level or in @media top level and only if the line length will be large.
    340                 if ((!state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) {
     340                if ((!state.stack || !state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) {
    341341                    state._cssPrettyPrint.lineLength = 0;
    342342                    return 1;
     
    396396        // This isn't exact line length, only the builder knows that, but it is good enough to get an idea.
    397397        // If we are at a top level, keep track of the current line length, otherwise we reset to 0.
    398         if (!state.stack.length || state.stack.lastValue === "@media{")
     398        if (!state.stack || !state.stack.length || state.stack.lastValue === "@media{")
    399399            state._cssPrettyPrint.lineLength += content.length;
    400400        else
  • trunk/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingDefaultTheme.css

    r167294 r167779  
    4646.cm-s-default .cm-atom,
    4747.cm-s-default .cm-keyword,
    48 .cm-s-default .cm-m-css.cm-tag,
     48.cm-s-default .cm-m-css.cm-atom,
    4949.cm-s-default .cm-m-css.cm-meta,
    5050.cm-s-default .cm-m-css.cm-variable-3,
     51.cm-s-default .cm-m-css.cm-property,
    5152.cm-s-default .cm-m-javascript.cm-builtin,
    5253.syntax-highlighted .css-keyword,
     
    6061
    6162.cm-s-default .cm-number,
    62 .cm-s-default .cm-m-css.cm-atom,
    6363.syntax-highlighted .css-number,
    6464.syntax-highlighted .javascript-number {
     
    6969.cm-s-default .cm-bracket,
    7070.cm-s-default .cm-operator,
    71 .cm-s-default .cm-qualifier,
    7271.cm-s-default .cm-variable,
    7372.cm-s-default .cm-variable-2,
     73.cm-s-default .cm-m-css.cm-tag,
    7474.cm-s-default .cm-m-css.cm-string-2,
    7575.cm-s-default .cm-m-css.cm-builtin,
    76 .cm-s-default .cm-m-css.cm-property,
     76.cm-s-default .cm-m-css.cm-qualifier,
    7777.syntax-highlighted .css-property,
    7878.syntax-highlighted .css-selector,
Note: See TracChangeset for help on using the changeset viewer.