Bug 810260 - xul:deck hidden pages shouldn't be offscreen, r=tbsaunde, a=akeybl
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 16 Nov 2012 19:12:45 +0900
changeset 114300 bdd31f2f2b08b0932e0b250130378d52884779d7
parent 114299 edc2aedfaed55a0f685d35867b074442055f749c
child 114301 51b78d0814360615f28b80a989e813a430ad7b81
push id2728
push usermzehe@mozilla.com
push dateMon, 19 Nov 2012 08:42:03 +0000
treeherdermozilla-aurora@bdd31f2f2b08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde, akeybl
bugs810260
milestone18.0a2
Bug 810260 - xul:deck hidden pages shouldn't be offscreen, r=tbsaunde, a=akeybl
accessible/src/generic/Accessible.cpp
accessible/tests/mochitest/states/Makefile.in
accessible/tests/mochitest/states/test_visibility.xul
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -618,21 +618,27 @@ Accessible::VisibilityState()
 
   nsIFrame* curFrame = frame;
   nsPoint framePos(0, 0);
   do {
     nsIView* view = curFrame->GetView();
     if (view && view->GetVisibility() == nsViewVisibility_kHide)
       return states::INVISIBLE;
 
-    // Offscreen state for background tab content.
+    // Offscreen state for background tab content and invisible for not selected
+    // deck panel.
     nsIFrame* parentFrame = curFrame->GetParent();
     nsDeckFrame* deckFrame = do_QueryFrame(parentFrame);
-    if (deckFrame && deckFrame->GetSelectedBox() != curFrame)
-      return states::OFFSCREEN;
+    if (deckFrame && deckFrame->GetSelectedBox() != curFrame) {
+      if (deckFrame->GetContent()->IsXUL() &&
+          deckFrame->GetContent()->Tag() == nsGkAtoms::tabpanels)
+        return states::OFFSCREEN;
+
+      return states::INVISIBLE;
+    }
 
     // If contained by scrollable frame then check that at least 12 pixels
     // around the object is visible, otherwise the object is offscreen.
     framePos += curFrame->GetPosition();
     nsIScrollableFrame* scrollableFrame = do_QueryFrame(parentFrame);
     if (scrollableFrame) {
       nsRect scrollPortRect = scrollableFrame->GetScrollPortRect();
       nsRect frameRect(framePos, frame->GetSize());
--- a/accessible/tests/mochitest/states/Makefile.in
+++ b/accessible/tests/mochitest/states/Makefile.in
@@ -26,16 +26,17 @@ MOCHITEST_A11Y_FILES =\
 		test_inputs.html \
 		test_link.html \
 		test_popup.xul \
 		test_selects.html \
 		test_stale.html \
 		test_textbox.xul \
 		test_tree.xul \
 		test_visibility.html \
+		test_visibility.xul \
 		z_frames.html \
 		z_frames_article.html \
 		z_frames_checkbox.html \
 		z_frames_textbox.html \
 		z_frames_update.html \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/states/test_visibility.xul
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+                 type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        title="XUL elements visibility states testing">
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
+
+  <script type="application/javascript"
+          src="../common.js" />
+  <script type="application/javascript"
+          src="../role.js" />
+  <script type="application/javascript"
+          src="../states.js" />
+
+  <script type="application/javascript">
+  <![CDATA[
+    function doTest()
+    {
+      testStates("deck_pane1", STATE_INVISIBLE, 0, STATE_OFFSCREEN);
+      testStates("deck_pane2", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
+      testStates("tabs_pane1", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
+      testStates("tabs_pane2", STATE_OFFSCREEN, 0, STATE_INVISIBLE);
+
+      SimpleTest.finish();
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addA11yLoadEvent(doTest);
+  ]]>
+  </script>
+
+  <hbox flex="1" style="overflow: auto;">
+    <body xmlns="http://www.w3.org/1999/xhtml">
+     <a target="_blank"
+         href="https://bugzilla.mozilla.org/show_bug.cgi?id=810260"
+         title=" xul:deck hidden pages shouldn't be offscreen">
+        Mozilla Bug 810260
+     </a>
+
+      <p id="display"></p>
+      <div id="content" style="display: none">
+      </div>
+      <pre id="test">
+      </pre>
+    </body>
+
+    <vbox flex="1">
+
+      <deck selectedIndex="1">
+        <description value="This is the first page" id="deck_pane1"/>
+        <button label="This is the second page" id="deck_pane2"/>
+      </deck>
+
+      <tabbox>
+        <tabs>
+          <tab>tab1</tab>
+          <tab>tab2</tab>
+        </tabs>
+        <tabpanels>
+          <description value="This is the first page" id="tabs_pane1"/>
+          <button label="This is the second page" id="tabs_pane2"/>
+        </tabpanels>
+      </tabbox>
+
+    </vbox>
+  </hbox>
+
+</window>
+