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

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

Issue 692073003: DevTools: [SSP] update style rules of SectionPropertyTreeElements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | « LayoutTests/inspector/elements/styles/styles-disable-property-after-selector-edit-expected.txt ('k') | 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 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 } else { 1852 } else {
1853 var previousSection = this.previousEditableSibling(); 1853 var previousSection = this.previousEditableSibling();
1854 if (!previousSection) 1854 if (!previousSection)
1855 return; 1855 return;
1856 1856
1857 previousSection.expand(); 1857 previousSection.expand();
1858 previousSection.addNewBlankProperty().startEditing(); 1858 previousSection.addNewBlankProperty().startEditing();
1859 } 1859 }
1860 }, 1860 },
1861 1861
1862 /**
1863 * @param {!WebInspector.CSSStyleDeclaration} newStyle
1864 */
1865 _propogateNewStyle: function(newStyle)
vsevik 2014/11/05 07:52:05 propagate
1866 {
1867 if (this.rule) {
1868 newStyle.parentRule = this.rule;
1869 this.rule.style = newStyle;
1870 }
1871 this.styleRule.style = newStyle;
1872 for (var i = 0; i < this.propertiesTreeOutline.children.length; ++i) {
1873 var treeElement = this.propertiesTreeOutline.children[i];
1874 treeElement.style = newStyle;
1875 treeElement._styleRule.style = newStyle;
1876 }
1877 },
1878
1862 editingSelectorCommitted: function(element, newContent, oldContent, context, moveDirection) 1879 editingSelectorCommitted: function(element, newContent, oldContent, context, moveDirection)
1863 { 1880 {
1864 this._editingSelectorEnded(); 1881 this._editingSelectorEnded();
1865 if (newContent) 1882 if (newContent)
1866 newContent = newContent.trim(); 1883 newContent = newContent.trim();
1867 if (newContent === oldContent) { 1884 if (newContent === oldContent) {
1868 // Revert to a trimmed version of the selector if need be. 1885 // Revert to a trimmed version of the selector if need be.
1869 this._selectorElement.textContent = newContent; 1886 this._selectorElement.textContent = newContent;
1870 this._moveEditorFromSelector(moveDirection); 1887 this._moveEditorFromSelector(moveDirection);
1871 return; 1888 return;
(...skipping 12 matching lines...) Expand all
1884 this.noAffect = true; 1901 this.noAffect = true;
1885 this.element.classList.add("no-affect"); 1902 this.element.classList.add("no-affect");
1886 } else { 1903 } else {
1887 delete this.noAffect; 1904 delete this.noAffect;
1888 this.element.classList.remove("no-affect"); 1905 this.element.classList.remove("no-affect");
1889 } 1906 }
1890 1907
1891 var oldSelectorRange = this.rule.selectorRange; 1908 var oldSelectorRange = this.rule.selectorRange;
1892 this.rule = newRule; 1909 this.rule = newRule;
1893 this.styleRule = { section: this, style: newRule.style, selectorText : newRule.selectorText, media: newRule.media, rule: newRule }; 1910 this.styleRule = { section: this, style: newRule.style, selectorText : newRule.selectorText, media: newRule.media, rule: newRule };
1911 this._propogateNewStyle(this.rule.style);
1912 this._parentPane.update(selectedNode);
1894 1913
1895 this._parentPane.update(selectedNode);
1896 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange, this.rule.selectorRange); 1914 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange, this.rule.selectorRange);
1897 1915
1898 finishOperationAndMoveEditor.call(this, moveDirection); 1916 finishOperationAndMoveEditor.call(this, moveDirection);
1899 } 1917 }
1900 1918
1901 /** 1919 /**
1902 * @this {WebInspector.StylePropertiesSection} 1920 * @this {WebInspector.StylePropertiesSection}
1903 */ 1921 */
1904 function finishOperationAndMoveEditor(direction) 1922 function finishOperationAndMoveEditor(direction)
1905 { 1923 {
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 if (userCallback) 2824 if (userCallback)
2807 userCallback(); 2825 userCallback();
2808 } 2826 }
2809 }, 2827 },
2810 2828
2811 /** 2829 /**
2812 * @param {!WebInspector.CSSStyleDeclaration} newStyle 2830 * @param {!WebInspector.CSSStyleDeclaration} newStyle
2813 */ 2831 */
2814 _applyNewStyle: function(newStyle) 2832 _applyNewStyle: function(newStyle)
2815 { 2833 {
2816 newStyle.parentRule = this.style.parentRule;
2817 var oldStyleRange = /** @type {!WebInspector.TextRange} */ (this.style.r ange); 2834 var oldStyleRange = /** @type {!WebInspector.TextRange} */ (this.style.r ange);
2818 var newStyleRange = /** @type {!WebInspector.TextRange} */ (newStyle.ran ge); 2835 var newStyleRange = /** @type {!WebInspector.TextRange} */ (newStyle.ran ge);
2819 this.style = newStyle; 2836 this.parent.section._propogateNewStyle(newStyle);
2820 this._styleRule.style = newStyle;
2821 if (this.style.parentRule) { 2837 if (this.style.parentRule) {
2822 this.style.parentRule.style = this.style; 2838 this.style.parentRule.style = this.style;
2823 this._parentPane._styleSheetRuleEdited(this.style.parentRule, oldSty leRange, newStyleRange); 2839 this._parentPane._styleSheetRuleEdited(this.style.parentRule, oldSty leRange, newStyleRange);
2824 } 2840 }
2825 }, 2841 },
2826 2842
2827 /** 2843 /**
2828 * @param {!Event} event 2844 * @param {!Event} event
2829 */ 2845 */
2830 toggleEnabled: function(event) 2846 toggleEnabled: function(event)
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) { 3673 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) {
3658 for (var i = 0; i < results.length; ++i) 3674 for (var i = 0; i < results.length; ++i)
3659 results[i] = results[i].toUpperCase(); 3675 results[i] = results[i].toUpperCase();
3660 } 3676 }
3661 var selectedIndex = this._cssCompletions.mostUsedOf(results); 3677 var selectedIndex = this._cssCompletions.mostUsedOf(results);
3662 completionsReadyCallback(results, selectedIndex); 3678 completionsReadyCallback(results, selectedIndex);
3663 }, 3679 },
3664 3680
3665 __proto__: WebInspector.TextPrompt.prototype 3681 __proto__: WebInspector.TextPrompt.prototype
3666 } 3682 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/elements/styles/styles-disable-property-after-selector-edit-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698