Closed Bug 170504 Opened 22 years ago Closed 21 years ago

Compose from template containing "Inline Styles" and a background image loses the background image

Categories

(MailNews Core :: Composition, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.5beta

People

(Reporter: skea, Assigned: mscott)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826

A template containing a background image that also uses inline styles looks fine
in the temples folder and when previewed, but when used for a new message it
loses the background image.  Seems to be related to the Inline Styles, i.e. when
the text/html part of the template contains the likes of:

  <body background="cid:part1.06040606.07010605@dummy.test.com"
   style="margin-top: 150px; margin-left: 50px; background-repeat: no-repeat;">

Reproducible: Always

Steps to Reproduce:
  1. compose a message
  2. Use Format -> Page Colours and Background to choose a background image.
  3  click OK and then save the file as a template.

This template will work fine.  However if you add some inline attributes to the
HTML <BODY> then it stops working.

  1. take then message into the composer (double click on the template)
  2, Use Format -> Page Colours and Background  to bring up the dialogue box
  3  Click on "Advanced Edit .."
  4. Select the "Inline Style" tab
  5. In the Property box enter Background-repeat
  6. In the Value box enter no-repeat
  7. click OK and then OK in the Page Colours ... window.
  8. Save the file as a template.
  9. click on the new template to preview - it looks OK
 10. double-click on the template to use it in a new message
       - the backgrond is gone.
Actual Results:  
background no longer is present in new message

Expected Results:  
retained the background image and multipart/related content.
accepting
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → mozilla1.3beta
*** Bug 206064 has been marked as a duplicate of this bug. ***
OS=>all, as dupe was on WinXP.  Resetting target, as 1.3b is long gone.
OS: Linux → All
Target Milestone: mozilla1.3beta → ---
*** Bug 191799 has been marked as a duplicate of this bug. ***
Taking. I want this fixed for thunderbird.
Assignee: ducarroz → scott
Status: ASSIGNED → NEW
accepting.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.5beta
Attached patch the fixSplinter Review
This patch does a couple things to fix the problem. The code where we were
parsing attribute name and value pairs in the body tag was broken for the
following case:

style="some style stuff"
LINERETURN
link="some link value"

if a line return came right after an attribute value, we failed to detect that
attribute value. 

I simplified the logic in this routine to make it handle this case.

I also removed an obsolete reference to the background propety and changed it
to style because composer only sets a background image as an inline style
property and not a background attribute anymore. This is a required part of the
fix.
Attachment #129823 - Flags: superreview?(bienvenu)
Attachment #129823 - Flags: superreview?(bienvenu) → superreview+
Does this patch also solves the problems mentioned in the two dupes? see Bug
206064 and Bug 191799. The latter is especially important for BiDi users, as it
provides the only reasonably convenient solution for RTL emails (through HTML
templates).

Prog.
Flags: blocking1.5b?
Depends on: 116867
yes it should solve both of those dups.
Interesting conclusion to the cause.  There was a line break in the test post I
had done a few weeks ago.
<body text="#000000" bgcolor="#ffcccc"
background="cid:part2.01020205.09070709@gisco.net" style="margin-top:32px;
margin-right:32px; margin-left:32px; border-width:8px; border-color: red white
blue green; border-style:groove; padding:12;">

This was done with the 20030611 build before the activation of inline
backgrounds as you can see from the background= attribute.  The template is
still in my folder for reuse when this bug fix makes it to your next nightly.
Comment on attachment 129823 [details] [diff] [review]
the fix

r/a=sspitzer for 1.5 beta.
Attachment #129823 - Flags: review+
Attachment #129823 - Flags: approval1.5b+
fixed
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Has this patch been checked in? it doesn't seem to work here, using today's nightly:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030818

Under HTML Attributes, I've added dir="rtl" and saved a template. I then closed
Mozilla and launched it again to test the template. Result: the attribute was
not saved.

Prog.
that does not look like an inline style attribute that you are setting.
sice dir is a direct attribute on body & not an inline body style which is what
i fixed in this bug, we could come up with a special case for dir. Can you file
a new bug on me for that?
Flags: blocking1.5b?
Is this problem back?  See bug 220708.
was the fix implemented in thunderbird 0.2 or .3 rc ?

i could never get templates to work with thunderbird official releases and
nightly releases
Scott MacGregor wrote in comment 15:

> sice dir is a direct attribute on body & not an inline body style which is what
> i fixed in this bug, we could come up with a special case for dir. Can you file
> a new bug on me for that?

Thanks a lot for this suggestion, but the problem no longer appears with either
Mozilla Mail&News 1.6b nor with Thundernbird 0.4.

Unfortunately, the templates are still not too useful for RTL users, due mostly
to another issue, Bug 136502, which deals with Mozilla wrongly down-converting
HTML emails to plain text. Scott, Could you please confirm this 20-month-old bug?

Thanks again,

Prog.
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: