<?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>208177</bug_id>
          
          <creation_ts>2020-02-24 22:42:51 -0800</creation_ts>
          <short_desc>Make Editor::applyEditingStyleToBodyElement do things in a straightforward manner</short_desc>
          <delta_ts>2020-03-07 13:47:12 -0800</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>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Darin Adler">darin</reporter>
          <assigned_to name="Darin Adler">darin</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>koivisto</cc>
    
    <cc>mifenton</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1622503</commentid>
    <comment_count>0</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-02-24 22:42:51 -0800</bug_when>
    <thetext>Make Editor::applyEditingStyleToBodyElement do things in a straightforward manner</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622504</commentid>
    <comment_count>1</comment_count>
      <attachid>391626</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-02-24 22:44:18 -0800</bug_when>
    <thetext>Created attachment 391626
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622579</commentid>
    <comment_count>2</comment_count>
      <attachid>391626</attachid>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2020-02-25 06:09:25 -0800</bug_when>
    <thetext>Comment on attachment 391626
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391626&amp;action=review

&gt; Source/WebCore/editing/Editor.cpp:-3442
&gt; -        // Mutate using the CSSOM wrapper so we get the same event behavior as a script.
&gt; -        auto&amp; style = body-&gt;cssomStyle();

This originates from https://bugs.webkit.org/show_bug.cgi?id=78589 and was based on Ryosuke&apos;s comments (&quot;In my second thought, not instantiating mutation scope is fine because all calls to setInlineStyleProperty are invisible to scripts except ones in Editor.cpp, RemoveCSSPropertyCommand.cpp, &amp; ReplaceSelectionCommand.cpp. Please revert those before landing the patch.&quot;)

Has something changed so we don&apos;t need this anymore here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622696</commentid>
    <comment_count>3</comment_count>
      <attachid>391626</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-02-25 12:02:14 -0800</bug_when>
    <thetext>Comment on attachment 391626
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391626&amp;action=review

&gt;&gt; Source/WebCore/editing/Editor.cpp:-3442
&gt;&gt; -        auto&amp; style = body-&gt;cssomStyle();
&gt; 
&gt; This originates from https://bugs.webkit.org/show_bug.cgi?id=78589 and was based on Ryosuke&apos;s comments (&quot;In my second thought, not instantiating mutation scope is fine because all calls to setInlineStyleProperty are invisible to scripts except ones in Editor.cpp, RemoveCSSPropertyCommand.cpp, &amp; ReplaceSelectionCommand.cpp. Please revert those before landing the patch.&quot;)
&gt; 
&gt; Has something changed so we don&apos;t need this anymore here?

The call sites in editing commands (RemoveCSSPropertyCommand, ReplaceSelectionCommand.cpp) are a web-visible part of how editing behaves on webpages. So Ryoskue’s logic makes sense there, although using the CSS object model wrappers seems like a roundabout way to implement it.

This function is used for something quite different, a mode switch on the entire web view. I don’t think the mutation event issues are the same, and the most important cases I am aware of, like in the iOS and macOS Mail apps, also disable content scripting.

However, there could be something I missed: maybe someone can think of a reason I would need to &quot;instantiate mutation scope&quot; here. I didn’t do that.

I think I need advice on how to write a test that can demonstrate why this matters. I’d be willing to do that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622699</commentid>
    <comment_count>4</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2020-02-25 12:07:19 -0800</bug_when>
    <thetext>&gt; This function is used for something quite different, a mode switch on the
&gt; entire web view. I don’t think the mutation event issues are the same, and
&gt; the most important cases I am aware of, like in the iOS and macOS Mail apps,
&gt; also disable content scripting.

Ok, maybe I just took the comment too broadly originally and this was never needed in the first place.

&gt; However, there could be something I missed: maybe someone can think of a
&gt; reason I would need to &quot;instantiate mutation scope&quot; here. I didn’t do that.
&gt; 
&gt; I think I need advice on how to write a test that can demonstrate why this
&gt; matters. I’d be willing to do that.

Ryosuke might have ideas?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622700</commentid>
    <comment_count>5</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2020-02-25 12:08:42 -0800</bug_when>
    <thetext>I&apos;m ok with landing as-is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622718</commentid>
    <comment_count>6</comment_count>
      <attachid>391626</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2020-02-25 13:08:23 -0800</bug_when>
    <thetext>Comment on attachment 391626
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391626&amp;action=review

I&apos;m not certain that we want to land this patch.

&gt; Source/WebCore/editing/Editor.cpp:-3435
&gt; -    // FIXME: Not clear it&apos;s valuable to do this to all body elements rather than just doing it on the single one returned by Document::body.

Isn&apos;t this because we can have multiple body elements in one of those badly written CMS pages?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1623349</commentid>
    <comment_count>7</comment_count>
      <attachid>391626</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-02-26 20:03:44 -0800</bug_when>
    <thetext>Comment on attachment 391626
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391626&amp;action=review

&gt;&gt; Source/WebCore/editing/Editor.cpp:-3435
&gt;&gt; -    // FIXME: Not clear it&apos;s valuable to do this to all body elements rather than just doing it on the single one returned by Document::body.
&gt; 
&gt; Isn&apos;t this because we can have multiple body elements in one of those badly written CMS pages?

Maybe; but when would that intersect with an editable WebView? This isn’t used by web browsers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1623363</commentid>
    <comment_count>8</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2020-02-26 21:01:09 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #7)
&gt; Comment on attachment 391626 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=391626&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WebCore/editing/Editor.cpp:-3435
&gt; &gt;&gt; -    // FIXME: Not clear it&apos;s valuable to do this to all body elements rather than just doing it on the single one returned by Document::body.
&gt; &gt; 
&gt; &gt; Isn&apos;t this because we can have multiple body elements in one of those badly written CMS pages?
&gt; 
&gt; Maybe; but when would that intersect with an editable WebView? This isn’t
&gt; used by web browsers.

Oh, I see. It&apos;s probably fine then. I knew we used to have a lot of code dealing with duplicated body elements because ReplaceSelectionCommand / createMarkup used to generate them sometimes but I think we&apos;ve mostly resolved that problem by now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1626507</commentid>
    <comment_count>9</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-03-05 21:46:07 -0800</bug_when>
    <thetext>Having a hard time deciding whether to land this patch or not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1626528</commentid>
    <comment_count>10</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2020-03-05 22:42:25 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #9)
&gt; Having a hard time deciding whether to land this patch or not.

It seems okay to land this change given it doesn&apos;t affect editing commands / general web visible behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1626530</commentid>
    <comment_count>11</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2020-03-05 22:43:40 -0800</bug_when>
    <thetext>Yeah, go ahead and land.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1627295</commentid>
    <comment_count>12</comment_count>
      <attachid>391626</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2020-03-07 13:46:29 -0800</bug_when>
    <thetext>Comment on attachment 391626
Patch

Clearing flags on attachment: 391626

Committed r258077: &lt;https://trac.webkit.org/changeset/258077&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1627296</commentid>
    <comment_count>13</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2020-03-07 13:46:30 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1627298</commentid>
    <comment_count>14</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-03-07 13:47:12 -0800</bug_when>
    <thetext>&lt;rdar://problem/60192151&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>391626</attachid>
            <date>2020-02-24 22:44:18 -0800</date>
            <delta_ts>2020-03-07 13:46:29 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-208177-20200224224416.patch</filename>
            <type>text/plain</type>
            <size>2513</size>
            <attacher name="Darin Adler">darin</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjU3MjkzCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFu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