Changeset 65905 in webkit


Ignore:
Timestamp:
Aug 24, 2010 9:15:46 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-08-24 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: Trace to the style that contributes to
the computed styles panel.
https://bugs.webkit.org/show_bug.cgi?id=44448

Test: inspector/styles-computed-trace.html

  • English.lproj/localizedStrings.js:
  • inspector/front-end/Section.js: (WebInspector.Section.prototype.set subtitle): (WebInspector.Section.prototype.get subtitleAsTextForTest):
  • inspector/front-end/StylesSidebarPane.js: (WebInspector.StylesSidebarPane.prototype._refreshUpdate): (WebInspector.StylesSidebarPane.prototype._rebuildUpdate): (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules): (WebInspector.StylesSidebarPane.prototype._refreshSectionsForStyleRules): (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules): (WebInspector.StylePropertiesSection.linkifyUncopyable): (WebInspector.StylePropertiesSection): (WebInspector.StylePropertiesSection.prototype.isPropertyInherited): (WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded): (WebInspector.StylePropertiesSection.prototype.isPropertyDisabled): (WebInspector.StylePropertiesSection.prototype.update): (WebInspector.StylePropertiesSection.prototype.onpopulate): (WebInspector.ComputedStylePropertiesSection): (WebInspector.ComputedStylePropertiesSection.prototype.collapse): (WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited): (WebInspector.ComputedStylePropertiesSection.prototype.update): (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate): (WebInspector.ComputedStylePropertiesSection.prototype.rebuildComputedTrace): (WebInspector.BlankStylePropertiesSection):
  • inspector/front-end/inspector.css: (.styles-section a::before):
  • inspector/front-end/inspector.js: (WebInspector.documentClick.followLink): (WebInspector.documentClick): (WebInspector.linkifyResourceAsNode):

