Bug 28968 - execCommand("fontsize") on certain selected html generates too many SPAN tags.
: execCommand("fontsize") on certain selected html generates too many SPAN tags.
Status: RESOLVED FIXED
: WebKit
HTML Editing
: 528+ (Nightly build)
: All All
: P2 Normal
Assigned To:
:
: HasReduction
: 45008 45026
: 27818
  Show dependency treegraph
 
Reported: 2009-09-04 04:16 PST by
Modified: 2010-09-10 15:26 PST (History)


Attachments
work in progress (39.20 KB, patch)
2010-08-31 16:26 PST, Ryosuke Niwa
no flags Review Patch | Details | Formatted Diff | Diff
Patch (2.60 KB, patch)
2010-09-10 15:13 PST, Ryosuke Niwa
eric: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-09-04 04:16:32 PST
execCommand("fontsize") on certain selected html generates too many SPAN tags.

1. Have this HTML code inside a contentEditable DIV:
  (code beautified, class="Apple-span-style" removed)

A man with 2 
<span style="font-family: Courier New, Courier">
    font faces
</span>
<br />
Death comes in all 
<span style="font-size: large">
    font sizes
</span>


2. Select all and apply execCommand("fontsize", false, 7)


Actual results:
<span style="font-size: -webkit-xxx-large;">
    A man with 2 
</span>
<span style="font-family: Courier New, Courier">
    <span style="font-size: -webkit-xxx-large;">
        font faces
    </span>
</span>
<span style="font-size: -webkit-xxx-large;">
    <br>
    Death comes in all font sizes
</span>




Expected results:
<span style="font-size: -webkit-xxx-large;">
    A man with 2 
    <span style="font-family: Courier New, Courier">
        font faces
    </span>
    <br>
    Death comes in all font sizes
</span>
------- Comment #1 From 2010-07-26 15:33:40 PST -------
This bug seems to be related to https://bugs.webkit.org/show_bug.cgi?id=30836.
------- Comment #2 From 2010-08-31 16:26:31 PST -------
Created an attachment (id=66135) [details]
work in progress
------- Comment #3 From 2010-08-31 16:28:48 PST -------
Work in progress requires rebaselines for 
editing/execCommand/toggle-compound-styles.html
editing/inserting/insert-3659587-fix.html
editing/style/style-3690704-fix.html
as well even though they are not included in the patch.

Fixing this bug ended up revealing a lot of bugs around remove/apply inline styles.  I'll file a bug and do some cleanup on applyInlineStyleToRange to reduce the size of patch.
------- Comment #4 From 2010-09-10 14:58:43 PST -------
Very interesting.  This bug has magically been fixed!  Will add a test.  Probably http://trac.webkit.org/changeset/67170 fixed it.
------- Comment #5 From 2010-09-10 15:13:21 PST -------
Created an attachment (id=67246) [details]
Patch
------- Comment #6 From 2010-09-10 15:16:14 PST -------
(From update of attachment 67246 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=67246&action=prettypatch

LGTM.
------- Comment #7 From 2010-09-10 15:26:56 PST -------
Committed r67243: <http://trac.webkit.org/changeset/67243>