Changeset 91070 in webkit
- Timestamp:
- Jul 15, 2011 8:34:28 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91069 r91070 1 2011-07-15 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: Focusing on another node while editing CSS property does not update styles 4 https://bugs.webkit.org/show_bug.cgi?id=64283 5 6 Reviewed by Yury Semikhatsky. 7 8 * http/tests/inspector/elements-test.js: 9 (initialize_ElementTest.InspectorTest.waitForStyles): 10 * inspector/styles/styles-change-node-while-editing-expected.txt: Added. 11 * inspector/styles/styles-change-node-while-editing.html: Added. 12 1 13 2011-07-15 Mike Reed <reed@google.com> 2 14 -
trunk/LayoutTests/http/tests/inspector/elements-test.js
r89804 r91070 85 85 return; 86 86 } 87 InspectorTest.addSniffer(WebInspector. ElementsPanel.prototype, "_stylesUpdated", sniff);87 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_nodeStylesUpdatedForTest", sniff); 88 88 })(null); 89 89 } -
trunk/Source/WebCore/ChangeLog
r91069 r91070 1 2011-07-15 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: Focusing on another node while editing CSS property does not update styles 4 https://bugs.webkit.org/show_bug.cgi?id=64283 5 6 Reviewed by Yury Semikhatsky. 7 8 Test: inspector/styles/styles-change-node-while-editing.html 9 10 * inspector/front-end/CSSStyleModel.js: 11 (WebInspector.CSSProperty.prototype.setText): 12 (WebInspector.CSSProperty.prototype.setText.callback): 13 * inspector/front-end/DOMAgent.js: 14 (WebInspector.DOMAgent.prototype._inlineStyleInvalidated): 15 (WebInspector.DOMDispatcher.prototype.inlineStyleInvalidated): 16 * inspector/front-end/ElementsPanel.js: 17 (WebInspector.ElementsPanel): 18 (WebInspector.ElementsPanel.prototype._attributesUpdated): 19 (WebInspector.ElementsPanel.prototype.updateStyles): 20 * inspector/front-end/MetricsSidebarPane.js: 21 (WebInspector.MetricsSidebarPane): 22 (WebInspector.MetricsSidebarPane.prototype.update): 23 (WebInspector.MetricsSidebarPane.prototype._innerUpdate.callback): 24 (WebInspector.MetricsSidebarPane.prototype._innerUpdate.inlineStyleCallback): 25 (WebInspector.MetricsSidebarPane.prototype._innerUpdate): 26 (WebInspector.MetricsSidebarPane.prototype._styleSheetChanged): 27 (WebInspector.MetricsSidebarPane.prototype._attributesUpdated): 28 (WebInspector.MetricsSidebarPane.prototype.startEditing): 29 (WebInspector.MetricsSidebarPane.prototype.editingEnded): 30 * inspector/front-end/StylesSidebarPane.js: 31 (WebInspector.StylesSidebarPane): 32 (WebInspector.StylesSidebarPane.prototype.update): 33 (WebInspector.StylesSidebarPane.prototype._innerUpdate.stylesCallback): 34 (WebInspector.StylesSidebarPane.prototype._innerUpdate.computedStyleCallback): 35 (WebInspector.StylesSidebarPane.prototype._innerUpdate): 36 (WebInspector.StylesSidebarPane.prototype._styleSheetChanged): 37 (WebInspector.StylesSidebarPane.prototype._attributesUpdated): 38 (WebInspector.StylesSidebarPane.prototype._refreshUpdate): 39 (WebInspector.StylesSidebarPane.prototype._rebuildUpdate): 40 (WebInspector.StylesSidebarPane.prototype._nodeStylesUpdatedForTest): 41 (WebInspector.StylesSidebarPane.prototype._toggleElementStatePane): 42 (WebInspector.StylesSidebarPane.prototype._createElementStatePane.clickListener): 43 (WebInspector.StylePropertyTreeElement.prototype): 44 (WebInspector.StylePropertyTreeElement.prototype.event): 45 (WebInspector.StylePropertyTreeElement.prototype.element.userInput.previousContent.context.moveDirection): 46 (WebInspector.StylePropertyTreeElement.prototype.styleText.updateInterface.majorChange.isRevert): 47 1 48 2011-07-15 Mike Reed <reed@google.com> 2 49 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r89922 r91070 514 514 { 515 515 if (style) 516 WebInspector.cssModel._fireStyleSheetChanged(style.id.styleSheetId, majorChange );517 if (userCallback)516 WebInspector.cssModel._fireStyleSheetChanged(style.id.styleSheetId, majorChange, userCallback ? userCallback.bind(null, style) : null); 517 else if (userCallback) 518 518 userCallback(style); 519 519 } … … 531 531 } 532 532 533 WebInspector.cssModel._fireStyleSheetChanged(style.id.styleSheetId, majorChange, userCallback ? userCallback.bind( this, style) : null);533 WebInspector.cssModel._fireStyleSheetChanged(style.id.styleSheetId, majorChange, userCallback ? userCallback.bind(null, style) : null); 534 534 } else { 535 535 if (userCallback) -
trunk/Source/WebCore/inspector/front-end/DOMAgent.js
r90460 r91070 430 430 }, 431 431 432 _inlineStyleInvalidated: function(nodeIds) 433 { 434 // FIXME: handle differently (we don't necessarily need to update attributes upon this message). 435 this._loadNodeAttributesSoon(nodeIds); 436 }, 437 432 438 _loadNodeAttributesSoon: function(nodeIds) 433 439 { … … 591 597 inlineStyleInvalidated: function(nodeIds) 592 598 { 593 this._domAgent._ attributesUpdated(nodeIds);599 this._domAgent._inlineStyleInvalidated(nodeIds); 594 600 }, 595 601 -
trunk/Source/WebCore/inspector/front-end/ElementsPanel.js
r90365 r91070 94 94 this.sidebarPanes.styles.addEventListener("style property toggled", this._stylesPaneEdited, this); 95 95 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPaneEdited, this); 96 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);97 96 98 97 this.sidebarElement = document.createElement("div"); … … 427 426 }, 428 427 429 startEditingStyle: function()430 {431 this._isEditingStyle = true;432 },433 434 endEditingStyle: function()435 {436 delete this._isEditingStyle;437 },438 439 428 _attributesUpdated: function(event) 440 429 { … … 442 431 if (this.visible) 443 432 this._updateModifiedNodesSoon(); 444 445 if (!this._isEditingStyle && event.data === this.focusedDOMNode)446 this._styleSheetChanged();447 433 }, 448 434 … … 538 524 this.sidebarPanes.styles.needsUpdate = true; 539 525 this.updateStyles(true); 540 },541 542 _styleSheetChanged: function()543 {544 this._metricsPaneEdited();545 this._stylesPaneEdited();546 526 }, 547 527 … … 1018 998 var stylesSidebarPane = this.sidebarPanes.styles; 1019 999 var computedStylePane = this.sidebarPanes.computedStyle; 1020 if ((!stylesSidebarPane.expanded && !computedStylePane.expanded) || !stylesSidebarPane.needsUpdate || this._isEditingStyle)1021 return; 1022 1023 stylesSidebarPane.update(this.focusedDOMNode, null, forceUpdate, this._stylesUpdated.bind(this, this.focusedDOMNode));1000 if ((!stylesSidebarPane.expanded && !computedStylePane.expanded) || !stylesSidebarPane.needsUpdate) 1001 return; 1002 1003 stylesSidebarPane.update(this.focusedDOMNode, forceUpdate); 1024 1004 stylesSidebarPane.needsUpdate = false; 1025 },1026 1027 _stylesUpdated: function(node)1028 {1029 // This method is overriden in tests.1030 1005 }, 1031 1006 -
trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js
r86663 r91070 30 30 { 31 31 WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics")); 32 33 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this); 34 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this); 32 35 } 33 36 … … 37 40 if (node) 38 41 this.node = node; 39 else 40 node = this.node; 42 this._innerUpdate(); 43 }, 44 45 _innerUpdate: function() 46 { 47 // FIXME: avoid updates of a collapsed pane. 48 var node = this.node; 41 49 42 50 if (!node || node.nodeType() !== Node.ELEMENT_NODE) { … … 45 53 } 46 54 47 var self = this; 48 var callback = function(style) { 49 if (!style) 50 return; 51 self._update(style); 52 }; 53 WebInspector.cssModel.getComputedStyleAsync(node.id, callback); 54 55 var inlineStyleCallback = function(style) { 56 if (!style) 57 return; 58 self.inlineStyle = style; 59 }; 60 WebInspector.cssModel.getInlineStyleAsync(node.id, inlineStyleCallback); 61 }, 55 function callback(style) 56 { 57 if (!style || this.node !== node) 58 return; 59 this._updateMetrics(style); 60 } 61 WebInspector.cssModel.getComputedStyleAsync(node.id, callback.bind(this)); 62 63 function inlineStyleCallback(style) 64 { 65 if (!style || this.node !== node) 66 return; 67 this.inlineStyle = style; 68 } 69 WebInspector.cssModel.getInlineStyleAsync(node.id, inlineStyleCallback.bind(this)); 70 }, 71 72 _styleSheetChanged: function() 73 { 74 this._innerUpdate(); 75 }, 76 77 _attributesUpdated: function(event) 78 { 79 if (this.node !== event.data) 80 return; 81 82 // "style" attribute might have changed. Update metrics unless they are being edited. 83 if (!this._isEditingMetrics) 84 this._innerUpdate(); 85 }, 62 86 63 87 _getPropertyValueAsPx: function(style, propertyName) … … 125 149 }, 126 150 127 _update : function(style)151 _updateMetrics: function(style) 128 152 { 129 153 // Updating with computed style. … … 273 297 targetElement.addEventListener("keydown", boundKeyDown, false); 274 298 275 WebInspector.panels.elements.startEditingStyle();299 this._isEditingMetrics = true; 276 300 WebInspector.startEditing(targetElement, { 277 301 context: context, … … 341 365 delete this.previousPropertyDataCandidate; 342 366 element.removeEventListener("keydown", context.keyDownHandler, false); 343 WebInspector.panels.elements.endEditingStyle();367 delete this._isEditingMetrics; 344 368 }, 345 369 -
trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js
r90630 r91070 84 84 this._sectionsContainer = document.createElement("div"); 85 85 this.bodyElement.appendChild(this._sectionsContainer); 86 87 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this); 88 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this); 86 89 } 87 90 … … 211 214 }, 212 215 213 update: function(node, editedSection, forceUpdate, callback)216 update: function(node, forceUpdate) 214 217 { 215 218 var refresh = false; … … 218 221 delete this.node; 219 222 220 if (!forceUpdate && ( !node ||node === this.node))223 if (!forceUpdate && (node === this.node)) 221 224 refresh = true; 222 225 … … 232 235 node = this.node; 233 236 237 this._innerUpdate(refresh, null); 238 }, 239 240 _innerUpdate: function(refresh, editedSection) 241 { 242 var node = this.node; 234 243 if (!node) { 235 244 this._sectionsContainer.removeChildren(); 236 245 this._computedStylePane.bodyElement.removeChildren(); 237 246 this.sections = {}; 238 if (callback)239 callback();240 247 return; 241 248 } … … 245 252 if (this.node === node && styles) 246 253 this._rebuildUpdate(node, styles); 247 if (callback)248 callback();249 254 } 250 255 … … 253 258 if (this.node === node && computedStyle) 254 259 this._refreshUpdate(node, computedStyle, editedSection); 255 if (callback)256 callback();257 260 } 258 261 … … 261 264 else 262 265 WebInspector.cssModel.getStylesAsync(node.id, this._forcedPseudoClasses, stylesCallback.bind(this)); 266 }, 267 268 _styleSheetChanged: function() 269 { 270 if (this._userOperation || this._isEditingStyle) 271 return; 272 273 this._innerUpdate(false); 274 }, 275 276 _attributesUpdated: function(event) 277 { 278 if (this.node !== event.data) 279 return; 280 281 // "style" attribute might have changed. Update styles unless they are being edited. 282 if (!this._isEditingStyle && !this._userOperation) 283 this._innerUpdate(false); 263 284 }, 264 285 … … 274 295 // Trace the computed style. 275 296 this.sections[0][0].rebuildComputedTrace(this.sections[0]); 297 298 this._nodeStylesUpdatedForTest(node, true); 276 299 }, 277 300 … … 309 332 this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, pseudoId, anchorElement); 310 333 } 334 335 this._nodeStylesUpdatedForTest(node, false); 336 }, 337 338 _nodeStylesUpdatedForTest: function(node, refresh) 339 { 340 // Tests override this method. 311 341 }, 312 342 … … 681 711 this._elementStatePane.inputs[i].checked = false; 682 712 delete this._forcedPseudoClasses; 683 this. update(WebInspector.panels.elements.focusedDOMNode, null, true);713 this._innerUpdate(false); 684 714 } 685 715 } … … 703 733 } 704 734 this._forcedPseudoClasses = pseudoClasses.length ? pseudoClasses : undefined; 705 this. update(WebInspector.panels.elements.focusedDOMNode, null, true);735 this._innerUpdate(false); 706 736 } 707 737 … … 1582 1612 }, 1583 1613 1584 updateAll: function(updateAllRules)1614 _updateAll: function() 1585 1615 { 1586 1616 if (!this.treeOutline) 1587 1617 return; 1588 if ( updateAllRules &&this.treeOutline.section && this.treeOutline.section.pane)1589 this.treeOutline.section.pane. update(null, this.treeOutline.section);1618 if (this.treeOutline.section && this.treeOutline.section.pane) 1619 this.treeOutline.section.pane._innerUpdate(true, this.treeOutline.section); 1590 1620 else if (this.treeOutline.section) 1591 1621 this.treeOutline.section.update(true); … … 1609 1639 this.treeOutline.section.pane.dispatchEventToListeners("style property toggled"); 1610 1640 1611 this. updateAll(true);1641 this._updateAll(); 1612 1642 } 1613 1643 … … 1786 1816 1787 1817 delete this.originalPropertyText; 1788 WebInspector.panels.elements.startEditingStyle(); 1818 1819 this._parentPane._isEditingStyle = true; 1789 1820 WebInspector.startEditing(selectElement, { 1790 1821 context: context, … … 1908 1939 editedElement.parentElement.removeStyleClass("child-editing"); 1909 1940 1910 WebInspector.panels.elements.endEditingStyle();1941 delete this._parentPane._isEditingStyle; 1911 1942 }, 1912 1943 … … 1962 1993 var shouldCommitNewProperty = this._newProperty && (moveToOther || (!moveDirection && !isEditingName) || (isEditingName && blankInput)); 1963 1994 if (((userInput !== previousContent || isDirtyViaPaste) && !this._newProperty) || shouldCommitNewProperty) { 1964 WebInspector.panels.elements.startEditingStyle();1965 1995 this.treeOutline.section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !blankInput, this.treeOutline.section); 1966 1996 var propertyText; … … 1985 2015 function moveToNextCallback(alreadyNew, valueChanged, section) 1986 2016 { 1987 WebInspector.panels.elements.endEditingStyle();1988 1989 2017 if (!moveDirection) 1990 2018 return; … … 2071 2099 } 2072 2100 2101 var currentNode = this._parentPane.node; 2102 this._parentPane._userOperation = true; 2103 2073 2104 function callback(originalPropertyText, newStyle) 2074 2105 { 2106 delete this._parentPane._userOperation; 2075 2107 if (!newStyle) { 2076 2108 if (updateInterface) { … … 2088 2120 section.pane.dispatchEventToListeners("style edited"); 2089 2121 2090 if (updateInterface )2091 this. updateAll(true);2122 if (updateInterface && currentNode === section.pane.node) 2123 this._updateAll(); 2092 2124 } 2093 2125
Note: See TracChangeset
for help on using the changeset viewer.