Title: [227232] trunk/Source/WebInspectorUI
- Revision
- 227232
- Author
- nvasil...@apple.com
- Date
- 2018-01-19 13:36:58 -0800 (Fri, 19 Jan 2018)
Log Message
Web Inspector: Styles Redesign: tabbing on commented out property throws exception
https://bugs.webkit.org/show_bug.cgi?id=180676
<rdar://problem/35981058>
Reviewed by Joseph Pecoraro.
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.startEditingFirstProperty):
Tabbing from the selector field should focus on the first editable property.
When no editable properties are present, a new blank property should be added after the commented out ones.
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.startEditingLastProperty):
Shift-tabbing from the selector field should focus on the last editable property of the previous CSS rule.
When no editable properties are present, a new blank property should be added after the commented out ones.
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetCSSStyleDeclarationEditorFocusMoved):
When navigating between properties skip the commented out ones.
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._editablePropertyAfter):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._editablePropertyBefore):
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.get enabled):
(WI.SpreadsheetStyleProperty.prototype._update):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (227231 => 227232)
--- trunk/Source/WebInspectorUI/ChangeLog 2018-01-19 21:22:30 UTC (rev 227231)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-01-19 21:36:58 UTC (rev 227232)
@@ -1,5 +1,31 @@
2018-01-19 Nikita Vasilyev <nvasil...@apple.com>
+ Web Inspector: Styles Redesign: tabbing on commented out property throws exception
+ https://bugs.webkit.org/show_bug.cgi?id=180676
+ <rdar://problem/35981058>
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.startEditingFirstProperty):
+ Tabbing from the selector field should focus on the first editable property.
+ When no editable properties are present, a new blank property should be added after the commented out ones.
+
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.startEditingLastProperty):
+ Shift-tabbing from the selector field should focus on the last editable property of the previous CSS rule.
+ When no editable properties are present, a new blank property should be added after the commented out ones.
+
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetCSSStyleDeclarationEditorFocusMoved):
+ When navigating between properties skip the commented out ones.
+
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._editablePropertyAfter):
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._editablePropertyBefore):
+ * UserInterface/Views/SpreadsheetStyleProperty.js:
+ (WI.SpreadsheetStyleProperty.prototype.get enabled):
+ (WI.SpreadsheetStyleProperty.prototype._update):
+
+2018-01-19 Nikita Vasilyev <nvasil...@apple.com>
+
Web Inspector: Make styles sidebar always LTR
https://bugs.webkit.org/show_bug.cgi?id=175357
<rdar://problem/33787988>
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (227231 => 227232)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2018-01-19 21:22:30 UTC (rev 227231)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2018-01-19 21:36:58 UTC (rev 227232)
@@ -101,22 +101,23 @@
startEditingFirstProperty()
{
- if (this._propertyViews.length)
- this._propertyViews[0].nameTextField.startEditing();
+ let firstEditableProperty = this._editablePropertyAfter(-1);
+ if (firstEditableProperty)
+ firstEditableProperty.nameTextField.startEditing();
else {
- let index = 0;
- this.addBlankProperty(index);
+ const appendAfterLast = -1;
+ this.addBlankProperty(appendAfterLast);
}
}
startEditingLastProperty()
{
- let lastProperty = this._propertyViews.lastValue;
- if (lastProperty)
- lastProperty.valueTextField.startEditing();
+ let lastEditableProperty = this._editablePropertyBefore(this._propertyViews.length);
+ if (lastEditableProperty)
+ lastEditableProperty.valueTextField.startEditing();
else {
- let index = 0;
- this.addBlankProperty(index);
+ const appendAfterLast = -1;
+ this.addBlankProperty(appendAfterLast);
}
}
@@ -194,29 +195,29 @@
}
if (direction === "forward") {
- // Move from the value to the next property's name.
- let index = movedFromIndex + 1;
- if (index < this._propertyViews.length)
- this._propertyViews[index].nameTextField.startEditing();
+ // Move from the value to the next enabled property's name.
+ let propertyView = this._editablePropertyAfter(movedFromIndex);
+ if (propertyView)
+ propertyView.nameTextField.startEditing();
else {
if (willRemoveProperty) {
// Move from the last value in the rule to the next rule's selector.
let reverse = false;
this._delegate.cssStyleDeclarationEditorStartEditingAdjacentRule(reverse);
- } else
- this.addBlankProperty(index);
+ } else {
+ const appendAfterLast = -1;
+ this.addBlankProperty(appendAfterLast);
+ }
}
} else {
- let index = movedFromIndex - 1;
- if (index < 0) {
+ let propertyView = this._editablePropertyBefore(movedFromIndex);
+ if (propertyView) {
+ // Move from the property's name to the previous enabled property's value.
+ propertyView.valueTextField.startEditing()
+ } else {
// Move from the first property's name to the rule's selector.
if (this._style.selectorEditable)
this._delegate.cssStyleDeclarationTextEditorStartEditingRuleSelector();
- } else {
- // Move from the property's name to the previous property's value.
- let valueTextField = this._propertyViews[index].valueTextField;
- if (valueTextField)
- valueTextField.startEditing();
}
}
}
@@ -253,6 +254,28 @@
return this._style.allProperties;
}
+ _editablePropertyAfter(propertyIndex)
+ {
+ for (let index = propertyIndex + 1; index < this._propertyViews.length; index++) {
+ let property = this._propertyViews[index];
+ if (property.enabled)
+ return property;
+ }
+
+ return null;
+ }
+
+ _editablePropertyBefore(propertyIndex)
+ {
+ for (let index = propertyIndex - 1; index >= 0; index--) {
+ let property = this._propertyViews[index];
+ if (property.enabled)
+ return property;
+ }
+
+ return null;
+ }
+
_propertiesChanged(event)
{
if (this.isFocused()) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (227231 => 227232)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2018-01-19 21:22:30 UTC (rev 227231)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2018-01-19 21:36:58 UTC (rev 227232)
@@ -57,6 +57,7 @@
get element() { return this._element; }
get nameTextField() { return this._nameTextField; }
get valueTextField() { return this._valueTextField; }
+ get enabled() { return this._property.enabled; }
detached()
{
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes