Bug 810260 - xul:deck hidden pages shouldn't be offscreen, r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 16 Nov 2012 19:12:45 +0900
changeset 113482 6ef7a00233aa539aa230ee1a18af99e7f85151db
parent 113481 dad2675c03d1930fbf1b0bd8a025d7ebbc339fc8
child 113483 f077ad362ca32faebd4438917c36dcef9f669e39
push id23872
push useremorley@mozilla.com
push dateFri, 16 Nov 2012 17:06:27 +0000
treeherdermozilla-central@a7ed19f7d21a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs810260
milestone19.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 810260 - xul:deck hidden pages shouldn't be offscreen, r=tbsaunde
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
@@ -616,21 +616,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>
+