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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!WebInspector.StylesSidebarPane} ssp | 7 * @param {!WebInspector.StylesSidebarPane} ssp |
8 */ | 8 */ |
9 WebInspector.PropertyChangeHighlighter = function(ssp) | 9 WebInspector.PropertyChangeHighlighter = function(ssp) |
10 { | 10 { |
(...skipping 28 matching lines...) Expand all Loading... |
39 var node = this._styleSidebarPane.node(); | 39 var node = this._styleSidebarPane.node(); |
40 if (!node || this._target !== node.target()) { | 40 if (!node || this._target !== node.target()) { |
41 this._clear(); | 41 this._clear(); |
42 return; | 42 return; |
43 } | 43 } |
44 | 44 |
45 var sectionBlocks = this._styleSidebarPane.sectionBlocks(); | 45 var sectionBlocks = this._styleSidebarPane.sectionBlocks(); |
46 var foundSection = null; | 46 var foundSection = null; |
47 for (var block of sectionBlocks) { | 47 for (var block of sectionBlocks) { |
48 for (var section of block.sections) { | 48 for (var section of block.sections) { |
49 var declaration = section.styleRule.style(); | 49 var declaration = section.style(); |
50 if (declaration.styleSheetId !== this._styleSheetId) | 50 if (declaration.styleSheetId !== this._styleSheetId) |
51 continue; | 51 continue; |
52 | 52 |
53 if (this._checkRanges(declaration.range, this._changeRange)) { | 53 if (this._checkRanges(declaration.range, this._changeRange)) { |
54 foundSection = section; | 54 foundSection = section; |
55 break; | 55 break; |
56 } | 56 } |
57 } | 57 } |
58 if (foundSection) | 58 if (foundSection) |
59 break; | 59 break; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 */ | 113 */ |
114 _checkRanges: function(outterRange, innerRange) | 114 _checkRanges: function(outterRange, innerRange) |
115 { | 115 { |
116 var startsBefore = outterRange.startLine < innerRange.startLine || (outt
erRange.startLine === innerRange.startLine && outterRange.startColumn <= innerRa
nge.startColumn); | 116 var startsBefore = outterRange.startLine < innerRange.startLine || (outt
erRange.startLine === innerRange.startLine && outterRange.startColumn <= innerRa
nge.startColumn); |
117 // SSP might be outdated, so inner range will a bit bigger than outter.
E.g.; "padding-left: 9px" -> "padding-left: 10px" | 117 // SSP might be outdated, so inner range will a bit bigger than outter.
E.g.; "padding-left: 9px" -> "padding-left: 10px" |
118 var eps = 5; | 118 var eps = 5; |
119 var endsAfter = outterRange.endLine > innerRange.endLine || (outterRange
.endLine === innerRange.endLine && outterRange.endColumn + eps >= innerRange.end
Column); | 119 var endsAfter = outterRange.endLine > innerRange.endLine || (outterRange
.endLine === innerRange.endLine && outterRange.endColumn + eps >= innerRange.end
Column); |
120 return startsBefore && endsAfter; | 120 return startsBefore && endsAfter; |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |