Closed Bug 102192 Opened 24 years ago Closed 24 years ago

Active Accessibility: Support STATE_OFFSCREEN in IAccessible states

Categories

(SeaMonkey :: General, defect, P2)

x86
Windows 2000
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla0.9.5

People

(Reporter: aaronlev, Assigned: aaronlev)

Details

(Keywords: access)

Attachments

(3 files, 3 obsolete files)

The STATE_OFFSCREEN bitflag should be returned in Accessible state when an element is offscreen. The accessibility vendors have asked for a quick, rough calculation. Therefore, for simplicity we just check to see if the top left corner of the object's frame is off screen. More comments in patch.
Keywords: access
Priority: -- → P2
Whiteboard: seeking r=, sr=
Target Milestone: --- → mozilla0.9.5
Attached file This has been tested - works well (obsolete) —
Umm.... I need code to do a review and all I see in the patch is some text comments.
Attachment #51240 - Attachment is obsolete: true
Attachment #51240 - Attachment is patch: false
Comment on attachment 51258 [details] [diff] [review] The last patch was the wrong file - this is the right one looks good. I'm confused why the GetOffsetFromView returns negative numbers for both the x and y, but I trust you and I'll do digging for my own satisfaction later. r=jgaunt
Attachment #51258 - Flags: review+
Sorry, I might have told you that GetOffsetFromView returns negative numbers. The one returning negative numbers is this: containingView->GetBounds(containingViewRect); Therefore our final comparison works: if (frameOffset.y < -containingViewRect.y || frameOffset.y + containingViewRect.y > scrollViewRect.height || frameOffset.x < -containingViewRect.x || frameOffset.x + containingViewRect.x > scrollViewRect.width) *aAccState |= STATE_OFFSCREEN; The expression |-containingViewRect.y| becomes a 0 or positive value representing how much of the top of document, in twips, is not currently shown on the screen.
kmcclusk, this looks okay to me...what do you think?
This is fine for most cases, but I think it will fail if there are intervening views consider the following view hierarchy where viewC has the frame: scrollview |- viewA |-viewB |-viewC (Frame) To get the absolute position of the Frame you must add together the offsets for ViewA, ViewB, and ViewC as well as the frame's offset. The patch looks like it always assumes it can calculate the position of the frame relative to the view by adding in only it's containing views offset. Another issue is if the frame is inside a scrolling div: scrollingViewA view1 scrollingViewB view2 view3 (frame) The position of scrollingViewB may be off screen and that may cause all of the views it contains to also be offscreen, but the patch only looks for the nearest enclosing scrollingView, so relative to ScrollingViewB the frame appears to be onscreen. A third issue would be clipping. Views may have clip set which would make the element invisible, but I'm not sure if they would still be considered on screen.
The current patch will probably satisfy 90%+ of the existing websites. If you want a more accurate determination of visibility, You should be able to use some code nsViewManager.cpp to help you out. PRBool nsViewManager::IsRectVisible(nsIView *aView, const nsRect &aRect). This method takes the view in question and rect within the view and returns a bool to indicate whether it is visible. You should be able to pass the frames bounds as aRect and the frames containing view and you will get back a boolean which indicates whether any portion of the rect is visible. This call is used within the viewmanager to avoid invalidating rects which are completely invisible. IsRectVisible would need to made part of nsIViewManager's public interface.
Status: NEW → ASSIGNED
Whiteboard: seeking r=, sr= → seeking more advice - Kevin's instructions not working for me
Kevin, I had to copy and paste IsRectVisible into my code, because it needed some modification for my purposes. Mainly, I wanted half-visible rectangles to be counted as not visible. In the process, I had to expose two methods through nsIViewManager GetAbsoluteRect(nsIView *aView, const nsRect &aRect, nsRect& aAbsRect)GetVisibleRect(nsRect& aVisibleRect)
Whiteboard: seeking more advice - Kevin's instructions not working for me → seeking new r= from jgaunt, ready for sr= from kmcclusk
Comment on attachment 51494 [details] [diff] [review] Fix using some altered code from nsIViewManager::IsRectVisible looks good! r=kmcclusk@netscape.com
Attachment #51494 - Flags: review+
Rather than copying and pasting this code (and worse, copying it _out_ of the view module to a place where we'll never be able to find it again), how about you modify the view manager in such a way that you can issue the query you need to. Maybe add a boolean argument to IsRectVisible(), or at least implement IsRectEntirelyVisible() as another method on the view manager. Kevin, would you have any objections to this approach?
"Kevin, would you have any objections to this approach?". No thats fine with me. If we need to add a new argument to a method on the ViewManager which indicates whether only part of the rectangle is visible that's fine with me.
IsRectVisible(nsIView *aView, const nsRect &aRect) could be modified to have an additional argument which the visible part of the aRect that is passed in. IsRectVisible(nsIView *aView, const nsRect &aRect, nsRect &aVisibleRect) If (aVisibleRect==aRect) then the entire rect is visible.
(aaronl: hope I didn't sound like too much of a smarty pants: I didn't know about the IsRectVisible method, either. But now that we _do_ know, it seems like putting this in view manager may be better...)
Whiteboard: seeking new r= from jgaunt, ready for sr= from kmcclusk → seeking new r= from kmcclusk and sr= from waterson
Attachment #51730 - Attachment is obsolete: true
Attachment #51494 - Attachment is obsolete: true
I'd be fine with you leaving nsIViewManager::IsRectVisible()'s return signature as a PRBool...no need to get carried away with COM here. (I suspect in the long run we probably ought to consider getting rid of the extra COM layer here anyway...)
Comment on attachment 51736 [details] [diff] [review] This is the patch that needs r=/sr= r=kmcclusk@netscape.com. Patch looks fine to me. I agree with waterson in regard to not needing to maintain nsIViewManager.h as a com interface, but it's OK with me if you check it in "as is".
Attachment #51736 - Flags: review+
Go ahead and revert the return type to PRBool, and sr=waterson.
Oy, I'm sorry. I thought that this was already a publicly accessible method that you'd changed the signature of. (Who's not reading the patch carefully?) Go ahead with attachment 51736 [details] [diff] [review] as it is. sr=waterson
Comment on attachment 51736 [details] [diff] [review] This is the patch that needs r=/sr= sr=waterson
Attachment #51736 - Flags: superreview+
-> checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Whiteboard: seeking new r= from kmcclusk and sr= from waterson
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: