Bug 1519952, don't use the boxobject screenX and screenY properties in the tooltip listener, instead get the screen coordinates from the frame directly, r=bz
authorNeil Deakin <neil@mozilla.com>
Fri, 15 Feb 2019 15:26:25 -0500
changeset 517536 4414af4d7368360eaee6f416e04e8e444b7a727d
parent 517535 b980d74e702db481501dad76d4705c60062c3b69
child 517537 eb06f238c16ad19a2085cad55136eeba2667f9ee
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1519952
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1519952, don't use the boxobject screenX and screenY properties in the tooltip listener, instead get the screen coordinates from the frame directly, r=bz
layout/xul/nsXULTooltipListener.cpp
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -17,25 +17,23 @@
 #  include "nsITreeView.h"
 #endif
 #include "nsIScriptContext.h"
 #include "nsPIDOMWindow.h"
 #ifdef MOZ_XUL
 #  include "nsXULPopupManager.h"
 #endif
 #include "nsIPopupContainer.h"
-#include "nsIBoxObject.h"
 #include "nsTreeColumns.h"
 #include "nsContentUtils.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"  // for Event
-#include "mozilla/dom/BoxObject.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/TreeColumnBinding.h"
 #include "mozilla/dom/XULTreeElementBinding.h"
 #include "mozilla/TextEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -320,35 +318,29 @@ void nsXULTooltipListener::RemoveTooltip
   aNode->RemoveSystemEventListener(NS_LITERAL_STRING("dragstart"), this, true);
 }
 
 #ifdef MOZ_XUL
 void nsXULTooltipListener::CheckTreeBodyMove(MouseEvent* aMouseEvent) {
   nsCOMPtr<nsIContent> sourceNode = do_QueryReferent(mSourceNode);
   if (!sourceNode) return;
 
-  // get the boxObject of the documentElement of the document the tree is in
-  nsCOMPtr<nsIBoxObject> bx;
+  // get the documentElement of the document the tree is in
   Document* doc = sourceNode->GetComposedDoc();
-  if (doc) {
-    ErrorResult ignored;
-    bx = doc->GetBoxObjectFor(doc->GetRootElement(), ignored);
-  }
 
   RefPtr<XULTreeElement> tree = GetSourceTree();
-  if (bx && tree) {
+  Element* root = doc ? doc->GetRootElement() : nullptr;
+  if (root && root->GetPrimaryFrame() && tree) {
     int32_t x = aMouseEvent->ScreenX(CallerType::System);
     int32_t y = aMouseEvent->ScreenY(CallerType::System);
 
-    // subtract off the documentElement's boxObject
-    int32_t boxX, boxY;
-    bx->GetScreenX(&boxX);
-    bx->GetScreenY(&boxY);
-    x -= boxX;
-    y -= boxY;
+    // subtract off the documentElement's position
+    CSSIntRect rect = root->GetPrimaryFrame()->GetScreenRect();
+    x -= rect.x;
+    y -= rect.y;
 
     ErrorResult rv;
     TreeCellInfo cellInfo;
     tree->GetCellAt(x, y, cellInfo, rv);
 
     int32_t row = cellInfo.mRow;
     RefPtr<nsTreeColumn> col = cellInfo.mCol;