Bug 25501

Summary: Extra font tag created when changing fonts
Product: WebKit Reporter: Annie Sullivan <sullivan>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric, jparent, michaelthomas, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
URL: http://www.mozilla.org/editor/midasdemo/
Attachments:
Description Flags
Patch
none
Patch none

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]
Patch
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]
Patch

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

(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]
Patch

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.