Diff
Modified: trunk/LayoutTests/ChangeLog (285895 => 285896)
--- trunk/LayoutTests/ChangeLog 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/LayoutTests/ChangeLog 2021-11-17 00:23:20 UTC (rev 285896)
@@ -1,3 +1,13 @@
+2021-11-16 Nikita Vasilyev <nvasil...@apple.com>
+
+ Web Inspector: Remove unused `dontCreateIfMissing` argument from CSSStyleDeclaration.prototype.propertyForName
+ https://bugs.webkit.org/show_bug.cgi?id=233198
+
+ Reviewed by Devin Rousso.
+
+ * inspector/css/overridden-property.html:
+ * inspector/css/pseudo-element-matches-for-pseudo-element-node.html:
+
2021-11-16 Rob Buis <rb...@igalia.com>
[css-contain] Support contain:paint
Modified: trunk/LayoutTests/inspector/css/overridden-property.html (285895 => 285896)
--- trunk/LayoutTests/inspector/css/overridden-property.html 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/LayoutTests/inspector/css/overridden-property.html 2021-11-17 00:23:20 UTC (rev 285896)
@@ -92,11 +92,10 @@
name: "OverriddenProperty.OverriddenByShorthand",
test(resolve, reject) {
getStyleDeclaration(".longhand-overridden-by-shorthand", (style) => {
- const dontCreateIfMissing = true;
- let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing);
+ let borderTopColorProperty = style.propertyForName("border-top-color");
InspectorTest.expectTrue(borderTopColorProperty.overridden, "border-top-color is overridden.");
- let borderColorProperty = style.propertyForName("border-color", dontCreateIfMissing);
+ let borderColorProperty = style.propertyForName("border-color");
InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden.");
resolve();
@@ -108,11 +107,10 @@
name: "OverriddenProperty.OverriddenByImportantShorthand",
test(resolve, reject) {
getStyleDeclaration(".longhand-overridden-by-important-shorthand", (style) => {
- const dontCreateIfMissing = true;
- let borderColorProperty = style.propertyForName("border-color", dontCreateIfMissing);
+ let borderColorProperty = style.propertyForName("border-color");
InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden.");
- let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing);
+ let borderTopColorProperty = style.propertyForName("border-top-color");
InspectorTest.expectTrue(borderTopColorProperty.overridden, "border-top-color is overridden.");
resolve();
@@ -124,11 +122,10 @@
name: "OverriddenProperty.NotOverriddenByImportantLonghand",
test(resolve, reject) {
getStyleDeclaration(".shorthand-overridden-by-important-longhand", (style) => {
- const dontCreateIfMissing = true;
- let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing);
+ let borderTopColorProperty = style.propertyForName("border-top-color");
InspectorTest.expectFalse(borderTopColorProperty.overridden, "border-top-color is NOT overridden.");
- let borderColorProperty = style.propertyForName("border-color", dontCreateIfMissing);
+ let borderColorProperty = style.propertyForName("border-color");
InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden.");
resolve();
@@ -140,11 +137,10 @@
name: "OverriddenProperty.NotOverriddenByLonghand",
test(resolve, reject) {
getStyleDeclaration(".shorthand-not-overridden-by-longhand", (style) => {
- const dontCreateIfMissing = true;
- let borderColorProperty = style.propertyForName("border-color", dontCreateIfMissing);
+ let borderColorProperty = style.propertyForName("border-color");
InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden.");
- let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing);
+ let borderTopColorProperty = style.propertyForName("border-top-color");
InspectorTest.expectFalse(borderTopColorProperty.overridden, "border-top-color is NOT overridden.");
resolve();
@@ -156,11 +152,10 @@
name: "OverriddenProperty.MixedCaseVariablesNotOverridden",
test(resolve, reject) {
getStyleDeclaration(".mixed-case-variables-not-overridden", (style) => {
- const dontCreateIfMissing = true;
- let lowercaseVariableProperty = style.propertyForName("--foo", dontCreateIfMissing);
+ let lowercaseVariableProperty = style.propertyForName("--foo");
InspectorTest.expectFalse(lowercaseVariableProperty.overridden, "`--foo` is NOT overridden.");
- let uppercaseVariableProperty = style.propertyForName("--FOO", dontCreateIfMissing);
+ let uppercaseVariableProperty = style.propertyForName("--FOO");
InspectorTest.expectFalse(uppercaseVariableProperty.overridden, "`--FOO` is NOT overridden.");
resolve();
Modified: trunk/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html (285895 => 285896)
--- trunk/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html 2021-11-17 00:23:20 UTC (rev 285896)
@@ -17,8 +17,7 @@
InspectorTest.expectThat(nodeStyles.computedStyle, "Has Computed Styles");
function logProperty(propertyName) {
- const dontCreateIfMissing = true;
- let property = nodeStyles.computedStyle.propertyForName(propertyName, dontCreateIfMissing);
+ let property = nodeStyles.computedStyle.propertyForName(propertyName);
InspectorTest.log(`PROPERTY: ${property.name}: ${property.value};`);
}
Modified: trunk/Source/WebInspectorUI/ChangeLog (285895 => 285896)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-11-17 00:23:20 UTC (rev 285896)
@@ -1,3 +1,25 @@
+2021-11-16 Nikita Vasilyev <nvasil...@apple.com>
+
+ Web Inspector: Remove unused `dontCreateIfMissing` argument from CSSStyleDeclaration.prototype.propertyForName
+ https://bugs.webkit.org/show_bug.cgi?id=233198
+
+ Reviewed by Devin Rousso.
+
+ `dontCreateIfMissing` was always set to `true`.
+
+ * UserInterface/Models/CSSStyleDeclaration.js:
+ (WI.CSSStyleDeclaration.prototype.propertyForName):
+ Drive-by: inline findMatch function, which was only used once.
+
+ * UserInterface/Models/DOMNodeStyles.js:
+ (WI.DOMNodeStyles.prototype._parseStylePropertyPayload):
+ * UserInterface/Models/Font.js:
+ (WI.Font):
+ * UserInterface/Views/BoxModelDetailsSectionRow.js:
+ (WI.BoxModelDetailsSectionRow.prototype._getPropertyValue):
+ * UserInterface/Views/SpreadsheetStyleProperty.js:
+ (WI.SpreadsheetStyleProperty.prototype._addVariableTokens):
+
2021-11-15 Patrick Angle <pan...@apple.com>
Web Inspector: Styles: Autocomplete should support mid-line completions
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js (285895 => 285896)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js 2021-11-17 00:23:20 UTC (rev 285896)
@@ -301,7 +301,7 @@
return this._node.appropriateSelectorFor(true);
}
- propertyForName(name, dontCreateIfMissing)
+ propertyForName(name)
{
console.assert(name);
if (!name)
@@ -313,39 +313,16 @@
// Editable styles don't use the map since they need to
// account for overridden properties.
- function findMatch(properties)
- {
- for (var i = 0; i < properties.length; ++i) {
- var property = properties[i];
- if (property.canonicalName !== name && property.name !== name)
- continue;
- if (bestMatchProperty && !bestMatchProperty.overridden && property.overridden)
- continue;
- bestMatchProperty = property;
- }
+ let bestMatchProperty = null;
+ for (let property of this.enabledProperties) {
+ if (property.canonicalName !== name && property.name !== name)
+ continue;
+ if (bestMatchProperty && !bestMatchProperty.overridden && property.overridden)
+ continue;
+ bestMatchProperty = property;
}
- var bestMatchProperty = null;
-
- findMatch(this.enabledProperties);
-
- if (bestMatchProperty)
- return bestMatchProperty;
-
- if (dontCreateIfMissing || !this.editable)
- return null;
-
- findMatch(this._pendingProperties, true);
-
- if (bestMatchProperty)
- return bestMatchProperty;
-
- var newProperty = new WI.CSSProperty(NaN, null, name);
- newProperty.ownerStyle = this;
-
- this._pendingProperties.push(newProperty);
-
- return newProperty;
+ return bestMatchProperty;
}
resolveVariableValue(text)
@@ -385,7 +362,7 @@
if (variableNameIndex === -1)
continue;
- let variableProperty = this.propertyForName(variableTokens[variableNameIndex].value, true);
+ let variableProperty = this.propertyForName(variableTokens[variableNameIndex].value);
if (variableProperty)
return variableProperty.value.trim();
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (285895 => 285896)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2021-11-17 00:23:20 UTC (rev 285896)
@@ -545,7 +545,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.enabledProperties[index];
+ var property = isNaN(index) ? styleDeclaration.propertyForName(name) : 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
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Font.js (285895 => 285896)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Font.js 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Font.js 2021-11-17 00:23:20 UTC (rev 285896)
@@ -206,8 +206,7 @@
_computedPropertyValueForName(domNodeStyle, name)
{
- const dontCreateIfMissing = true;
- return domNodeStyle.computedStyle?.propertyForName(name, dontCreateIfMissing)?.value || "";
+ return domNodeStyle.computedStyle?.propertyForName(name)?.value || "";
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js (285895 => 285896)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js 2021-11-17 00:23:20 UTC (rev 285896)
@@ -80,8 +80,7 @@
_getPropertyValue(style, propertyName)
{
- const dontCreateIfMissing = true;
- let property = style.propertyForName(propertyName, dontCreateIfMissing);
+ let property = style.propertyForName(propertyName);
if (!property)
return null;
return property.value;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (285895 => 285896)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2021-11-17 00:14:20 UTC (rev 285895)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2021-11-17 00:23:20 UTC (rev 285896)
@@ -870,8 +870,7 @@
let contents = rawTokens.slice(0, variableNameIndex + 1);
if (WI.settings.experimentalEnableStylesJumpToVariableDeclaration.value && this._property.ownerStyle.type !== WI.CSSStyleDeclaration.Type.Computed && this._delegate && this._delegate.spreadsheetStylePropertySelectByProperty) {
- const dontCreateIfMissing = true;
- let effectiveVariableProperty = this._property.ownerStyle.nodeStyles.effectivePropertyForName(rawTokens[variableNameIndex].value, dontCreateIfMissing);
+ let effectiveVariableProperty = this._property.ownerStyle.nodeStyles.effectivePropertyForName(rawTokens[variableNameIndex].value);
if (effectiveVariableProperty) {
let arrowElement = WI.createGoToArrowButton();
arrowElement.classList.add("select-variable-property");