Title: [225568] trunk/Source/WebInspectorUI
Revision
225568
Author
[email protected]
Date
2017-12-05 23:01:29 -0800 (Tue, 05 Dec 2017)

Log Message

Web Inspector: Styles Redesign: adding a property before or after the first one appends it to the end
https://bugs.webkit.org/show_bug.cgi?id=180321
<rdar://problem/35816402>

Reviewed by Timothy Hatcher.

* UserInterface/Models/CSSStyleDeclaration.js:
(WI.CSSStyleDeclaration.prototype._rangeAfterPropertyAtIndex):
* UserInterface/Models/TextRange.js:
(WI.TextRange.prototype.collapseToStart):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (225567 => 225568)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-12-06 05:25:15 UTC (rev 225567)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-12-06 07:01:29 UTC (rev 225568)
@@ -1,3 +1,16 @@
+2017-12-05  Nikita Vasilyev  <[email protected]>
+
+        Web Inspector: Styles Redesign: adding a property before or after the first one appends it to the end
+        https://bugs.webkit.org/show_bug.cgi?id=180321
+        <rdar://problem/35816402>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/CSSStyleDeclaration.js:
+        (WI.CSSStyleDeclaration.prototype._rangeAfterPropertyAtIndex):
+        * UserInterface/Models/TextRange.js:
+        (WI.TextRange.prototype.collapseToStart):
+
 2017-12-05  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Empty Message View in Network Tab has padding at top

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js (225567 => 225568)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js	2017-12-06 05:25:15 UTC (rev 225567)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js	2017-12-06 07:01:29 UTC (rev 225568)
@@ -418,13 +418,14 @@
 
     _rangeAfterPropertyAtIndex(index)
     {
-        if (index > 0) {
-            let property = this.allVisibleProperties[index];
-            if (property && property.styleSheetTextRange)
-                return property.styleSheetTextRange.collapseToEnd();
-        }
+        if (index < 0)
+            return this._styleSheetTextRange.collapseToStart();
 
-        return this._styleSheetTextRange.collapseToEnd();
+        if (index >= this.allVisibleProperties.length)
+            return this._styleSheetTextRange.collapseToEnd();
+
+        let property = this.allVisibleProperties[index];
+        return property.styleSheetTextRange.collapseToEnd();
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TextRange.js (225567 => 225568)


--- trunk/Source/WebInspectorUI/UserInterface/Models/TextRange.js	2017-12-06 05:25:15 UTC (rev 225567)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TextRange.js	2017-12-06 07:01:29 UTC (rev 225568)
@@ -128,6 +128,12 @@
         return new WI.TextRange(startLine, startColumn, endLine, endColumn);
     }
 
+    collapseToStart()
+    {
+        console.assert(!isNaN(this._startLine), "TextRange needs line/column data.");
+        return new WI.TextRange(this._startLine, this._startColumn, this._startLine, this._startColumn);
+    }
+
     collapseToEnd()
     {
         console.assert(!isNaN(this._endLine), "TextRange needs line/column data.");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to