Title: [231838] trunk/Source/WebCore
Revision
231838
Author
[email protected]
Date
2018-05-15 22:30:09 -0700 (Tue, 15 May 2018)

Log Message

Web Inspector: element details hanger in inspector overlay should have better placement logic
https://bugs.webkit.org/show_bug.cgi?id=128482
<rdar://problem/16020709>

Reviewed by Timothy Hatcher.

When determining the best position for the hovered element details "tooltip",
perform placement tests in view space, not canvas space, and account for the
top content inset.

* inspector/InspectorOverlayPage.js:
(reset): Drive by fix: added missing `.height`.
(_drawElementTitle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (231837 => 231838)


--- trunk/Source/WebCore/ChangeLog	2018-05-16 04:43:15 UTC (rev 231837)
+++ trunk/Source/WebCore/ChangeLog	2018-05-16 05:30:09 UTC (rev 231838)
@@ -1,3 +1,19 @@
+2018-05-15  Matt Baker  <[email protected]>
+
+        Web Inspector: element details hanger in inspector overlay should have better placement logic
+        https://bugs.webkit.org/show_bug.cgi?id=128482
+        <rdar://problem/16020709>
+
+        Reviewed by Timothy Hatcher.
+
+        When determining the best position for the hovered element details "tooltip",
+        perform placement tests in view space, not canvas space, and account for the
+        top content inset.
+
+        * inspector/InspectorOverlayPage.js:
+        (reset): Drive by fix: added missing `.height`.
+        (_drawElementTitle):
+
 2018-05-15  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r231765.

Modified: trunk/Source/WebCore/inspector/InspectorOverlayPage.js (231837 => 231838)


--- trunk/Source/WebCore/inspector/InspectorOverlayPage.js	2018-05-16 04:43:15 UTC (rev 231837)
+++ trunk/Source/WebCore/inspector/InspectorOverlayPage.js	2018-05-16 05:30:09 UTC (rev 231838)
@@ -137,7 +137,7 @@
     document.getElementById("element-title-container").textContent = "";
     document.body.classList.remove("dimmed");
 
-    document.getElementById("log").style.setProperty("top", DATA.contentInset + "px");
+    document.getElementById("log").style.setProperty("top", DATA.contentInset.height + "px");
 }
 
 function DOMBuilder(tagName, className)
@@ -338,20 +338,24 @@
     anchorTop -= scroll.y;
     anchorBottom -= scroll.y;
 
-    if (boxX + titleWidth > canvas.width)
-        boxX = canvas.width - titleWidth - 2;
+    var viewportWidth = DATA.viewportSize.width;
+    if (boxX + titleWidth > viewportWidth)
+        boxX = viewportWidth - titleWidth - 2;
 
+    var viewportHeight = DATA.viewportSize.height;
+    var viewportTop = DATA.contentInset.height;
+
     var boxY;
-    if (anchorTop > canvas.height) {
+    if (anchorTop > viewportHeight) {
         boxY = canvas.height - titleHeight - arrowHeight;
         renderArrowDown = true;
-    } else if (anchorBottom < 0) {
+    } else if (anchorBottom < viewportTop) {
         boxY = arrowHeight;
         renderArrowUp = true;
-    } else if (anchorBottom + titleHeight + arrowHeight < canvas.height) {
+    } else if (anchorBottom + titleHeight + arrowHeight < viewportHeight) {
         boxY = anchorBottom + arrowHeight - 4;
         renderArrowUp = true;
-    } else if (anchorTop - titleHeight - arrowHeight > 0) {
+    } else if (anchorTop - titleHeight - arrowHeight > viewportTop) {
         boxY = anchorTop - titleHeight - arrowHeight + 3;
         renderArrowDown = true;
     } else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to