Bug 1123163 - Hit testing broken on Google Search results page. r=yzen, a=sledru
authorAlexander Surkov <surkov.alexander@gmail.com>
Mon, 26 Jan 2015 13:30:17 -0500
changeset 243063 e63d5e1865db
parent 243062 852ac927b731
child 243064 f91cc6838063
push id4378
push userryanvm@gmail.com
push date2015-01-27 15:46 +0000
treeherdermozilla-beta@f91cc6838063 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen, sledru
bugs1123163
milestone36.0
Bug 1123163 - Hit testing broken on Google Search results page. r=yzen, a=sledru
accessible/generic/Accessible.cpp
accessible/tests/mochitest/hittest/test_general.html
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -520,21 +520,18 @@ Accessible::FocusedChild()
 }
 
 Accessible*
 Accessible::ChildAtPoint(int32_t aX, int32_t aY,
                          EWhichChildAtPoint aWhichChild)
 {
   // If we can't find the point in a child, we will return the fallback answer:
   // we return |this| if the point is within it, otherwise nullptr.
+  Accessible* fallbackAnswer = nullptr;
   nsIntRect rect = Bounds();
-  if (rect.IsEmpty())
-   return nullptr;
-
-  Accessible* fallbackAnswer = nullptr;
   if (aX >= rect.x && aX < rect.x + rect.width &&
       aY >= rect.y && aY < rect.y + rect.height)
     fallbackAnswer = this;
 
   if (nsAccUtils::MustPrune(this))  // Do not dig any further
     return fallbackAnswer;
 
   // Search an accessible at the given point starting from accessible document
--- a/accessible/tests/mochitest/hittest/test_general.html
+++ b/accessible/tests/mochitest/hittest/test_general.html
@@ -63,16 +63,18 @@ if (!MAC) {
 
       testChildAtPoint("area", 1, 1, "area", "area");
 
       // Test image maps. Their children are not in the layout tree.
       var theLetterA = getAccessible("imgmap").firstChild;
       hitTest("imgmap", theLetterA, theLetterA);
       hitTest("container", "imgmap", theLetterA);
 
+      // hit testing for element contained by zero-width element
+      hitTest("container2", "container2_input", "container2_input");
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doPreTest);
   </script>
 </head>
 <body>
@@ -101,10 +103,13 @@ if (!MAC) {
     <area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#a"
           coords="0,0,15,15" alt="thelettera" shape="rect"/>
   </map>
 
   <div id="container">
     <img id="imgmap" width="447" height="15" usemap="#atoz_map" src="../letters.gif"/>
   </div>
 
+  <div id="container2" style="width: 0px">
+    <input id="container2_input">
+  </div>
 </body>
 </html>