<?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>7360</bug_id>
          
          <creation_ts>2006-02-19 04:44:41 -0800</creation_ts>
          <short_desc>Typing style isn&apos;t bold in a bold context</short_desc>
          <delta_ts>2022-07-06 13:33:22 -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>HTML Editing</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <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="Graham Dennis">Graham.Dennis</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>ayg</cc>
    
    <cc>bfulgham</cc>
    
    <cc>dwood</cc>
    
    <cc>enrica</cc>
    
    <cc>ian</cc>
    
    <cc>justin.garcia</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>33363</commentid>
    <comment_count>0</comment_count>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-02-19 04:44:41 -0800</bug_when>
    <thetext>Let me prefix this by saying that I&apos;m not sure that this actually is a bug.
If one adds styling to the text at the start of a contentEditable div, and then deletes all of the content in the div, any new text that is added has the styling that was added to the text at the start of the div. This is the same behaviour as TextEdit, however, for TextEdit, there is no well-defined default style. For a contentEditable div, it is possible that a style has been applied to the div, which has since been overridden by the span. It makes sense that there should be a way to remove the style applied by the span. One way to do this would be to remove a span once it contains no text.

I&apos;ll attach a testcase.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33364</commentid>
    <comment_count>1</comment_count>
      <attachid>6607</attachid>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-02-19 04:46:31 -0800</bug_when>
    <thetext>Created attachment 6607
testcase

