Bug 117337

Summary: Applied background color is not retained after typing a characters
Product: WebKit Reporter: Sudarshan C P <sudarshan.cp>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: arpitabahuguna, commit-queue, rniwa, vanivhegde
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
rniwa: review-
Patch none

Description Sudarshan C P 2013-06-07 03:23:29 PDT
HTML content :
<html>
<head>
<script type="text/javascript">
function ChangeTextColor()
{
  document.execCommand("ForeColor", false, "red");  
}

function ChangeTextBack()
{
  document.execCommand("HiliteColor", false, "green");  
}
</script>
</head>
<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
</div>
</body>
</html>

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]
Patch
Comment 2 Ryosuke Niwa 2013-07-24 11:01:53 PDT
Comment on attachment 207387 [details]
Patch

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

r- due to an inadequate test.
Comment 4 Vani Hegde 2013-11-06 01:53:47 PST
Created attachment 216156 [details]
Patch
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]
Patch

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.