| Index: third_party/WebKit/Source/devtools/front_end/elements/StylePropertyHighlighter.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/elements/StylePropertyHighlighter.js b/third_party/WebKit/Source/devtools/front_end/elements/StylePropertyHighlighter.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0fa62c673b68d056396d7878d7f5c8790c186161
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylePropertyHighlighter.js
|
| @@ -0,0 +1,51 @@
|
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +/**
|
| + * @unrestricted
|
| + */
|
| +Elements.StylePropertyHighlighter = class {
|
| + /**
|
| + * @param {!Elements.StylesSidebarPane} ssp
|
| + * @param {!SDK.CSSProperty} cssProperty
|
| + */
|
| + constructor(ssp, cssProperty) {
|
| + this._styleSidebarPane = ssp;
|
| + this._cssProperty = cssProperty;
|
| + }
|
| +
|
| + perform() {
|
| + // Expand all shorthands.
|
| + for (var section of this._styleSidebarPane.allSections()) {
|
| + for (var treeElement = section.propertiesTreeOutline.firstChild(); treeElement;
|
| + treeElement = treeElement.nextSibling)
|
| + treeElement.onpopulate();
|
| + }
|
| + var highlightTreeElement = null;
|
| + for (var section of this._styleSidebarPane.allSections()) {
|
| + var treeElement = section.propertiesTreeOutline.firstChild();
|
| + while (treeElement && !highlightTreeElement) {
|
| + if (treeElement.property === this._cssProperty) {
|
| + highlightTreeElement = treeElement;
|
| + break;
|
| + }
|
| + treeElement = treeElement.traverseNextTreeElement(false, null, true);
|
| + }
|
| + if (highlightTreeElement)
|
| + break;
|
| + }
|
| +
|
| + if (!highlightTreeElement)
|
| + return;
|
| +
|
| + highlightTreeElement.parent.expand();
|
| + highlightTreeElement.listItemElement.scrollIntoViewIfNeeded();
|
| + highlightTreeElement.listItemElement.animate(
|
| + [
|
| + {offset: 0, backgroundColor: 'rgba(255, 255, 0, 0.2)'},
|
| + {offset: 0.1, backgroundColor: 'rgba(255, 255, 0, 0.7)'}, {offset: 1, backgroundColor: 'transparent'}
|
| + ],
|
| + {duration: 2000, easing: 'cubic-bezier(0, 0, 0.2, 1)'});
|
| + }
|
| +};
|
|
|