The red colour is applied by a &lt;span&gt; element inside the contentEditable div. If all the text in the div is deleted, this style is still applied to any new text typed in the div.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33365</commentid>
    <comment_count>2</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2006-02-19 05:30:55 -0800</bug_when>
    <thetext>The behavior i can confirm... Don&apos;t know if this is wrong thoug... Justin, what do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33728</commentid>
    <comment_count>3</comment_count>
    <who name="Justin Garcia">justin.garcia</who>
    <bug_when>2006-02-22 14:03:41 -0800</bug_when>
    <thetext>(In reply to comment #0)
&gt; This is the same behaviour as TextEdit, however, for TextEdit, there is no well-defined default
&gt; style. 

In TextEdit, create a few lines of bold text, with an empty line somewhere in the middle.  Click in that empty line, unbold with command-b, and start typing.  You&apos;ll get unbolded text.  Now, delete all the text on that line, and begin typing again.  You&apos;ll still have unbolded text.  So, even though you&apos;re inside a bold context, the unbold style hangs onto the caret even though you&apos;ve deleted all unbold text.

Also notice that if you click somewhere else and then click back on the empty line and start typing, you&apos;ll get bold text.  So clicking away and clicking back blows away the unbold style that was hanging on the caret.  We mimic this behavior as well.

We consider this behavior correct, since our goal in general has been to mimic the behavior of TextEdit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33854</commentid>
    <comment_count>4</comment_count>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-02-24 00:05:38 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Also notice that if you click somewhere else and then click back on the empty
&gt; line and start typing, you&apos;ll get bold text.  So clicking away and clicking
&gt; back blows away the unbold style that was hanging on the caret.  We mimic this
&gt; behavior as well.

I just tried to do this, but the behaviour is not what you said. If in the testcase, I create three lines of text, with a blank line in the middle, then bold the lot, text on the blank line is typed as bold. So far, so good. I unbold and type text which is unbolded. Then I delete the the text on this line (but not the line itself), then click on the URL entry field, then back on the empty line. New text I type is not bold, but we would expect bold text (and TextEdit does show bold text).

I haven&apos;t reopened this bug in case I&apos;m not understanding this properly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33861</commentid>
    <comment_count>5</comment_count>
    <who name="Justin Garcia">justin.garcia</who>
    <bug_when>2006-02-24 02:07:15 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; Also notice that if you click somewhere else and then click back on the empty
&gt; &gt; line and start typing, you&apos;ll get bold text.  So clicking away and clicking
&gt; &gt; back blows away the unbold style that was hanging on the caret.  We mimic this
&gt; &gt; behavior as well.
&gt; 
&gt; I just tried to do this, but the behaviour is not what you said. If in the
&gt; testcase, I create three lines of text, with a blank line in the middle, then
&gt; bold the lot, text on the blank line is typed as bold. So far, so good. I
&gt; unbold and type text which is unbolded. Then I delete the the text on this line
&gt; (but not the line itself), then click on the URL entry field, then back on the
&gt; empty line. New text I type is not bold, but we would expect bold text (and
&gt; TextEdit does show bold text).

You&apos;re right, this is a bug.  Reopening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34976</commentid>
    <comment_count>6</comment_count>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-03-03 13:02:14 -0800</bug_when>
    <thetext>I&apos;ve had a look at this, and the problem seems to be caused when DeleteSelectionCommand::calculateTypingStyleAfterDelete applies the typing style to the placeholder element. However, I can&apos;t figure out how to calculate the correct style. Consider the following two cases:
1: Type three lines, bold all three, and delete the text in the middle line.
2: Type three lines, bold just the first and third lines, and delete the text in the middle line.
In case 1, after moving the caret away and back again, new text on the second line should be bold. In case 2, after moving the caret away and back again, new text on the second line should not be bold. In HTML, it will be difficult to tell the difference between case 1 and case 2 because all tags must be nested, and because the newlines aren&apos;t &lt;br/&gt;&apos;s, but each paragraph is a block element, there must be a boldface tag for each line separately. So how can we tell the difference between these cases in HTML? For the given two cases, it looks like one solution might be to use the current typing style (this is what is done in the code at present), but consider a third case:
3: Type three lines, bold all three, unbold the middle line, now delete the text in the middle line.
In this case, after clicking away and back again, the text should be bold, which is not the previous typing style.
Ideas anyone?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38601</commentid>
    <comment_count>7</comment_count>
      <attachid>7526</attachid>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-04-05 06:41:49 -0700</bug_when>
    <thetext>Created attachment 7526
work in progress patch

Justin,
I&apos;ve been doing a bit of work on this bug, and what I have been trying to do is to apply styles to the block element when a style should be applied to the entire paragraph (i.e. the style should be persistent when moving the caret away and back to the paragraph). This means that some styles aren&apos;t using the apple-style-span span&apos;s... Is this reasonable behaviour?
The patch I have attached is a work in progress that I&apos;d like your feedback on. I haven&apos;t marked it r? as it is missing a testcase, changelog entry, etc. I just want to know if you think I&apos;m on the right track. Other than that, this patch does fix this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38605</commentid>
    <comment_count>8</comment_count>
    <who name="Justin Garcia">justin.garcia</who>
    <bug_when>2006-04-05 09:06:58 -0700</bug_when>
    <thetext>I&apos;m not sure that this bug is titled appropriately anymore, and the testcase that&apos;s attached doesn&apos;t describe what it&apos;s testing.  Let&apos;s make sure we&apos;re on the same page.  There is only one bug discussed here that I am familiar with.  If there are others, let&apos;s file those in separate reports.

Here&apos;s the tree we produce, and the typing style resulting from the three examples you gave:

&gt; 1: Type three lines, bold all three, and delete the text in the middle line.

&lt;div&gt;&lt;b&gt;line 1&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;line 3&lt;/b&gt;&lt;/div&gt;

Current typing style: bold

Typing on the second line produces characters with the right style, and clicking away/clicking back and typing produces characters with the right style.


&gt; 2: Type three lines, bold just the first and third lines, and delete the text in the middle line.

&lt;div&gt;&lt;b&gt;line 1&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;line 3&lt;/b&gt;&lt;/div&gt;

Current typing style: unbold

Typing on the second line produces characters with the right style, and clicking away/clicking back and typing produces characters with the right style.


&gt; 3: Type three lines, bold all three, unbold the middle line, now delete the text in the middle line.

&lt;div&gt;&lt;b&gt;line 1&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;line 3&lt;/b&gt;&lt;/div&gt;

Current typing style: unbold

Typing on the second line produces characters with the right style, but clicking away/clicking back and typing produces unbold text.  This is the only bug as far as I can tell.  I&apos;m going to retitle this bug and add a testcase that demonstrates this bug.


&gt; In HTML, it will be difficult to tell the difference between case 1 and case 2 because all tags must be nested

What do you mean by &quot;all tags must be nested&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38607</commentid>
    <comment_count>9</comment_count>
      <attachid>7528</attachid>
    <who name="Justin Garcia">justin.garcia</who>
    <bug_when>2006-04-05 09:20:45 -0700</bug_when>
    <thetext>Created attachment 7528
testcase

This is an automated testcase that demonstrates this bug:
Type three lines of text
Bold them all
Unbold the middle line
Delete the text on the middle line
Click away and click back to the middle line
Start typing

You should see bold text.  You instead see unbold text.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>40700</commentid>
    <comment_count>10</comment_count>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-04-28 18:17:42 -0700</bug_when>
    <thetext>Sorry for the delay in replying...

(In reply to comment #8)
&gt; I&apos;m not sure that this bug is titled appropriately anymore, and the testcase
&gt; that&apos;s attached doesn&apos;t describe what it&apos;s testing.  Let&apos;s make sure we&apos;re on
&gt; the same page.  There is only one bug discussed here that I am familiar with. 
&gt; If there are others, let&apos;s file those in separate reports.

That&apos;s the bug I&apos;m talking about.

Of the three cases I was talking about, only the third worked incorrectly. The reason I mentioned the other two is because they are similar, and at present the HTML code produced for 2 and 3 is identical, however I wasn&apos;t sure how they should differ when the bug is fixed.

&gt; &gt; In HTML, it will be difficult to tell the difference between case 1 and case 2 because all tags must be nested
&gt; 
&gt; What do you mean by &quot;all tags must be nested&quot;?
What I mean to say is that in Cocoa, this problem is avoided because we can say that the bolding started in one paragraph, continued through one paragraph and into the next. However this is impossible to do with one tag in HTML as all tags must be nested. The bolding region that starts in the first paragraph must also finish in the first paragraph. So a new bolding region must be used for the second and third paragraphs.

My solution to this problem is where a bolding region (or styling region in general) would cover an entire paragraph (actually any Block element), the style is applied to the block element itself, instead of creating a styling span within it. This way, when all text in a block is deleted (and any empty styling spans removed), when the cursor moves away and back again, the style that was applied to the block will still apply to the text.

Let me know if I haven&apos;t explained myself properly...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44181</commentid>
    <comment_count>11</comment_count>
    <who name="Justin Garcia">justin.garcia</who>
    <bug_when>2006-05-31 15:13:53 -0700</bug_when>
    <thetext>&gt; This way, when all text in a block is deleted (and any empty
&gt; styling spans removed), when the cursor moves away and back again, the style
&gt; that was applied to the block will still apply to the text.

So, would it be better to fix this bug by not removing a span when its contents are removed?

Please add some testcases. 

     // Do not check for legacy styles here. Those styles, like &lt;B&gt; and &lt;I&gt;, only apply for
     // inline content.
+    // No longer true.

Just remove the comment.

r- for now until you add some testcases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44182</commentid>
    <comment_count>12</comment_count>
    <who name="Justin Garcia">justin.garcia</who>
    <bug_when>2006-05-31 15:20:23 -0700</bug_when>
    <thetext>+        // If the node we are in is an empty paragraph, then we have selected the entire paragraph
+        // so we want to apply the style to the whole paragraph
+        VisiblePosition startPos(start, VP_UPSTREAM_IF_POSSIBLE);
+        if (start.offset() == end.offset() &amp;&amp; isStartOfParagraph(startPos) &amp;&amp; isEndOfParagraph(startPos)) {
+            HTMLElement *block = static_cast&lt;HTMLElement *&gt;(start.node()-&gt;enclosingBlockFlowElement());
+            removeCSSStyle(style, block);
+            addBlockStyleIfNeeded(style, block);

Just because startPos is in an empty paragraph, doesn&apos;t mean that it&apos;s in a block by itself.  For example [br2, 0] example in the tree below:
&lt;div&gt;&lt;br1&gt;&lt;br2&gt;&lt;/div&gt;
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47971</commentid>
    <comment_count>13</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2006-07-02 02:17:04 -0700</bug_when>
    <thetext>Comments indicates this has been confirmed as a bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>453351</commentid>
    <comment_count>14</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-08-18 14:27:08 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; My solution to this problem is where a bolding region (or styling region in general) would cover an entire paragraph (actually any Block element), the style is applied to the block element itself, instead of creating a styling span within it. This way, when all text in a block is deleted (and any empty styling spans removed), when the cursor moves away and back again, the style that was applied to the block will still apply to the text.

This is not a good idea.  Gecko does something like this, and it causes problems:

1) It doesn&apos;t work at all if styleWithCSS is false.  You can&apos;t use CSS for styling in that case: it would break non-CSS UAs, like some mail clients.  (Or so I&apos;ve been told.)

2) If you do it only when styleWithCSS is true, it will produce markup that has different effects in some cases.  For instance, &lt;p style=&quot;text-decoration:underline&quot;&gt;&lt;font color=red&gt;foo&lt;/font&gt;&lt;/p&gt; has a different underline color than &lt;p style=&quot;color:red; text-decoration:underline&quot;&gt;foo&lt;/p&gt;.  This is bad, because styleWithCSS vs. not should only affect the markup produced, not the visual effect.

3) It breaks hiliteColor, because background-color does something different on block vs. inline elements.  &lt;p style=&quot;background-color:teal&quot;&gt;foo&lt;/p&gt; is different from &lt;p&gt;&lt;span style=&quot;background-color:teal&quot;&gt;foo&lt;/span&gt;&lt;/p&gt;.

