Bug 810260 - xul:deck hidden pages shouldn't be offscreen, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-11-16 19:12:45 +09:00
parent 8d7bae626d
commit 58c67984b6
3 changed files with 83 additions and 3 deletions

View File

@ -621,11 +621,17 @@ Accessible::VisibilityState()
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.

View File

@ -31,6 +31,7 @@ MOCHITEST_A11Y_FILES =\
test_textbox.xul \
test_tree.xul \
test_visibility.html \
test_visibility.xul \
z_frames.html \
z_frames_article.html \
z_frames_checkbox.html \

View File

@ -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>