<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>196427</bug_id>
          
          <creation_ts>2019-03-30 09:42:25 -0700</creation_ts>
          <short_desc>REGRESSION (r135972): WebCore::TextIterator::plainText() discards value from Document::displayStringModifiedByEncoding() when isDisplayString == true</short_desc>
          <delta_ts>2023-05-23 08:47:34 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=103295</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=166569</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1522778</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2019-03-30 09:42:25 -0700</bug_when>
    <thetext>WebCore::TextIterator::plainText() discards value from WebCore::Document::displayStringModifiedByEncoding() when argument isDisplayString == true.

&lt;https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/editing/TextIterator.cpp#L2655&gt;

String plainText(Position start, Position end, TextIteratorBehavior defaultBehavior, bool isDisplayString)
{
    […]
    String result = builder.toString();

    if (isDisplayString)
        document-&gt;displayStringModifiedByEncoding(result);

    return result;
}

Looks like this regressed with this commit:

Bug 103295: TextIterator unnecessarily converts 8 bit strings to 16 bits
&lt;https://bugs.webkit.org/show_bug.cgi?id=103295&gt;
&lt;https://trac.webkit.org/changeset/135972&gt;

The method call changed, but the new method returned an updated string instead of modifying it in place:

     if (isDisplayString &amp;&amp; r-&gt;ownerDocument())
-        r-&gt;ownerDocument()-&gt;displayBufferModifiedByEncoding(result, bufferLength);
+        r-&gt;ownerDocument()-&gt;displayStringModifiedByEncoding(result);

And Document::displayBufferModifiedByEncoding() was removed by:

Bug 166569: Remove PassRefPtr use from the &quot;dom&quot; directory, related cleanup
&lt;https://bugs.webkit.org/show_bug.cgi?id=166569&gt;
&lt;https://trac.webkit.org/changeset/210216&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1522779</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2019-03-30 09:42:43 -0700</bug_when>
    <thetext>&lt;rdar://problem/49450607&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1522780</commentid>
    <comment_count>2</comment_count>
      <attachid>366364</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2019-03-30 09:44:50 -0700</bug_when>
    <thetext>Created attachment 366364
Patch (no tests; checking EWS)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1522781</commentid>
    <comment_count>3</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2019-03-30 09:49:00 -0700</bug_when>
    <thetext>(In reply to David Kilzer (:ddkilzer) from comment #2)
&gt; Created attachment 366364 [details]
&gt; Patch (no tests to check EWS)

Interesting...the style bot doesn&apos;t complain about a missing ChangeLog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1522789</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2019-03-30 13:25:21 -0700</bug_when>
    <thetext>We need a test for this...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1522838</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2019-03-31 16:45:36 -0700</bug_when>
    <thetext>I agree.

And also, maybe soon we can remove the special yen sign and backslash handling if it’s not needed in practice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1522844</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2019-03-31 18:34:06 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #5)
&gt; I agree.
&gt; 
&gt; And also, maybe soon we can remove the special yen sign and backslash
&gt; handling if it’s not needed in practice.

Unfortunately, I don&apos;t think the situation is changing anytime soon about the yen mark :( There is simply too much legacy content out there...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1957299</commentid>
    <comment_count>7</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-05-23 05:47:33 -0700</bug_when>
    <thetext>Backslash handling was removed by Blink in this commit:

https://src.chromium.org/viewvc/blink?view=revision&amp;revision=159589</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1957325</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-05-23 08:47:34 -0700</bug_when>
    <thetext>It&apos;s certainly interesting that this bug hasn&apos;t been fixed, and we don&apos;t seem to be seeing any complaints. That said, I&apos;d be very cautious about putting too much weight Blink decisions in this area.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>366364</attachid>
            <date>2019-03-30 09:44:50 -0700</date>
            <delta_ts>2019-04-18 09:09:07 -0700</delta_ts>
            <desc>Patch (no tests; checking EWS)</desc>
            <filename>rdar-49450607-fix-no-test.diff</filename>
            <type>text/plain</type>
            <size>1175</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL2RvbS9Eb2N1bWVudC5oIGIvU291cmNlL1dlYkNv
cmUvZG9tL0RvY3VtZW50LmgKaW5kZXggZDY3ZjZlODgzODQuLjM4NjJjYjE5ZGJkIDEwMDY0NAot
LS0gYS9Tb3VyY2UvV2ViQ29yZS9kb20vRG9jdW1lbnQuaAorKysgYi9Tb3VyY2UvV2ViQ29yZS9k
b20vRG9jdW1lbnQuaApAQCAtMTEyNSw3ICsxMTI1LDcgQEAgcHVibGljOgogICAgIHZvaWQgc2V0
RGVjb2RlcihSZWZQdHI8VGV4dFJlc291cmNlRGVjb2Rlcj4mJik7CiAgICAgVGV4dFJlc291cmNl
RGVjb2RlciogZGVjb2RlcigpIGNvbnN0IHsgcmV0dXJuIG1fZGVjb2Rlci5nZXQoKTsgfQogCi0g
ICAgV0VCQ09SRV9FWFBPUlQgU3RyaW5nIGRpc3BsYXlTdHJpbmdNb2RpZmllZEJ5RW5jb2Rpbmco
Y29uc3QgU3RyaW5nJikgY29uc3Q7CisgICAgV0VCQ09SRV9FWFBPUlQgU3RyaW5nIGRpc3BsYXlT
dHJpbmdNb2RpZmllZEJ5RW5jb2RpbmcoY29uc3QgU3RyaW5nJikgY29uc3QgV0FSTl9VTlVTRURf
UkVUVVJOOwogCiAjaWYgRU5BQkxFKERBU0hCT0FSRF9TVVBQT1JUKQogICAgIHZvaWQgc2V0SGFz
QW5ub3RhdGVkUmVnaW9ucyhib29sIGYpIHsgbV9oYXNBbm5vdGF0ZWRSZWdpb25zID0gZjsgfQpk
aWZmIC0tZ2l0IGEvU291cmNlL1dlYkNvcmUvZWRpdGluZy9UZXh0SXRlcmF0b3IuY3BwIGIvU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