New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 709549 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocking:
issue 707857



Sign in to add a comment

Paste from SpannableString lost text format

Project Member Reported by ctzsm@chromium.org, Apr 7 2017

Issue description

What steps will reproduce the problem?
(1) Send a SpannableString to Clipboard.
(2) Paste into Gmail and observe.
(3) 

What is the expected result?
Text has format.

What happens instead?
Text has no format.

 
Cc: -kristianm@chromium.org
it is been years kristian left WebView team.

Comment 2 by ctzsm@chromium.org, Apr 7 2017

Summary: Paste from SpannableString lost text format (was: Paste from Spannable )
There was a discussion on which of |getHtmlText| and |cocereToHtmlText| to use in Clipboard.java for |getHtmlText| method. The reason for using |getHtmlText| was to prevent promoting plain text to HTML text, however, it will break SpannableString paste.
what is cocereToHtmlText?

Comment 4 by ctzsm@chromium.org, Apr 7 2017

Sorry it is |coerceToHtmlText|, which is behavior differently from |getHtmlText|, it will try to coerce as much as it can from origin type of text to HTML including Intent and URI. On the other hand, getHtmlText will return null if origin source is not HTML type.
https://developer.android.com/reference/android/content/ClipData.Item.html#coerceToHtmlText(android.content.Context)

Comment 5 by ctzsm@chromium.org, Apr 11 2017

A simple replacement will break two bookmark tests, see crrev/2812933003, need to look into it.
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b65bc61d6aa279bc1012d33c55c0019c21abed6e

commit b65bc61d6aa279bc1012d33c55c0019c21abed6e
Author: ctzsm <ctzsm@chromium.org>
Date: Thu Apr 13 22:47:49 2017

Support paste with style from Spanned

Only coerce text to HTML when needed, since replace getHtmlText with coerceToHtmlText will break two bookmark tests.
1. if text is HTML.
2. if text is plain text and has style (Spanned).

BUG= 709549 

Review-Url: https://codereview.chromium.org/2812933003
Cr-Commit-Position: refs/heads/master@{#464584}

[modify] https://crrev.com/b65bc61d6aa279bc1012d33c55c0019c21abed6e/ui/android/java/src/org/chromium/ui/base/Clipboard.java
[modify] https://crrev.com/b65bc61d6aa279bc1012d33c55c0019c21abed6e/ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java

Comment 7 by ctzsm@chromium.org, Apr 17 2017

Status: Fixed (was: Assigned)

Sign in to add a comment