2010-08-24 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: Trace to the style that contributes to
the computed styles panel.
https://bugs.webkit.org/show_bug.cgi?id=44448

  • inspector/elements-panel-styles-expected.txt:
  • inspector/elements-tests.js: (frontend_getSelectedElementStyles): (frontend_dumpStyleTreeItem):
  • inspector/styles-computed-trace-expected.txt: Added.
  • inspector/styles-computed-trace.html: Added.
  • inspector/styles-disable-inherited-expected.txt:
  • inspector/styles-disable-inherited.html:
  • inspector/styles-disable-then-delete-expected.txt:
  • inspector/styles-source-lines-inline-expected.txt:
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65903 r65905  
     12010-08-24  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: Trace to the style that contributes to
     6        the computed styles panel.
     7        https://bugs.webkit.org/show_bug.cgi?id=44448
     8
     9        * inspector/elements-panel-styles-expected.txt:
     10        * inspector/elements-tests.js:
     11        (frontend_getSelectedElementStyles):
     12        (frontend_dumpStyleTreeItem):
     13        * inspector/styles-computed-trace-expected.txt: Added.
     14        * inspector/styles-computed-trace.html: Added.
     15        * inspector/styles-disable-inherited-expected.txt:
     16        * inspector/styles-disable-inherited.html:
     17        * inspector/styles-disable-then-delete-expected.txt:
     18        * inspector/styles-source-lines-inline-expected.txt:
     19
    1202010-08-24  Csaba Osztrogonác  <ossy@webkit.org>
    221
  • trunk/LayoutTests/inspector/elements-panel-styles-expected.txt

    r61010 r65905  
    33[expanded]  ()
    44color: blue;
     5    .foo, .foo::before - blue resources/elements-panel-styles.css:15
     6    /-- overloaded --/ .foo - black resources/elements-panel-styles.css:10
    57display: none;
     8    element.style - none
     9    /-- overloaded --/ div - block user agent stylesheet
    610font-family: serif;
     11    #container - serif resources/elements-panel-styles.css:5
    712font-size: 14px;
    8 height: auto;
     13    #container - 14px resources/elements-panel-styles.css:5
     14    /-- overloaded --/ body - 12px resources/elements-panel-styles.css:1
    915margin-bottom: 2px;
     16    .foo - 2px resources/elements-panel-styles.css:10
    1017margin-left: 0px;
     18    .foo - 0px resources/elements-panel-styles.css:10
    1119margin-right: 0px;
     20    .foo - 0px resources/elements-panel-styles.css:10
    1221margin-top: 10px;
    13 width: auto;
     22    .foo - 10px resources/elements-panel-styles.css:10
    1423
    15 [expanded] element.style { (element’s “style” attribute)
     24[expanded] element.style { ()
    1625display: none;
    1726
  • trunk/LayoutTests/inspector/elements-tests.js

    r62630 r65905  
    6161            if (section.element.previousSibling && section.element.previousSibling.className === "styles-sidebar-separator")
    6262                result.push("======== " + section.element.previousSibling.textContent + " ========");
    63             result.push((section.expanded ? "[expanded] " : "[collapsed] ") + section.titleElement.textContent + " (" + section.subtitleAsText + ")");
     63            result.push((section.expanded ? "[expanded] " : "[collapsed] ") + section.titleElement.textContent + " (" + section.subtitleAsTextForTest + ")");
    6464            section.expand();
    6565            frontend_dumpStyleTreeOutline(section.propertiesTreeOutline, result);
     
    9393function frontend_dumpStyleTreeItem(treeItem, result, prefix)
    9494{
     95    // Filter out width and height properties in order to minimize
     96    // potential diffs.
     97    if (!treeItem.listItemElement.textContent.indexOf("width") ||
     98        !treeItem.listItemElement.textContent.indexOf("height"))
     99        return;
     100
    95101    if (treeItem.listItemElement.hasStyleClass("inherited"))
    96102        return;
     
    100106    if (treeItem.listItemElement.hasStyleClass("disabled"))
    101107        typePrefix += "/-- disabled --/ ";
    102     result.push(prefix + typePrefix + treeItem.listItemElement.textContent);
     108    var textContent = treeItem.listItemElement.textContent;
     109
     110    // Add non-selectable url text.
     111    var textData = treeItem.listItemElement.querySelector("[data-uncopyable]");
     112    if (textData)
     113        textContent += textData.getAttribute("data-uncopyable");
     114
     115    result.push(prefix + typePrefix + textContent);
    103116    treeItem.expand();
    104117    var children = treeItem.children;
  • trunk/LayoutTests/inspector/styles-disable-inherited-expected.txt

    r59243 r65905  
    22
    33Before disable
    4 [expanded] element.style { (element’s “style” attribute)
     4[expanded] element.style { ()
    55
    66======== Matched CSS Rules ========
     
    99
    1010======== Inherited from div#container ========
    11 [expanded] Style Attribute { (element’s “style” attribute)
     11[expanded] Style Attribute { ()
    1212font-weight: bold;
    1313
    1414
    1515After disable:
    16 [expanded] element.style { (element’s “style” attribute)
     16[expanded] element.style { ()
    1717
    1818======== Matched CSS Rules ========
  • trunk/LayoutTests/inspector/styles-disable-inherited.html

    r59381 r65905  
    5050        testController.results.push("After disable:");
    5151        testController.results = testController.results.concat(frontend_getSelectedElementStyles(true));
    52         testController.notifyDone(window.__result);
     52        testController.notifyDone(testController.results);
    5353    }
    5454    frontend_selectElementAndRun(testController, "nested", reportResults);
  • trunk/LayoutTests/inspector/styles-disable-then-delete-expected.txt

    r59381 r65905  
    22
    33Before disable
    4 [expanded] element.style { (element’s “style” attribute)
     4[expanded] element.style { ()
    55font-weight: bold;
    66
    77
    88After disable
    9 [expanded] element.style { (element’s “style” attribute)
     9[expanded] element.style { ()
    1010/-- overloaded --/ /-- disabled --/ font-weight: bold;
    1111
    1212
    1313After delete
    14 [expanded] element.style { (element’s “style” attribute)
     14[expanded] element.style { ()
    1515
    1616
  • trunk/LayoutTests/inspector/styles-source-lines-inline-expected.txt

    r62630 r65905  
    22
    33
    4 [expanded] element.style { (element’s “style” attribute)
     4[expanded] element.style { ()
    55display: none;
    66
     
    1313
    1414
    15 [expanded] element.style { (element’s “style” attribute)
     15[expanded] element.style { ()
    1616
    1717======== Matched CSS Rules ========
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r65884 r65905  
    31343134//BUG41968 LINUX WIN : svg/hittest/svg-rect-hit.html = TEXT
    31353135
    3136 BUGWK43720 WIN : http/tests/inspector-enabled/console-log-before-frame-navigation.html = TEXT
    3137 
    31383136// Failure caused by r64749
    31393137BUGSATISH: fast/speech/input-text-speechbutton.html = TIMEOUT
  • trunk/WebCore/ChangeLog

    r65904 r65905  
     12010-08-24  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: Trace to the style that contributes to
     6        the computed styles panel.
     7        https://bugs.webkit.org/show_bug.cgi?id=44448
     8
     9        Test: inspector/styles-computed-trace.html
     10
     11        * English.lproj/localizedStrings.js:
     12        * inspector/front-end/Section.js:
     13        (WebInspector.Section.prototype.set subtitle):
     14        (WebInspector.Section.prototype.get subtitleAsTextForTest):
     15        * inspector/front-end/StylesSidebarPane.js:
     16        (WebInspector.StylesSidebarPane.prototype._refreshUpdate):
     17        (WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
     18        (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
     19        (WebInspector.StylesSidebarPane.prototype._refreshSectionsForStyleRules):
     20        (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
     21        (WebInspector.StylePropertiesSection.linkifyUncopyable):
     22        (WebInspector.StylePropertiesSection):
     23        (WebInspector.StylePropertiesSection.prototype.isPropertyInherited):
     24        (WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded):
     25        (WebInspector.StylePropertiesSection.prototype.isPropertyDisabled):
     26        (WebInspector.StylePropertiesSection.prototype.update):
     27        (WebInspector.StylePropertiesSection.prototype.onpopulate):
     28        (WebInspector.ComputedStylePropertiesSection):
     29        (WebInspector.ComputedStylePropertiesSection.prototype.collapse):
     30        (WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited):
     31        (WebInspector.ComputedStylePropertiesSection.prototype.update):
     32        (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
     33        (WebInspector.ComputedStylePropertiesSection.prototype.rebuildComputedTrace):
     34        (WebInspector.BlankStylePropertiesSection):
     35        * inspector/front-end/inspector.css:
     36        (.styles-section a::before):
     37        * inspector/front-end/inspector.js:
     38        (WebInspector.documentClick.followLink):
     39        (WebInspector.documentClick):
     40        (WebInspector.linkifyResourceAsNode):
     41
    1422010-08-24  Daniel Cheng  <dcheng@chromium.org>
    243
  • trunk/WebCore/inspector/front-end/Section.js

    r61494 r65905  
    8383            return;
    8484        this._subtitle = x;
    85         this.subtitleElement.setAttribute("data-uncopyable", x);
     85        this.subtitleElement.textContent = x;
    8686    },
    8787
    88     get subtitleAsText()
     88    get subtitleAsTextForTest()
    8989    {
    90         var result = "";
    91         var data = this.subtitleElement.getAttribute("data-uncopyable");
    92         if (data)
    93             result += data;
     90        var result = this.subtitleElement.textContent;
    9491        var child = this.subtitleElement.querySelector("[data-uncopyable]");
    9592        if (child) {
  • trunk/WebCore/inspector/front-end/StylesSidebarPane.js

    r65806 r65905  
    161161            this._refreshSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, editedSection);
    162162        }
     163        // Trace the computed style.
     164        this.sections[0][0].rebuildComputedTrace(this.sections[0]);
    163165    },
    164166
     
    174176        this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0);
    175177        var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement;
     178        // Trace the computed style.
     179        this.sections[0][0].rebuildComputedTrace(this.sections[0]);
    176180
    177181        for (var i = 0; i < styles.pseudoElements.length; ++i) {
     
    224228        for (var name in styles.styleAttributes) {
    225229            var attrStyle = { style: new WebInspector.CSSStyleDeclaration(styles.styleAttributes[name]), editable: false };
    226             attrStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", name);
    227230            attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName) + "[" + name;
    228231            if (node.getAttribute(name))
     
    235238        if (styles.inlineStyle && node.nodeType === Node.ELEMENT_NODE) {
    236239            var inlineStyle = { selectorText: "element.style", style: new WebInspector.CSSStyleDeclaration(styles.inlineStyle), isAttribute: true };
    237             inlineStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", "style");
    238240            styleRules.push(inlineStyle);
    239241        }
     
    263265                if (this._containsInherited(parentStyles.inlineStyle)) {
    264266                    var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: new WebInspector.CSSStyleDeclaration(parentStyles.inlineStyle), isAttribute: true, isInherited: true };
    265                     inlineStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", "style");
    266267                    if (!separatorInserted) {
    267268                        insertInheritedNodeSeparator(parentNode);
     
    387388            var styleRule = styleRules[i];
    388389            var section = styleRule.section;
    389             if (styleRule.computedStyle)
    390                 section.disabledComputedProperties = disabledComputedProperties;
    391             section._usedProperties = (styleRule.usedProperties || usedProperties);
    392             section.update((section === editedSection) || styleRule.computedStyle);
     390            if (styleRule.computedStyle) {
     391                section._disabledComputedProperties = disabledComputedProperties;
     392                section._usedProperties = usedProperties;
     393                section.update();
     394            } else {
     395                section._usedProperties = styleRule.usedProperties;
     396                section.update(section === editedSection);
     397            }
    393398        }
    394399    },
     
    429434                editable = true;
    430435
    431             var section = new WebInspector.StylePropertiesSection(styleRule, styleRule.subtitle, styleRule.computedStyle, (styleRule.usedProperties || usedProperties), editable, styleRule.isInherited, lastWasSeparator);
    432436            if (computedStyle)
    433                 section.disabledComputedProperties = disabledComputedProperties;
     437                var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties, disabledComputedProperties, styleRules);
     438            else
     439                var section = new WebInspector.StylePropertiesSection(styleRule, editable, styleRule.isInherited, lastWasSeparator);
    434440            section.pane = this;
    435441            section.expanded = true;
     
    597603WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
    598604
    599 WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyle, usedProperties, editable, isInherited, isFirstSection)
     605WebInspector.StylePropertiesSection = function(styleRule, editable, isInherited, isFirstSection)
    600606{
    601607    WebInspector.PropertiesSection.call(this, "");
     
    606612    this.titleElement.appendChild(this._selectorElement);
    607613
    608     if (!computedStyle) {
    609         var openBrace = document.createElement("span");
    610         openBrace.textContent = " {";
    611         this.titleElement.appendChild(openBrace);
    612 
    613         var closeBrace = document.createElement("div");
    614         closeBrace.textContent = "}";
    615         this.element.appendChild(closeBrace);
    616     }
     614    var openBrace = document.createElement("span");
     615    openBrace.textContent = " {";
     616    this.titleElement.appendChild(openBrace);
     617
     618    var closeBrace = document.createElement("div");
     619    closeBrace.textContent = "}";
     620    this.element.appendChild(closeBrace);
    617621
    618622    this._selectorElement.addEventListener("dblclick", this._handleSelectorDoubleClick.bind(this), false);
     
    621625    this.styleRule = styleRule;
    622626    this.rule = this.styleRule.rule;
    623     this.computedStyle = computedStyle;
    624     this.editable = (editable && !computedStyle);
     627    this.editable = editable;
    625628    this.isInherited = isInherited;
    626629
     
    633636        this.editable = false;
    634637
    635     this._usedProperties = usedProperties;
     638    this._usedProperties = styleRule.usedProperties;
    636639
    637640    if (this.rule)
    638641        this.titleElement.addStyleClass("styles-selector");
    639642
    640     if (computedStyle) {
    641         this.element.addStyleClass("computed-style");
    642         this.headerElement.addStyleClass("hidden");
    643     } else {
    644         if (!subtitle) {
    645             function linkifyUncopyable(url, line)
    646             {
    647                 var link = WebInspector.linkifyResourceAsNode(url, "resources", line + 1);
    648                 link.setAttribute("data-uncopyable", link.textContent);
    649                 link.textContent = "";
    650                 return link;
    651             }
    652 
    653             if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href)
    654                 this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.parentStyleSheet.href, this.rule.sourceLine));
    655             else if (isUserAgent)
    656                 subtitle = WebInspector.UIString("user agent stylesheet");
    657             else if (isUser)
    658                 subtitle = WebInspector.UIString("user stylesheet");
    659             else if (isViaInspector)
    660                 subtitle = WebInspector.UIString("via inspector");
    661             else
    662                 this.subtitleElement.appendChild(linkifyUncopyable(this.rule.documentURL, this.rule.sourceLine));
    663         }
    664         if (isInherited)
    665             this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not compted style.
    666         if (subtitle)
    667             this.subtitle = subtitle;
     643    function linkifyUncopyable(url, line)
     644    {
     645        var link = WebInspector.linkifyResourceAsNode(url, "resources", line + 1);
     646        link.setAttribute("data-uncopyable", link.textContent);
     647        link.textContent = "";
     648        return link;
    668649    }
     650
     651    var subtitle = "";
     652    if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href)
     653        this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.parentStyleSheet.href, this.rule.sourceLine));
     654    else if (isUserAgent)
     655        subtitle = WebInspector.UIString("user agent stylesheet");
     656    else if (isUser)
     657        subtitle = WebInspector.UIString("user stylesheet");
     658    else if (isViaInspector)
     659        subtitle = WebInspector.UIString("via inspector");
     660    else if (this.rule && this.rule.documentURL)
     661        this.subtitleElement.appendChild(linkifyUncopyable(this.rule.documentURL, this.rule.sourceLine));
     662
     663    if (isInherited)
     664        this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not compted style.
     665    if (subtitle)
     666        this.subtitle = subtitle;
    669667
    670668    this.identifier = styleRule.selectorText;
     
    677675
    678676WebInspector.StylePropertiesSection.prototype = {
    679     get usedProperties()
    680     {
    681         return this._usedProperties || {};
    682     },
    683 
    684     set usedProperties(x)
    685     {
    686         this._usedProperties = x;
    687         this.update();
    688     },
    689 
    690677    collapse: function(dontRememberState)
    691678    {
     
    700687            return !(property in WebInspector.StylesSidebarPane.InheritedProperties);
    701688        }
    702 
    703         if (!this.computedStyle || !this._usedProperties || this.noAffect)
    704             return false;
    705         // These properties should always show for Computed Style.
    706         var alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
    707         return !(property in this.usedProperties) && !(property in alwaysShowComputedProperties) && !(property in this.disabledComputedProperties);
     689        return false;
    708690    },
    709691
    710692    isPropertyOverloaded: function(property, shorthand)
    711693    {
    712         if (this.computedStyle || !this._usedProperties || this.noAffect)
     694        if (!this._usedProperties || this.noAffect)
    713695            return false;
    714696
     
    718700        }
    719701
    720         var used = (property in this.usedProperties);
     702        var used = (property in this._usedProperties);
    721703        if (used || !shorthand)
    722704            return !used;
     
    727709        for (var j = 0; j < longhandProperties.length; ++j) {
    728710            var individualProperty = longhandProperties[j];
    729             if (individualProperty in this.usedProperties)
     711            if (individualProperty in this._usedProperties)
    730712                return false;
    731713        }
     
    734716    },
    735717
     718    isPropertyDisabled: function(property)
     719    {
     720        if (!this.styleRule.style.__disabledPropertyValues)
     721            return false;
     722        return property in this.styleRule.style.__disabledPropertyValues;
     723    },
     724
    736725    update: function(full)
    737726    {
    738         if (full || this.computedStyle) {
     727        if (full) {
    739728            this.propertiesTreeOutline.removeChildren();
    740729            this.populated = false;
     
    746735            }
    747736        }
    748 
    749737        this.afterUpdate();
    750738    },
     
    765753        var disabledProperties = style.__disabledPropertyValues || {};
    766754
    767         var uniqueProperties = [];
     755        this.uniqueProperties = [];
    768756        for (var i = 0; i < style.length; ++i)
    769             uniqueProperties.push(style[i]);
     757            this.uniqueProperties.push(style[i]);
    770758
    771759        for (var name in disabledProperties)
    772             uniqueProperties.push(name);
    773 
    774         uniqueProperties.sort();
    775 
    776         for (var i = 0; i < uniqueProperties.length; ++i) {
    777             var name = uniqueProperties[i];
     760            this.uniqueProperties.push(name);
     761
     762        this.uniqueProperties.sort();
     763
     764        for (var i = 0; i < this.uniqueProperties.length; ++i) {
     765            var name = this.uniqueProperties[i];
    778766            var disabled = name in disabledProperties;
    779             if (!disabled && this.disabledComputedProperties && !(name in this.usedProperties) && name in this.disabledComputedProperties)
    780                 disabled = true;
    781 
    782767            var shorthand = !disabled ? style.getPropertyShorthand(name) : null;
    783768
     
    921906WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
    922907
     908WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties, disabledComputedProperties)
     909{
     910    WebInspector.PropertiesSection.call(this, "");
     911    this.headerElement.addStyleClass("hidden");
     912    this.element.className = "styles-section monospace first-styles-section read-only computed-style";
     913    this.styleRule = styleRule;
     914    this._usedProperties = usedProperties;
     915    this._disabledComputedProperties = disabledComputedProperties;
     916    this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
     917    this.computedStyle = true;
     918    this._propertyTreeElements = {};
     919    this._expandedPropertyNames = {};
     920}
     921
     922WebInspector.ComputedStylePropertiesSection.prototype = {
     923    collapse: function(dontRememberState)
     924    {
     925        // Overriding with empty body.
     926    },
     927
     928    _isPropertyInherited: function(property)
     929    {
     930        return !(property in this._usedProperties) && !(property in this._alwaysShowComputedProperties) && !(property in this._disabledComputedProperties);
     931    },
     932
     933    update: function()
     934    {
     935        this._expandedPropertyNames = {};
     936        for (var name in this._propertyTreeElements) {
     937            if (this._propertyTreeElements[name].expanded)
     938                this._expandedPropertyNames[name] = true;
     939        }
     940        this._propertyTreeElements = {};
     941        this.propertiesTreeOutline.removeChildren();
     942        this.populated = false;
     943    },
     944
     945    onpopulate: function()
     946    {
     947        var style = this.styleRule.style;
     948        var uniqueProperties = [];
     949        for (var i = 0; i < style.length; ++i)
     950            uniqueProperties.push(style[i]);
     951        uniqueProperties.sort();
     952
     953        this._propertyTreeElements = {};
     954        for (var i = 0; i < uniqueProperties.length; ++i) {
     955            var name = uniqueProperties[i];
     956            var inherited = this._isPropertyInherited(name);
     957            var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, name, false, inherited, false, false);
     958            this.propertiesTreeOutline.appendChild(item);
     959            this._propertyTreeElements[name] = item;
     960        }
     961    },
     962
     963    rebuildComputedTrace: function(sections)
     964    {
     965        for (var i = 0; i < sections.length; ++i) {
     966            var section = sections[i];
     967            if (section.computedStyle || section instanceof WebInspector.BlankStylePropertiesSection)
     968                continue;
     969
     970            for (var j = 0; j < section.uniqueProperties.length; ++j) {
     971                var name = section.uniqueProperties[j];
     972                if (section.isPropertyDisabled(name))
     973                    continue;
     974                if (section.isInherited && !(name in WebInspector.StylesSidebarPane.InheritedProperties))
     975                    continue;
     976
     977                var treeElement = this._propertyTreeElements[name];
     978                if (treeElement) {
     979                    var selectorText = section.styleRule.selectorText;
     980                    var value = section.styleRule.style.getPropertyValue(name);
     981                    var title = "<span style='color: gray'>" + selectorText + "</span> - " + value;
     982                    var subtitle = " <span style='float:right'>" + section.subtitleElement.innerHTML + "</span>";
     983                    var childElement = new TreeElement(title + subtitle, null, false);
     984                    treeElement.appendChild(childElement);
     985                    if (section.isPropertyOverloaded(name))
     986                        childElement.listItemElement.addStyleClass("overloaded");
     987                }
     988            }
     989        }
     990
     991        // Restore expanded state after update.
     992        for (var name in this._expandedPropertyNames) {
     993            if (name in this._propertyTreeElements)
     994                this._propertyTreeElements[name].expand();
     995        }
     996    }
     997}
     998
     999WebInspector.ComputedStylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
     1000
    9231001WebInspector.BlankStylePropertiesSection = function(defaultSelectorText)
    9241002{
    925     WebInspector.StylePropertiesSection.call(this, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, "", false, {}, false);
    926 
     1003    WebInspector.StylePropertiesSection.call(this, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, true, false, false);
    9271004    this.element.addStyleClass("blank-section");
    9281005}
     
    9631040    {
    9641041        this.element.removeStyleClass("blank-section");
    965 
    9661042        this.styleRule = styleRule;
    9671043        this.rule = styleRule.rule;
    968         this.computedStyle = false;
    969         this.editable = true;
    9701044        this.identifier = styleRule.selectorText + ":via inspector";
    971 
    9721045        this.__proto__ = WebInspector.StylePropertiesSection.prototype;
    9731046    }
  • trunk/WebCore/inspector/front-end/inspector.css

    r65806 r65905  
    41084108}
    41094109
    4110 .styles-section .subtitle::before, .styles-section .subtitle a::before {
     4110.styles-section a::before {
    41114111    content: attr(data-uncopyable);
    41124112}
  • trunk/WebCore/inspector/front-end/inspector.js

    r65809 r65905  
    715715    {
    716716        // FIXME: support webkit-html-external-link links here.
    717         if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel)) {
     717        if (WebInspector.canShowSourceLine(anchor.href, anchor.getAttribute("line_number"), anchor.getAttribute("preferred_panel"))) {
    718718            if (anchor.hasStyleClass("webkit-html-external-link")) {
    719719                anchor.removeStyleClass("webkit-html-external-link");
     
    721721            }
    722722
    723             WebInspector.showSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel);
     723            WebInspector.showSourceLine(anchor.href, anchor.getAttribute("line_number"), anchor.getAttribute("preferred_panel"));
    724724            return;
    725725        }
     
    18011801        linkText += ":" + lineNumber;
    18021802    var node = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
    1803     node.lineNumber = lineNumber;
    1804     node.preferredPanel = preferredPanel;
     1803    node.setAttribute("line_number", lineNumber);
     1804    node.setAttribute("preferred_panel", preferredPanel);
    18051805    return node;
    18061806}
Note: See TracChangeset for help on using the changeset viewer.