Web Inspector: new image preview has poorly positioned popover arrow.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 12:28:46 +0000 (12:28 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 12:28:46 +0000 (12:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78884

Reviewed by Vsevolod Vlasov.

* inspector/front-end/Popover.js:
(WebInspector.Popover.prototype._positionElement):
* inspector/front-end/utilities.js:
(Element.prototype.boxInWindow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@108061 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/Popover.js
Source/WebCore/inspector/front-end/utilities.js

index 8da4c32..621542c 100644 (file)
@@ -1,5 +1,17 @@
 2012-02-17  Pavel Feldman  <pfeldman@google.com>
 
+        Web Inspector: new image preview has poorly positioned popover arrow.
+        https://bugs.webkit.org/show_bug.cgi?id=78884
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/Popover.js:
+        (WebInspector.Popover.prototype._positionElement):
+        * inspector/front-end/utilities.js:
+        (Element.prototype.boxInWindow):
+
+2012-02-17  Pavel Feldman  <pfeldman@google.com>
+
         Web Inspector: enable "Single click CSS editing" experiment by default.
         https://bugs.webkit.org/show_bug.cgi?id=78881
 
index 48a5dd8..44cc0fa 100644 (file)
@@ -152,6 +152,7 @@ WebInspector.Popover.prototype = {
             // Position arrow accurately.
             var arrowRightPosition = Math.max(0, totalWidth - anchorBox.x - anchorBox.width - borderRadius - arrowOffset);
             arrowRightPosition += anchorBox.width / 2;
+            arrowRightPosition = Math.min(arrowRightPosition, newElementPosition.width - borderRadius - arrowOffset);
             this._popupArrowElement.style.right = arrowRightPosition + "px";
         } else {
             newElementPosition.x = borderRadius;
index ebe2ec7..663317c 100644 (file)
@@ -342,8 +342,8 @@ Element.prototype.boxInWindow = function(targetWindow)
     targetWindow = targetWindow || this.ownerDocument.defaultView;
 
     var anchorBox = this.offsetRelativeToWindow(window);
-    anchorBox.width = this.offsetWidth;
-    anchorBox.height = this.offsetHeight;
+    anchorBox.width = Math.min(this.offsetWidth, window.innerWidth - anchorBox.x);
+    anchorBox.height = Math.min(this.offsetHeight, window.innerHeight - anchorBox.y);
 
     return anchorBox;
 }