Closed Bug 612036 Opened 9 years ago Closed 9 years ago

Error during resize if focused element has a custom dragger

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set

Tracking

(Not tracked)

VERIFIED FIXED
Firefox 4.0

People

(Reporter: wesj, Assigned: wesj)

Details

Attachments

(1 file)

When a resize event occurs we get the focused element, and then scroll the nearest scrollbox we can find in order to keep the element in view. However, calls to getScrollboxFromElement also return elements with custom draggers for custom scrolling techniques, and these may not have a scrollInterface. When we resize with one of these elements focused, an error occurs:

JavaScript error: chrome://browser/content/browser.js, line 297: scrollInterface is null

Easy fix is just to check for the scrollInterface or better to pass in a parameter to say we don't want back custom draggers so that we climb higher in the tre. We would (ideally) handle both these cases (returned dragger or a scrollInterface).

STR:
1.) Start Fennec
2.) Load a page
3.) Click on the page
4.) Rotate orientation (CTRL-SHIFT-Q on desktop)

Result:
Error appears in console.
Assignee: nobody → wjohnston
Attached patch Patch v1Splinter Review
The only case I can find where this happens is the when the browser is focused. During an orientation change, the browser element holds a customdragger for panning which doesn't require a scrollInterface. The only other customDragger I know of (the default one) expects a scrollInterface to work, and will work here.

Since we don't know much about what is focused in browser elements, the easiest solution seem to be doing nothing in this case. Other solutions seem fairly involved, without a huge payoff.
Attachment #490751 - Flags: review?(mark.finkle)
Comment on attachment 490751 [details] [diff] [review]
Patch v1

>       // We want to keep the current focused element into view if possible
>       let currentElement = document.activeElement;
>       let [scrollbox, scrollInterface] = ScrollUtils.getScrollboxFromElement(currentElement);
>-      if (currentElement && (currentElement.id != "inputhandler-overlay") && scrollbox && currentElement != scrollbox) {
>+      if (scrollInterface && currentElement && (currentElement.id != "inputhandler-overlay") && scrollbox && currentElement != scrollbox) {

I don't believe we have any elements with an id == "inputhandler-overlay" anymore.

r+ with the nit fixed
Attachment #490751 - Flags: review?(mark.finkle) → review+
pushed with nit fixed:
http://hg.mozilla.org/mobile-browser/rev/8c49c2535457
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
verified Mozilla/5.0 (Android; Linux armv7l; rv:2.1.1) Gecko/20110415 Firefox/4.0.2pre Fennec/4.0.1 ID:20110415172201
Status: RESOLVED → VERIFIED
Target Milestone: --- → Firefox 4.0
You need to log in before you can comment on or make changes to this bug.