4) It makes everything more complicated.  You&apos;ll have to add lots of different code paths everywhere to properly handle the two different types of style.

Instead, I would suggest that if the entire contents of the block are deleted, the styling tag should just be left.  So instead of &lt;p&gt;&lt;b&gt;foo&lt;/b&gt;&lt;/p&gt; -&gt; &lt;p&gt;&lt;br&gt;&lt;/p&gt; with a typing style set, it should become &lt;p&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/p&gt; with no typing style.

This bug also affects the editing spec.  I filed a bug against that:

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13831

I plan to specify the solution that I just outlined, if no one has any objections to it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>613247</commentid>
    <comment_count>15</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-04-30 22:41:03 -0700</bug_when>
    <thetext>Also see the bug 34608.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881077</commentid>
    <comment_count>16</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-07-06 13:33:07 -0700</bug_when>
    <thetext>Chrome and Safari agree on behavior (the middle line is not bolded), while Firefox shows all three lines in bold.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881078</commentid>
    <comment_count>17</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-06 13:33:22 -0700</bug_when>
    <thetext>&lt;rdar://problem/96544639&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>6607</attachid>
            <date>2006-02-19 04:46:31 -0800</date>
            <delta_ts>2006-04-05 09:20:45 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>SpanStylesInEditableDivs.html</filename>
            <type>text/html</type>
            <size>111</size>
            <attacher name="Graham Dennis">Graham.Dennis</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5Pgo8ZGl2IGNvbnRlbnRFZGl0YWJsZT0idHJ1ZSI+PHNwYW4gc3R5bGU9ImNv
