Closed
Bug 461803
Opened 16 years ago
Closed 16 years ago
need elementFromPoint that optionally ignores scrollframe
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.9.1b2
People
(Reporter: Gavin, Assigned: Gavin)
References
Details
(Keywords: mobile)
Attachments
(1 file, 3 obsolete files)
11.52 KB,
patch
|
Details | Diff | Splinter Review |
See discussion in bug 459604. Fennec needs to be able to find elements at a given point in the window, which may or may not be visible in the viewport. document.elementFromPoint only works for elements that are scrolled into view. The current proposal is to add an elementFromPoint method to nsIDOMWindowUtils that takes an optional "ignoreScrollFrame" argument.
Assignee | ||
Comment 1•16 years ago
|
||
Is there a good way to share this code between nsDOMWindowUtils and nsDocument? A helper on nsContentUtils maybe? nsDocument::ElementFromPoint does some layout-y stuff like FlushPendingNotifications, and I'm not sure how doable that is from nsDOMWindowUtils. Is it even necessary?
It certainly is doable from nsDOMWindowUtils, and it is necessary in general to make sure that the layout is up to date. Now, it may be that for your needs you don't need the layout to be up to date and you're happy to query the current frame tree. If so, taking out the FPN will improve performance.
If you want to share code, moving code to nsContentUtils is a reasonable way to go. Another way would be to define an ElementFromPoint helper in nsIDocument.
Assignee | ||
Comment 4•16 years ago
|
||
This seems to work, but I'm not sure I like it very much. I had to make some changes to CheckAncestryAndGetFrame and move it to nsContentUtils along with most of ElementFromPoint, and have nsContentUtils include nsLayoutUtils.h. Thoughts?
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•16 years ago
|
||
Can we change nsIDocument for 1.9.1? That would probably make things simpler.
We can.
Assignee | ||
Comment 7•16 years ago
|
||
This is simpler, and works. Not sure who the best person to review this is... I'll take r+sr from anyone, though!
Attachment #345644 -
Attachment is obsolete: true
Attachment #346069 -
Flags: superreview?(bzbarsky)
Attachment #346069 -
Flags: review?
Assignee | ||
Updated•16 years ago
|
Attachment #346069 -
Flags: review? → review?(peterv)
Comment 8•16 years ago
|
||
Comment on attachment 346069 [details] [diff] [review] patch >+++ b/content/base/public/nsIDocument.h >+ * Helper for nsIDOMNSDocument::elementFromPoint implementation that allows >+ * ignoring the scroll frame and/or avoiding layout flushes. This should probably document the args. An @see pointing to the nsIDOMWindowUtils docs is likely sufficient documentation. >+++ b/dom/public/idl/base/nsIDOMWindowUtils.idl >+ nsIDOMElement elementFromPoint(in long aX, >+ in long aY, >+ [optional] in boolean aIgnoreScrollFrame, >+ [optional] in boolean aFlushLayout); This needs documentation (e.g. which scrollframe is being ignored? Does passing false for aFlushLayout flush anything else?). I'm also not so happy about having the default value of aFlushLayout being false. Since we have no good way to change that, maybe flip the args and make that one required? Callers that don't want to pass anything for these two booleans can just use the nsIDOMNSDocument version of this method. With those nits, r+sr=bzbarsky
Attachment #346069 -
Flags: superreview?(bzbarsky)
Attachment #346069 -
Flags: superreview+
Attachment #346069 -
Flags: review?(peterv)
Attachment #346069 -
Flags: review+
Assignee | ||
Comment 9•16 years ago
|
||
Changes: -s/ignoreScrollFrame/ignoreRootScrollFrame/ per bug 462887 -made both parameters non-optional -added comments to nsIDOMWindowUtils, and reference in nsIDocument.h
Attachment #346069 -
Attachment is obsolete: true
Assignee | ||
Comment 10•16 years ago
|
||
Attachment #346125 -
Attachment is obsolete: true
Assignee | ||
Comment 11•16 years ago
|
||
bz, do the comments look OK to you?
Comment 12•16 years ago
|
||
Looks good to me.
Assignee | ||
Comment 13•16 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/bfed44de0709
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b2
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•