Title: [101385] trunk/Source/WebCore
Revision
101385
Author
[email protected]
Date
2011-11-29 08:24:47 -0800 (Tue, 29 Nov 2011)

Log Message

Web Inspector: TextPrompt should show suggest above or under so that it has maximal height.
https://bugs.webkit.org/show_bug.cgi?id=73239

Reviewed by Pavel Feldman.

Fixed suggest box vertical position / height calculation.
Added round corners when suggest box is positioned under text prompt.

* inspector/front-end/TextPrompt.js:
(WebInspector.TextPrompt.SuggestBox.prototype._updateBoxPosition):
* inspector/front-end/inspector.css:
(.suggest-box.generic-suggest.under-anchor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101384 => 101385)


--- trunk/Source/WebCore/ChangeLog	2011-11-29 16:18:13 UTC (rev 101384)
+++ trunk/Source/WebCore/ChangeLog	2011-11-29 16:24:47 UTC (rev 101385)
@@ -1,3 +1,18 @@
+2011-11-28  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: TextPrompt should show suggest above or under so that it has maximal height.
+        https://bugs.webkit.org/show_bug.cgi?id=73239
+
+        Reviewed by Pavel Feldman.
+
+        Fixed suggest box vertical position / height calculation.
+        Added round corners when suggest box is positioned under text prompt.
+
+        * inspector/front-end/TextPrompt.js:
+        (WebInspector.TextPrompt.SuggestBox.prototype._updateBoxPosition):
+        * inspector/front-end/inspector.css:
+        (.suggest-box.generic-suggest.under-anchor):
+
 2011-11-29  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Fix the GTK+ port build after r101307.

Modified: trunk/Source/WebCore/inspector/front-end/TextPrompt.js (101384 => 101385)


--- trunk/Source/WebCore/inspector/front-end/TextPrompt.js	2011-11-29 16:18:13 UTC (rev 101384)
+++ trunk/Source/WebCore/inspector/front-end/TextPrompt.js	2011-11-29 16:24:47 UTC (rev 101385)
@@ -897,37 +897,38 @@
 
         // Lay out the suggest-box relative to the anchorBox.
         this._anchorBox = anchorBox;
+        const spacer = 6;
+
         const suggestBoxPaddingX = 21;
-        const suggestBoxPaddingY = 2;
-        const spacer = 6;
-        const minHeight = 25;
         var maxWidth = document.body.offsetWidth - anchorBox.x - spacer;
         var width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
-
-        var maxHeight = document.body.offsetHeight - anchorBox.y - anchorBox.height - spacer;
         var paddedWidth = contentWidth + suggestBoxPaddingX;
-        var paddedHeight = contentHeight + suggestBoxPaddingY;
-        var height = Math.min(paddedHeight, maxHeight);
         var boxX = anchorBox.x;
+        if (width < paddedWidth) {
+            // Shift the suggest box to the left to accommodate the content without trimming to the BODY edge.
+            maxWidth = document.body.offsetWidth - spacer;
+            width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
+            boxX = document.body.offsetWidth - width;
+        }
+
+        const suggestBoxPaddingY = 2;
         var boxY;
-        if (height >= minHeight || height === paddedHeight) {
+        var aboveHeight = anchorBox.y;
+        var underHeight = document.body.offsetHeight - anchorBox.y - anchorBox.height;
+        var maxHeight = Math.max(underHeight, aboveHeight) - spacer;
+        height = Math.min(contentHeight, maxHeight - suggestBoxPaddingY) + suggestBoxPaddingY;
+        if (underHeight >= aboveHeight) {
             // Locate the suggest box under the anchorBox.
             boxY = anchorBox.y + anchorBox.height;
             this._element.removeStyleClass("above-anchor");
+            this._element.addStyleClass("under-anchor");
         } else {
             // Locate the suggest box above the anchorBox.
-            maxHeight = anchorBox.y - spacer;
-            height = Math.min(contentHeight, maxHeight - suggestBoxPaddingY) + suggestBoxPaddingY;
             boxY = anchorBox.y - height;
+            this._element.removeStyleClass("under-anchor");
             this._element.addStyleClass("above-anchor");
         }
 
-        if (width < paddedWidth) {
-            // Shift the suggest box to the left to accommodate the content without trimming to the BODY edge.
-            maxWidth = document.body.offsetWidth - spacer;
-            width = Math.min(contentWidth, maxWidth - suggestBoxPaddingX) + suggestBoxPaddingX;
-            boxX = document.body.offsetWidth - width;
-        }
         this._element.positionAt(boxX, boxY);
         this._element.style.width = width + "px";
         this._element.style.height = height + "px";

Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (101384 => 101385)


--- trunk/Source/WebCore/inspector/front-end/inspector.css	2011-11-29 16:18:13 UTC (rev 101384)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css	2011-11-29 16:24:47 UTC (rev 101385)
@@ -2548,6 +2548,10 @@
    border-radius: 5px 5px 5px 0;
 }
 
+.suggest-box.generic-suggest.under-anchor {
+   border-radius: 0 5px 5px 5px;
+}
+
 /* Custom popup scrollers */
 
 .custom-popup-horizontal-scroll ::-webkit-scrollbar, .custom-popup-vertical-scroll ::-webkit-scrollbar {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to