Changeset 90397 in webkit
- Timestamp:
- Jul 5, 2011 8:35:19 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90395 r90397 1 2011-07-05 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: add "element state" setting to the styles section title. 4 https://bugs.webkit.org/show_bug.cgi?id=63932 5 6 Reviewed by Yury Semikhatsky. 7 8 * English.lproj/localizedStrings.js: 9 * WebCore.gypi: 10 * inspector/front-end/Images/paneElementStateButtons.png: Added. 11 * inspector/front-end/StylesSidebarPane.js: 12 (WebInspector.StylesSidebarPane.muteEventListener): 13 (WebInspector.StylesSidebarPane): 14 (WebInspector.StylesSidebarPane.prototype.update): 15 (WebInspector.StylesSidebarPane.prototype._rebuildUpdate): 16 (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules): 17 (WebInspector.StylesSidebarPane.prototype.addBlankSection): 18 (WebInspector.StylesSidebarPane.prototype.registerShortcuts): 19 (WebInspector.StylesSidebarPane.prototype._toggleElementStatePane): 20 (WebInspector.StylesSidebarPane.prototype._createElementStatePane.clickListener): 21 (WebInspector.StylesSidebarPane.prototype._createElementStatePane.createCheckbox): 22 (WebInspector.StylesSidebarPane.prototype._createElementStatePane): 23 * inspector/front-end/WebKit.qrc: 24 * inspector/front-end/inspector.css: 25 (.pane > .title > .pane-title-button:active, .pane > .title > .pane-title-button.toggled): 26 (.pane > .title > .pane-title-button.element-state): 27 (.styles-element-state-pane): 28 (.styles-element-state-pane.expanded): 29 (.styles-element-state-pane > table): 30 (.styles-element-state-pane input): 31 1 32 2011-06-22 Pavel Podivilov <podivilov@chromium.org> 2 33 -
trunk/Source/WebCore/WebCore.gypi
r90365 r90397 6425 6425 'inspector/front-end/Images/paneBottomGrow.png', 6426 6426 'inspector/front-end/Images/paneBottomGrowActive.png', 6427 'inspector/front-end/Images/paneElementStateButtons.png', 6427 6428 'inspector/front-end/Images/paneFilterButtons.png', 6428 6429 'inspector/front-end/Images/paneGrowHandleLine.png', -
trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js
r90387 r90397 56 56 57 57 // Prevent section from collapsing. 58 this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false); 59 58 var muteEventListener = function(event) { event.stopPropagation(); event.preventDefault(); }; 59 60 this.settingsSelectElement.addEventListener("click", muteEventListener, true); 60 61 this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false); 61 62 this._updateColorFormatFilter(); 62 63 63 64 this.titleElement.appendChild(this.settingsSelectElement); 65 66 this._elementStateButton = document.createElement("button"); 67 this._elementStateButton.className = "pane-title-button element-state"; 68 this._elementStateButton.title = WebInspector.UIString("Toggle Element State"); 69 this._elementStateButton.addEventListener("click", this._toggleElementStatePane.bind(this), false); 70 this.titleElement.appendChild(this._elementStateButton); 64 71 65 72 var addButton = document.createElement("button"); … … 72 79 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true); 73 80 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSettingChanged.bind(this)); 81 82 this._createElementStatePane(); 83 this.bodyElement.appendChild(this._elementStatePane); 84 this._sectionsContainer = document.createElement("div"); 85 this.bodyElement.appendChild(this._sectionsContainer); 74 86 } 75 87 … … 221 233 222 234 if (!node) { 223 this. bodyElement.removeChildren();235 this._sectionsContainer.removeChildren(); 224 236 this._computedStylePane.bodyElement.removeChildren(); 225 237 this.sections = {}; … … 248 260 WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCallback.bind(this)); 249 261 else 250 WebInspector.cssModel.getStylesAsync(node.id, undefined, stylesCallback.bind(this));262 WebInspector.cssModel.getStylesAsync(node.id, this._forcedPseudoClasses, stylesCallback.bind(this)); 251 263 }, 252 264 … … 266 278 _rebuildUpdate: function(node, styles) 267 279 { 268 this. bodyElement.removeChildren();280 this._sectionsContainer.removeChildren(); 269 281 this._computedStylePane.bodyElement.removeChildren(); 270 282 … … 507 519 } else 508 520 separatorElement.textContent = styleRule.text; 509 this. bodyElement.insertBefore(separatorElement, anchorElement);521 this._sectionsContainer.insertBefore(separatorElement, anchorElement); 510 522 lastWasSeparator = true; 511 523 continue; … … 529 541 lastWasSeparator = true; 530 542 } else { 531 this. bodyElement.insertBefore(section.element, anchorElement);543 this._sectionsContainer.insertBefore(section.element, anchorElement); 532 544 lastWasSeparator = false; 533 545 } … … 597 609 598 610 var elementStyleSection = this.sections[0][1]; 599 this. bodyElement.insertBefore(blankSection.element, elementStyleSection.element.nextSibling);611 this._sectionsContainer.insertBefore(blankSection.element, elementStyleSection.element.nextSibling); 600 612 601 613 this.sections[0].splice(2, 0, blankSection); … … 651 663 ]; 652 664 section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 0.1)); 665 }, 666 667 _toggleElementStatePane: function(event) 668 { 669 event.stopPropagation(); 670 if (!this._elementStateButton.hasStyleClass("toggled")) { 671 this.expand(); 672 this._elementStateButton.addStyleClass("toggled"); 673 this._elementStatePane.addStyleClass("expanded"); 674 } else { 675 this._elementStateButton.removeStyleClass("toggled"); 676 this._elementStatePane.removeStyleClass("expanded"); 677 // Clear flags on hide. 678 if (this._forcedPseudoClasses) { 679 for (var i = 0; i < this._elementStatePane.inputs.length; ++i) 680 this._elementStatePane.inputs[i].checked = false; 681 delete this._forcedPseudoClasses; 682 this.update(WebInspector.panels.elements.focusedDOMNode, null, true); 683 } 684 } 685 }, 686 687 _createElementStatePane: function() 688 { 689 this._elementStatePane = document.createElement("div"); 690 this._elementStatePane.className = "styles-element-state-pane source-code"; 691 var table = document.createElement("table"); 692 693 var inputs = []; 694 this._elementStatePane.inputs = inputs; 695 696 function clickListener(event) 697 { 698 var pseudoClasses = []; 699 for (var i = 0; i < inputs.length; ++i) { 700 if (inputs[i].checked) 701 pseudoClasses.push(inputs[i].state); 702 } 703 this._forcedPseudoClasses = pseudoClasses.length ? pseudoClasses : undefined; 704 this.update(WebInspector.panels.elements.focusedDOMNode, null, true); 705 } 706 707 function createCheckbox(state) 708 { 709 var td = document.createElement("td"); 710 var label = document.createElement("label"); 711 var input = document.createElement("input"); 712 input.type = "checkbox"; 713 input.state = state; 714 input.addEventListener("click", clickListener.bind(this), false); 715 inputs.push(input); 716 label.appendChild(input); 717 label.appendChild(document.createTextNode(":" + state)); 718 td.appendChild(label); 719 return td; 720 } 721 722 var tr = document.createElement("tr"); 723 tr.appendChild(createCheckbox.call(this, "active")); 724 tr.appendChild(createCheckbox.call(this, "hover")); 725 table.appendChild(tr); 726 727 tr = document.createElement("tr"); 728 tr.appendChild(createCheckbox.call(this, "focus")); 729 tr.appendChild(createCheckbox.call(this, "visited")); 730 table.appendChild(tr); 731 732 this._elementStatePane.appendChild(table); 653 733 } 654 734 } … … 663 743 664 744 if (WebInspector.settings.showInheritedComputedStyleProperties.get()) { 665 this. bodyElement.addStyleClass("show-inherited");745 this._sectionsContainer.addStyleClass("show-inherited"); 666 746 showInheritedCheckbox.checked = true; 667 747 } … … 671 751 WebInspector.settings.showInheritedComputedStyleProperties.set(showInheritedCheckbox.checked); 672 752 if (WebInspector.settings.showInheritedComputedStyleProperties.get()) 673 this. bodyElement.addStyleClass("show-inherited");753 this._sectionsContainer.addStyleClass("show-inherited"); 674 754 else 675 this. bodyElement.removeStyleClass("show-inherited");755 this._sectionsContainer.removeStyleClass("show-inherited"); 676 756 } 677 757 -
trunk/Source/WebCore/inspector/front-end/WebKit.qrc
r90365 r90397 185 185 <file>Images/paneBottomGrow.png</file> 186 186 <file>Images/paneBottomGrowActive.png</file> 187 <file>Images/paneElementStateButtons.png</file> 187 188 <file>Images/paneGrowHandleLine.png</file> 188 189 <file>Images/paneRefreshButtons.png</file> -
trunk/Source/WebCore/inspector/front-end/inspector.css
r90387 r90397 1799 1799 } 1800 1800 1801 .pane > .title > .pane-title-button:active {1801 .pane > .title > .pane-title-button:active, .pane > .title > .pane-title-button.toggled { 1802 1802 background-position: -46px 0px; 1803 1803 } … … 1805 1805 .pane > .title > .pane-title-button.add { 1806 1806 background-image: url(Images/paneAddButtons.png); 1807 } 1808 1809 .pane > .title > .pane-title-button.element-state { 1810 background-image: url(Images/paneElementStateButtons.png); 1807 1811 } 1808 1812 … … 4547 4551 } 4548 4552 4553 .styles-element-state-pane { 4554 background-color: rgb(240, 240, 240); 4555 overflow: hidden; 4556 margin-top: -38px; 4557 -webkit-transition: margin-top 0.1s ease-in-out; 4558 padding-left: 2px; 4559 } 4560 4561 .styles-element-state-pane.expanded { 4562 border-bottom: 1px solid rgb(189, 189, 189); 4563 margin-top: 0; 4564 } 4565 4566 .styles-element-state-pane > table { 4567 width: 100%; 4568 border-spacing: 0; 4569 } 4570 4571 .styles-element-state-pane input { 4572 margin: 2px; 4573 vertical-align: -2px; 4574 } 4549 4575 4550 4576 .body .styles-section .properties .inherited {
Note: See TracChangeset
for help on using the changeset viewer.