[webkit-changes] [WebKit/WebKit] af9084: When converting HTML that contains an attachment t...

Richard Robinson noreply at github.com
Fri May 31 18:31:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: af90843c7e73e53a874763252a77875ab196857c
      https://github.com/WebKit/WebKit/commit/af90843c7e73e53a874763252a77875ab196857c
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2024-05-31 (Fri, 31 May 2024)

  Changed paths:
    M Source/WebCore/editing/TextIterator.cpp
    M Source/WebCore/editing/TextIteratorBehavior.h
    M Source/WebCore/editing/WebContentReader.h
    M Source/WebCore/editing/cocoa/HTMLConverter.h
    M Source/WebCore/editing/cocoa/HTMLConverter.mm
    M Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
    M Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm

  Log Message:
  -----------
  When converting HTML that contains an attachment to an attributed string and back using `HTMLConverter::editingAttributedString`, the attachment is lost
https://bugs.webkit.org/show_bug.cgi?id=274948
rdar://120873087

Reviewed by Wenson Hsieh.

Add support for non-image attachments in `HTMLConverter::editingAttributedString`. To do this,
encode the attachment id into an NSTextAttachment, and then decode it back to the existing HTMLAttachmentElement
element from within `WebContentReaderCocoa`.

Add a TextIterator option to maintain consistency between the character count produced by TextIterator
and the length of the string produced by `HTMLConverter::editingAttributedString`.

* Source/WebCore/editing/TextIterator.cpp:
(WebCore::TextIterator::handleReplacedElement):
* Source/WebCore/editing/TextIteratorBehavior.h:
* Source/WebCore/editing/WebContentReader.h:
* Source/WebCore/editing/cocoa/HTMLConverter.h:
(WebCore::editingAttributedString):
* Source/WebCore/editing/cocoa/HTMLConverter.mm:
(fileWrapperForElement):
(attributedStringWithAttachmentForElement):
(WebCore::editingAttributedString):
* Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::replaceRichContentWithAttachments):
* Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm:
(WebKit::UnifiedTextReplacementController::willBeginTextReplacementSession):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::dictionaryPopupInfoForRange):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
* Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm:
(+[WebImmediateActionController _dictionaryPopupInfoForRange:inFrame:indicatorOptions:transition:]):

Canonical link: https://commits.webkit.org/279605@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list