Bug 963829 - Include CSS/SVG transformations when calculating OFFSCREEN state. r=roc

This commit is contained in:
Eitan Isaacson 2014-01-28 09:10:28 -08:00
parent 9002ff9c6c
commit 952168d4ad
2 changed files with 6 additions and 3 deletions

View File

@ -581,7 +581,6 @@ Accessible::VisibilityState()
return states::INVISIBLE;
nsIFrame* curFrame = frame;
nsPoint framePos(0, 0);
do {
nsView* view = curFrame->GetView();
if (view && view->GetVisibility() == nsViewVisibility_kHide)
@ -605,11 +604,11 @@ Accessible::VisibilityState()
// 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());
nsRect frameRect = nsLayoutUtils::TransformFrameRectToAncestor(
frame, frame->GetRectRelativeToSelf(), parentFrame);
if (!scrollPortRect.Contains(frameRect)) {
const nscoord kMinPixels = nsPresContext::CSSPixelsToAppUnits(12);
scrollPortRect.Deflate(kMinPixels, kMinPixels);

View File

@ -119,6 +119,7 @@
{
testStates("div", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
testStates("div_off", STATE_OFFSCREEN, 0, STATE_INVISIBLE);
testStates("div_transformed", STATE_OFFSCREEN, 0, STATE_INVISIBLE);
testStates("div_abschild", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN);
gQueue = new eventQueue();
@ -160,6 +161,9 @@
<div id="div_off" style="position: absolute; left:-999px; top:-999px">
offscreen!
</div>
<div id="div_transformed" style="transform: translate(-999px, -999px);">
transformed!
</div>
<!-- edge case: no rect but has out of flow child -->
<div id="div_abschild">