Closed Bug 1539651 Opened 6 years ago Closed 5 years ago

Convert places-popup-base and places-popup-arrow to Custom Elements

Categories

(Toolkit :: UI Widgets, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: bgrins, Assigned: surkov)

References

(Regressed 2 open bugs)

Details

Attachments

(3 files, 4 obsolete files)

https://bgrins.github.io/xbl-analysis/tree/#places-popup-base

Once we have the base popup class in place (Bug 1531870), it should be possible to take these two extended menupopups.

Priority: -- → P3

(In reply to Brian Grinstead [:bgrins] from comment #0)

https://bgrins.github.io/xbl-analysis/tree/#places-popup-base

Once we have the base popup class in place (Bug 1531870), it should be possible to take these two extended menupopups.

it appears the bug is unblocked now, which makes it a good candidate to wipe out next?

(In reply to alexander :surkov (:asurkov) from comment #2)

(In reply to Brian Grinstead [:bgrins] from comment #0)

https://bgrins.github.io/xbl-analysis/tree/#places-popup-base

Once we have the base popup class in place (Bug 1531870), it should be possible to take these two extended menupopups.

it appears the bug is unblocked now, which makes it a good candidate to wipe out next?

I have a proof of concept here, feel free to take it! If I remember correctly there are styling issues with it especially when using shadow DOM.

Blocks: 1555497
Attachment #9054049 - Attachment is obsolete: true
Assignee: nobody → surkov.alexander
Type: enhancement → task

Emilio, I logged nsMenuPopupFrame::ComputeAnchorRect as you recommended in bug 1555497 comment #6 and the results looks identical between builds. Where to look next?

ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400
ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400
ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400
ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400
ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400
ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400
ComputeAnchorRect for : <toolbarbutton id='bookmarks-menu-button'>
AnchorRect: x=0, y=0, width=1920, height=2400
relative to root AnchorRect: x=72657, y=1980, width=1920, height=2400
relative to screen AnchorRect: x=81177, y=8640, width=1920, height=2400

Flags: needinfo?(emilio)

Probably at the relevant frame's mRect then. You can call DumpFrameTree() / DumpFrameTreeLimited() and try to find the different values.

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #7)

Probably at the relevant frame's mRect then. You can call DumpFrameTree() / DumpFrameTreeLimited() and try to find the different values.

Do you refer to https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Debugging_a_Performance_Problem#Dump_the_Frame_Tree_via_GDB or something else? Is it expected work with lldb (I'm on os x)?

Also not sure I caught what relevant frame is you refer to. Do you mean popup and its anchor frames?

Yes, that :)

And yeah, I suspect MenuPopupFrame and the relevant popup / popupset frames are the things you want to look at.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #9)

Yes, that :)

And yeah, I suspect MenuPopupFrame and the relevant popup / popupset frames are the things you want to look at.

so, finally I figured out that @position attribute was missed on a menupoup, which gave it wrong positioning

Attachment #9068772 - Attachment is obsolete: true
Attachment #9054049 - Attachment is obsolete: false
Attachment #9054049 - Attachment is obsolete: true

Emilio, if you get a chance to take a look at bookmarks menu wrong height issue (D33821 patch), it'd be super helpful. Thank you!

Flags: needinfo?(emilio)
Attached image bookmarks.png

How do I repro it? This is what I see, and it looks fine?

Flags: needinfo?(emilio) → needinfo?(surkov.alexander)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #12)

Created attachment 9077664 [details]
bookmarks.png

How do I repro it? This is what I see, and it looks fine?

you'd need to have more items bookmarked, so the popup doesn't fit on the screen.

Flags: needinfo?(surkov.alexander) → needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #12)

Created attachment 9077664 [details]
bookmarks.png

How do I repro it? This is what I see, and it looks fine?

In your screenshot, you're also showing the Library menu, not the Bookmarks menu (which can be found in the customize mode).

So to be clear, what is not working is the popup scrolling when it overflows the screen, right?

I was a bit confused, since I don't see the scrolling on current nightly, but that's because I'm on Wayland and it's broken there (bug 1539651). Switching to X11 I can repro that.

This is the code that takes care of that, I'll check what it's doing.

I think this is a styling issue.

The problem is that the arrowscrollbox is not receiving the overflow event in the vertical direction. It does receive (and properly ignore) the overflow event on the horizontal direction (if any).

I think this is not a layout issue, since the scroll range is zero (scrollbox.scrollTopMax is zero). But I'll poke a bit more.

Flags: needinfo?(emilio)

So I did a bit of digging into this, and there are a bunch of frames that just aren't there when the popup is first laid out.

I think afterwards they end up there (since you can see them!), but I think the XUL layout code is bogus and messes up something with the dynamic change.

Well, after more digging, this is not a layout bug after all. I got confused by that initial layout, but that happens only because the order of the event listeners firing is different with and without XBL, in this case. So the onpopupshowing="" in the BMB_BookmarksPopup, which is what populates the menu, is just firing after the on_popupshowing from the custom element.

But that's alright, once it's populated we relayout just fine.

Here's your fix: You were missing a flex=1, which makes the xul element inflexible and thus makes it take the whole space unconditionally.

diff --git a/browser/components/places/content/places-menupopup.js b/browser/components/places/content/places-menupopup.js
index 694348dbb266..f5cf9b166f53 100644
--- a/browser/components/places/content/places-menupopup.js
+++ b/browser/components/places/content/places-menupopup.js
@@ -638,7 +638,7 @@ class MozPlacesPopupArrow extends MozPlacesPopup {
     return `
       <html:link rel="stylesheet" href="chrome://global/content/widgets.css" />
       <html:style>${this.commonStyles}</html:style>
-      <vbox class="panel-arrowcontainer">
+      <vbox class="panel-arrowcontainer" flex="1">
         <box class="panel-arrowbox">
           <image class="panel-arrow"></image>
         </box>
Attachment #9078050 - Attachment is obsolete: true
Attachment #9078051 - Attachment is obsolete: true

(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)

Here's your fix: You were missing a flex=1, which makes the xul element inflexible and thus makes it take the whole space unconditionally.

thank you a lot! it's so bad that such a small thing may require so disproportionately large effort.

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:surkov, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(surkov.alexander)

Alex is on PTO, I'm sure he'll get to this when he's back so reducing his needinfo backlog...

Flags: needinfo?(surkov.alexander)
Pushed by asurkov@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bd7cd9d7b6ad Convert places-popup-base and places-popup-arrow bindings to Custom Elements r=mak
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Regressions: 1572624
Regressions: 1572628
Regressions: 1573337
Regressions: 1468890
Regressions: 1498063
Regressions: 1575138
Regressions: 1578111
Regressions: 1800475
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: