Title: [196869] trunk/Source/WebInspectorUI
Revision
196869
Author
[email protected]
Date
2016-02-20 16:17:01 -0800 (Sat, 20 Feb 2016)

Log Message

Web Inspector: Opacity slider thumb sometimes goes past the bar in Visual Styles sidebar
https://bugs.webkit.org/show_bug.cgi?id=154497

Patch by Devin Rousso <[email protected]> on 2016-02-20
Reviewed by Timothy Hatcher.

Since WebInspector.Slider uses CSS transforms to move the slider knob
along the track, if the width of the track changes then the position
of the knob would stay the same since it was translated instead of
adjusting its position relative to the new width.

* UserInterface/Views/Slider.js:
(WebInspector.Slider.prototype.recalculateKnobX):
Resets the maxX value to 0 to ensure that a new maxX is calculated with
the current width.

* UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.set specifiedWidth): Deleted.
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.recalculateWidth):

* UserInterface/Views/VisualStyleDetailsPanel.js:
(WebInspector.VisualStyleDetailsPanel.prototype.widthDidChange):
(WebInspector.VisualStyleDetailsPanel.prototype._updateProperties):
(WebInspector.VisualStyleDetailsPanel.prototype._populateDisplaySection):

* UserInterface/Views/VisualStyleUnitSlider.js:
(WebInspector.VisualStyleUnitSlider.prototype.recalculateWidth):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (196868 => 196869)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-02-20 23:51:33 UTC (rev 196868)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-02-21 00:17:01 UTC (rev 196869)
@@ -1,5 +1,34 @@
 2016-02-20  Devin Rousso  <[email protected]>
 
+        Web Inspector: Opacity slider thumb sometimes goes past the bar in Visual Styles sidebar
+        https://bugs.webkit.org/show_bug.cgi?id=154497
+
+        Reviewed by Timothy Hatcher.
+
+        Since WebInspector.Slider uses CSS transforms to move the slider knob
+        along the track, if the width of the track changes then the position
+        of the knob would stay the same since it was translated instead of
+        adjusting its position relative to the new width.
+
+        * UserInterface/Views/Slider.js:
+        (WebInspector.Slider.prototype.recalculateKnobX):
+        Resets the maxX value to 0 to ensure that a new maxX is calculated with
+        the current width.
+
+        * UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.set specifiedWidth): Deleted.
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.recalculateWidth):
+
+        * UserInterface/Views/VisualStyleDetailsPanel.js:
+        (WebInspector.VisualStyleDetailsPanel.prototype.widthDidChange):
+        (WebInspector.VisualStyleDetailsPanel.prototype._updateProperties):
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateDisplaySection):
+
+        * UserInterface/Views/VisualStyleUnitSlider.js:
+        (WebInspector.VisualStyleUnitSlider.prototype.recalculateWidth):
+
+2016-02-20  Devin Rousso  <[email protected]>
+
         Web Inspector: Visual Styles: Modifying background expands Font section
         https://bugs.webkit.org/show_bug.cgi?id=154491
         <rdar://problem/24755440>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Slider.js (196868 => 196869)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Slider.js	2016-02-20 23:51:33 UTC (rev 196868)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Slider.js	2016-02-21 00:17:01 UTC (rev 196869)
@@ -81,6 +81,12 @@
         return this._maxX;
     }
 
+    recalculateKnobX()
+    {
+        this._maxX = 0;
+        this.knobX = this._value;
+    }
+
     // Protected
 
     handleEvent(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js (196868 => 196869)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js	2016-02-20 23:51:33 UTC (rev 196868)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js	2016-02-21 00:17:01 UTC (rev 196869)
@@ -125,7 +125,7 @@
         return this.value || null;
     }
 
-    set specifiedWidth(value)
+    recalculateWidth(value)
     {
         if (this._titleElement) {
             // 55px width and 4px margin on left and right for title element,

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js (196868 => 196869)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js	2016-02-20 23:51:33 UTC (rev 196868)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js	2016-02-21 00:17:01 UTC (rev 196869)
@@ -118,14 +118,14 @@
     {
         super.widthDidChange();
 
-        let width = this.element.realOffsetWidth;
+        let sidebarWidth = this.element.realOffsetWidth;
         for (let key in this._groups) {
             let group = this._groups[key];
             if (!group.specifiedWidthProperties)
                 continue;
 
             for (let editor of group.specifiedWidthProperties)
-                editor.specifiedWidth = width;
+                editor.recalculateWidth(sidebarWidth);
         }
     }
 
@@ -221,9 +221,9 @@
         }
 
         if (group.specifiedWidthProperties) {
-            let width = this.element.realOffsetWidth;
+            let sidebarWidth = this.element.realOffsetWidth;
             for (let editor of group.specifiedWidthProperties)
-                editor.specifiedWidth = width;
+                editor.recalculateWidth(sidebarWidth);
         }
     }
 
@@ -350,6 +350,8 @@
         overflowRow.element.appendChild(properties.opacity.element);
         overflowRow.element.appendChild(properties.overflow.element);
 
+        group.specifiedWidthProperties = [properties.opacity];
+
         let displayGroup = new WebInspector.DetailsSectionGroup([displayRow, sizingRow, overflowRow]);
         this._populateSection(group, [displayGroup]);
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js (196868 => 196869)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js	2016-02-20 23:51:33 UTC (rev 196868)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleUnitSlider.js	2016-02-21 00:17:01 UTC (rev 196869)
@@ -55,6 +55,11 @@
         return this.value;
     }
 
+    recalculateWidth(value)
+    {
+        this._slider.recalculateKnobX();
+    }
+
     sliderValueDidChange(slider, value)
     {
         this._valueDidChange();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to