Changeset 56846 in webkit
- Timestamp:
- Mar 31, 2010 9:23:47 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56844 r56846 1 2010-03-31 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: creating new style bugfixing. 6 7 https://bugs.webkit.org/show_bug.cgi?id=36884 8 9 - InspectorDOMAgent should clear internal state upon reset (we are re-using 10 single dom agent instance throughout entire inspector controller lifetime) 11 - Brought back blank style 'refresh' processing logic - remove it by mistake earlier 12 - Blocked couple of click handlers so that double-click to edit was not 13 expanding / collapsing the pane 14 - There is no need to reach out for matched rules upon 'refresh' update - 15 getting computed style is sufficient. 16 17 * css/CSSStyleSelector.cpp: 18 (WebCore::CSSStyleSelector::matchRulesForList): 19 * inspector/InspectorDOMAgent.cpp: 20 (WebCore::InspectorDOMAgent::discardBindings): 21 * inspector/front-end/StylesSidebarPane.js: 22 (WebInspector.StylesSidebarPane.prototype.update.getStylesCallback): 23 (WebInspector.StylesSidebarPane.prototype.update.getComputedStyleCallback): 24 (WebInspector.StylesSidebarPane.prototype.update): 25 (WebInspector.StylesSidebarPane.prototype._refreshUpdate): 26 (WebInspector.StylesSidebarPane.prototype._rebuildUpdate): 27 (WebInspector.StylesSidebarPane.prototype._refreshStyleRules): 28 (WebInspector.StylesSidebarPane.prototype.addBlankSection): 29 (WebInspector.StylePropertiesSection.prototype._dblclickEmptySpace): 30 (WebInspector.StylePropertiesSection.prototype._clickSelector): 31 1 32 2010-03-31 Yury Semikhatsky <yurys@chromium.org> 2 33 -
trunk/WebCore/css/CSSStyleSelector.cpp
r56608 r56846 711 711 if (m_dynamicPseudo != NOPSEUDO && m_checker.m_pseudoStyle == NOPSEUDO) { 712 712 if (m_checker.m_collectRulesOnly) 713 return;713 continue; 714 714 if (m_dynamicPseudo < FIRST_INTERNAL_PSEUDOID) 715 715 m_style->setHasPseudoStyle(m_dynamicPseudo); -
trunk/WebCore/inspector/InspectorDOMAgent.cpp
r56825 r56846 237 237 releaseDanglingNodes(); 238 238 m_childrenRequested.clear(); 239 m_styleToId.clear(); 240 m_idToStyle.clear(); 241 m_ruleToId.clear(); 242 m_idToRule.clear(); 243 m_idToDisabledStyle.clear(); 244 m_inspectorStyleSheet = 0; 239 245 } 240 246 -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r56798 r56846 134 134 } 135 135 136 var self = this; 137 function callback(styles) 136 function getStylesCallback(styles) 138 137 { 139 if (!styles) 140 return; 141 self._update(refresh, node, styles, editedSection); 142 } 143 144 InspectorBackend.getStyles(WebInspector.Callback.wrap(callback), node.id, !WebInspector.settings.showUserAgentStyles); 145 }, 146 147 _update: function(refresh, node, styles, editedSection) 148 { 149 if (refresh) { 150 for (var pseudoId in this.sections) { 151 var styleRules = this._refreshStyleRules(this.sections[pseudoId], styles); 152 var usedProperties = {}; 153 var disabledComputedProperties = {}; 154 this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); 155 this._refreshSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, editedSection); 156 } 157 } else { 158 this.bodyElement.removeChildren(); 159 var styleRules = this._rebuildStyleRules(node, styles); 138 if (styles) 139 this._rebuildUpdate(node, styles); 140 } 141 142 function getComputedStyleCallback(computedStyle) 143 { 144 if (computedStyle) 145 this._refreshUpdate(node, computedStyle, editedSection); 146 }; 147 148 if (refresh) 149 InspectorBackend.getComputedStyle(WebInspector.Callback.wrap(getComputedStyleCallback.bind(this)), node.id); 150 else 151 InspectorBackend.getStyles(WebInspector.Callback.wrap(getStylesCallback.bind(this)), node.id, !WebInspector.settings.showUserAgentStyles); 152 }, 153 154 _refreshUpdate: function(node, computedStyle, editedSection) 155 { 156 for (var pseudoId in this.sections) { 157 var styleRules = this._refreshStyleRules(this.sections[pseudoId], computedStyle); 160 158 var usedProperties = {}; 161 159 var disabledComputedProperties = {}; 162 160 this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); 163 this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0); 164 165 for (var i = 0; i < styles.pseudoElements.length; ++i) { 166 var pseudoElementCSSRules = styles.pseudoElements[i]; 167 168 styleRules = []; 169 var pseudoId = pseudoElementCSSRules.pseudoId; 170 171 var entry = { isStyleSeparator: true, pseudoId: pseudoId }; 172 styleRules.push(entry); 173 174 // Add rules in reverse order to match the cascade order. 175 for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) { 176 var rule = WebInspector.CSSStyleDeclaration.parseRule(pseudoElementCSSRules.rules[j]); 177 styleRules.push({ style: rule.style, selectorText: rule.selectorText, parentStyleSheet: rule.parentStyleSheet, rule: rule }); 178 } 179 usedProperties = {}; 180 disabledComputedProperties = {}; 181 this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); 182 this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, pseudoId); 183 } 184 } 185 }, 186 187 _refreshStyleRules: function(sections, styles) 188 { 189 var nodeComputedStyle = new WebInspector.CSSStyleDeclaration(styles.computedStyle); 161 this._refreshSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, editedSection); 162 } 163 }, 164 165 _rebuildUpdate: function(node, styles) 166 { 167 this.bodyElement.removeChildren(); 168 var styleRules = this._rebuildStyleRules(node, styles); 169 var usedProperties = {}; 170 var disabledComputedProperties = {}; 171 this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); 172 this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0); 173 174 for (var i = 0; i < styles.pseudoElements.length; ++i) { 175 var pseudoElementCSSRules = styles.pseudoElements[i]; 176 177 styleRules = []; 178 var pseudoId = pseudoElementCSSRules.pseudoId; 179 180 var entry = { isStyleSeparator: true, pseudoId: pseudoId }; 181 styleRules.push(entry); 182 183 // Add rules in reverse order to match the cascade order. 184 for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) { 185 var rule = WebInspector.CSSStyleDeclaration.parseRule(pseudoElementCSSRules.rules[j]); 186 styleRules.push({ style: rule.style, selectorText: rule.selectorText, parentStyleSheet: rule.parentStyleSheet, rule: rule }); 187 } 188 usedProperties = {}; 189 disabledComputedProperties = {}; 190 this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); 191 this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, pseudoId); 192 } 193 }, 194 195 _refreshStyleRules: function(sections, computedStyle) 196 { 197 var nodeComputedStyle = new WebInspector.CSSStyleDeclaration(computedStyle); 190 198 var styleRules = []; 191 199 for (var i = 0; sections && i < sections.length; ++i) { 192 200 var section = sections[i]; 201 if (section instanceof WebInspector.BlankStylePropertiesSection) 202 continue; 193 203 if (section.computedStyle) 194 204 section.styleRule.style = nodeComputedStyle; … … 508 518 this.bodyElement.insertBefore(blankSection.element, elementStyleSection.element.nextSibling); 509 519 520 this.sections[0].splice(2, 0, blankSection); 521 510 522 return blankSection; 511 523 }, … … 532 544 533 545 this.titleElement.addEventListener("dblclick", this._dblclickSelector.bind(this), false); 546 this.titleElement.addEventListener("click", this._clickSelector.bind(this), false); 534 547 this.element.addEventListener("dblclick", this._dblclickEmptySpace.bind(this), false); 535 548 … … 665 678 }, 666 679 667 isInspectorStylesheet: function()668 {669 return (this.styleRule.parentStyleSheet === WebInspector.panels.elements.stylesheet);670 },671 672 680 update: function(full) 673 681 { … … 757 765 _dblclickEmptySpace: function(event) 758 766 { 767 if (event.target.hasStyleClass("header")) { 768 event.stopPropagation(); 769 return; 770 } 759 771 this.expand(); 760 772 this.addNewBlankProperty().startEditing(); 773 }, 774 775 _clickSelector: function(event) 776 { 777 event.stopPropagation(); 761 778 }, 762 779
Note: See TracChangeset
for help on using the changeset viewer.