Bug 25501 - Extra font tag created when changing fonts
Summary: Extra font tag created when changing fonts
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://www.mozilla.org/editor/midasdemo/
Depends on:
Reported: 2009-04-30 17:14 PDT by Annie Sullivan
Modified: 2010-01-21 22:53 PST (History)
5 users (show)

See Also:

Patch (3.34 KB, patch)
2010-01-20 23:02 PST, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (3.06 KB, patch)
2010-01-21 17:00 PST, Tony Chang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Annie Sullivan 2009-04-30 17:14:41 PDT
Steps to reproduce:
1. Go to Midas Demo: http://www.mozilla.org/editor/midasdemo/
2. Enter the following HTML:
<font face="Arial">text</font>
(This is what IE generates when setting the font to Arial.)
3. Uncheck "View HTML Source", highlight "text", and change font to Courier.

Actual result:
<font><font class="Apple-style-span" face="Courier">text</font></font>

Expected result:
<font class="Apple-style-span" face="Courier">text</font>
or just
<font face="Courier">text</font>

Lots of editing on different browsers can result in a document filling up with redundant tags. This makes it harder and harder to change the font correctly on all browsers.
Comment 1 Tony Chang 2010-01-20 23:02:54 PST
Created attachment 47099 [details]
Comment 2 Tony Chang 2010-01-20 23:04:54 PST
(In reply to comment #1)
> Created an attachment (id=47099) [details]
> Patch

I think the original code wasn't removing the extra font tag because it didn't create the font tag.  That said, that seems like a silly reason to keep the extra font tag.  E.g., if you unbold a section, webkit doesn't care who created the <b> tags and just remove them.
Comment 3 Darin Adler 2010-01-21 09:54:18 PST
Comment on attachment 47099 [details]

Comment 4 Tony Chang 2010-01-21 17:00:40 PST
Created attachment 47159 [details]
Comment 5 Tony Chang 2010-01-21 17:52:10 PST
Comment on attachment 47159 [details]

(same as before with better layout test that uses dumpAsText)
Comment 6 WebKit Commit Bot 2010-01-21 22:53:22 PST
Comment on attachment 47159 [details]

Clearing flags on attachment: 47159

Committed r53680: <http://trac.webkit.org/changeset/53680>
Comment 7 WebKit Commit Bot 2010-01-21 22:53:27 PST
All reviewed patches have been landed.  Closing bug.