Closed
Bug 324443
Opened 19 years ago
Closed 19 years ago
Middle clicking a tab loads the clipboard URL into the active tab (not the one clicked on)
Categories
(SeaMonkey :: Tabbed Browser, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: ajschult784, Assigned: csthomas)
Details
(Keywords: fixed-seamonkey1.1a, fixed1.8.1)
Attachments
(1 file, 3 obsolete files)
|
1.80 KB,
patch
|
neil
:
review+
neil
:
superreview+
neil
:
approval-branch-1.8.1+
|
Details | Diff | Splinter Review |
As noted in bug 171787, middle-clicking on a tab loads the clipboard URL into the currently-focused tab, not the one that's clicked on. To see this you need to set the pref "middlemouse.contentLoadURL" to true (default on linux).
| Assignee | ||
Comment 1•19 years ago
|
||
->me just so I don't forget it. I don't want to fix this myself though, so please steal the bug from me.
Assignee: nobody → cst
| Assignee | ||
Comment 2•19 years ago
|
||
Two options I see are:
1. make contentAreaFoo aware of tabs (requires adding a parameter to its loadURI)
2. make the tabbrowser grab the middle click (likely requires duplicating some code from contentAreaFoo's middleMousePaste())
| Assignee | ||
Comment 3•19 years ago
|
||
see also firefox bug 284379
| Assignee | ||
Comment 4•19 years ago
|
||
This seems to work.
Attachment #212760 -
Flags: superreview?(neil)
Attachment #212760 -
Flags: review?(neil)
Comment 5•19 years ago
|
||
Comment on attachment 212760 [details] [diff] [review]
patch
This doesn't verify that the tab is a tabbed browser tab, and it updates the URLbar for inactive tabs. It might be easier to make middle-clicking switch tab?
Attachment #212760 -
Flags: superreview?(neil)
Attachment #212760 -
Flags: superreview-
Attachment #212760 -
Flags: review?(neil)
Attachment #212760 -
Flags: review-
Comment 6•19 years ago
|
||
I'd expect middle-click paste to behave the same as dragging a URL onto a tab. Preferably, neither switches to the tab if it's not the active one.
If I recall correctly, changing the URL bar value was done in case the page doesn't load so you still have the URL available to try again. Do we want to emulate this for inactive tabs?
| Assignee | ||
Comment 7•19 years ago
|
||
(In reply to comment #5)
> (From update of attachment 212760 [details] [diff] [review] [edit])
> This doesn't verify that the tab is a tabbed browser tab
var browser;
try {
browser = getBrowser();
} catch (ex) { }
var ot = event.originalTarget;
if (browser &&
ot.localName == "tab" &&
ot.parentNode.parentNode.parentNode.parentNode == browser) {
So, what's the right way to do that?
| Assignee | ||
Comment 8•19 years ago
|
||
This fixes the URL bar issue (properly, I hope), and should handle content tabs properly too.
Attachment #212760 -
Attachment is obsolete: true
Attachment #213799 -
Flags: superreview?(neil)
Attachment #213799 -
Flags: review?(neil)
Comment 9•19 years ago
|
||
Comment on attachment 213799 [details] [diff] [review]
revised
>+ var browser;
>+ try {
>+ browser = getBrowser();
>+ } catch (ex) { }
Hmm... without this patch, what happens if you middle-click a mail message?
>+ var ot = event.originalTarget;
>+ if (browser &&
>+ ot.localName == "tab" &&
>+ ot.parentNode == browser.mTabContainer) {
I think that if the parentNode is the tab container then it's pretty likely that the local name is "tab". And based on the first question we might always expect to have a browser at this point, otherwise loadURI will fail. Or maybe we should move this logic into loadURI.
>+ ot.linkedBrowser.loadURI(url);
>+ ot.linkedBrowser.userTypedValue = url;
Possibly need to test for about:blank?
Attachment #213799 -
Flags: superreview?(neil) → superreview?(jag)
Comment 10•19 years ago
|
||
If you middle-click on the active tab you'll also wanna update the urlbar value.
If you middle click in empty space in the tab bar, what happens? Looks like it'll load it into the active tab. Should that open a new tab instead, like D&D would do?
Comment 11•19 years ago
|
||
(In reply to comment #10)
>If you middle-click on the active tab you'll also wanna update the urlbar value.
That code's still there, isn't it?
>If you middle click in empty space in the tab bar, what happens? Looks like it'll
>load it into the active tab. Should that open a new tab instead, like D&D would do?
Hmm... I guess you need to do event.originalTarget.ownerDocument == document, then you can check for event.originalTarget.localName == "tab", otherwise you're looking at the tab strip? Should the new tab load in the background?
| Assignee | ||
Comment 12•19 years ago
|
||
(In reply to comment #11)
> >If you middle click in empty space in the tab bar, what happens? Looks like it'll
> >load it into the active tab. Should that open a new tab instead, like D&D would do?
> Hmm... I guess you need to do event.originalTarget.ownerDocument == document,
> then you can check for event.originalTarget.localName == "tab", otherwise
> you're looking at the tab strip? Should the new tab load in the background?
For me, drag-drop does background. It ignores shift... I wonder if we should fix that.
Comment 13•19 years ago
|
||
(In reply to comment #9)
> (From update of attachment 213799 [details] [diff] [review] [edit])
> >+ var ot = event.originalTarget;
> >+ if (browser &&
> >+ ot.localName == "tab" &&
> >+ ot.parentNode == browser.mTabContainer) {
> I think that if the parentNode is the tab container then it's pretty likely
> that the local name is "tab".
What about the anonymous content spacers and the new tab and close tab buttons?
======================================================================
(In reply to comment #11)
> (In reply to comment #10)
> >If you middle-click on the active tab you'll also wanna update the
> >urlbar value.
> That code's still there, isn't it?
Wouldn't that now go through the bit that says "if it's a tab, set the userTypedValue"?
> >If you middle click in empty space in the tab bar, what happens? Looks
> >like it'll load it into the active tab. Should that open a new tab
> >instead, like D&D would do?
> Hmm... I guess you need to do event.originalTarget.ownerDocument == document,
> then you can check for event.originalTarget.localName == "tab", otherwise
> you're looking at the tab strip? Should the new tab load in the background?
Yes, it should, unless your preference of course is to switch to new tabs. And, as CTho points out, perhaps invert the default when shift is held.
| Assignee | ||
Comment 14•19 years ago
|
||
This behaves well for middle clicking:
1. the page content
2. the current tab
3. a background tab
4. an empty part of the tab bar, and the new tab button (and maybe the close button, didn't try)
Attachment #213799 -
Attachment is obsolete: true
Attachment #214212 -
Flags: superreview?(neil)
Attachment #214212 -
Flags: review?(jag)
Attachment #213799 -
Flags: superreview?(jag)
Attachment #213799 -
Flags: review?(neil)
Comment 15•19 years ago
|
||
Comment on attachment 214212 [details] [diff] [review]
patch
>+ var browser;
>+ try {
>+ browser = getBrowser();
>+ } catch (ex) { }
I don't think we need to try/catch this; all our windows with loadURI also have getBrowser(). Same goes for the null-checks.
>+ ot.linkedBrowser.loadURI(url);
>+ ot.linkedBrowser.userTypedValue = url;
>+ if (ot == browser.mCurrentTab && url != "about:blank") {
>+ gURLBar.value = url;
>+ }
Need to have loadURI last, in case the URI loads before you set the value.
>+ browser.addTab(url, null, null, event.shiftKey);
This isn't a child tab, just a new tab.
Attachment #214212 -
Flags: superreview?(neil) → superreview-
| Assignee | ||
Comment 16•19 years ago
|
||
Attachment #214212 -
Attachment is obsolete: true
Attachment #214744 -
Flags: superreview?(neil)
Attachment #214744 -
Flags: review?(neil)
Attachment #214212 -
Flags: review?(jag)
Comment 17•19 years ago
|
||
Comment on attachment 214744 [details] [diff] [review]
patch
>+ var ot = event.originalTarget;
I think I'd like this to be named "tab".
>+ if (event.shiftKey ^ (pref && pref.getBoolPref("browser.tabs.loadInBackground")))
>+ if (event.shiftKey ^ (pref && pref.getBoolPref("browser.tabs.loadInBackground")))
Should be != as discussed on IRC. If you can think of a way to avoid the duplication then better still.
Attachment #214744 -
Flags: superreview?(neil)
Attachment #214744 -
Flags: superreview+
Attachment #214744 -
Flags: review?(neil)
Attachment #214744 -
Flags: review+
| Assignee | ||
Updated•19 years ago
|
Attachment #214744 -
Flags: approval-branch-1.8.1?(neil)
| Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: [cst: landed on trunk, need a= for branch]
Updated•19 years ago
|
Attachment #214744 -
Flags: approval-branch-1.8.1?(neil) → approval-branch-1.8.1+
Comment 18•19 years ago
|
||
I don't really like this trick that compares two unrelated booleans. I think the ^ was actually clearer in conveying the intent of the code.
I'd have preferred |var target = event.originalTarget;| over |tab| to make |else if (target.ownerDocument == document)| a little easier to comprehend (the word "tab" sends you down the wrong path here, since the object at this point isn't a tab). In fact, in addition to that I'd like a comment there along the lines of "check if it's in chrome or in content".
I guess that's what you get for not reviewing faster :-)
| Assignee | ||
Updated•19 years ago
|
Keywords: fixed-seamonkey1.1a
Whiteboard: [cst: landed on trunk, need a= for branch]
| Assignee | ||
Updated•19 years ago
|
Keywords: fixed1.8.1
Updated•17 years ago
|
Product: Core → SeaMonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•