Hi Botond, Thanks a lot for your reply. After a bit of testing I agree with you that rendering the entire document is way too expensive. I didn't realize how expensive. But taking a full page screenshot from the Developer Tools can take several seconds (per screenshot).
I've started implementing my own function, which I based on elementsFromPoint(), what I've learned from CanvasRenderingContext2D.drawWindow() and all the help in the Google Groups. I noticed that parsing the display-lists is not trivial: https://dxr.mozilla.org/mozilla-central/source/gfx/layers/layerviewer/layerTreeView.js and https://github.com/mozilla/layerscope. Especially for the data I'm looking for (absolute position of DOM nodes in the document and z-order). My function currently works like document.elementsFromPoint() but returns all DOM nodes in the document (regardless of scroll position) ordered by z-order. It also dumps the absolute position for all DOM nodes to stderr so I can capture and parse this. I've pasted the code here: http://pastebin.com/FKEC7Ejg I'm still stuck with a few things. Just like elementsFromPoint() my function currently ignores nodes with pointer-events:none; or visibility:hidden; (and maybe more). I only want to ignore nodes with display:none; Where can I override this? One thing that comes to mind is looping over all nodes first, then unset pointer-events:none; backup the original setting, then querying nsLayoutUtils::GetFramesForArea() (now it includes also the nodes which had pointer-events:none;) and then re-setting the backed up settings. But this sounds like a bad idea and will probably cause other problems. While working on this I noticed a bug with elementsFromPoint(). I reported it here: https://bugzilla.mozilla.org/show_bug.cgi?id=1266932 Since my function is based on elementsFromPoint(), this currently also effects my function. I tried to fix it but did it the wrong way (and in the wrong place). Would be great if you have some more tips. It's the first time I look at C++ so I'm already quite happy I've been able to implement a function in Firefox for my personal convenience. On Wednesday, 20 April 2016 19:29:03 UTC+2, [email protected] wrote: > On Wednesday, April 20, 2016 at 5:44:14 AM UTC-4, [email protected] wrote: > > I've tried increasing the dimensions of aDirtyRegion when calling > > nsLayoutUtils::PaintFrame() from nsPresShell.cpp. > > https://dxr.mozilla.org/mozilla-central/source/layout/base/nsPresShell.cpp#6351 > > That didn't seem to make a difference. > > I haven't tested this, but I'll try to point you in the right direction. > > The place to start looking is probably this line in > nsGfxScrollFrame::BuildDisplayList() [1] where we restrict the dirty rect > (which is essentially the rect that needs to be repainted) to the scroll > frame's "scroll port". For the page's root scroll frame, that's the viewport. > > You may want to condition any modification you make to this line, to the > scroll frame being the page's root scroll frame. The condition to test this > is something like |mIsRoot && > mOuter->PresContext()->IsRootContentDocument()|. (|mIsRoot| is true for the > root scroll frame of any document, including an iframe. > |IsRootContentDocument()| is only true for the top-level page you're viewing). > > If you're using APZ (async panning/zooming; it's the default in e10s mode on > 46 and newer), you probably also want to adjust this line [2] which > overwrites the dirty rect to be the "display port", which is an area larger > than the scroll port that we pre-render so async panning can bring it into > view without repainting, but still not (necessarily) as large as the entire > document. > > There may also be other places that need to be adjusted that I'm not aware of > or not thinking of right now. > > This probably goes without saying, but rendering the entire document will > kill performance for large documents, so it's suitable for debugging only (I > assume that's what you have in mind). > > Hope that helps! > > Cheers, > Botond > > [1] > https://dxr.mozilla.org/mozilla-central/rev/ae7413abfa4d3954a6a4ce7c1613a7100f367f9a/layout/generic/nsGfxScrollFrame.cpp#3145 > [2] > https://dxr.mozilla.org/mozilla-central/rev/ae7413abfa4d3954a6a4ce7c1613a7100f367f9a/layout/generic/nsGfxScrollFrame.cpp#3512 _______________________________________________ dev-tech-layout mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-layout

