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

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

Issue 2155263002: DevTools: Rename StylesPopoverHelper to SwatchPopoverHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/StylesPopoverHelper.js ('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 22 matching lines...) Expand all
33 */ 33 */
34 WebInspector.StylesSidebarPane = function() 34 WebInspector.StylesSidebarPane = function()
35 { 35 {
36 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles")) ; 36 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles")) ;
37 this.setMinimumSize(96, 26); 37 this.setMinimumSize(96, 26);
38 38
39 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind (this)); 39 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind (this));
40 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update .bind(this)); 40 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update .bind(this));
41 41
42 this._sectionsContainer = this.element.createChild("div"); 42 this._sectionsContainer = this.element.createChild("div");
43 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper(); 43 this._swatchPopoverHelper = new WebInspector.SwatchPopoverHelper();
44 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); 44 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter());
45 45
46 this.element.classList.add("styles-pane"); 46 this.element.classList.add("styles-pane");
47 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind( this), false); 47 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind( this), false);
48 this._keyDownBound = this._keyDown.bind(this); 48 this._keyDownBound = this._keyDown.bind(this);
49 this._keyUpBound = this._keyUp.bind(this); 49 this._keyUpBound = this._keyUp.bind(this);
50 50
51 /** @type {!Array<!WebInspector.SectionBlock>} */ 51 /** @type {!Array<!WebInspector.SectionBlock>} */
52 this._sectionBlocks = []; 52 this._sectionBlocks = [];
53 WebInspector.StylesSidebarPane._instance = this; 53 WebInspector.StylesSidebarPane._instance = this;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 */ 129 */
130 revealProperty: function(cssProperty) 130 revealProperty: function(cssProperty)
131 { 131 {
132 this._decorator = new WebInspector.PropertyRevealHighlighter(this, cssPr operty); 132 this._decorator = new WebInspector.PropertyRevealHighlighter(this, cssPr operty);
133 this._decorator.perform(); 133 this._decorator.perform();
134 this.update(); 134 this.update();
135 }, 135 },
136 136
137 forceUpdate: function() 137 forceUpdate: function()
138 { 138 {
139 this._stylesPopoverHelper.hide(); 139 this._swatchPopoverHelper.hide();
140 this._resetCache(); 140 this._resetCache();
141 this.update(); 141 this.update();
142 }, 142 },
143 143
144 /** 144 /**
145 * @param {!Event} event 145 * @param {!Event} event
146 */ 146 */
147 _onAddButtonLongClick: function(event) 147 _onAddButtonLongClick: function(event)
148 { 148 {
149 var cssModel = this.cssModel(); 149 var cssModel = this.cssModel();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 this.element.ownerDocument.body.addEventListener("keyup", this._keyUpBou nd, false); 483 this.element.ownerDocument.body.addEventListener("keyup", this._keyUpBou nd, false);
484 }, 484 },
485 485
486 /** 486 /**
487 * @override 487 * @override
488 */ 488 */
489 willHide: function() 489 willHide: function()
490 { 490 {
491 this.element.ownerDocument.body.removeEventListener("keydown", this._key DownBound, false); 491 this.element.ownerDocument.body.removeEventListener("keydown", this._key DownBound, false);
492 this.element.ownerDocument.body.removeEventListener("keyup", this._keyUp Bound, false); 492 this.element.ownerDocument.body.removeEventListener("keyup", this._keyUp Bound, false);
493 this._stylesPopoverHelper.hide(); 493 this._swatchPopoverHelper.hide();
494 this._discardElementUnderMouse(); 494 this._discardElementUnderMouse();
495 WebInspector.ElementsSidebarPane.prototype.willHide.call(this); 495 WebInspector.ElementsSidebarPane.prototype.willHide.call(this);
496 }, 496 },
497 497
498 _discardElementUnderMouse: function() 498 _discardElementUnderMouse: function()
499 { 499 {
500 if (this._elementUnderMouse) 500 if (this._elementUnderMouse)
501 this._elementUnderMouse.classList.remove("styles-panel-hovered"); 501 this._elementUnderMouse.classList.remove("styles-panel-hovered");
502 delete this._elementUnderMouse; 502 delete this._elementUnderMouse;
503 }, 503 },
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 var color = WebInspector.Color.parse(text); 2007 var color = WebInspector.Color.parse(text);
2008 if (!color) 2008 if (!color)
2009 return createTextNode(text); 2009 return createTextNode(text);
2010 2010
2011 if (!this._editable()) { 2011 if (!this._editable()) {
2012 var swatch = WebInspector.ColorSwatch.create(); 2012 var swatch = WebInspector.ColorSwatch.create();
2013 swatch.setColorText(text); 2013 swatch.setColorText(text);
2014 return swatch; 2014 return swatch;
2015 } 2015 }
2016 2016
2017 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; 2017 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper;
2018 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, stylesPop overHelper, text); 2018 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, swatchPop overHelper, text);
2019 2019
2020 /** 2020 /**
2021 * @param {?Array<string>} backgroundColors 2021 * @param {?Array<string>} backgroundColors
2022 */ 2022 */
2023 function computedCallback(backgroundColors) 2023 function computedCallback(backgroundColors)
2024 { 2024 {
2025 // TODO(aboxhall): distinguish between !backgroundColors (no text) a nd 2025 // TODO(aboxhall): distinguish between !backgroundColors (no text) a nd
2026 // !backgroundColors.length (no computed bg color) 2026 // !backgroundColors.length (no computed bg color)
2027 if (!backgroundColors || !backgroundColors.length) 2027 if (!backgroundColors || !backgroundColors.length)
2028 return; 2028 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 2062
2063 /** 2063 /**
2064 * @param {string} text 2064 * @param {string} text
2065 * @return {!Node} 2065 * @return {!Node}
2066 */ 2066 */
2067 _processBezier: function(text) 2067 _processBezier: function(text)
2068 { 2068 {
2069 var geometry = WebInspector.Geometry.CubicBezier.parse(text); 2069 var geometry = WebInspector.Geometry.CubicBezier.parse(text);
2070 if (!geometry || !this._editable()) 2070 if (!geometry || !this._editable())
2071 return createTextNode(text); 2071 return createTextNode(text);
2072 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; 2072 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper;
2073 return new WebInspector.BezierPopoverIcon(this, stylesPopoverHelper, tex t).element(); 2073 return new WebInspector.BezierPopoverIcon(this, swatchPopoverHelper, tex t).element();
2074 }, 2074 },
2075 2075
2076 _updateState: function() 2076 _updateState: function()
2077 { 2077 {
2078 if (!this.listItemElement) 2078 if (!this.listItemElement)
2079 return; 2079 return;
2080 2080
2081 if (this._style.isPropertyImplicit(this.name)) 2081 if (this._style.isPropertyImplicit(this.name))
2082 this.listItemElement.classList.add("implicit"); 2082 this.listItemElement.classList.add("implicit");
2083 else 2083 else
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 3165
3166 /** 3166 /**
3167 * @override 3167 * @override
3168 * @return {!WebInspector.ToolbarItem} 3168 * @return {!WebInspector.ToolbarItem}
3169 */ 3169 */
3170 item: function() 3170 item: function()
3171 { 3171 {
3172 return this._button; 3172 return this._button;
3173 } 3173 }
3174 } 3174 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/StylesPopoverHelper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698