Closed
Bug 36809
Opened 26 years ago
Closed 26 years ago
Clicking on an image blows away whatever is on clipboard
Categories
(Core :: XUL, defect, P3)
Tracking
()
VERIFIED
FIXED
M18
People
(Reporter: spam, Assigned: akkzilla)
Details
(Whiteboard: [nsbeta3+][p:3])
Attachments
(1 file)
|
2.87 KB,
patch
|
Details | Diff | Splinter Review |
Build ID 2000042113 M16 Linux
If i click on an illustration on a webpage (not link) that image gets copied to
clipboard instead of what was there from before. This is very annoying and can't
be intentional?
For the first, i loose the copy my previous selection.
Secondly, why is it assumed i even *want* to copy that image? Perhaps i just
slipped and the image is 4 MB large - bummer!!
Last and not least: The usual way to copy images is via context menu. Then the
user has a real choise.
There is a context menuitem reading "Copy". But if i right-click and bring up
context-menu over and image, and then select "copy" there, the option is
suddenly greyed out and nothing gets copied.
All i'm able to do per today is "copy image location", which is only the URL to
it. Since copying of images works so well already - why not attach that feature
to the copy menuitem instead? As it works right now, users are in for an ugly
surprise.
tested some more - it seems it's the complete link location that is copied when
i click an image, not the image as such. Still very annoying though - i'd like
to be in control of what gets copied and not. Simply clicking somewhere
shouldn't autocopy anything, as it trashes whatever was on clipboard.
I first found this unexpected behaviour when pasting to Composer, and found an
image pasted in instead of what i thought i had copied.
Comment 3•26 years ago
|
||
Is this pp? I can't repro on 2000042113 win98
left-clicking still copies to clipboard in linux M16 2000042309
Comment 5•26 years ago
|
||
Confirming, reproduced on PC/Linux, build 2000042113.
I don't know what really gets copied, but when I paste into the URL bar
after clicking on an image, I sometimes get lots of errors like
->>>>>>>>>>>>>> Read Clipboard from memory
Transferable didn't support data flavor text/unicode (type = 252)
and sometimes there occur some strange characters in the location field,
looking like chinese, japanese, or whatever, mixed with "?"s...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 7•26 years ago
|
||
[Moving to correct component. Thanks for making this a separate bug report,
dark@c2i.net.]
Component: XP Toolkit/Widgets: Menus → XP Toolkit/Widgets
Comment 8•26 years ago
|
||
assigning this one to akkana -- can you tell what is happening?
Assignee: mjudge → akkana
Target Milestone: --- → M17
| Assignee | ||
Comment 9•26 years ago
|
||
Pavlov -- sounds like image selection isn't correctly differentiating the two
selection types.
I'll check to make sure Mike's selection code is calling the right selection
type; if it is, the selection code might be doing something wrong, and I'll pass
this on to Pav.
Status: NEW → ASSIGNED
| Assignee | ||
Comment 10•26 years ago
|
||
Selection kinda sucks now on linux -- it's always getting blown away by one
thing or another. Bumping the priority up since I think we should look at these
issues as soon as we can.
Priority: P3 → P2
| Assignee | ||
Comment 11•26 years ago
|
||
Moving to M18.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Target Milestone: M17 → M18
Comment 12•26 years ago
|
||
huh? Has this been fixed?
| Assignee | ||
Comment 13•26 years ago
|
||
No, it must have gotten marked fixed mistakenly.
Actually, I bet what's happening is that the image gets selected, but in
unformatted plaintext, images aren't output, so when you paste, there appears to
be nothing. One or the other of these ought to be fixed (we shouldn't grab the
selection if we aren't going to put something else there).
| Assignee | ||
Updated•26 years ago
|
Status: REOPENED → ASSIGNED
Comment 16•26 years ago
|
||
setting priority in status whiteboard
Priority: P2 → P3
Whiteboard: [nsbeta3+] → [nsbeta3+][p:3]
Comment 17•26 years ago
|
||
Since the ability to copy images seems to exist on Linux, shouldn't we move
this functionality over to the context menu rather than getting rid of it
completely (to satisfy at least part of bug 21747)?
| Assignee | ||
Comment 18•26 years ago
|
||
Suspicion confirmed. In the editor, click on an image to select it, then do
Debug->Test Selection to output it in various forms. In XIF and HTML, the image
comes out; but we get nothing in either formatted or unformatted plaintext.
There's code in nsHTMLToTXTSinkStream to deal with images, at least in formatted
mode (this might need to be moved up higher for the unformatted case), but it
turns out that OpenContainer isn't called at all in this case.
For example, if I edit http://www.mozilla.org and click on the banner image at
the top, the XIF is
<?xml version="1.0"?>
<!DOCTYPE xif>
<encode selection="1"/>
<section>
<section_head>
<document_info charset="ISO-8859-1" uri="http://www.mozilla.org/"/>
</section_head>
<section_body>
<markup_declaration><content>DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2
Final//EN"</content>
</markup_declaration>
<leaf isa="img">
<attr name="src" value="images/mozilla-banner.gif"/>
<attr name="alt" value=""/>
<attr name="border" value="0"/>
<attr name="usemap" value="#banner"/>
<attr name="width" value="600"/>
<attr name="height" value="58"/>
<attr name="vspace" value="0"/>
<attr name="hspace" value="0"/>
</leaf><!--img-->
</section_body>
</section>
and the html is
<img src="images/mozilla-banner.gif" alt border="0" usemap="#banner" width="600"
height="58" vspace="0" hspace="0">
but if I set a breakpoint in nsHTMLToTXTSinkStream::OpenContainer, it gets
called once for the document_info tag and once for the markup_declaration tag,
then nothing else. Somehow the img tag is being ignored.
I might need Harish's help on this to find out why nsXIFDTD isn't calling
OpenContainer. Harish, any ideas?
| Assignee | ||
Comment 19•26 years ago
|
||
Oh, this is interesting. I'd been thrown off in my testing because I was
testing against the banner image on mozilla.org, and it turns out that it has an
alt attribute (not alt="something", just alt by itself) and Ben's code outputs
nothing in that case. But the clipboard code doesn't really handle null output
-- it gets upset if it doesn't have something.
Probably if the alt tag is set but has no value, we should fall back to title,
and then to src. Ben, would that be okay? Alternately, I suppose we could say
something like [img] to indicate that there's something there but the author
doesn't want us to know what; but as a user I'd rather see the src than just
[img], myself.
| Assignee | ||
Comment 20•26 years ago
|
||
Oh, one other thing: there was a problem with the img code, which was that it
needed to be in AddLeaf instead of OpenContainer.
Will attach patch curing this and including my suggested fix for the empty alt
problem.
| Assignee | ||
Comment 21•26 years ago
|
||
Actually, I'll wait on the patch until I hear what Ben has to say, since he
obviously wrote this deliberately. Ben, we can't output nothing because of
clipboard problems.
Comment 22•26 years ago
|
||
Akk, we *have* to output nothing. This special case was not inserted
"deliberately", but I read somewhere (somewhere at w3.org, IIRC), that empty alt
tags (alt="") *have* to be ignored. Rationale: Images are (ab)used for graphical
effects, e.g. those bad transparent gifs, and they must not be rendered in text
environments. alt="" is the correct (and encouraged) workaround for this
problem. And yes, all this does apply to our HTML->TXT converter.
So, if the clipboard code has problems with empty output of our sink, then fix
the clipboard.
| Assignee | ||
Comment 23•26 years ago
|
||
Okay, if you say so. With Pavlov's blessing, I've removed the annoying printf
we get whenever copied data returns null. Clicking on an image will still clear
the clipboard yet, if the alt tag is null, paste nothing; but if there's an alt
tag it will paste with the patch I'm about to attach.
| Assignee | ||
Comment 24•26 years ago
|
||
| Assignee | ||
Comment 25•26 years ago
|
||
The patch I just attached isn't quite what I tested -- there was just a big
checkin to the parser and now I'm seeing crashes in string code. But I think
this should work once I update my tree, in case someone is willing to review
it. All it does is move the existing img tag handling code from OpenContainer
to AddLeaf, without changing any of it (so I've kept Ben's rule that empty alt
tags aren't output).
Comment 26•26 years ago
|
||
Tested with my build from Aug 30 20:39:49 CEST 2000. Found a little bug in my
code (that you move): Please s/ ]/] /. If that is changed, r=BenB. Maybe also
add an explanatory comment why nothing should be put out for alt="".
(BTW: All of this img code (apart from alt="" :) ) is preliminary. I thought, it
was better than nothing.)
| Assignee | ||
Comment 27•26 years ago
|
||
Oh, good, I was noticing the space before the ] but was thinking that that was
in my alt tags. :-)
I've checked it in, after moving the space as you suggested.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago → 26 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 29•26 years ago
|
||
I can't really see what's changed: If i click an image that is just an
illustration - whatever was formerly on clipboard is deleted.
This is wrong. Merely clicking an image shouldn't interfere with clipboard at all.
Should i file a new bug called "Clicking on an image blows away whatever is on
clipboard" ?
Comment 30•26 years ago
|
||
Reading over the bug, I don't see why clicking on an image copies at all. I
wouldn't expect that. This is what the reporter (aark) originally complained
about, and I agree.
| Assignee | ||
Comment 31•26 years ago
|
||
Clicking on an image selects the image (and therefore copies it to the
clipboard, if you have autocopy enabled). I wasn't part of that decision, but I
assume it was because it wasn't obvious how else to select an image, and images
need to be selectable for the editor and presumably also for other reasons.
My fix was to fix image conversion to plaintext, so when you copy, you can see
the results of the copy (except in the case of empty alt tags, since Ben didn't
want me to fix that part).
If you want the selection policy changed so that images can't be selected by
clicking on them, that would be an RFE to someone else -- maybe mjudge, or
cmanske? Cc'ing some people who might care.
Comment 32•26 years ago
|
||
Clicking on an image to select it in Composer makes perfectly good sense.
If you have the autocopy on, then you shouldn't be surprised.
But in the browser, I could see where that might not be the expected behavior.
So an RFE might be a good idea for that.
| Reporter | ||
Comment 33•26 years ago
|
||
Well well well. That was what i filed here - half a year ago.
Filed bug 52538 now:
"Clicking on an image blows away whatever is on clipboard"
Comment 34•26 years ago
|
||
lol
You need to log in
before you can comment on or make changes to this bug.
Description
•