Bug 1144322 - Handle tabindex in overridden IsInteractiveHTMLContent methods. r=smaug
authorTooru Fujisawa <arai_a@mac.com>
Mon, 23 Mar 2015 18:02:33 +0900
changeset 265346 41f424ff87542c6cd42c4fb36605c970d95e1d17
parent 265345 327a93e5cc397700118cfa20a184f17c9aeb3cbc
child 265347 749fd9127c14a242042c0f45423bbb5ab60e2cf9
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1144322
milestone39.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 1144322 - Handle tabindex in overridden IsInteractiveHTMLContent methods. r=smaug
dom/html/HTMLAudioElement.cpp
dom/html/HTMLImageElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLObjectElement.cpp
dom/html/HTMLVideoElement.cpp
dom/html/test/forms/test_interactive_content_in_label.html
--- a/dom/html/HTMLAudioElement.cpp
+++ b/dom/html/HTMLAudioElement.cpp
@@ -38,17 +38,18 @@ HTMLAudioElement::HTMLAudioElement(alrea
 
 HTMLAudioElement::~HTMLAudioElement()
 {
 }
 
 bool
 HTMLAudioElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
 {
-  return HasAttr(kNameSpaceID_None, nsGkAtoms::controls);
+  return HasAttr(kNameSpaceID_None, nsGkAtoms::controls) ||
+         HTMLMediaElement::IsInteractiveHTMLContent(aIgnoreTabindex);
 }
 
 already_AddRefed<HTMLAudioElement>
 HTMLAudioElement::Audio(const GlobalObject& aGlobal,
                         const Optional<nsAString>& aSrc,
                         ErrorResult& aRv)
 {
   nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aGlobal.GetAsSupports());
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -146,17 +146,18 @@ NS_IMPL_STRING_ATTR(HTMLImageElement, Lo
 NS_IMPL_URI_ATTR(HTMLImageElement, Src, src)
 NS_IMPL_STRING_ATTR(HTMLImageElement, Srcset, srcset)
 NS_IMPL_STRING_ATTR(HTMLImageElement, UseMap, usemap)
 NS_IMPL_INT_ATTR(HTMLImageElement, Vspace, vspace)
 
 bool
 HTMLImageElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
 {
-  return HasAttr(kNameSpaceID_None, nsGkAtoms::usemap);
+  return HasAttr(kNameSpaceID_None, nsGkAtoms::usemap) ||
+          nsGenericHTMLElement::IsInteractiveHTMLContent(aIgnoreTabindex);
 }
 
 bool
 HTMLImageElement::IsSrcsetEnabled()
 {
   return Preferences::GetBool(kPrefSrcsetEnabled, false);
 }
 
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -3219,17 +3219,18 @@ HTMLInputElement::Focus(ErrorResult& aEr
   }
 
   return;
 }
 
 bool
 HTMLInputElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
 {
-  return mType != NS_FORM_INPUT_HIDDEN;
+  return mType != NS_FORM_INPUT_HIDDEN ||
+         nsGenericHTMLFormElementWithState::IsInteractiveHTMLContent(aIgnoreTabindex);
 }
 
 NS_IMETHODIMP
 HTMLInputElement::Select()
 {
   if (mType == NS_FORM_INPUT_NUMBER) {
     nsNumberControlFrame* numberControlFrame =
       do_QueryFrame(GetPrimaryFrame());
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -47,17 +47,18 @@ HTMLObjectElement::~HTMLObjectElement()
 {
   UnregisterActivityObserver();
   DestroyImageLoadingContent();
 }
 
 bool
 HTMLObjectElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
 {
-  return HasAttr(kNameSpaceID_None, nsGkAtoms::usemap);
+  return HasAttr(kNameSpaceID_None, nsGkAtoms::usemap) ||
+         nsGenericHTMLFormElement::IsInteractiveHTMLContent(aIgnoreTabindex);
 }
 
 bool
 HTMLObjectElement::IsDoneAddingChildren()
 {
   return mIsDoneAddingChildren;
 }
 
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -124,17 +124,18 @@ nsresult HTMLVideoElement::SetAcceptHead
   return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
                                     value,
                                     false);
 }
 
 bool
 HTMLVideoElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
 {
-  return HasAttr(kNameSpaceID_None, nsGkAtoms::controls);
+  return HasAttr(kNameSpaceID_None, nsGkAtoms::controls) ||
+         HTMLMediaElement::IsInteractiveHTMLContent(aIgnoreTabindex);
 }
 
 uint32_t HTMLVideoElement::MozParsedFrames() const
 {
   MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
   if (!sVideoStatsEnabled) {
     return 0;
   }
--- a/dom/html/test/forms/test_interactive_content_in_label.html
+++ b/dom/html/test/forms/test_interactive_content_in_label.html
@@ -13,71 +13,54 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=229925">Mozilla Bug 229925</a>
 <p id="display"></p>
 <form action="#">
   <label>
     <span id="text">label</span>
     <input type="button" id="target" value="target">
 
-    <a id="yes1" href="#">a</a>
-    <audio id="yes2" controls></audio>
-    <button id="yes3">button</button>
-    <details id="yes4">details</details>
-    <embed id="yes5">embed</embed>
-    <iframe id="yes6" src="data:text/plain," style="width: 16px; height: 16px;"></iframe>
-    <img id="yes7" src="data:image/png," usemap="#map">
-    <input id="yes8" type="text" size="4">
-    <keygen id="yes9">
-    <label id="yes10">label</label>
-    <object id="yes11" usemap="#map">object</object>
-    <select id="yes12"><option>select</option></select>
-    <textarea id="yes13" cols="1" rows="1"></textarea>
-    <video id="yes14" controls></video>
+    <a class="yes" href="#">a</a>
+    <audio class="yes" controls></audio>
+    <button class="yes">button</button>
+    <details class="yes">details</details>
+    <embed class="yes">embed</embed>
+    <iframe class="yes" src="data:text/plain," style="width: 16px; height: 16px;"></iframe>
+    <img class="yes" src="data:image/png," usemap="#map">
+    <input class="yes" type="text" size="4">
+    <keygen class="yes">
+    <label class="yes">label</label>
+    <object class="yes" usemap="#map">object</object>
+    <select class="yes"><option>select</option></select>
+    <textarea class="yes" cols="1" rows="1"></textarea>
+    <video class="yes" controls></video>
 
-    <audio id="no1"></audio>
-    <img id="no2" src="data:image/png,">
-    <input id="no3" type="hidden">
-    <object id="no4">object</object>
-    <video id="no5"></video>
-    <span id="no6" tabindex="1">tabindex</span>
+    <audio class="no"></audio>
+    <img class="no" src="data:image/png,">
+    <input class="no" type="hidden">
+    <object class="no">object</object>
+    <video class="no"></video>
+
+    <span class="no" tabindex="1">tabindex</span>
+    <audio class="no" tabindex="1"></audio>
+    <img class="no" src="data:image/png," tabindex="1">
+    <input class="no" type="hidden" tabindex="1">
+    <object class="no" tabindex="1">object</object>
+    <video class="no" tabindex="1"></video>
   </label>
 </form>
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 229925 **/
 
 var target = document.getElementById("target");
 
-var yes_nodes = [
-  document.getElementById("yes1"),
-  document.getElementById("yes2"),
-  document.getElementById("yes3"),
-  document.getElementById("yes4"),
-  document.getElementById("yes5"),
-  document.getElementById("yes6"),
-  document.getElementById("yes7"),
-  document.getElementById("yes8"),
-  document.getElementById("yes9"),
-  document.getElementById("yes10"),
-  document.getElementById("yes11"),
-  document.getElementById("yes12"),
-  document.getElementById("yes13"),
-  document.getElementById("yes14"),
-];
+var yes_nodes = Array.from(document.getElementsByClassName("yes"));
 
-var no_nodes = [
-  document.getElementById("text"),
-  document.getElementById("no1"),
-  document.getElementById("no2"),
-  document.getElementById("no3"),
-  document.getElementById("no4"),
-  document.getElementById("no5"),
-  document.getElementById("no6"),
-];
+var no_nodes = Array.from(document.getElementsByClassName("no"));
 
 var target_clicked = false;
 target.addEventListener("click", function() {
   target_clicked = true;
 });
 
 var node;
 for (node of yes_nodes) {