Closed
Bug 774125
Opened 13 years ago
Closed 13 years ago
Switch to new drag and drop api for home button
Categories
(SeaMonkey :: Location Bar, defect)
SeaMonkey
Location Bar
Tracking
(seamonkey2.14 fixed)
RESOLVED
FIXED
seamonkey2.14
| Tracking | Status | |
|---|---|---|
| seamonkey2.14 | --- | fixed |
People
(Reporter: iannbugzilla, Assigned: iannbugzilla)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 3 obsolete files)
|
6.49 KB,
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
This patch expands on the helper introduced in bug 773983 and changes the home button to use the new API. I may have been over generous with the number of aEvent.stopPropagation(); entries.
Attachment #642437 -
Flags: review?(neil)
Comment 1•13 years ago
|
||
Comment on attachment 642437 [details] [diff] [review]
Switch home button
Which other consumer(s) are you expecting to use this?
>+ canDropLink: function (aEvent)
>+ {
>+ return Services.droppedLinkHandler.canDropLink(aEvent, true);
>+ },
Hardly seems worth it.
>+ drop: function (aEvent, aName, aDisallowInherit)
>+ {
>+ return Services.droppedLinkHandler
>+ .dropLink(aEvent, aName, aDisallowInherit);
> }
Ditto.
>+ dragOver: function (aEvent, aStatusString)
>+ {
>+ if (this.canDropLink(aEvent))
>+ aEvent.preventDefault();
>+
>+ if (aStatusString)
>+ {
>+ var statusTextFld = document.getElementById("statusbar-display");
>+ statusTextFld.label = gNavigatorBundle.getString(aStatusString);
>+ }
>+ },
...
>+ onDragExit: function (aEvent)
>+ {
>+ aEvent.stopPropagation();
>+ document.getElementById("statusbar-display").label = "";
>+ }
This separates the status updating, which makes the code confusing.
Attachment #642437 -
Flags: review?(neil) → review-
Changes since last version:
* Unneeded helpers removed.
* Remaining helper renamed.
Attachment #642437 -
Attachment is obsolete: true
Attachment #642588 -
Flags: review?(neil)
Comment 3•13 years ago
|
||
Comment on attachment 642588 [details] [diff] [review]
Less complex version
>+function BeginDragOver(aEvent)
You don't begin a drag over another element.
Call it DragLinkOver perhaps?
>+ if (Services.droppedLinkHandler.canDropLink(aEvent, true))
Nice idea.
>+ var homepage = nsPreferences.getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
I knew there was something I forgot to mention.
We should stop using nsPreferences and use one of our other APIs.
>- if (aEvent.target == aDragSession.dataTransfer.mozSourceNode)
>- {
>- aDragSession.dragAction = nsIDragService.DRAGDROP_ACTION_NONE;
>- return;
>- }
Unfortunately we lost this so the patch lets you drop the home button on itself :-(
Attachment #642588 -
Flags: review?(neil) → review-
Changes since last version:
* Remove the two uses of nsPreferences.
* Stop Home button from dropping on itself.
Attachment #642588 -
Attachment is obsolete: true
Attachment #642995 -
Flags: review?(neil)
Comment 5•13 years ago
|
||
> - nsPreferences.setUnicharPref("browser.startup.homepage", aURL);
> + Services.prefs.setCharPref("browser.startup.homepage", aURL);
Urgh, I think you want GetLocalizedStringPref() here.
(In reply to Philip Chee from comment #5)
> > - nsPreferences.setUnicharPref("browser.startup.homepage", aURL);
> > + Services.prefs.setCharPref("browser.startup.homepage", aURL);
> Urgh, I think you want GetLocalizedStringPref() here.
Eh? We need to set a pref not get one!
Comment 7•13 years ago
|
||
Comment on attachment 642995 [details] [diff] [review]
With less nsPreferences
>- var homepage = nsPreferences.getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
[Note to self: is default value reasonable?]
>+ // XXX find a readable title string for homepage,
>+ // perhaps do a history lookup.
[Sadly we probably can't do that any more because history is async]
>+ Services.prefs.setCharPref("browser.startup.homepage", aURL);
[Note to self: try a unicode URL]
Comment 8•13 years ago
|
||
(In reply to comment #7)
> >- var homepage = nsPreferences.getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
> [Note to self: is default value reasonable?]
Yes it is :-)
> >+ Services.prefs.setCharPref("browser.startup.homepage", aURL);
> [Note to self: try a unicode URL]
Oops, this doesn't quite work. If you have a the URL http://☃.net/ then dragging the link will work because the link target is actually http://xn--n3h.net/ and therefore ASCII. But unfortunately dragging the text ☃.net on its own used to work with the old code, but doesn't with your patch.
Changes since last version:
* Use SetStringPref to set a complex value.
Attachment #642995 -
Attachment is obsolete: true
Attachment #642995 -
Flags: review?(neil)
Attachment #647364 -
Flags: review?(neil)
Updated•13 years ago
|
Attachment #647364 -
Flags: review?(neil) → review+
| Assignee | ||
Comment 10•13 years ago
|
||
Comment on attachment 647364 [details] [diff] [review]
With SetStringPref [Checked in: Comment 10]
http://hg.mozilla.org/comm-central/rev/ca8eda5e95fd
Attachment #647364 -
Attachment description: With SetStringPref → With SetStringPref [Checked in: Comment 10]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
status-seamonkey2.14:
--- → fixed
Flags: in-testsuite-
Flags: in-qa-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.14
You need to log in
before you can comment on or make changes to this bug.
Description
•