[de-xbl] Migrate modebox to a custom element
Categories
(Calendar :: Lightning Only, task)
Tracking
(Not tracked)
People
(Reporter: arshad, Assigned: pmorris)
References
Details
Attachments
(1 file, 9 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
|
||
Reporter | ||
Comment 2•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
Reporter | ||
Comment 5•5 years ago
|
||
Comment 6•5 years ago
|
||
Over to Khushil, since Arshad is not working for Thunderbird anymore.
There is no direct rush with this bug, since it doesn't depend on other bindings.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 7•5 years ago
|
||
1 of 2. This is the main one. Some thoughts:
I thought about renaming "modebox" to "modehbox" for a clearer parallel/contrast with "modevbox", but have left it as it is.
It's a bit awkward to have the tiny calendar-modebox.css
file that has to accompany the custom element file. (That CSS-in-JS approach may be on to something.) I was tempted to set those styles in the connectedCallback (as an inline "style" property), but left it as is.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 8•5 years ago
|
||
2 of 2. Just a minor XUL indentation fix.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Comment 10•5 years ago
|
||
I'd like to have a close look at this before it lands, setting NI? on myself because I'm not going to do it now.
Comment 11•5 years ago
|
||
Updated•5 years ago
|
Comment 12•5 years ago
|
||
A few comments. I was going to assign this bug to myself, if you hadn't been working on it already.
- I think we can get rid of
-moz-user-focus: normal
. I'm not sure why it exists but there's no need (IMO) for any of these elements to be focusable. - We can get rid of
-moz-box-orient: vertical
– dothis.orient = "vertical"
orthis.setAttribute("orient", "vertical")
where necessary. - With those gone the stylesheet is unnecessary.
- There's no need for a subclass for vertical boxes (unless custom elements doesn't allow defining two things to the same class, which would be weird) – you can check
this.localName
to find out which one you have, which is only needed to set the orientation. - I don't like the use of
DOMAttrModified
event, which has been considered a bad idea™ since ages ago. Also I wouldn't be surprised if<broadcaster>
and<observer>
are endangered species. These are the problems I came here to look at, but I'll deal with them in another bug.
Assignee | ||
Comment 13•5 years ago
|
||
Thanks for the review and the bonus comments.
(In reply to Magnus Melin [:mkmelin] from comment #11)
we should take the opportunity to rename them to calnendar-modebox
CEs need to have a hypen in their name (and some things will break when they
do not)
Good call, and done. And now there's only a single patch since the rename involved re-indentation of the code that was in the part2 patch.
(In reply to Geoff Lankow (:darktrojan) from comment #12)
- I think we can get rid of
-moz-user-focus: normal
. I'm not sure why it exists but there's no need (IMO) for any of these elements to be focusable.- We can get rid of
-moz-box-orient: vertical
– dothis.orient = "vertical"
orthis.setAttribute("orient", "vertical")
where necessary.- With those gone the stylesheet is unnecessary.
That is much better, thanks.
- There's no need for a subclass for vertical boxes (unless custom elements doesn't allow defining two things to the same class, which would be weird) – you can check
this.localName
to find out which one you have, which is only needed to set the orientation.
I had tried this before and turns out different Custom Elements can't use the same class, for some silly reason. You get an error like:
NotSupportedError: 'calendar-modevbox' and 'calendar-modebox' have the same constructor
So I've kept the subclass and put setting its orient to vertical in its connectedCallback.
- I don't like the use of
DOMAttrModified
event, which has been considered a bad idea™ since ages ago. Also I wouldn't be surprised if<broadcaster>
and<observer>
are endangered species. These are the problems I came here to look at, but I'll deal with them in another bug.
Sounds good. I've seen the bug about <broadcaster> going away and was thinking that we'd need to revisit this as part of that.
Assignee | ||
Comment 14•5 years ago
|
||
Comment 15•5 years ago
|
||
Re broadcaster, I'm working on the last pieces of removing that in bug 1567424.
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
Found this in the console, maybe related
JavaScript error: chrome://calendar/content/calendar-multiday-base-view.js, line 1002: TypeError: item is undefined
JavaScript error: chrome://calendar/content/calendar-common-sets.js, line 941: TypeError: item is undefined
Assignee | ||
Comment 18•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #16)
It seems that for multi-week and month views, rotate doesn't work properly.
Rotate View should apparently be disabled for those, it isn't with this
patch). And also something fishy for the other views with rotate, and then
trying to disable it again. (Not sure about the details, and could be
resolved by resolving the other problem?)
Hm, I wasn't able to reproduce this. I'm using artifact builds and when I built with this patch on top of this changeset:
(050d0ef127f2) Bug 1569399 - openConversationButton.tooltip changed to openMsgConversationButton.tooltip for messenger.dtd to fix...
then rotate view is disabled (in appmenu and menubar view menu) for month and multi-week, and works as expected for day and week views. I also didn't see any errors appearing in the console. Any ideas?
instead of putting Services as global, please import Services (inside the block)
OK, done in this new version of the patch.
Comment 19•5 years ago
|
||
Comment 20•5 years ago
|
||
I suppose it's possible the problem could have been when I run with the patch the first time in the profile, related to mode persistence? Can you double check that works.
Assignee | ||
Comment 21•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #19)
modes will always be true, and then you don't really need the length > 0 test either
Thanks, I've made this change, simplified the function.
(In reply to Magnus Melin [:mkmelin] from comment #20)
I suppose it's possible the problem could have been when I run with the patch the first time in the profile, related to mode persistence? Can you double check that works.
Good thought. I checked this and wasn't able to reproduce the problem. I tried a couple things:
- Starting with a fresh profile with the patch applied, and restarting to install calendar.
- Starting with another fresh profile without the patch applied, restarting to install calendar, then applying the patch and running with that same profile.
Comment 22•5 years ago
|
||
Assignee | ||
Comment 23•5 years ago
|
||
Thanks for the review.
(In reply to Geoff Lankow (:darktrojan) from comment #22)
Add a handleEvent function to CalendarModebox that checks event.type and
passes event on to the right function. The we can stop mucking around with
handler objects and just pass 'this' to add/removeEventListener. Same goes
for the DOMAttrModified handling.
Good call, this is much better!
This event can be removed. It's a hack to ensure an XBL binding has loaded
when we need it.
Done.
Can we rename modeAttribute to attributeName? This is confusing.
Done.
I think I prefer this as a block, it's more readable:
Done.
It seems this should default to true. I'm not sure if we're ever in a state
where there is no mode attribute, but just in case we'd better keep the same
behaviour.
Oooh, good catch, fixed.
modebox will always be 'this'.
Ok, dropped the modebox arg to use 'this' instead.
It's common in our code to put brackets around the first part, to make it
more obvious what's happening, like this:
(command.getAttribute("checked") == "true") ? "false" : "true"
Ok, done.
modebox is unused, and it's always 'this' anyway.
Removed.
return XULElement.prototype.setAttribute.call(this, attr, val);
I'm guessing you could not use super.setAttribute?
Well, I just hadn't changed the code from the XBL binding version. I've switched it to super.setAttribute now. Good call.
Comment 24•5 years ago
|
||
Assignee | ||
Comment 25•5 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #24)
Thanks, just watch your comment line-length. Some of them are creeping past
100 characters in a line.
Huh, then my editor is lying to me. It said I was right up to 100 but not past. I re-formatted a few to make sure they're under 100.
Assignee | ||
Comment 27•5 years ago
|
||
Forgot to post this link to successful try server run:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=97fc7770f89d3965b0efa9cf49ba68f62283809e
Comment 28•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/1879fcb9f785
[de-xbl] Migrate modebox and modevbox to custom elements. r=darktrojan,mkmelin
Updated•5 years ago
|
Description
•