Backed out changeset ce98c76af3f5 (bug 950225) to see if it makes the test_reftests_with_caret.html perma-fail go away. a=backout
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 29 Jan 2014 20:16:27 -0500
changeset 176109 f9f88af152ca346674c0496d78152f56acc80665
parent 176108 095aa30cb6ef6a6772808db30e4ec3685a2d7d76
child 176110 60d7769f9d4c68ddba3706dc9bec1b9358b2b706
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs950225
milestone28.0a2
backs outce98c76af3f51694e92b8fa8e3e978e47c7bf205
Backed out changeset ce98c76af3f5 (bug 950225) to see if it makes the test_reftests_with_caret.html perma-fail go away. a=backout 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)
-{
-  nsRect bound = nsLayoutUtils::TransformFrameRectToAncestor(
-    aFrame, nsRect(nsPoint(0, 0), aFrame->GetSize()), aRootFrame);
-  nsRect result = bound.Intersect(aRect);
-  return result;
-}
-
 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,43 +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");
-  if (self.frameElement &&
-      (self.frameElement.offsetLeft + self.innerWidth >
-       SpecialPowers.wrap(top).innerWidth)) {
-    info("WARNING: Window is too narrow, can't test t10_right");
-  } else {
-    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");
-  if (self.frameElement &&
-      (self.frameElement.offsetTop + self.innerHeight >
-       SpecialPowers.wrap(top).innerHeight)) {
-    info("WARNING: Window is too short, can't test t10_bottom");
-  } else {
-    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>