Closed Bug 91380 Opened 25 years ago Closed 25 years ago

Implementation of nsScrollBoxObject::ScrollToElement and EnsureElementIsVisible

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: kinger, Assigned: bryner)

Details

Attachments

(2 files)

We needed these two functions for Komodo, so we implemented them. The work was done by Shane Caraveo, who is copied on the bug, so address any questions to Shane. Patch coming ...
Hmmm, aparently Shane does not have a bugzilla account
bryner, can you land these in the tree? the work appears to be done.
Assignee: trudelle → bryner
A few nits: - in nsScrollBoxObject::ScrollToElement, why do you bother getting the width and height if they aren't needed? + // get the twips rectangle from teh boxobject (which has pixels) fix the typo (this appears in two places) Also, can you explain what algorithm you are using in EnsureElementIsVisible to compute the scroll position?
Ok, fixing typos and removing some unused code, patch to follow. As an explanation of the computation in EnsureElementIsVisible (if I'm not explaining this clearly, let me know): if (horiz) { // if the right edge of the element is to the right of the // right edge of the viewable box, get the difference, and move // the left edge that many twips if (rect.x + rect.width > cp.x + crect.width) { newx = cp.x + ((rect.x + rect.width)-(cp.x + crect.width)); // else if the left edge of the element is not within the viewable box, // make the left edge of the viewable box the left edge of the element } else if (rect.x < cp.x) { newx = rect.x; } // if neither of the above, the element is already fully visible } else { // if the bottom edge of the element is to the below the // bottom edge of the viewable box, get the difference, and move // the top edge that many twips if (rect.y + rect.height > cp.y + crect.height) { newx = cp.y + ((rect.y + rect.height)-(cp.y + crect.height)); // else if the top edge of the element is above the top edge of // the viewable box, // make the top edge of the viewable box the top edge of the element } else if (rect.y < cp.y) { newy = rect.y; } // if neither of the above, the element is already fully visible }
ok, r=bryner
Does this need an sr? It would be nice if it made it in before the freeze tomorrow.
yes, it needs an sr.
Pick an sr=, likely hyatt or ben, and email them for review cc:reviewers@mozilla.org
sr=hyatt
Checked in.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
May God have mercy on us all. The 212 bug spam-o-rama is Now!
QA Contact: aegis → jrgm
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: