Diff
Modified: trunk/LayoutTests/ChangeLog (240313 => 240314)
--- trunk/LayoutTests/ChangeLog 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/ChangeLog 2019-01-23 01:46:01 UTC (rev 240314)
@@ -1,3 +1,21 @@
+2019-01-22 Nikita Vasilyev <[email protected]>
+
+ Web Inspector: Styles: refactor properties/allProperties/visibleProperties/allVisibleProperties
+ https://bugs.webkit.org/show_bug.cgi?id=193615
+
+ Reviewed by Devin Rousso.
+
+ Rename:
+ - properties to enabledProperties;
+ - allProperties to properties.
+
+ * inspector/css/css-property-expected.txt:
+ * inspector/css/css-property.html:
+ * inspector/css/force-page-appearance.html:
+ * inspector/css/matched-style-properties.html:
+ * inspector/css/modify-css-property.html:
+ * inspector/css/shadow-scoped-style.html:
+
2019-01-22 Sihui Liu <[email protected]>
Layout test storage/indexeddb/open-during-transaction-private.html is failing
Modified: trunk/LayoutTests/inspector/css/css-property-expected.txt (240313 => 240314)
--- trunk/LayoutTests/inspector/css/css-property-expected.txt 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/inspector/css/css-property-expected.txt 2019-01-23 01:46:01 UTC (rev 240314)
@@ -51,6 +51,6 @@
PASS: "background-repeat-y" has the _text (private) "".
-- Running test case: CSSProperty.prototype.remove
-PASS: The removed property should no longer be in allProperties array.
+PASS: The removed property should no longer be in properties array.
PASS: The second property should shift and become the first.
Modified: trunk/LayoutTests/inspector/css/css-property.html (240313 => 240314)
--- trunk/LayoutTests/inspector/css/css-property.html 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/inspector/css/css-property.html 2019-01-23 01:46:01 UTC (rev 240314)
@@ -16,7 +16,7 @@
if (rule.selectorText !== "div#x")
continue;
- for (let property of rule.style.properties) {
+ for (let property of rule.style.enabledProperties) {
switch (property.name) {
case "background-repeat":
InspectorTest.expectThat(property.valid, `"${property.name}" is a valid property.`);
@@ -42,7 +42,7 @@
if (rule.selectorText !== "div#x")
continue;
- for (let property of rule.style.properties) {
+ for (let property of rule.style.enabledProperties) {
switch (property.name) {
case "background-repeat":
case "background-repeat-x":
@@ -68,7 +68,7 @@
if (rule.selectorText !== "div#x")
continue;
- for (let property of rule.style.properties) {
+ for (let property of rule.style.enabledProperties) {
switch (property.name) {
case "background-repeat":
case "background-repeat-x":
@@ -94,7 +94,7 @@
if (rule.selectorText !== "div#x")
continue;
- for (let property of rule.style.properties) {
+ for (let property of rule.style.enabledProperties) {
switch (property.name) {
case "background-repeat":
case "background-repeat-x":
@@ -118,7 +118,7 @@
if (rule.selectorText !== "div#x")
continue;
- for (let property of rule.style.allProperties) {
+ for (let property of rule.style.properties) {
switch (property.name) {
case "background-repeat":
case "background-repeat-x":
@@ -145,7 +145,7 @@
if (rule.selectorText !== "div#x")
continue;
- for (let property of rule.style.allProperties) {
+ for (let property of rule.style.properties) {
switch (property.name) {
case "background-repeat":
case "background-repeat-x":
@@ -176,7 +176,7 @@
// synthesize a value for the CSSProperty if it is falsy. This is used for cases
// where a shorthand property is written in the style, since the longhand properties
// (with corresponding values) are still sent to the frontend.
- for (let property of rule.style.properties) {
+ for (let property of rule.style.enabledProperties) {
switch (property.name) {
case "background-repeat":
InspectorTest.expectEqual(property.text, "background-repeat: repeat;", `"${property.name}" has the text "background-repeat: repeat;".`);
@@ -210,14 +210,14 @@
if (rule.selectorText !== "div#x")
continue;
- let propertiesLength = rule.style.allProperties.length;
- let firstProperty = rule.style.allProperties[0];
- let secondProperty = rule.style.allProperties[1];
+ let propertiesLength = rule.style.properties.length;
+ let firstProperty = rule.style.properties[0];
+ let secondProperty = rule.style.properties[1];
- rule.style.allProperties[0].remove();
+ rule.style.properties[0].remove();
- InspectorTest.expectEqual(rule.style.allProperties.length, propertiesLength - 1, "The removed property should no longer be in allProperties array.");
- InspectorTest.expectEqual(rule.style.allProperties[0], secondProperty, "The second property should shift and become the first.");
+ InspectorTest.expectEqual(rule.style.properties.length, propertiesLength - 1, "The removed property should no longer be in properties array.");
+ InspectorTest.expectEqual(rule.style.properties[0], secondProperty, "The second property should shift and become the first.");
}
resolve();
Modified: trunk/LayoutTests/inspector/css/force-page-appearance.html (240313 => 240314)
--- trunk/LayoutTests/inspector/css/force-page-appearance.html 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/inspector/css/force-page-appearance.html 2019-01-23 01:46:01 UTC (rev 240314)
@@ -14,7 +14,7 @@
let getProperty = (propertyName) => {
let styleDeclaration = nodeStyles.computedStyle;
- for (let property of styleDeclaration.properties) {
+ for (let property of styleDeclaration.enabledProperties) {
if (property.name === propertyName)
return property;
}
Modified: trunk/LayoutTests/inspector/css/matched-style-properties.html (240313 => 240314)
--- trunk/LayoutTests/inspector/css/matched-style-properties.html 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/inspector/css/matched-style-properties.html 2019-01-23 01:46:01 UTC (rev 240314)
@@ -40,8 +40,8 @@
if (rule.type !== WI.CSSStyleSheet.Type.Author)
continue;
- for (var j = 0; j < rule.style.properties.length; ++j) {
- var property = rule.style.properties[j];
+ for (var j = 0; j < rule.style.enabledProperties.length; ++j) {
+ var property = rule.style.enabledProperties[j];
if (property.anonymous)
continue;
Modified: trunk/LayoutTests/inspector/css/modify-css-property.html (240313 => 240314)
--- trunk/LayoutTests/inspector/css/modify-css-property.html 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/inspector/css/modify-css-property.html 2019-01-23 01:46:01 UTC (rev 240314)
@@ -29,7 +29,7 @@
let getProperty = (propertyName) => {
let styleDeclaration = getMatchedStyleDeclaration();
- for (let property of styleDeclaration.properties) {
+ for (let property of styleDeclaration.enabledProperties) {
if (property.name === propertyName)
return property;
}
@@ -64,7 +64,7 @@
let getProperty = (propertyName) => {
let styleDeclaration = getMatchedStyleDeclaration();
- for (let property of styleDeclaration.properties) {
+ for (let property of styleDeclaration.enabledProperties) {
if (property.name === propertyName)
return property;
}
@@ -107,7 +107,7 @@
let getProperty = (propertyName) => {
let styleDeclaration = getInlineStyleDeclaration();
- for (let property of styleDeclaration.properties) {
+ for (let property of styleDeclaration.enabledProperties) {
if (property.name === propertyName)
return property;
}
@@ -153,7 +153,7 @@
let getProperty = (propertyName) => {
let styleDeclaration = getMatchedStyleDeclaration();
- for (let property of styleDeclaration.allProperties) {
+ for (let property of styleDeclaration.properties) {
if (property.name === propertyName)
return property;
}
@@ -200,7 +200,7 @@
let getProperty = (propertyName) => {
let styleDeclaration = getMatchedStyleDeclaration();
- for (let property of styleDeclaration.allProperties) {
+ for (let property of styleDeclaration.properties) {
if (property.name === propertyName)
return property;
}
Modified: trunk/LayoutTests/inspector/css/shadow-scoped-style.html (240313 => 240314)
--- trunk/LayoutTests/inspector/css/shadow-scoped-style.html 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/LayoutTests/inspector/css/shadow-scoped-style.html 2019-01-23 01:46:01 UTC (rev 240314)
@@ -13,7 +13,7 @@
function generateCSSRuleString(style) {
let styleText = style.selectorText + " {\n";
- for (let property of style.properties) {
+ for (let property of style.enabledProperties) {
if (property.anonymous)
continue;
Modified: trunk/Source/WebInspectorUI/ChangeLog (240313 => 240314)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-01-23 01:46:01 UTC (rev 240314)
@@ -1,3 +1,47 @@
+2019-01-22 Nikita Vasilyev <[email protected]>
+
+ Web Inspector: Styles: refactor properties/allProperties/visibleProperties/allVisibleProperties
+ https://bugs.webkit.org/show_bug.cgi?id=193615
+
+ Reviewed by Devin Rousso.
+
+ Remove unused visibleProperties.
+
+ Rename:
+ - properties to enabledProperties;
+ - allProperties to properties;
+ - allVisibleProperties to visibleProperties.
+
+ * UserInterface/Models/CSSProperty.js:
+ (WI.CSSProperty.prototype._prependSemicolonIfNeeded):
+ (WI.CSSProperty):
+ * UserInterface/Models/CSSStyleDeclaration.js:
+ (WI.CSSStyleDeclaration):
+ (WI.CSSStyleDeclaration.prototype.get enabledProperties):
+ (WI.CSSStyleDeclaration.prototype.get properties):
+ (WI.CSSStyleDeclaration.prototype.propertyForName):
+ (WI.CSSStyleDeclaration.prototype.newBlankProperty):
+ (WI.CSSStyleDeclaration.prototype.shiftPropertiesAfter):
+ (WI.CSSStyleDeclaration.prototype._rangeAfterPropertyAtIndex):
+ * UserInterface/Models/DOMNodeStyles.js:
+ (WI.DOMNodeStyles.prototype._parseStylePropertyPayload):
+ (WI.DOMNodeStyles.prototype._markOverriddenProperties):
+ (WI.DOMNodeStyles.prototype._associateRelatedProperties):
+ (WI.DOMNodeStyles.prototype._isPropertyFoundInMatchingRules):
+ (WI.DOMNodeStyles):
+ * UserInterface/Views/BoxModelDetailsSectionRow.js:
+ (WI.BoxModelDetailsSectionRow.prototype._updateMetrics):
+ * UserInterface/Views/ComputedStyleDetailsPanel.js:
+ (WI.ComputedStyleDetailsPanel.prototype._computePropertyTraces):
+ * UserInterface/Views/ComputedStyleSection.js:
+ (WI.ComputedStyleSection.prototype.get propertiesToRender):
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.get propertiesToRender):
+ * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
+ (WI.SpreadsheetRulesStyleDetailsPanel.prototype.layout):
+ * UserInterface/Views/SpreadsheetStyleProperty.js:
+ (WI.SpreadsheetStyleProperty.prototype.updateStatus):
+
2019-01-22 Joseph Pecoraro <[email protected]>
Web Inspector: Network Table appears broken after filter - rows look collapsed
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -392,7 +392,7 @@
_prependSemicolonIfNeeded()
{
for (let i = this.index - 1; i >= 0; --i) {
- let property = this._ownerStyle.allProperties[i];
+ let property = this._ownerStyle.properties[i];
if (!property.enabled)
continue;
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -44,8 +44,9 @@
this._pendingProperties = [];
this._propertyNameMap = {};
- this._allProperties = [];
- this._allVisibleProperties = null;
+ this._properties = [];
+ this._enabledProperties = [];
+ this._visibleProperties = null;
this.update(text, properties, styleSheetTextRange, {dontFireEvents: true});
}
@@ -114,18 +115,17 @@
var oldText = this._text;
this._text = text;
- this._properties = properties.filter((property) => property.enabled);
- this._allProperties = properties;
+ this._properties = properties;
+ this._enabledProperties = properties.filter((property) => property.enabled);
this._styleSheetTextRange = styleSheetTextRange;
this._propertyNameMap = {};
- delete this._visibleProperties;
- this._allVisibleProperties = null;
+ this._visibleProperties = null;
var editable = this.editable;
- for (let property of this._allProperties) {
+ for (let property of this._properties) {
property.ownerStyle = this;
// Store the property in a map if we aren't editable. This
@@ -144,7 +144,7 @@
for (var i = 0; i < oldProperties.length; ++i) {
var oldProperty = oldProperties[i];
- if (!this._properties.includes(oldProperty)) {
+ if (!this._enabledProperties.includes(oldProperty)) {
// Clear the index, since it is no longer valid.
oldProperty.index = NaN;
@@ -161,9 +161,9 @@
return;
var addedProperties = [];
- for (var i = 0; i < this._properties.length; ++i) {
- if (!oldProperties.includes(this._properties[i]))
- addedProperties.push(this._properties[i]);
+ for (var i = 0; i < this._enabledProperties.length; ++i) {
+ if (!oldProperties.includes(this._enabledProperties[i]))
+ addedProperties.push(this._enabledProperties[i]);
}
// Don't fire the event if there is text and it hasn't changed.
@@ -220,21 +220,13 @@
this._nodeStyles.changeStyleText(this, text);
}
- get properties()
+ get enabledProperties()
{
- return this._properties;
+ return this._enabledProperties;
}
- get allProperties() { return this._allProperties; }
+ get properties() { return this._properties; }
- get allVisibleProperties()
- {
- if (!this._allVisibleProperties)
- this._allVisibleProperties = this._allProperties.filter((property) => !!property.styleDeclarationTextRange);
-
- return this._allVisibleProperties;
- }
-
get visibleProperties()
{
if (!this._visibleProperties)
@@ -293,7 +285,7 @@
var bestMatchProperty = null;
- findMatch(this._properties);
+ findMatch(this._enabledProperties);
if (bestMatchProperty)
return bestMatchProperty;
@@ -314,11 +306,6 @@
return newProperty;
}
- hasProperties()
- {
- return !!this._properties.length;
- }
-
newBlankProperty(propertyIndex)
{
let text, name, value, priority, overridden, implicit, anonymous;
@@ -328,11 +315,11 @@
let property = new WI.CSSProperty(propertyIndex, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange);
- this._allProperties.insertAtIndex(property, propertyIndex);
- for (let index = propertyIndex + 1; index < this._allProperties.length; index++)
- this._allProperties[index].index = index;
+ this._properties.insertAtIndex(property, propertyIndex);
+ for (let index = propertyIndex + 1; index < this._properties.length; index++)
+ this._properties[index].index = index;
- this.update(this._text, this._allProperties, this._styleSheetTextRange, {dontFireEvents: true, suppressLock: true});
+ this.update(this._text, this._properties, this._styleSheetTextRange, {dontFireEvents: true, suppressLock: true});
return property;
}
@@ -340,14 +327,14 @@
shiftPropertiesAfter(cssProperty, lineDelta, columnDelta, propertyWasRemoved)
{
// cssProperty.index could be set to NaN by WI.CSSStyleDeclaration.prototype.update.
- let realIndex = this._allProperties.indexOf(cssProperty);
+ let realIndex = this._properties.indexOf(cssProperty);
if (realIndex === -1)
return;
let endLine = cssProperty.styleSheetTextRange.endLine;
- for (let i = realIndex + 1; i < this._allProperties.length; i++) {
- let property = this._allProperties[i];
+ for (let i = realIndex + 1; i < this._properties.length; i++) {
+ let property = this._properties[i];
if (property._styleSheetTextRange) {
if (property.styleSheetTextRange.startLine === endLine) {
@@ -362,10 +349,10 @@
}
if (propertyWasRemoved)
- this._allProperties.splice(realIndex, 1);
+ this._properties.splice(realIndex, 1);
// Invalidate cached properties.
- this._allVisibleProperties = null;
+ this._visibleProperties = null;
}
// Protected
@@ -382,10 +369,10 @@
if (index < 0)
return this._styleSheetTextRange.collapseToStart();
- if (index >= this.allVisibleProperties.length)
+ if (index >= this.visibleProperties.length)
return this._styleSheetTextRange.collapseToEnd();
- let property = this.allVisibleProperties[index];
+ let property = this.visibleProperties[index];
return property.styleSheetTextRange.collapseToEnd();
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -536,7 +536,7 @@
if (styleDeclaration) {
// Use propertyForName when the index is NaN since propertyForName is fast in that case.
- var property = isNaN(index) ? styleDeclaration.propertyForName(name, true) : styleDeclaration.properties[index];
+ var property = isNaN(index) ? styleDeclaration.propertyForName(name, true) : styleDeclaration.enabledProperties[index];
// Reuse a property if the index and name matches. Otherwise it is a different property
// and should be created from scratch. This works in the simple cases where only existing
@@ -880,7 +880,7 @@
for (var i = 0; i < styles.length; ++i) {
var style = styles[i];
- var properties = style.properties;
+ var properties = style.enabledProperties;
for (var j = 0; j < properties.length; ++j) {
var property = properties[j];
@@ -922,7 +922,7 @@
_associateRelatedProperties(styles, propertyNameToEffectiveProperty)
{
for (var i = 0; i < styles.length; ++i) {
- var properties = styles[i].properties;
+ var properties = styles[i].enabledProperties;
var knownShorthands = {};
@@ -979,7 +979,7 @@
_isPropertyFoundInMatchingRules(propertyName)
{
return this._orderedStyles.some((style) => {
- return style.properties.some((property) => property.name === propertyName);
+ return style.enabledProperties.some((property) => property.name === propertyName);
});
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -200,7 +200,7 @@
this._boxElements = [];
- if (!style.hasProperties()) {
+ if (style.enabledProperties.length === 0) {
this.showEmptyMessage();
return;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -166,7 +166,7 @@
{
let result = new Map();
for (let rule of orderedDeclarations) {
- for (let property of rule.allProperties) {
+ for (let property of rule.properties) {
let properties = result.get(property.name);
if (!properties) {
properties = [];
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -125,9 +125,9 @@
return properties;
if (this._style._styleSheetTextRange)
- properties = this._style.allVisibleProperties;
+ properties = this._style.visibleProperties;
else
- properties = this._style.allProperties;
+ properties = this._style.properties;
properties.sort((a, b) => a.name.extendedLocaleCompare(b.name));
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -222,9 +222,9 @@
return properties;
if (this._style._styleSheetTextRange)
- properties = this._style.allVisibleProperties;
+ properties = this._style.visibleProperties;
else
- properties = this._style.allProperties;
+ properties = this._style.properties;
if (this._sortPropertiesByName)
properties.sort((a, b) => a.name.extendedLocaleCompare(b.name));
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -236,7 +236,7 @@
section.addEventListener(WI.SpreadsheetCSSStyleDeclarationSection.Event.FilterApplied, this._handleSectionFilterApplied, this);
- if (this._newRuleSelector === style.selectorText && !style.hasProperties())
+ if (this._newRuleSelector === style.selectorText && style.enabledProperties.length === 0)
section.startEditingRuleSelector();
this.addSubview(section);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (240313 => 240314)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2019-01-23 01:13:44 UTC (rev 240313)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2019-01-23 01:46:01 UTC (rev 240314)
@@ -247,7 +247,7 @@
let duplicatePropertyExistsBelow = (cssProperty) => {
let propertyFound = false;
- for (let property of this._property.ownerStyle.properties) {
+ for (let property of this._property.ownerStyle.enabledProperties) {
if (property === cssProperty)
propertyFound = true;
else if (property.name === cssProperty.name && propertyFound)