Changeset 61506 in webkit


Ignore:
Timestamp:
Jun 20, 2010 10:02:12 AM (14 years ago)
Author:
Joseph Pecoraro
Message:

2010-06-20 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Timothy Hatcher.

Web Inspector: Should Autocomplete Style Properties
https://bugs.webkit.org/show_bug.cgi?id=38448

This Autocompletes style properties when in the console.

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

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r61505 r61506  
     12010-06-20  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: Should Autocomplete Style Properties
     6        https://bugs.webkit.org/show_bug.cgi?id=38448
     7
     8        This Autocompletes style properties when in the console.
     9
     10        * inspector/front-end/InjectedScript.js:
     11        (injectedScriptConstructor):
     12
    1132010-06-20  Robert Hogan  <robert@webkit.org>
    214
  • trunk/WebCore/inspector/front-end/InjectedScript.js

    r61317 r61506  
    231231}
    232232
     233// Automatically generate the list of CSS properties, and convert
     234// them to their JavaScript accessible form.
     235InjectedScript._hiddenStyleProperties = (function() {
     236    var properties = [];
     237
     238    var keywords = window.getComputedStyle(document.documentElement);
     239    for (var i = 0, len = keywords.length; i < len; ++i) {
     240        // Strip leading hyphen from "-vendor" properties.
     241        var property = keywords[i];
     242        if (property.charAt(0) === "-")
     243            property = property.substring(1);
     244
     245        // Turn hypens points into camel case points.
     246        properties[i] = property.replace(/\-./g, function(match) {
     247            return match.charAt(1).toUpperCase();
     248        });
     249    }
     250
     251    return properties;
     252})();
     253
     254InjectedScript._addHiddenStyleProperties = function(resultSet)
     255{
     256    var hiddenStyleProperties = InjectedScript._hiddenStyleProperties;
     257    for (var i = 0, length = hiddenStyleProperties.length; i < length; ++i)
     258        resultSet[hiddenStyleProperties[i]] = true;
     259}
     260
    233261InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI, callFrameId)
    234262{
     
    254282            expressionResult = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false);
    255283        }
    256         if (typeof expressionResult == "object")
     284
     285        if (typeof expressionResult === "object") {
    257286            InjectedScript._populatePropertyNames(expressionResult, props);
     287            if (expressionResult.constructor === inspectedWindow.document.documentElement.style.constructor)
     288                InjectedScript._addHiddenStyleProperties(props);
     289        }
    258290
    259291        if (includeInspectorCommandLineAPI) {
Note: See TracChangeset for help on using the changeset viewer.