Closed
Bug 394887
Opened 17 years ago
Closed 17 years ago
Consider creating widgets for nsMenuPopupFrames lazily
Categories
(Core :: XUL, enhancement)
Core
XUL
Tracking
()
RESOLVED
FIXED
mozilla1.9beta1
People
(Reporter: Gavin, Assigned: enndeakin)
References
Details
(Keywords: perf)
Attachments
(2 files, 3 obsolete files)
(deleted),
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
roc
:
approval1.9+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review |
See bug 391385 comment 11. Adding empty <panel>s to the browser chrome seems to have a fairly large impact on Txul. Widgets are already created lazily for popups of type ePopupTypeMenu, but Neil suggested we might be able to lazily create widgets for other of menus as well. This could help reduce the performance impact of bug 391385 and hopefully bug 383183.
Reporter | ||
Comment 1•17 years ago
|
||
This is what I tried locally, from a quick glance at the code you mentioned. It seems to cause sizing problems when autocomplete popups are initially displayed (they're fine once they've been shown once).
Assignee | ||
Comment 2•17 years ago
|
||
Yes, the autocomplete uses 'sizetopopup', yet it isn't the parent of the popup frame (a popupset is in-between for some reason), so it never ends up checking the sizetopopup condition below.
Reporter | ||
Comment 3•17 years ago
|
||
Ah, I see. Should we search the parent chain, instead of just checking the direct parent?
Assignee | ||
Comment 4•17 years ago
|
||
(In reply to comment #3)
> Ah, I see. Should we search the parent chain, instead of just checking the
> direct parent?
>
That would work for some cases, but some autocomplete popups (such as those added in 391385) are outside of the autocomplete widget. In reality, the popup code doesn't know what will be used as the anchor, if anything, at the time the frame is constructed.
The autocomplete widget doesn't even use sizetopopup properly (see bug 387548). One possible way is to add a sizetomenu attribute (or another suitable attribute) on the popup which causes the widget to be pre-created.
Or, we could dive deeper into layout in order to find out why autocomplete needs the widget to be pre-created.
Assignee | ||
Comment 5•17 years ago
|
||
OK, the autocomplete widget doesn't work because it has this function 'adjustHeight' that is called before the popup is showing which uses the view and the row height to calculate the tree size. However, when no child frames are being constructed, this is null/0 so the height doesn't get determined properly.
I think the easiest solution is to add some attribute to a popup which can be checked to see if the widget creation should be skipped.
Assignee | ||
Comment 6•17 years ago
|
||
This creates widgets only for menus with sizetopopup and popups with a type attribute, such as the autocomplete widget.
This will need to be tested extensively to make sure it doesn't cause any regressions.
Reporter | ||
Updated•17 years ago
|
Summary: Consider create widgets for nsMenuPopupFrames lazily → Consider creating widgets for nsMenuPopupFrames lazily
Assignee | ||
Comment 7•17 years ago
|
||
Attachment #279956 -
Attachment is obsolete: true
Attachment #280187 -
Flags: superreview?(bzbarsky)
Attachment #280187 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 8•17 years ago
|
||
Attachment #280187 -
Attachment is obsolete: true
Attachment #280188 -
Flags: superreview?(bzbarsky)
Attachment #280188 -
Flags: review?(bzbarsky)
Attachment #280187 -
Flags: superreview?(bzbarsky)
Attachment #280187 -
Flags: review?(bzbarsky)
Comment 9•17 years ago
|
||
Comment on attachment 280188 [details] [diff] [review]
this is the real patch
>Index: layout/xul/base/src/nsMenuPopupFrame.cpp
>+ if (!mGeneratedChildren) {
I'd reverse this test, return PR_FALSE if mGeneratedChildren, then outdent everything following.
>+ if (parentContent &&
>+ !parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup))
>+ return PR_TRUE;
And this part could be |return parentContent && !parentContent->HasAttr(....)|;
>+ }
>+
>+ return PR_FALSE;
>+}
This was indented wrong; watch the indents as you outdent?
r+sr=bzbarsky with that.
Attachment #280188 -
Flags: superreview?(bzbarsky)
Attachment #280188 -
Flags: superreview+
Attachment #280188 -
Flags: review?(bzbarsky)
Attachment #280188 -
Flags: review+
Assignee | ||
Comment 10•17 years ago
|
||
Assignee | ||
Updated•17 years ago
|
Attachment #280188 -
Flags: approval1.9?
Attachment #280188 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Comment 11•17 years ago
|
||
OK, I tried checking this in and it caused a large performance regression. I investigated and discovered that the bookmarks menus use type="places", causing these to be generated upfront which is fairly bad. So I'll either need to specifically look for type="autocomplete" or find some other mechanism which filters out the right items.
Assignee | ||
Comment 12•17 years ago
|
||
I checked in a modified version of this patch which moved the type attribute check inside the check for non ePopupType_Menu so it only checks the type for menus. TXul is better (5-6ms) and startup is a bit better, although strangely not on Windows. I'm going to mark this fixed.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Updated•17 years ago
|
Flags: in-testsuite?
Target Milestone: --- → mozilla1.9 M9
You need to log in
before you can comment on or make changes to this bug.
Description
•