New issue
Advanced search Search tips

Issue 724950 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

We should get rid of StyledMarkupAccumulator::RenderedText()

Project Member Reported by yosin@chromium.org, May 22 2017

Issue description

We should use DOM text for DOM to HTML serialization to copy raw characters
instead of collapsed and text-transform'ed characters.

Here is call stack:
- PlainText(); this is a kind of "rendered text"
- StyledMarkupAccumulator::RenderedText()
- StyledMarkupAccumulator::AppendTextWithInlineStyle()

Here is code snippet:

void StyledMarkupAccumulator::AppendTextWithInlineStyle(
    Text& text,
    EditingStyle* inline_style) {
...
  if (!ShouldAnnotate()) {
    AppendText(text);
  } else {
   

// We use |RenderedText()| for |Text| in SELECT element
// Why?
    const bool use_rendered_text = !EnclosingElementWithTag(
        Position::FirstPositionInNode(&text), selectTag);
    String content =
        use_rendered_text ? RenderedText(text) : StringValueForRange(text);
   
 StringBuilder buffer;
    MarkupFormatter::AppendCharactersReplacingEntities(
        buffer, content, 0, content.length(), kEntityMaskInPCDATA);
    result_.Append(ConvertHTMLTextToInterchangeFormat(buffer.ToString(), text));
  }
...
}
 

Comment 1 Deleted

Comment 2 by yosin@chromium.org, May 22 2017

It seems we use rendered text from beginning[1], 2004-12-13.

Using StringValueForRange() is introduced by patch[2].

[1] https://trac.webkit.org/changeset/8198/webkit moved markup-related functions into new sources files in the editing directory
[2] https://trac.webkit.org/changeset/17532/webkit Copy/paste of a select element fails to include the options

Comment 3 by yosin@chromium.org, May 22 2017

Cc: kojii@chromium.org

Comment 4 by yosin@chromium.org, May 22 2017

Using rendered text is introduce by patch[1].

The comment is 

Some improvements for paste, including some new code to annotate
whitespace when writing to the pasteboard to ensure that the meaning
of the markup on the pasteboard is unambiguous.

[1] https://trac.webkit.org/changeset/8096/webkit/trunk/WebCore/khtml/xml/dom_nodeimpl.cpp

Comment 5 by yosin@chromium.org, May 22 2017

Following tests are failed in LayoutTests/editing when using StringValuseForRange()
instead of RenderedText().

When we have hard time to adjust Layout NG version of TextIterator, we may want to
consider using StringValueForRange() rather than adjusting Layout NG version.


Regressions: Unexpected text-only failures (33)
  editing/inserting/insert-3786362-fix.html [ Failure ]
  editing/pasteboard/19644-1.html [ Failure ]
  editing/pasteboard/19644-2.html [ Failure ]
  editing/pasteboard/4944770-1.html [ Failure ]
  editing/pasteboard/block-wrappers-necessary.html [ Failure ]
  editing/pasteboard/copy-backslash-with-euc.html [ Failure ]
  editing/pasteboard/copy-resolves-urls.html [ Failure ]
  editing/pasteboard/display-block-on-spans.html [ Failure ]
  editing/pasteboard/paste-4039777-fix.html [ Failure ]
  editing/pasteboard/paste-and-sanitize.html [ Failure ]
  editing/pasteboard/paste-blockquote-and-paragraph-break.html [ Failure ]
  editing/pasteboard/paste-blockquote-before-blockquote.html [ Failure ]
  editing/pasteboard/paste-double-nested-blockquote-before-blockquote.html [ Failure ]
  editing/pasteboard/paste-list-002.html [ Failure ]
  editing/pasteboard/paste-list-003.html [ Failure ]
  editing/pasteboard/paste-list-004.html [ Failure ]
  editing/pasteboard/paste-noplugin.html [ Failure ]
  editing/pasteboard/paste-noscript.html [ Failure ]
  editing/pasteboard/paste-sanitize-crash-1.html [ Failure ]
  editing/pasteboard/paste-sanitize-crash-2.html [ Failure ]
  editing/pasteboard/paste-table-002.html [ Failure ]
  editing/pasteboard/paste-table-cells.html [ Failure ]
  editing/pasteboard/paste-text-012.html [ Failure ]
  editing/pasteboard/paste-text-017.html [ Failure ]
  editing/pasteboard/paste-text-with-style.html [ Failure ]
  editing/pasteboard/paste-unrendered-select.html [ Failure ]
  editing/pasteboard/paste-visible-script.html [ Failure ]
  editing/pasteboard/paste-wrapped-blockquote-into-nonblockquote.html [ Failure ]
  editing/pasteboard/paste_line_endings.html [ Failure ]
  editing/pasteboard/paste_text.html [ Failure ]
  editing/pasteboard/preserve-line-break-at-end-of-pasted-content.html [ Failure ]
  editing/pasteboard/smart-drag-drop.html [ Failure ]
  editing/style/non-inheritable-styles.html [ Failure ]

Regressions: Unexpected image-only failures (1)
  editing/pasteboard/copy-element-with-conflicting-background-color-from-rule.html [ Failure ]

Regressions: Unexpected image and text failures (1)
  editing/pasteboard/paste-text-016.html [ Failure ]

Labels: -OS-Fuchsia

Comment 7 by yosin@chromium.org, Jan 10 2018

Labels: Pri-3
Project Member

Comment 8 by sheriffbot@chromium.org, Jan 10

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment