| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.PropertyChangeHighlighter = class { | 7 Elements.PropertyChangeHighlighter = class { |
| 8 /** | 8 /** |
| 9 * @param {!WebInspector.StylesSidebarPane} ssp | 9 * @param {!Elements.StylesSidebarPane} ssp |
| 10 * @param {!WebInspector.CSSModel} cssModel | 10 * @param {!SDK.CSSModel} cssModel |
| 11 * @param {!Protocol.CSS.StyleSheetId} styleSheetId | 11 * @param {!Protocol.CSS.StyleSheetId} styleSheetId |
| 12 * @param {!WebInspector.TextRange} range | 12 * @param {!Common.TextRange} range |
| 13 */ | 13 */ |
| 14 constructor(ssp, cssModel, styleSheetId, range) { | 14 constructor(ssp, cssModel, styleSheetId, range) { |
| 15 this._styleSidebarPane = ssp; | 15 this._styleSidebarPane = ssp; |
| 16 this._target = cssModel.target(); | 16 this._target = cssModel.target(); |
| 17 this._styleSheetId = styleSheetId; | 17 this._styleSheetId = styleSheetId; |
| 18 this._range = range; | 18 this._range = range; |
| 19 } | 19 } |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 */ | 22 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 {offset: 0.5, backgroundColor: 'rgba(158, 54, 153, 1)', color: 'whit
e'}, | 73 {offset: 0.5, backgroundColor: 'rgba(158, 54, 153, 1)', color: 'whit
e'}, |
| 74 {offset: 0.9, backgroundColor: 'rgba(158, 54, 153, 0)', color: 'init
ial'}, | 74 {offset: 0.9, backgroundColor: 'rgba(158, 54, 153, 0)', color: 'init
ial'}, |
| 75 {offset: 1, backgroundColor: 'white', color: 'initial'} | 75 {offset: 1, backgroundColor: 'white', color: 'initial'} |
| 76 ], | 76 ], |
| 77 {duration: 400, easing: 'cubic-bezier(0, 0, 0.2, 1)'}); | 77 {duration: 400, easing: 'cubic-bezier(0, 0, 0.2, 1)'}); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * | 82 * |
| 83 * @param {!WebInspector.TextRange} outterRange | 83 * @param {!Common.TextRange} outterRange |
| 84 * @param {!WebInspector.TextRange} innerRange | 84 * @param {!Common.TextRange} innerRange |
| 85 * @return {boolean} | 85 * @return {boolean} |
| 86 */ | 86 */ |
| 87 _checkRanges(outterRange, innerRange) { | 87 _checkRanges(outterRange, innerRange) { |
| 88 var startsBefore = outterRange.startLine < innerRange.startLine || | 88 var startsBefore = outterRange.startLine < innerRange.startLine || |
| 89 (outterRange.startLine === innerRange.startLine && outterRange.startColu
mn <= innerRange.startColumn); | 89 (outterRange.startLine === innerRange.startLine && outterRange.startColu
mn <= innerRange.startColumn); |
| 90 // SSP might be outdated, so inner range will a bit bigger than outter. E.g.
; "padding-left: 9px" -> "padding-left: 10px" | 90 // SSP might be outdated, so inner range will a bit bigger than outter. E.g.
; "padding-left: 9px" -> "padding-left: 10px" |
| 91 var eps = 5; | 91 var eps = 5; |
| 92 var endsAfter = outterRange.endLine > innerRange.endLine || | 92 var endsAfter = outterRange.endLine > innerRange.endLine || |
| 93 (outterRange.endLine === innerRange.endLine && outterRange.endColumn + e
ps >= innerRange.endColumn); | 93 (outterRange.endLine === innerRange.endLine && outterRange.endColumn + e
ps >= innerRange.endColumn); |
| 94 return startsBefore && endsAfter; | 94 return startsBefore && endsAfter; |
| 95 } | 95 } |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * @unrestricted | 99 * @unrestricted |
| 100 */ | 100 */ |
| 101 WebInspector.PropertyRevealHighlighter = class { | 101 Elements.PropertyRevealHighlighter = class { |
| 102 /** | 102 /** |
| 103 * @param {!WebInspector.StylesSidebarPane} ssp | 103 * @param {!Elements.StylesSidebarPane} ssp |
| 104 * @param {!WebInspector.CSSProperty} cssProperty | 104 * @param {!SDK.CSSProperty} cssProperty |
| 105 */ | 105 */ |
| 106 constructor(ssp, cssProperty) { | 106 constructor(ssp, cssProperty) { |
| 107 this._styleSidebarPane = ssp; | 107 this._styleSidebarPane = ssp; |
| 108 this._cssProperty = cssProperty; | 108 this._cssProperty = cssProperty; |
| 109 } | 109 } |
| 110 | 110 |
| 111 perform() { | 111 perform() { |
| 112 // Expand all shorthands. | 112 // Expand all shorthands. |
| 113 for (var section of this._styleSidebarPane.allSections()) { | 113 for (var section of this._styleSidebarPane.allSections()) { |
| 114 for (var treeElement = section.propertiesTreeOutline.firstChild(); treeEle
ment; | 114 for (var treeElement = section.propertiesTreeOutline.firstChild(); treeEle
ment; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 135 highlightTreeElement.parent.expand(); | 135 highlightTreeElement.parent.expand(); |
| 136 highlightTreeElement.listItemElement.scrollIntoViewIfNeeded(); | 136 highlightTreeElement.listItemElement.scrollIntoViewIfNeeded(); |
| 137 highlightTreeElement.listItemElement.animate( | 137 highlightTreeElement.listItemElement.animate( |
| 138 [ | 138 [ |
| 139 {offset: 0, backgroundColor: 'rgba(255, 255, 0, 0.2)'}, | 139 {offset: 0, backgroundColor: 'rgba(255, 255, 0, 0.2)'}, |
| 140 {offset: 0.1, backgroundColor: 'rgba(255, 255, 0, 0.7)'}, {offset: 1,
backgroundColor: 'transparent'} | 140 {offset: 0.1, backgroundColor: 'rgba(255, 255, 0, 0.7)'}, {offset: 1,
backgroundColor: 'transparent'} |
| 141 ], | 141 ], |
| 142 {duration: 2000, easing: 'cubic-bezier(0, 0, 0.2, 1)'}); | 142 {duration: 2000, easing: 'cubic-bezier(0, 0, 0.2, 1)'}); |
| 143 } | 143 } |
| 144 }; | 144 }; |
| OLD | NEW |