Bug 117337 - Applied background color is not retained after typing a characters
Summary: Applied background color is not retained after typing a characters
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Major
Assignee: Nobody
: 123872 (view as bug list)
Depends on:
Reported: 2013-06-07 03:23 PDT by Sudarshan C P
Modified: 2013-11-06 19:47 PST (History)
4 users (show)

See Also:

Patch (11.10 KB, patch)
2013-07-24 05:31 PDT, vanivhegde
rniwa: review-
Details | Formatted Diff | Diff
Patch (4.53 KB, patch)
2013-11-06 01:53 PST, Vani Hegde
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sudarshan C P 2013-06-07 03:23:29 PDT
HTML content :
<script type="text/javascript">
function ChangeTextColor()
  document.execCommand("ForeColor", false, "red");  

function ChangeTextBack()
  document.execCommand("HiliteColor", false, "green");  
<body contenteditable="true">
<input type="Button" onclick="ChangeTextColor()" value="Font Color" />
<input type="Button" onclick="ChangeTextBack()" value="BackGround Color" />

<div >
Type text here and apply fontcolor and cut and paste two time and apply backcolor and type

Steps to reproduce the issue :
1.select all the text
2.select Font color button
3.select all and cut 
4.paste twice the cut content
5.select all and apply Background color by tapping BackGround color button
6.type text

Expected behavior :
Background color should retain for typing text.
Comment 1 vanivhegde 2013-07-24 05:31:11 PDT
Created attachment 207387 [details]
Comment 2 Ryosuke Niwa 2013-07-24 11:01:53 PDT
Comment on attachment 207387 [details]

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

> Source/WebCore/ChangeLog:12
> +        While deleting a selection, only inheritable style properties were
> +        saved. Since background color is considered as noninheritable style
> +        property, it was not being saved and hence was lost. Before deleting
> +        a selection we should save all style properties applied on that
> +        particular selection.

This doesn't explain why it was lost. Which code is removing the node with background color?

> LayoutTests/editing/style/background-color-retained-expected.txt:44
> +PASS span.style.backgroundColor is green
> +This is the test case for defect 117337 : Applied background color is not retained after typing a characters
> +This tests whether background style is retained when old text is deleted/cut and new text is typed in.
> +The background color of the text below should be green.
> +
> +New Text
> +

This output doesn't tell us whether the typed text is green or not.
Comment 3 Ryosuke Niwa 2013-08-01 20:04:06 PDT
Comment on attachment 207387 [details]

r- due to an inadequate test.
Comment 4 Vani Hegde 2013-11-06 01:53:47 PST
Created attachment 216156 [details]
Comment 5 Ryosuke Niwa 2013-11-06 02:13:28 PST
*** Bug 123872 has been marked as a duplicate of this bug. ***
Comment 6 WebKit Commit Bot 2013-11-06 19:47:45 PST
Comment on attachment 216156 [details]

Clearing flags on attachment: 216156

Committed r158815: <http://trac.webkit.org/changeset/158815>
Comment 7 WebKit Commit Bot 2013-11-06 19:47:47 PST
All reviewed patches have been landed.  Closing bug.