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
Product: WebKit
Classification: Unclassified
Component: HTML Editing
: 528+ (Nightly build)
: All All
: P2 Normal
Assigned To: Ryosuke Niwa
: HasReduction
Depends on: 45008 45026
Blocks: 27818
  Show dependency treegraph
 
Reported: 2009-09-04 04:16 PDT by Dan POPA
Modified: 2010-09-10 15:26 PDT (History)
7 users (show)

See Also:


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

Note You need to log in before you can comment on or make changes to this bug.
Description Dan POPA 2009-09-04 04:16:32 PDT
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 Ryosuke Niwa 2010-07-26 15:33:40 PDT
This bug seems to be related to https://bugs.webkit.org/show_bug.cgi?id=30836.
Comment 2 Ryosuke Niwa 2010-08-31 16:26:31 PDT
Created attachment 66135 [details]
work in progress
Comment 3 Ryosuke Niwa 2010-08-31 16:28:48 PDT
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 Ryosuke Niwa 2010-09-10 14:58:43 PDT
Very interesting.  This bug has magically been fixed!  Will add a test.  Probably http://trac.webkit.org/changeset/67170 fixed it.
Comment 5 Ryosuke Niwa 2010-09-10 15:13:21 PDT
Created attachment 67246 [details]
Patch
Comment 6 Eric Seidel 2010-09-10 15:16:14 PDT
Comment on attachment 67246 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=67246&action=prettypatch

LGTM.
Comment 7 Ryosuke Niwa 2010-09-10 15:26:56 PDT
Committed r67243: <http://trac.webkit.org/changeset/67243>