Closed Bug 964218 Opened 12 years ago Closed 12 years ago

Bookmarks widget issue in bookmarks toolbar

Categories

(Firefox :: Toolbars and Customization, defect)

29 Branch
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 29

People

(Reporter: u428464, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

(Whiteboard: [Australis:P3][good first verify])

Attachments

(1 file, 2 obsolete files)

STR: 1. Put the bookmarks widget in the bookmarks toolbar 2. The bookmarks widgets takes its new form 3. Put it back in the menu panel Result : A small star appears in the menu ER : the widget should take its classic form again.
Whiteboard: [Australis:P3]
I'm not sure why the button is reported as null when in the panel. However, this seems to work just fine, and also fixes the star button not appearing starred when in the menu panel.
Attachment #8365965 - Flags: review?(mak77)
Assignee: nobody → gijskruitbosch+bugs
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 8365965 [details] [diff] [review] Australis' bookmark widget isn't styled correctly in the panel, Review of attachment 8365965 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/base/content/browser-places.js @@ +959,5 @@ > > let BookmarkingUI = { > get button() { > let widgetGroup = CustomizableUI.getWidget("bookmarks-menu-button"); > + return widgetGroup.forWindow(window).node; The null button is mostly to save useless work, since in the menupanel we don't update the star state, we don't open the panel anchored to the star, we don't listen to pageproxy changes, don't listen to bookmarks changes and so on... So, if we want to make button always return meaningful content, we need something to "activate" and "deactivate" live-updates in given cases, and use that property to bail out of updates. It could indeed make sense, but it's more work. That said, we can't just do this otherwise we'd do a bunch of useless computation. @@ +971,5 @@ > > get anchor() { > + let widgetGroup = CustomizableUI.getWidget("bookmarks-menu-button"); > + let widget = widgetGroup.forWindow(window); > + if (widget.overflowed || widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) what's this change for? we don't want the "page bookmarked" panel to be attached to the button, since it would look crazy... currectly it anchors to the urlbar notifications area when the star is in the panel. This was by design, I don't know if anything changed.
Attachment #8365965 - Flags: review?(mak77) → review-
This seems to work well, and adds some slight optimizations to how the module uses CustomizableUI. Does this look better?
Attachment #8366699 - Flags: review?(mak77)
Attachment #8365965 - Attachment is obsolete: true
Comment on attachment 8366699 [details] [diff] [review] Australis' bookmark widget isn't styled correctly in the panel, Review of attachment 8366699 [details] [diff] [review]: ----------------------------------------------------------------- There's more to do, but looks promising! ::: browser/base/content/browser-places.js @@ +959,5 @@ > > let BookmarkingUI = { > get button() { > let widgetGroup = CustomizableUI.getWidget("bookmarks-menu-button"); > + return widgetGroup.forWindow(window).node; sounds like with this change button will never be null, that means a bunch of null-checks in this code module become pointless (or should be handled differently) @@ +964,5 @@ > }, > > get star() { > let button = this.button; > return button && document.getAnonymousElementByAttribute(button, "anonid", for example, this null-check is pointless, that means also the .star null-checks are now pointless and should be handled differently @@ +968,5 @@ > return button && document.getAnonymousElementByAttribute(button, "anonid", > "button"); > }, > > get anchor() { we should not return an anchor if the button is not on a toolbar. this was previously accomplished by .star being null (return star && document.getAnonymousElem...) similarly .status should return UNSTARRED if not on a toolbar (until UX decides whether it should report the status) @@ +1054,5 @@ > * Handles star styling based on page proxy state changes. > */ > onPageProxyStateChanged: function BUI_onPageProxyStateChanged(aState) { > + let star = this.star; > + if (!star || this._currentAreaType != CustomizableUI.TYPE_TOOLBAR) { there should never be a case where star is null null... the other check is correct, though I'd like if you may abstract that a little bit more, instead of checking everywhere _currentAreaType I'd like an helper like this._shouldLiveUpdate() (fancy name, maybe you have better ideas?) that internally does that, and use the helper around. @@ +1066,3 @@ > } > else { > + star.removeAttribute("disabled"); while here, would you mind fixing bug 865319? basically should be enough to call this._updateStar() in the else brace, after the removal of the disabled attribute. @@ +1070,5 @@ > this._updateToolbarStyle(); > }, > > + _updateCustomizationState: function BUI__updateCustomizationState() { > + let oldAreaType = this._currentAreaType; what's this oldAreaType for? it looks unused @@ +1079,4 @@ > _updateToolbarStyle: function BUI__updateToolbarStyle() { > let button = this.button; > if (!button) > return; this doesn't make sense anymore... @@ +1082,5 @@ > return; > > let personalToolbar = document.getElementById("PersonalToolbar"); > let onPersonalToolbar = button.parentNode == personalToolbar || > button.parentNode.parentNode == personalToolbar; though here you may want first to check if the widget is on a toolbar area, before walking the dom. @@ +1102,3 @@ > let button = this.button; > if (button && button._placesView) > button._placesView.uninit(); again, pointless null-check now @@ +1108,5 @@ > this._uninitView(); > }, > > customizeChange: function BUI_customizeChange() { > + this._updateCustomizationState(); I'm not yet sure whether we should do this here or just in customizeDone, the widget during customization is mostly disabled... I guess I will get a better idea at the next iteration when I see what we are still disabling with this. @@ +1274,2 @@ > return; > } ok the problem here (and I guess is an existing bug already), is that when we are not on a toolbar we stop updating the starred status... that's fine, we don't care about it (so far)... Though, when customizeDone is invoked and then we have been moved to a toolbar, we should requery for bookmarked status. Basically onCustomizeDone we should check _shouldLiveUpdate and if it was false onCustomizeStart and changed to true, it should enforce a requery, by calling _updateStarState()... Notice that we are already doing that here: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-customization.js#103 but that's wrong, first cause we are no more part of gUrlbar, second cause it's not always needed, third cause the update is skipped by the this._uri checkeven if needed. So, I suggest removing the bogus call from browser-customization.js, adding an aForceUpdate param to updateStarState, and call updateStarState(true) in customizeDone if live-updating changed from false to true during customization.
Attachment #8366699 - Flags: review?(mak77) → feedback+
This depends on bug 964887. I believe I've addressed all your comments. Note that (a) we need to update immediately on customize change, because this can happen outside of customize mode, too (right click the widget, move to panel/palette), (b) we need to update also when moving from toolbar to panel (ie turning updates for the star off) in case it was starred before, to ensure that the tooltip and starred state is correct, and (c) the button reference should never die so I believe we can just keep that reference instead of getting it all the time.
Attachment #8368288 - Flags: review?(mak77)
Attachment #8366699 - Attachment is obsolete: true
Comment on attachment 8368288 [details] [diff] [review] Australis' bookmark widget isn't styled correctly in the panel, Review of attachment 8368288 [details] [diff] [review]: ----------------------------------------------------------------- it looks good, clearly depends on the other bug, so I guess you should merge the 2 patches, and I will review the global patch then. ::: browser/base/content/browser-places.js @@ +1115,5 @@ > return; > } > > + let star = this.star; > + let button = this.button; since now this.button is a lazy getter, there's no more overload in using this.button everywhere @@ +1139,3 @@ > > + let onPersonalToolbar = this._currentAreaType == CustomizableUI.TYPE_TOOLBAR; > + if (onPersonalToolbar) { For readability I'd prefer: let onPersonalToolbar = false; if (this._currentAreaType == CustomizableUI.TYPE_TOOLBAR) { onPersonalToolbar = ...
Attachment #8368288 - Flags: review?(mak77) → feedback+
Depends on: 964887
Fixed by bug 964887. Steps to reproduce are in comment #0.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Keywords: verifyme
Resolution: --- → FIXED
Whiteboard: [Australis:P3] → [Australis:P3][good first verify]
Target Milestone: --- → Firefox 29
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 (Microsoft Surface Pro 2 device) Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:29.0) Gecko/20100101 Firefox/29.0 Mozilla/5.0 (X11; Linux i686; rv:29.0) Gecko/20100101 Firefox/29.0 Verified as fixed on latest Aurora (build ID: 20140303004002).
Status: RESOLVED → VERIFIED
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: