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

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: simplistic approach 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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 this._editingSelectorEnded(); 1864 this._editingSelectorEnded();
1865 if (newContent) 1865 if (newContent)
1866 newContent = newContent.trim(); 1866 newContent = newContent.trim();
1867 if (newContent === oldContent) { 1867 if (newContent === oldContent) {
1868 // Revert to a trimmed version of the selector if need be. 1868 // Revert to a trimmed version of the selector if need be.
1869 this._selectorElement.textContent = newContent; 1869 this._selectorElement.textContent = newContent;
1870 this._moveEditorFromSelector(moveDirection); 1870 this._moveEditorFromSelector(moveDirection);
1871 return; 1871 return;
1872 } 1872 }
1873 1873
1874 var selectedNode = this._parentPane._node;
1875
1876 /** 1874 /**
1877 * @param {!WebInspector.CSSRule} newRule 1875 * @param {!WebInspector.CSSRule} newRule
1878 * @this {WebInspector.StylePropertiesSection} 1876 * @this {WebInspector.StylePropertiesSection}
1879 */ 1877 */
1880 function successCallback(newRule) 1878 function successCallback(newRule)
1881 { 1879 {
1882 var doesAffectSelectedNode = newRule.matchingSelectors.length > 0; 1880 var doesAffectSelectedNode = newRule.matchingSelectors.length > 0;
1883 if (!doesAffectSelectedNode) { 1881 if (!doesAffectSelectedNode) {
1884 this.noAffect = true; 1882 this.noAffect = true;
1885 this.element.classList.add("no-affect"); 1883 this.element.classList.add("no-affect");
1886 } else { 1884 } else {
1887 delete this.noAffect; 1885 delete this.noAffect;
1888 this.element.classList.remove("no-affect"); 1886 this.element.classList.remove("no-affect");
1889 } 1887 }
1890 1888
1891 var oldSelectorRange = this.rule.selectorRange; 1889 var oldSelectorRange = this.rule.selectorRange;
1892 this.rule = newRule; 1890 this.rule = newRule;
1893 this.styleRule = { section: this, style: newRule.style, selectorText : newRule.selectorText, media: newRule.media, rule: newRule }; 1891 this.styleRule = { section: this, style: newRule.style, selectorText : newRule.selectorText, media: newRule.media, rule: newRule };
1894 1892
1895 this._parentPane.update(selectedNode); 1893 this._parentPane._refreshUpdate(this, false);
1896 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange, this.rule.selectorRange); 1894 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange, this.rule.selectorRange);
1897 1895
1898 finishOperationAndMoveEditor.call(this, moveDirection); 1896 finishOperationAndMoveEditor.call(this, moveDirection);
1899 } 1897 }
1900 1898
1901 /** 1899 /**
1902 * @this {WebInspector.StylePropertiesSection} 1900 * @this {WebInspector.StylePropertiesSection}
1903 */ 1901 */
1904 function finishOperationAndMoveEditor(direction) 1902 function finishOperationAndMoveEditor(direction)
1905 { 1903 {
1906 delete this._parentPane._userOperation; 1904 delete this._parentPane._userOperation;
1907 this._moveEditorFromSelector(direction); 1905 this._moveEditorFromSelector(direction);
1908 this._editingSelectorCommittedForTest(); 1906 this._editingSelectorCommittedForTest();
1909 } 1907 }
1910 1908
1911 // This gets deleted in finishOperationAndMoveEditor(), which is called both on success and failure. 1909 // This gets deleted in finishOperationAndMoveEditor(), which is called both on success and failure.
1912 this._parentPane._userOperation = true; 1910 this._parentPane._userOperation = true;
1911 var selectedNode = this._parentPane._node;
1913 this._parentPane._target.cssModel.setRuleSelector(this.rule, selectedNod e ? selectedNode.id : 0, newContent, successCallback.bind(this), finishOperation AndMoveEditor.bind(this, moveDirection)); 1912 this._parentPane._target.cssModel.setRuleSelector(this.rule, selectedNod e ? selectedNode.id : 0, newContent, successCallback.bind(this), finishOperation AndMoveEditor.bind(this, moveDirection));
1914 }, 1913 },
1915 1914
1916 _editingSelectorCommittedForTest: function() { }, 1915 _editingSelectorCommittedForTest: function() { },
1917 1916
1918 _updateRuleOrigin: function() 1917 _updateRuleOrigin: function()
1919 { 1918 {
1920 this._selectorRefElement.removeChildren(); 1919 this._selectorRefElement.removeChildren();
1921 this._selectorRefElement.appendChild(this._createRuleOriginNode(this.rul e)); 1920 this._selectorRefElement.appendChild(this._createRuleOriginNode(this.rul e));
1922 }, 1921 },
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) { 3656 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) {
3658 for (var i = 0; i < results.length; ++i) 3657 for (var i = 0; i < results.length; ++i)
3659 results[i] = results[i].toUpperCase(); 3658 results[i] = results[i].toUpperCase();
3660 } 3659 }
3661 var selectedIndex = this._cssCompletions.mostUsedOf(results); 3660 var selectedIndex = this._cssCompletions.mostUsedOf(results);
3662 completionsReadyCallback(results, selectedIndex); 3661 completionsReadyCallback(results, selectedIndex);
3663 }, 3662 },
3664 3663
3665 __proto__: WebInspector.TextPrompt.prototype 3664 __proto__: WebInspector.TextPrompt.prototype
3666 } 3665 }
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