Title: [108062] trunk/Source/WebCore
Revision
108062
Author
[email protected]
Date
2012-02-17 04:31:28 -0800 (Fri, 17 Feb 2012)

Log Message

Web Inspector: color picker does not allow changing the color.
https://bugs.webkit.org/show_bug.cgi?id=78886

Reviewed by Vsevolod Vlasov.

* inspector/front-end/ElementsPanel.js:
(WebInspector.ElementsPanel.prototype._showPopover.showPopover):
* inspector/front-end/Popover.js:
(WebInspector.Popover.prototype.setCanShrink):
(WebInspector.Popover.prototype._positionElement):
* inspector/front-end/Settings.js:
* inspector/front-end/Spectrum.js:
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane):
(WebInspector.StylePropertyTreeElement.prototype.updateTitle.):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108061 => 108062)


--- trunk/Source/WebCore/ChangeLog	2012-02-17 12:28:46 UTC (rev 108061)
+++ trunk/Source/WebCore/ChangeLog	2012-02-17 12:31:28 UTC (rev 108062)
@@ -1,5 +1,23 @@
 2012-02-17  Pavel Feldman  <[email protected]>
 
+        Web Inspector: color picker does not allow changing the color.
+        https://bugs.webkit.org/show_bug.cgi?id=78886
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype._showPopover.showPopover):
+        * inspector/front-end/Popover.js:
+        (WebInspector.Popover.prototype.setCanShrink):
+        (WebInspector.Popover.prototype._positionElement):
+        * inspector/front-end/Settings.js:
+        * inspector/front-end/Spectrum.js:
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane):
+        (WebInspector.StylePropertyTreeElement.prototype.updateTitle.):
+
+2012-02-17  Pavel Feldman  <[email protected]>
+
         Web Inspector: new image preview has poorly positioned popover arrow.
         https://bugs.webkit.org/show_bug.cgi?id=78884
 

Modified: trunk/Source/WebCore/inspector/front-end/ElementsPanel.js (108061 => 108062)


--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2012-02-17 12:28:46 UTC (rev 108061)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2012-02-17 12:31:28 UTC (rev 108062)
@@ -414,6 +414,7 @@
         function showPopover(imageElement, dimensions)
         {
             var contents = buildPopoverContents(imageElement, dimensions);
+            popover.setCanShrink(false);
             popover.show(contents, anchor);
         }
 

Modified: trunk/Source/WebCore/inspector/front-end/Popover.js (108061 => 108062)


--- trunk/Source/WebCore/inspector/front-end/Popover.js	2012-02-17 12:28:46 UTC (rev 108061)
+++ trunk/Source/WebCore/inspector/front-end/Popover.js	2012-02-17 12:31:28 UTC (rev 108062)
@@ -104,6 +104,11 @@
         this._disposed = true;
     },
 
+    setCanShrink: function(canShrink)
+    {
+        this._hasFixedHeight = !canShrink;
+    },
+
     _positionElement: function(anchorElement, preferredWidth, preferredHeight)
     {
         const borderWidth = 25;
@@ -129,15 +134,24 @@
             if (anchorBox.y > newElementPosition.height + arrowHeight + borderRadius)
                 newElementPosition.y = anchorBox.y - newElementPosition.height - arrowHeight;
             else {
-                newElementPosition.y = borderRadius * 2;
+                newElementPosition.y = borderRadius;
                 newElementPosition.height = anchorBox.y - borderRadius * 2 - arrowHeight;
+                if (this._hasFixedHeight && newElementPosition.height < preferredHeight) {
+                    newElementPosition.y = borderRadius;
+                    newElementPosition.height = preferredHeight;
+                }
             }
             verticalAlignment = "bottom";
         } else {
             // Positioning below the anchor.
             newElementPosition.y = anchorBox.y + anchorBox.height + arrowHeight;
-            if (newElementPosition.y + newElementPosition.height + arrowHeight - borderWidth >= totalHeight)
+            if (newElementPosition.y + newElementPosition.height + arrowHeight - borderWidth >= totalHeight) {
                 newElementPosition.height = totalHeight - anchorBox.y - anchorBox.height - borderRadius * 2 - arrowHeight;
+                if (this._hasFixedHeight && newElementPosition.height < preferredHeight) {
+                    newElementPosition.y = totalHeight - preferredHeight - borderRadius;
+                    newElementPosition.height = preferredHeight;
+                }
+            }
             // Align arrow.
             verticalAlignment = "top";
         }

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (108061 => 108062)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-02-17 12:28:46 UTC (rev 108061)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-02-17 12:31:28 UTC (rev 108062)
@@ -44,8 +44,7 @@
     exposeWorkersInspection: false,
     applicationTitle: "Web Inspector - %s",
     showHeapSnapshotObjectsHiddenProperties: false,
