Closed Bug 189320 Opened 22 years ago Closed 22 years ago

Copy of HTML with CSS info not visually similar after pasting in E-mail

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mbabcock-mozilla, Assigned: mozeditor)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130

It should be fairly easy to make a minimal test-case for this feature, but the
above URI is where I was when I discovered it.

If one highlights some text from within the document and then pastes it into a
new E-mail message, it is properly formatted and displayed (I love this feature)
with one exception; the red and green text are marked as stylesheet classes, not
font colours, and these aren't copied at all.

Reproducible: Always

Steps to Reproduce:
1. Select text with stylesheet markings (red/green on colour terminals)
2. Copy (Ctrl-C / Edit, Copy / etc.)
3. Open new E-mail message window
4. Paste copied text into message body

Actual Results:  
Properly formatted HTML text, with no colours (styles).

Expected Results:  
Properly formatted HTML text, with the same colours (styles) as the original page.

It seems to me that the actual stylesheet data relevant to the copied text
should be copied over into the pasted HTML message as well as the formatted text
itself.

For what its worth, I couldn't decide whether to post this bug to this component
or not; it seems like more of a copying problem than a pasting problem and more
of a copy and paste problem than a stylesheet problem, but please recategorize
it as necessary.

Also, I'll use the word 'colour' spelt 'color' for the sake of my American
friends and people searching for bugs.
Not sure if this is a copy bug or a paste bug: normally, when pasting HTML, you
don't want to copy any of the styles, you just want to pick up the new
stylesheet. The exception is e-mail, which shouldn't really be called HTML at
all, but HTPL (HyperText Presentation Language).
Assignee: dbaron → jfrancis
Component: Style System → Editor: Core
QA Contact: ian → sujay
So, this is about copying all the CSS rules applying to the copied chunk and
pasting them in the target document to preserve the styles ?
That's almost impossible in all cases. Here is a bad example, copied/pasted
portion is the span.

<style type="text/css">
  p.abstract > span.important { color: red; }
</style>
...
<p class="abstract">this is <span class="important">a major issue</span></p>

if you copy the span and paste it in another document, it's unlikely you will
get another p.abstract parent... Even if you copy the style rule, the style
won't be preserved.

We are here reaching the limits of wysywigness due to the way CSS is designed
and that's why important and exportable styles should be carried by a style
attribute.
From my perspective, this bug is a wontfix.
Daniel said the same thing I was going to say.  I do think it would be neat if
we had an easy way for users to see the various style sheets on a document, and
be able to "copy" those and apply them to an editor document, though.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
I was actually thinking that it would be easiest to just (optionally?) include
all stylesheet information for the page.  Oh well :(
Component: Editor: Core → Style System
The basic idea in composer copy/paste is to be wysiwyg.  Not being aware of
style sheets in the source breaks wysiwyg in the target.  However, copying style
sheets in the source to the target is even worse, since it would affect display
of other content in the target besides what was pasted.

Imagine pasting in some red bold text copied from a web site and suddednly
finding that all of your headers in your document became red (ie, the red text
in the source was really a header, with a style sheet that made all headers
red).  This really is a worse scenario than simply not copying the stylesheet
and not being quite wysiwyg on the pasted text.  It is easier to use composer to
make that text red, than it is to use composer to straighten out a hodgepodge of
unwanted stylesheets.  

And if you copied from multiple sources you could end up with quite a slew of
style sheets that likely would not work well together.

In the end, it's better to treat css style sheets as "meta" information that is
properly associated with a whole document, rather than with any content taken
from that document.
I hate to spam the bug and it would probably help to know what stages the CSS
information goes through in the browser's rendering engine to end up as it is
when displayed, but assuming the information is parsed down to some degree,
doesn't the data end up being 'understood' at a lower level like:

(assuming page from comment #2 above, plus: p.abstract { font-face: "Helvetica"; } )

... <p style="font-face: Helvtica;">this is <span style="font-face: Helvetica;
color: red;">a major issue</span></p> ...

... and if so, that more basic data would be the useful one for copying and
pasting.  I'm assuming these capabilities will basically never exist until a
page description language (post formatting, pre-rendering) comes into the
picture (therefore, probably never).  Thanks for the attention though.
See bug 406488 for a revived version of this bug.
You need to log in before you can comment on or make changes to this bug.