Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (242621 => 242622)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-03-08 00:40:02 UTC (rev 242622)
@@ -1,3 +1,40 @@
+2019-03-07 Nikita Vasilyev <[email protected]>
+
+ Web Inspector: Styles: overridden CSS property should have go-to button to jump to effective property
+ https://bugs.webkit.org/show_bug.cgi?id=185930
+ <rdar://problem/40506252>
+
+ Reviewed by Matt Baker.
+
+ Introduce a new experimental jump to effective property button. The button is a small arrow button
+ next to an overridden CSS property. Clicking the button scrolls to the effective CSS property and
+ selects it.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Base/Setting.js:
+ * UserInterface/Models/CSSProperty.js:
+ (WI.CSSProperty):
+ (WI.CSSProperty.prototype.update):
+ (WI.CSSProperty.prototype.get overridingProperty):
+ (WI.CSSProperty.prototype.set overridingProperty):
+ * UserInterface/Models/DOMNodeStyles.js:
+ (WI.DOMNodeStyles.prototype._markOverriddenProperties):
+ * UserInterface/Views/SettingsTabContentView.js:
+ (WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
+ (.spreadsheet-style-declaration-editor .property.overridden .select-effective-property):
+ (.spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property,):
+ (.spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property::after,):
+ (@media (prefers-color-scheme: dark)):
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertySelectByProperty):
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
+ (WI.SpreadsheetCSSStyleDeclarationSection.prototype.spreadsheetCSSStyleDeclarationEditorSelectProperty):
+ * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
+ (WI.SpreadsheetRulesStyleDetailsPanel.prototype.spreadsheetCSSStyleDeclarationSectionSelectProperty):
+ * UserInterface/Views/SpreadsheetStyleProperty.js:
+ (WI.SpreadsheetStyleProperty.prototype.updateStatus):
+
2019-03-07 Devin Rousso <[email protected]>
Web Inspector: Protocol: add type checking when commands are called via invoke
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -913,6 +913,7 @@
localizedStrings["Show Console tab"] = "Show Console tab";
localizedStrings["Show Elements"] = "Show Elements";
localizedStrings["Show Grid"] = "Show Grid";
+localizedStrings["Show Jump to Effective Property Button"] = "Show Jump to Effective Property Button";
localizedStrings["Show Path"] = "Show Path";
localizedStrings["Show Remaining (%d)"] = "Show Remaining (%d)";
localizedStrings["Show Rulers"] = "Show Rulers";
@@ -990,6 +991,7 @@
localizedStrings["Styles Recalculated"] = "Styles Recalculated";
localizedStrings["Styles \u2014 Computed"] = "Styles \u2014 Computed";
localizedStrings["Styles \u2014 Rules"] = "Styles \u2014 Rules";
+localizedStrings["Styles:"] = "Styles:";
localizedStrings["Stylesheet"] = "Stylesheet";
localizedStrings["Stylesheets"] = "Stylesheets";
localizedStrings["Subject"] = "Subject";
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -162,6 +162,7 @@
experimentalEnableLayersTab: new WI.Setting("experimental-enable-layers-tab", false),
experimentalEnableNewTabBar: new WI.Setting("experimental-enable-new-tab-bar", false),
experimentalEnableSourcesTab: new WI.Setting("experimental-enable-sources-tab", false),
+ experimentalEnableStylesJumpToEffective: new WI.Setting("experimental-styles-jump-to-effective", false),
// DebugUI
autoLogProtocolMessages: new WI.Setting("auto-collect-protocol-messages", false),
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -31,6 +31,7 @@
this._ownerStyle = null;
this._index = index;
+ this._overridingProperty = null;
this._initialState = null;
this.update(text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, true);
@@ -100,6 +101,9 @@
else
this._overridden = overridden;
+ if (!overridden)
+ this._overridingProperty = null;
+
this._text = text;
this._name = name;
this._rawValue = value;
@@ -261,6 +265,9 @@
if (this._overridden === overridden)
return;
+ if (!overridden)
+ this._overridingProperty = null;
+
var previousOverridden = this._overridden;
this._overridden = overridden;
@@ -281,6 +288,20 @@
this._overriddenStatusChangedTimeout = setTimeout(delayed.bind(this), 0);
}
+ get overridingProperty()
+ {
+ console.assert(this._overridden);
+ return this._overridingProperty;
+ }
+
+ set overridingProperty(effectiveProperty)
+ {
+ if (!WI.settings.experimentalEnableStylesJumpToEffective.value)
+ return;
+
+ this._overridingProperty = effectiveProperty || null;
+ }
+
get implicit() { return this._implicit; }
set implicit(implicit) { this._implicit = implicit; }
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -918,15 +918,19 @@
if (effectiveProperty.ownerStyle === property.ownerStyle) {
if (effectiveProperty.important && !property.important) {
property.overridden = true;
+ property.overridingProperty = effectiveProperty;
continue;
}
} else if (effectiveProperty.important || !property.important || effectiveProperty.ownerStyle.node !== property.ownerStyle.node) {
property.overridden = true;
+ property.overridingProperty = effectiveProperty;
continue;
}
- if (!property.anonymous)
+ if (!property.anonymous) {
effectiveProperty.overridden = true;
+ effectiveProperty.overridingProperty = property;
+ }
}
property.overridden = false;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -275,6 +275,9 @@
experimentalSettingsView.addSetting(WI.unlocalizedString("CPU Usage:"), WI.settings.experimentalEnableCPUUsageEnhancements, WI.unlocalizedString("Enhancements"));
experimentalSettingsView.addSeparator();
+ experimentalSettingsView.addSetting(WI.UIString("Styles:"), WI.settings.experimentalEnableStylesJumpToEffective, WI.UIString("Show Jump to Effective Property Button"));
+ experimentalSettingsView.addSeparator();
+
let reloadInspectorButton = document.createElement("button");
reloadInspectorButton.textContent = WI.UIString("Reload Web Inspector");
reloadInspectorButton.addEventListener("click", (event) => {
@@ -303,6 +306,7 @@
listenForChange(WI.settings.experimentalEnableLayersTab);
listenForChange(WI.settings.experimentalEnableNewTabBar);
listenForChange(WI.settings.experimentalEnableCPUUsageEnhancements);
+ listenForChange(WI.settings.experimentalEnableStylesJumpToEffective);
this.addSettingsView(experimentalSettingsView);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css 2019-03-08 00:40:02 UTC (rev 242622)
@@ -166,6 +166,29 @@
color: var(--syntax-highlight-string-color);
}
+.spreadsheet-style-declaration-editor .property.overridden .select-effective-property {
+ display: none;
+ height: 10px;
+ line-height: 10px;
+ vertical-align: middle;
+ color: var(--text-color-secondary);
+ cursor: pointer;
+}
+
+.spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property,
+.spreadsheet-style-declaration-editor .property.overridden:focus-within .select-effective-property {
+ display: inline-block;
+}
+
+.spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property::after,
+.spreadsheet-style-declaration-editor .property.overridden:focus-within .select-effective-property::after {
+ content: attr(data-value);
+ display: inline-block;
+ position: relative;
+ left: 16px;
+ white-space: nowrap;
+}
+
.meta-key-pressed .spreadsheet-css-declaration:not(.locked) :matches(.name, .value):not(.editing):hover {
color: var(--syntax-highlight-link-color) !important;
text-decoration: underline !important;
@@ -196,4 +219,10 @@
.spreadsheet-style-declaration-editor .property.modified:not(.selected) {
background-color: hsl(106, 13%, 25%);
}
+
+ .spreadsheet-style-declaration-editor .property.overridden:hover .select-effective-property::after,
+ .spreadsheet-style-declaration-editor .property.overridden:focus-within .select-effective-property::after {
+ /* .select-effective-property has inverted colors. Invert the pseudo-element again to restore the original text color. */
+ filter: invert();
+ }
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -455,6 +455,12 @@
this.selectProperties(index, index);
}
+ spreadsheetStylePropertySelectByProperty(property)
+ {
+ if (this._delegate && this._delegate.spreadsheetCSSStyleDeclarationEditorSelectProperty)
+ this._delegate.spreadsheetCSSStyleDeclarationEditorSelectProperty(property);
+ }
+
spreadsheetStylePropertyAddBlankPropertySoon(propertyView, {index})
{
if (isNaN(index))
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -229,6 +229,12 @@
}
}
+ spreadsheetCSSStyleDeclarationEditorSelectProperty(property)
+ {
+ if (this._delegate && this._delegate.spreadsheetCSSStyleDeclarationSectionSelectProperty)
+ this._delegate.spreadsheetCSSStyleDeclarationSectionSelectProperty(property);
+ }
+
applyFilter(filterText)
{
this._filterText = filterText;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -157,6 +157,11 @@
// SpreadsheetCSSStyleDeclarationSection delegate
+ spreadsheetCSSStyleDeclarationSectionSelectProperty(property)
+ {
+ this.scrollToSectionAndHighlightProperty(property);
+ }
+
spreadsheetCSSStyleDeclarationSectionStartEditingAdjacentRule(currentSection, delta)
{
console.assert(delta !== 0);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (242621 => 242622)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2019-03-08 00:36:42 UTC (rev 242621)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2019-03-08 00:40:02 UTC (rev 242622)
@@ -39,6 +39,7 @@
this._contentElement = null;
this._nameElement = null;
this._valueElement = null;
+ this._jumpToEffectivePropertyButton = null;
this._nameTextField = null;
this._valueTextField = null;
@@ -261,6 +262,22 @@
let elementTitle = "";
if (this._property.overridden) {
+ if (!this._jumpToEffectivePropertyButton && this._delegate && this._delegate.spreadsheetStylePropertySelectByProperty) {
+ console.assert(this._property.overridingProperty, `Overridden property is missing overridingProperty: ${this._property.formattedText}`);
+ if (this._property.overridingProperty) {
+ this._jumpToEffectivePropertyButton = WI.createGoToArrowButton();
+ this._jumpToEffectivePropertyButton.classList.add("select-effective-property");
+ this._jumpToEffectivePropertyButton.dataset.value = this._property.overridingProperty.rawValue;
+ this._element.append(this._jumpToEffectivePropertyButton);
+
+ this._jumpToEffectivePropertyButton.addEventListener("click", (event) => {
+ console.assert(this._property.overridingProperty);
+ event.stop();
+ this._delegate.spreadsheetStylePropertySelectByProperty(this._property.overridingProperty);
+ });
+ }
+ }
+
classNames.push("overridden");
if (duplicatePropertyExistsBelow(this._property)) {
classNames.push("has-warning");