-    showDockToRight: false,
-    useSpectrum: true
+    showDockToRight: false
 }
 
 var Capabilities = {

Modified: trunk/Source/WebCore/inspector/front-end/Spectrum.js (108061 => 108062)


--- trunk/Source/WebCore/inspector/front-end/Spectrum.js	2012-02-17 12:28:46 UTC (rev 108061)
+++ trunk/Source/WebCore/inspector/front-end/Spectrum.js	2012-02-17 12:31:28 UTC (rev 108062)
@@ -33,6 +33,7 @@
 WebInspector.Spectrum = function()
 {
     this._popover = new WebInspector.Popover();
+    this._popover.setCanShrink(false);
     this._popover.element.addEventListener("mousedown", stopPropagation, false);
 
     this._containerElement = document.createElement('div');

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (108061 => 108062)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-02-17 12:28:46 UTC (rev 108061)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-02-17 12:31:28 UTC (rev 108062)
@@ -90,8 +90,7 @@
     this._sectionsContainer = document.createElement("div");
     this.bodyElement.appendChild(this._sectionsContainer);
 
-    if (Preferences.useSpectrum)
-        this._spectrum = new WebInspector.Spectrum();
+    this._spectrum = new WebInspector.Spectrum();
 
     WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetOrMediaQueryResultChanged, this);
     WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this);
@@ -1691,15 +1690,11 @@
                 }
 
                 var format = getFormat();
-                var hasColorpicker = self._parentPane;
-                var spectrum = hasColorpicker ? self._parentPane._spectrum : null;
+                var spectrum = self._parentPane._spectrum;
 
                 var swatchElement = document.createElement("span");
                 var swatchInnerElement = swatchElement.createChild("span", "swatch-inner");
-                if (hasColorpicker)
-                    swatchElement.title = WebInspector.UIString("Click to open a colorpicker. Shift-click to change color format");
-                else
-                    swatchElement.title = WebInspector.UIString("Click to change color format");
+                swatchElement.title = WebInspector.UIString("Click to open a colorpicker. Shift-click to change color format");
 
                 swatchElement.className = "swatch";
 
@@ -1709,7 +1704,7 @@
 
                 swatchInnerElement.style.backgroundColor = text;
 
-                var scrollerElement = hasColorpicker ? self._parentPane._computedStylePane.element.parentElement : null;
+                var scrollerElement = self._parentPane._computedStylePane.element.parentElement;
 
                 function spectrumChanged(e)
                 {
@@ -1743,9 +1738,9 @@
                 {
                     // Shift + click toggles color formats.
                     // Click opens colorpicker, only if the element is not in computed styles section.
-                    if (!spectrum || e.shiftKey)
+                    if (e.shiftKey)
                         changeColorDisplay(e);
-                    else if (hasColorpicker) {
+                    else {
                         var isVisible = spectrum.toggle(swatchElement, color, format);
 
                         if (isVisible) {
@@ -1757,6 +1752,8 @@
                             scrollerElement.addEventListener("scroll", repositionSpectrum, false);
                         }
                     }
+                    e.stopPropagation();
+                    e.preventDefault();
                 }
 
                 function getFormat()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to