[Webkit-unassigned] [Bug 254031] New: [GTK] Editor: Odd SPAN added on text input

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 16 10:12:07 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=254031

            Bug ID: 254031
           Summary: [GTK] Editor: Odd SPAN added on text input
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcrha at redhat.com
                CC: bugs-noreply at webkitgtk.org

Created attachment 465461

  --> https://bugs.webkit.org/attachment.cgi?id=465461&action=review

test-html-editor.c

There is added an odd SPAN element when editing a text. Even I cannot reproduce this under MiniBrowser, I can reproduce it consistently with the attached program, which depends on the Evolution HTML editor.

Steps:
1) install evolution-devel package (aka development files for the evolution package)
2) download, compile and run the attached test-html-editor.c file - the first line of it contains a comment with a command to do it
3) press for example 'a' key

Current result:
The HTML structure looks like this:
   <body>
     <div><span style="background-color: inherit;">a</span></div>
   </body>

Expected result:
   <body>
     <div>a</div>
   </body>

This is reproducible with 2.35.1-1 release onwards (including 2.38.x series), the last version where it does not misbehave is 2.34.6-1.

Notes:

The test program has enabled Ctrl+Shift+I to open the WebKit Inspector, or one can use View->Inspector from the menu, for easier debugging.

An interesting thing is that it does not do it always. For example when I run the test program as:

   ./test-html-editor "<div>b</div>"

then the press of the 'a' constructs:

    <body>
      <div>ab</div>
    </body>

as expected.

Another interesting thing is that when I comment these lines:

                // make sure there is a selection
                if (!document.getSelection().anchorNode || document.getSelection().anchorNode.tagName == "HTML") {
                        document.getSelection().setPosition(document.body.firstChild ? document.body.firstChild : document.body, 0);
                }

in /usr/share/evolution/webkit/e-editor.js , in function EvoEditor.initializeContent, then it does not misbehave too, but it can write text in a wrong place.

Alternatively, when I execute (re-run) the command `document.getSelection().setPosition(document.body.firstChild ? document.body.firstChild : document.body, 0);` in the WebKit console after the editor is opened, then it also does not misbehave.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230316/e8e22459/attachment.htm>


More information about the webkit-unassigned mailing list