Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 703143002: Merge 184054 "DevTools: [SSP] fix memory leak through settings" (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2171/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 this._addButtonLongClickController = new WebInspector.LongClickController(ad dButton); 54 this._addButtonLongClickController = new WebInspector.LongClickController(ad dButton);
55 this._addButtonLongClickController.addEventListener(WebInspector.LongClickCo ntroller.Events.LongClick, this._onAddButtonLongClick.bind(this)); 55 this._addButtonLongClickController.addEventListener(WebInspector.LongClickCo ntroller.Events.LongClick, this._onAddButtonLongClick.bind(this));
56 this._addButtonLongClickController.enable(); 56 this._addButtonLongClickController.enable();
57 57
58 this._computedStylePane = computedStylePane; 58 this._computedStylePane = computedStylePane;
59 computedStylePane.setHostingPane(this); 59 computedStylePane.setHostingPane(this);
60 this._setPseudoClassCallback = setPseudoClassCallback; 60 this._setPseudoClassCallback = setPseudoClassCallback;
61 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true); 61 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true);
62 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSetting Changed.bind(this)); 62 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSetting Changed.bind(this));
63 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg entStylesSettingChanged.bind(this)); 63 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg entStylesSettingChanged.bind(this));
64 WebInspector.settings.showInheritedComputedStyleProperties.addChangeListener (this._showInheritedComputedStyleChanged.bind(this));
64 65
65 this._createElementStatePane(); 66 this._createElementStatePane();
66 this.bodyElement.appendChild(this._elementStatePane); 67 this.bodyElement.appendChild(this._elementStatePane);
67 this._sectionsContainer = document.createElement("div"); 68 this._sectionsContainer = document.createElement("div");
68 this.bodyElement.appendChild(this._sectionsContainer); 69 this.bodyElement.appendChild(this._sectionsContainer);
69 70
70 this._spectrumHelper = new WebInspector.SpectrumPopupHelper(); 71 this._spectrumHelper = new WebInspector.SpectrumPopupHelper();
71 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); 72 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter());
72 73
73 this.element.classList.add("styles-pane"); 74 this.element.classList.add("styles-pane");
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // IE hack. 162 // IE hack.
162 if (value.endsWith("\9")) 163 if (value.endsWith("\9"))
163 return true; 164 return true;
164 if (hasUnknownVendorPrefix(value)) 165 if (hasUnknownVendorPrefix(value))
165 return true; 166 return true;
166 167
167 return false; 168 return false;
168 } 169 }
169 170
170 WebInspector.StylesSidebarPane.prototype = { 171 WebInspector.StylesSidebarPane.prototype = {
172 _showInheritedComputedStyleChanged: function()
173 {
174 if (!this.sections || !this.sections[0])
175 return;
176 for (var i = 0; i < this.sections[0].length; ++i) {
177 var section = this.sections[0][i];
178 if (section instanceof WebInspector.ComputedStylePropertiesSection)
179 section.onShowInheritedChanged();
180 }
181 },
182
171 /** 183 /**
172 * @param {!WebInspector.Event} event 184 * @param {!WebInspector.Event} event
173 */ 185 */
174 _onAddButtonLongClick: function(event) 186 _onAddButtonLongClick: function(event)
175 { 187 {
176 this._addButtonLongClickController.reset(); 188 this._addButtonLongClickController.reset();
177 var cssModel = this._target.cssModel; 189 var cssModel = this._target.cssModel;
178 var headers = cssModel.styleSheetHeaders().filter(styleSheetResourceHead er); 190 var headers = cssModel.styleSheetHeaders().filter(styleSheetResourceHead er);
179 191
180 /** @type {!Array.<{text: string, handler: function()}>} */ 192 /** @type {!Array.<{text: string, handler: function()}>} */
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 * @param {!WebInspector.StylesSidebarPane} stylesPane 1903 * @param {!WebInspector.StylesSidebarPane} stylesPane
1892 * @param {!Object} styleRule 1904 * @param {!Object} styleRule
1893 * @param {!Object.<string, boolean>} usedProperties 1905 * @param {!Object.<string, boolean>} usedProperties
1894 */ 1906 */
1895 WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, us edProperties) 1907 WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, us edProperties)
1896 { 1908 {
1897 WebInspector.PropertiesSection.call(this, ""); 1909 WebInspector.PropertiesSection.call(this, "");
1898 this._hasFreshContent = false; 1910 this._hasFreshContent = false;
1899 this.element.className = "styles-section monospace read-only computed-style" ; 1911 this.element.className = "styles-section monospace read-only computed-style" ;
1900 1912
1901 var showInheritedCheckbox = WebInspector.SettingsUI.createSettingCheckbox(We bInspector.UIString("Show inherited properties"), WebInspector.settings.showInhe ritedComputedStyleProperties, true); 1913 this.headerElement.appendChild(WebInspector.ComputedStylePropertiesSection._ showInheritedCheckbox());
1902 showInheritedCheckbox.classList.add("checkbox-with-label"); 1914 this.onShowInheritedChanged();
1903 this.headerElement.appendChild(showInheritedCheckbox);
1904 WebInspector.settings.showInheritedComputedStyleProperties.addChangeListener (showInheritedChanged.bind(this));
1905 showInheritedChanged.call(this);
1906
1907 /**
1908 * @this {WebInspector.ComputedStylePropertiesSection}
1909 */
1910 function showInheritedChanged()
1911 {
1912 this.element.classList.toggle("styles-show-inherited", WebInspector.sett ings.showInheritedComputedStyleProperties.get());
1913 }
1914 1915
1915 this._stylesPane = stylesPane; 1916 this._stylesPane = stylesPane;
1916 this.styleRule = styleRule; 1917 this.styleRule = styleRule;
1917 this._usedProperties = usedProperties; 1918 this._usedProperties = usedProperties;
1918 this._alwaysShowComputedProperties = { "display": true, "height": true, "wid th": true }; 1919 this._alwaysShowComputedProperties = { "display": true, "height": true, "wid th": true };
1919 this.computedStyle = true; 1920 this.computedStyle = true;
1920 this._propertyTreeElements = {}; 1921 this._propertyTreeElements = {};
1921 this._expandedPropertyNames = {}; 1922 this._expandedPropertyNames = {};
1922 } 1923 }
1923 1924
1925 /**
1926 * @return {!Element}
1927 */
1928 WebInspector.ComputedStylePropertiesSection._showInheritedCheckbox = function()
1929 {
1930 if (!WebInspector.ComputedStylePropertiesSection._showInheritedCheckboxEleme nt) {
1931 WebInspector.ComputedStylePropertiesSection._showInheritedCheckboxElemen t = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show in herited properties"), WebInspector.settings.showInheritedComputedStyleProperties , true);
1932 WebInspector.ComputedStylePropertiesSection._showInheritedCheckboxElemen t.classList.add("checkbox-with-label");
1933 }
1934 return WebInspector.ComputedStylePropertiesSection._showInheritedCheckboxEle ment;
1935 }
1936
1924 WebInspector.ComputedStylePropertiesSection.prototype = { 1937 WebInspector.ComputedStylePropertiesSection.prototype = {
1938 onShowInheritedChanged: function()
1939 {
1940 this.element.classList.toggle("styles-show-inherited", WebInspector.sett ings.showInheritedComputedStyleProperties.get());
1941 },
1942
1925 collapse: function(dontRememberState) 1943 collapse: function(dontRememberState)
1926 { 1944 {
1927 // Overriding with empty body. 1945 // Overriding with empty body.
1928 }, 1946 },
1929 1947
1930 _isPropertyInherited: function(propertyName) 1948 _isPropertyInherited: function(propertyName)
1931 { 1949 {
1932 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope rtyName); 1950 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope rtyName);
1933 return !(canonicalName in this._usedProperties) && !(canonicalName in th is._alwaysShowComputedProperties); 1951 return !(canonicalName in this._usedProperties) && !(canonicalName in th is._alwaysShowComputedProperties);
1934 }, 1952 },
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after
3563 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) { 3581 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) {
3564 for (var i = 0; i < results.length; ++i) 3582 for (var i = 0; i < results.length; ++i)
3565 results[i] = results[i].toUpperCase(); 3583 results[i] = results[i].toUpperCase();
3566 } 3584 }
3567 var selectedIndex = this._cssCompletions.mostUsedOf(results); 3585 var selectedIndex = this._cssCompletions.mostUsedOf(results);
3568 completionsReadyCallback(results, selectedIndex); 3586 completionsReadyCallback(results, selectedIndex);
3569 }, 3587 },
3570 3588
3571 __proto__: WebInspector.TextPrompt.prototype 3589 __proto__: WebInspector.TextPrompt.prototype
3572 } 3590 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698