Back out 7bfec63e417b (bug 950225) for test failures
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 27 Jan 2014 23:12:54 -0800
changeset 181461 071ced6c6e9d05843da0848243d4bc1e00a9ed1a
parent 181460 f785310ab034aa1c61c4fec97804d2266f1ee34b
child 181462 753d7a9f2726da0c17a8362bfe35aea604a72702
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs950225
milestone29.0a1
backs out7bfec63e417b464416a3bd0d0a64d2bc7d9206ea
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
Back out 7bfec63e417b (bug 950225) for test failures CLOSED TREE
layout/base/PositionedEventTargeting.cpp
layout/base/tests/test_event_target_radius.html
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -222,40 +222,27 @@ AppUnitsFromMM(nsIFrame* aFrame, uint32_
   nsPresContext* pc = aFrame->PresContext();
   nsIPresShell* presShell = pc->PresShell();
   float result = float(aMM) *
     (pc->DeviceContext()->AppUnitsPerPhysicalInch() / MM_PER_INCH_FLOAT) *
     (aVertical ? presShell->GetYResolution() : presShell->GetXResolution());
   return NSToCoordRound(result);
 }
 
-/**
- * Clip aRect with the bounds of aFrame in the coordinate system of
- * aRootFrame. aRootFrame is an ancestor of aFrame.
- */
-static nsRect
-ClipToFrame(nsIFrame* aRootFrame, nsIFrame* aFrame, nsRect& aRect)
-{
-  nsRegion bound = nsLayoutUtils::TransformFrameRectToAncestor(
-    aFrame, nsRect(nsPoint(0, 0), aFrame->GetSize()), aRootFrame);
-  nsRegion result = bound.Intersect(aRect);
-  return result.GetBounds();
-}
-
 static nsRect
 GetTargetRect(nsIFrame* aRootFrame, const nsPoint& aPointRelativeToRootFrame,
-              nsIFrame* aRestrictToDescendants, const EventRadiusPrefs* aPrefs)
+              const EventRadiusPrefs* aPrefs)
 {
   nsMargin m(AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[0], true),
              AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[1], false),
              AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[2], true),
              AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[3], false));
   nsRect r(aPointRelativeToRootFrame, nsSize(0,0));
   r.Inflate(m);
-  return ClipToFrame(aRootFrame, aRestrictToDescendants, r);
+  return r;
 }
 
 static float
 ComputeDistanceFromRect(const nsPoint& aPoint, const nsRect& aRect)
 {
   nscoord dx = std::max(0, std::max(aRect.x - aPoint.x, aPoint.x - aRect.XMost()));
   nscoord dy = std::max(0, std::max(aRect.y - aPoint.y, aPoint.y - aRect.YMost()));
   return float(NS_hypot(dx, dy));
@@ -370,31 +357,29 @@ FindFrameTargetedByInputEvent(const Widg
   // events generated by touch-screen hardware.
   if (aEvent->eventStructType == NS_MOUSE_EVENT &&
       prefs->mTouchOnly &&
       aEvent->AsMouseEvent()->inputSource !=
         nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
     return target;
   }
 
+  nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs);
+  nsAutoTArray<nsIFrame*,8> candidates;
+  nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, flags);
+  if (NS_FAILED(rv)) {
+    return target;
+  }
+
   // If the exact target is non-null, only consider candidate targets in the same
   // document as the exact target. Otherwise, if an ancestor document has
   // a mouse event handler for example, targets that are !IsElementClickable can
   // never be targeted --- something nsSubDocumentFrame in an ancestor document
   // would be targeted instead.
   nsIFrame* restrictToDescendants = target ?
     target->PresContext()->PresShell()->GetRootFrame() : aRootFrame;
-
-  nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame,
-                                    restrictToDescendants, prefs);
-  nsAutoTArray<nsIFrame*,8> candidates;
-  nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, flags);
-  if (NS_FAILED(rv)) {
-    return target;
-  }
-
   nsIFrame* closestClickable =
     GetClosest(aRootFrame, aPointRelativeToRootFrame, targetRect, prefs,
                restrictToDescendants, candidates);
   return closestClickable ? closestClickable : target;
 }
 
 }
--- a/layout/base/tests/test_event_target_radius.html
+++ b/layout/base/tests/test_event_target_radius.html
@@ -7,17 +7,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test radii for mouse events</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <style>
   .target { position:absolute; left:100px; top:100px; width:100px; height:100px; background:blue; }
   </style>
 </head>
-<body id="body" onload="setTimeout(startTest, 0)" style="margin:0; width:100%; height:100%; overflow:hidden">
+<body id="body" onload="setTimeout(startTest, 0)" style="margin:0; width:100%; height:100%">
 <p id="display"></p>
 <div id="content">
   <div id="ruler" style="position:absolute; left:0; top:0; width:1mozmm; height:0;"></div>
 
   <div class="target" id="t" onmousedown="x=1"></div>
 
   <div class="target" id="t2" hidden></div>
 
@@ -42,21 +42,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   <div class="target" id="t7" onmousedown="x=1" hidden></div>
   <div class="target" id="t7_over" hidden></div>
 
   <div id="t8" contenteditable="true" class="target" hidden></div>
 
   <div id="t9" class="target" ontouchend="x=1" hidden></div>
 
-  <div id="t10_left" class="target" style="left:-50px;" onmousedown="x=1" hidden></div>
-  <div id="t10_right" class="target" style="left:auto;right:-50px" onmousedown="x=1" hidden></div>
-  <div id="t10_top" class="target" style="top:-50px;" onmousedown="x=1" hidden></div>
-  <div id="t10_bottom" class="target" style="top:auto;bottom:-50px;" onmousedown="x=1" hidden></div>
-  <div id="t10_over" style="position:absolute; left:0; top:0; width:100%; height:100%; background:yellow;" hidden></div>
 </div>
 <pre id="test">
 <script type="application/javascript">
 function startTest() {
   SpecialPowers.pushPrefEnv({"set": [["ui.mouse.radius.enabled", true],
                                      ["ui.mouse.radius.inputSource.touchOnly", false],
                                      ["ui.mouse.radius.leftmm", 12],
                                      ["ui.mouse.radius.topmm", 8],
@@ -214,31 +209,16 @@ function test3() {
   setShowing("t9", true);
   var rect = document.getElementById("t9").getBoundingClientRect();
   testMouseClick("t9", rect.left + 1, rect.top + 1, "t9", "div enabled with mouse input");
   testMouseClick("t9", rect.left + 1, rect.top + 1, "t9", "div enabled with touch input", {
     inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
   });
   setShowing("t9", false);
 
-  setShowing("t10_over", true);
-  setShowing("t10_left", true);
-  setShowing("t10_right", true);
-  setShowing("t10_top", true);
-  setShowing("t10_bottom", true);
-  testMouseClick("t10_left", 51, 10, "t10_over", "element outside of visible area is not selected");
-  testMouseClick("t10_right", 49, 10, "t10_over", "element outside of visible area is not selected");
-  testMouseClick("t10_top", 10, 51, "t10_over", "element outside of visible area is not selected");
-  testMouseClick("t10_bottom", 10, 49, "t10_over", "element outside of visible area is not selected");
-  setShowing("t10_over", false);
-  setShowing("t10_left", false);
-  setShowing("t10_right", false);
-  setShowing("t10_top", false);
-  setShowing("t10_bottom", false);
-
   // Not yet tested:
   // -- visited link weight
   // -- "Closest" using Euclidean distance
   endTest();
 }
 </script>
 </pre>
 </body>