[Webkit-unassigned] [Bug 250003] New: [GTK] Clipboard copy adds extra font style

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 2 07:15:25 PST 2023


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

            Bug ID: 250003
           Summary: [GTK] Clipboard copy adds extra font style
           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

Moving from downstream bug report:
https://gitlab.gnome.org/GNOME/evolution/-/issues/1950

When copying HTML content and pasting it back to the WebKitWebView, the pasted text can contain a font size style attribute (in pixels), which was not set in the selected text. This can negatively affect the content rendering, thus it would be better to not add the font size information into the clipboard if the selected text uses either the default font size or the parent element has set a font size.

The font size declared in pixels is also rather wrong (consider when composing on a normal DPI screen and then viewing the content on a hiDPI screen - untested here, but I guess the pixel-defined font size will be smaller than the text without the font size definition, even though the normal DPI screen will show the texts in the same size, thus it'll be unnoticed by the text editor).

Steps:
a) run: MiniBrowser --editor-mode
b) press Ctrl+Shift+I to open the Inspector, right-click the <head> element and choose Edit->HTML from the context menu and change its content to:

   <head><style>body { font-size: 11pt; }</style></head>

c) focus the text body
d) type: line one<enter>
e) type: line two<enter>
f) highlight "line two"
g) press Ctrl+C
h) put cursor after "line one'
i) press <enter>
j) press Ctrl+V

See the HTML source [1], the pasted text contains font size information as a style attribute.

Note the `Default font size` setting is set to 16 here and when I change the font size <style> of the body element (in the <head>) to 16px (from 11pt), then the font declaration is not included in the pasted text.

Tested with 2.38.2 of the WebKitGTK.

[1] HTML source:
   <html>
      <head><style>body { font-size: 11pt; }</style></head>
      <body>
         line 1
         <div><span style="font-size: 14.666667px;">line 2</span><br>
            <div>line 2</div>
         </div>
      </body>
   </html>

-- 
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/20230102/4aff1949/attachment.htm>


More information about the webkit-unassigned mailing list