bG9yOiByZ2IoMjU1LCAwLCAwKTsiPkZvbzwvc3Bhbj48L2Rpdj4KPC9ib2R5Pgo8L2h0bWw+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>7526</attachid>
            <date>2006-04-05 06:41:49 -0700</date>
            <delta_ts>2010-06-10 14:22:23 -0700</delta_ts>
            <desc>work in progress patch</desc>
            <filename>BlockStyles test.diff</filename>
            <type>text/plain</type>
            <size>5843</size>
            <attacher name="Graham Dennis">Graham.Dennis</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvZWRpdGluZy9EZWxldGVTZWxlY3Rpb25Db21tYW5kLmNwcAo9PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09Ci0tLSBXZWJDb3JlL2VkaXRpbmcvRGVsZXRlU2VsZWN0aW9uQ29tbWFuZC5jcHAJKHJldmlz
aW9uIDEzNTM1KQorKysgV2ViQ29yZS9lZGl0aW5nL0RlbGV0ZVNlbGVjdGlvbkNvbW1hbmQuY3Bw
CSh3b3JraW5nIGNvcHkpCkBAIC02MjUsOCArNjI1LDggQEAgdm9pZCBEZWxldGVTZWxlY3Rpb25D
b21tYW5kOjpjYWxjdWxhdGVUeQogICAgICAgICAvLyBpcyBub3QgcmV0YWluZWQgdW50aWwgdGhl
IG5leHQgdHlwaW5nIGFjdGlvbi4KIAogICAgICAgICBzZXRFbmRpbmdTZWxlY3Rpb24oU2VsZWN0
aW9uKFBvc2l0aW9uKGluc2VydGVkUGxhY2Vob2xkZXIsIDApLCBET1dOU1RSRUFNKSk7Ci0gICAg
ICAgIGFwcGx5U3R5bGUobV90eXBpbmdTdHlsZS5nZXQoKSwgRWRpdEFjdGlvblVuc3BlY2lmaWVk
KTsKLSAgICAgICAgbV90eXBpbmdTdHlsZSA9IDA7CisvLyAgICAgICAgYXB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PnNldFByb3BlcnR5KENTU19QUk9QX0ZPTlRfU0laRSwg
c3R5bGVDaGFuZ2UuZm9udFNpemUoKSk7CisgICAgCisgICAgICAgIGlmIChzdHlsZUNoYW5nZS5h
cHBseUJvbGQoKSkKKyAgICAgICAgICAgIGRlY2wtPnNldFByb3BlcnR5KENTU19QUk9QX0ZPTlRf
V0VJR0hULCAiYm9sZCIpOworICAgICAgICAKKyAgICAgICAgaWYgKHN0eWxlQ2hhbmdlLmFwcGx5
SXRhbGljKCkpCisgICAgICAgICAgICBkZWNsLT5zZXRQcm9wZXJ0eShDU1NfUFJPUF9GT05UX1NU
WUxFLCAiaXRhbGljIik7CisgICAgfQogfQogCiB2b2lkIEFwcGx5U3R5bGVDb21tYW5kOjphZGRJ
bmxpbmVTdHlsZUlmTmVlZGVkKENTU011dGFibGVTdHlsZURlY2xhcmF0aW9uICpzdHlsZSwgTm9k
ZSAqc3RhcnROb2RlLCBOb2RlICplbmROb2RlKQo=
</data>
<flag name="review"
          id="2356"
          type_id="1"
          status="-"
          setter="justin.garcia"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>7528</attachid>
            <date>2006-04-05 09:20:45 -0700</date>
            <delta_ts>2006-04-05 09:20:45 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>7360-testcase.html</filename>
            <type>text/html</type>
            <size>1078</size>
            <attacher name="Justin Garcia">justin.garcia</attacher>
            
              <data encoding="base64">PHByZT5UaGlzIGlzIGFuIGF1dG9tYXRlZCB0ZXN0Y2FzZSB0aGF0IGRlbW9uc3RyYXRlcyB0aGlz
IGJ1ZzoKVHlwZSB0aHJlZSBsaW5lcyBvZiB0ZXh0CkJvbGQgdGhlbSBhbGwKVW5ib2xkIHRoZSBt
aWRkbGUgbGluZQpEZWxldGUgdGhlIHRleHQgb24gdGhlIG1pZGRsZSBsaW5lCkNsaWNrIGF3YXkg
YW5kIGNsaWNrIGJhY2sgdG8gdGhlIG1pZGRsZSBs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