Bug 91783 - execCommand copies the backgroung-color of the enclosing element to the element being edited.
Summary: execCommand copies the backgroung-color of the enclosing element to the eleme...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-19 14:18 PDT by Ryosuke Niwa
Modified: 2012-07-27 17:32 PDT (History)
5 users (show)

See Also:


Attachments
Patch (5.03 KB, patch)
2012-07-27 05:01 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff
Patch (4.94 KB, patch)
2012-07-27 13:07 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2012-07-19 14:18:43 PDT
What steps will reproduce the problem?
1. Open a blank/any page.
2. Open the developer tool console.
3. Execute the following JS from the console:

var body = document.getElementsByTagName('body')[0];
body.contentEditable = true;
body.style['cssText'] = 'background-color: white;';

4. Now type some text into the page. (e.g aaa)
5. select the text typed in 4.
6. from the js console:

document.execCommand('insertUnorderedList');


What is the expected result?

body.innerHTML should give
"<ul><li>aaa</li></ul>"

What happens instead?

body.innerHTML gives
"<ul><li><span style="background-color: white; ">aaa</span></li></ul>"

Please provide any additional information below. Attach a screenshot if
possible.

It can also be reproduced with other commands e.g insertOrderedList.
Comment 1 Ryosuke Niwa 2012-07-19 14:18:55 PDT
http://crbug.com/137466
Comment 2 Sukolsak Sakshuwong 2012-07-27 05:01:24 PDT
Created attachment 154908 [details]
Patch
Comment 3 Ryosuke Niwa 2012-07-27 11:15:37 PDT
Comment on attachment 154908 [details]
Patch

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

The code change looks right.

> LayoutTests/editing/style/redundant-background-color.html:6
> +<script src="../../resources/testharness.js"></script>
> +<script src="../../resources/testharnessreport.js"></script>

We don't normally use testharness.js for webkit regression tests. Use dump-as-markup.js in LayoutTests/resources/ instead.
Comment 4 Sukolsak Sakshuwong 2012-07-27 13:07:23 PDT
Created attachment 155033 [details]
Patch
Comment 5 WebKit Review Bot 2012-07-27 17:32:31 PDT
Comment on attachment 155033 [details]
Patch

Clearing flags on attachment: 155033

Committed r123940: <http://trac.webkit.org/changeset/123940>
Comment 6 WebKit Review Bot 2012-07-27 17:32:35 PDT
All reviewed patches have been landed.  Closing bug.