[webkit-reviews] review granted: [Bug 211524] Preserve character set information when writing to the pasteboard when copying rich text : [Attachment 398804] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 7 15:35:15 PDT 2020


Darin Adler <darin at apple.com> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 211524: Preserve character set information when writing to the pasteboard
when copying rich text
https://bugs.webkit.org/show_bug.cgi?id=211524

Attachment 398804: Patch

https://bugs.webkit.org/attachment.cgi?id=398804&action=review




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 398804
  --> https://bugs.webkit.org/attachment.cgi?id=398804
Patch

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

> Source/WebCore/editing/markup.cpp:921
> +#if PLATFORM(COCOA)

I think this kind of issue might exist on other platforms as well. Would be
nice to call people’s attention to this in case they want it to take advantage
of it.

> Source/WebCore/editing/markup.cpp:926
> +    if (!accumulatedMarkup.isAllASCII()) {
> +	   // On Cocoa platforms, this markup is eventually persisted to the
pasteboard and read back as UTF-8 data,
> +	   // so this meta tag is needed for clients that read this data in the
future from the pasteboard and load it.
> +	   return makeString("<meta charset=\"UTF-8\">",
WTFMove(accumulatedMarkup));
> +    }

Could avoid making a second copy of the entire string by adding an isAllASCII
function to StyledMarkupAccumulator and adding another function you can use to
add this to m_reversedPrecedingMarkup before calling takeResults. Less
economical in code complexity, but more efficient.


More information about the webkit-reviews mailing list