Bug 1252857 - Value change events for HTML:select have wrong target. r=marcoz, a=ritu
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 18 Mar 2016 16:22:17 -0400
changeset 323645 35a5dfe62c0b08e0af289f0969e6ef91e9b151dc
parent 323644 43fc1a8c20e13f2bf1fcddcae5bb5bd12ebe5ef3
child 323646 094bebe3dafd9c7603ecabd181e0110375f64781
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarcoz, ritu
bugs1252857
milestone47.0a2
Bug 1252857 - Value change events for HTML:select have wrong target. r=marcoz, a=ritu
accessible/generic/DocAccessible.cpp
accessible/tests/mochitest/events/test_valuechange.html
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1242,22 +1242,16 @@ DocAccessible::GetAccessibleOrContainer(
     // Fallback to just get parent node, in case there is no parent content
     // node. Or current node is not a content node.
     if (!parent)
       parent = currNode->GetParentNode();
 
     if (!(currNode = parent)) break;
   }
 
-  // HTML comboboxes have no-content list accessible as an intermediate
-  // containing all options.
-  if (accessible && accessible->IsHTMLCombobox()) {
-    return accessible->FirstChild();
-  }
-
   return accessible;
 }
 
 Accessible*
 DocAccessible::GetAccessibleOrDescendant(nsINode* aNode) const
 {
   Accessible* acc = GetAccessible(aNode);
   if (acc)
@@ -1696,16 +1690,22 @@ DocAccessible::ProcessContentInserted(Ac
       // If new root content has been inserted then update it.
       UpdateRootElIfNeeded();
 
       // Continue to update the tree even if we don't have root content.
       // For example, elements may be inserted under the document element while
       // there is no HTML body element.
     }
 
+    // HTML comboboxes have no-content list accessible as an intermediate
+    // containing all options.
+    if (container && container->IsHTMLCombobox()) {
+      container = container->FirstChild();
+    }
+
     // We have a DOM/layout change under the container accessible, and its tree
     // might need an update. Since DOM/layout change of the element may affect
     // on the accessibleness of adjacent elements (for example, insertion of
     // extra HTML:body make the old body accessible) then we have to recache
     // children of the container, and then fire show/hide events for a change.
     UpdateTreeOnInsertion(container);
     break;
   }
--- a/accessible/tests/mochitest/events/test_valuechange.html
+++ b/accessible/tests/mochitest/events/test_valuechange.html
@@ -127,17 +127,18 @@
       this.getID = function changeRangeValue_getID()
       {
         return prettyName(aID) + " range value changed";
       }
     }
 
     function changeSelectValue(aID, aKey, aValue)
     {
-      this.eventSeq = [new invokerChecker(EVENT_TEXT_VALUE_CHANGE, aID)];
+      this.eventSeq =
+        [ new invokerChecker(EVENT_TEXT_VALUE_CHANGE, getAccessible(aID)) ];
 
       this.invoke = function changeSelectValue_invoke()
       {
         getNode(aID).focus();
         synthesizeKey(aKey, {}, window);
       }
 
       this.finalCheck = function changeSelectValue_finalCheck()