Open Bug 344594 Opened 19 years ago Updated 3 years ago

[rfe] readonly (something) elementIsVisible attribute to nsIScrollBoxObject

Categories

(Core :: XUL, defect)

x86
Windows XP
defect

Tracking

()

People

(Reporter: moco, Unassigned)

References

()

Details

[rfe] readonly (something) elementIsVisible attribute to nsIScrollBoxObject for something I'm working on (see bug #343251, the part about coloring menu items based on if a tab is visible) would require this. I chatted briefly with dbaron about this, and he pointed out that we might want four results: 1) not visible 2) partially visible 3) as visible as possible (*) 4) completely visible 3 is interesting, as it means the element is bigger than the scroll box, so you'd never get "completely visible" I was surprised this didn't exist already (for accessibility reasons), but maybe people have just implemented the logic in the "caller code" where they checked the element dimensions and position with the scroll box dimensions and position.
Accessibility uses nsIViewManager::GetRectVisibility http://lxr.mozilla.org/seamonkey/source/view/public/nsIViewManager.h#561
aaron: > Accessibility uses nsIViewManager::GetRectVisibility > http://lxr.mozilla.org/seamonkey/source/view/public/nsIViewManager.h#561 do you think that's the right approach for what I need, or do you think doing the simple calculations (see my next comment for what I'm current doing) in the ScrollBoxObject is the right approach for this special case of elementIsVisible?
for bug #343251, I'm currently doing "completely visible" in js, in tabbrowser.xml by comparing just the x coordinates for the box objects, because I know the tab strip is horizontal. var tsbo = tabbrowser.mTabContainer.mTabstrip.scrollBoxObject; var tsboStart = tsbo.screenX; var tsboEnd = tsboStart + tsbo.width; ... var ctbo = tabs[i].boxObject; var ctboStart = ctbo.screenX; var ctboEnd = ctboStart + ctbo.width; ... if (tsboStart <= ctboStart && ctboEnd <= tsboEnd) menuItem.setAttribute("completelyvisible", "true"); for the general case, for all ScrollBoxObjects, I obviously have to handle vertical and horizontal scroll box objects, and I need to return one of the four states of visibility that dbaron pointed out.
Status: NEW → ASSIGNED
Seth, I think roc is a better person to ask about this stuff.
I'm not sure we really want to add a built-in API for this. Maybe a JS API on the scrollbox binding?
not actively working on this.
Assignee: sspitzer → nobody
Status: ASSIGNED → NEW
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.