Changeset 236612 in webkit


Ignore:
Timestamp:
Sep 28, 2018 2:08:54 PM (6 years ago)
Author:
rniwa@webkit.org
Message:

Rename createMarkup to serializePreservingVisualAppearance
https://bugs.webkit.org/show_bug.cgi?id=190086

Reviewed by Wenson Hsieh.

Source/WebCore:

Renamed the function to clarify what it does. Also removed the unused Range::toHTML.

  • dom/Range.cpp:

(WebCore::Range::toHTML const): Deleted.

  • dom/Range.h:
  • editing/CompositeEditCommand.cpp:

(WebCore::CompositeEditCommand::moveParagraphs):

  • editing/cocoa/EditorCocoa.mm:

(WebCore::Editor::selectionInHTMLFormat):

  • editing/gtk/EditorGtk.cpp:

(WebCore::Editor::writeSelectionToPasteboard):

  • editing/markup.cpp:

(WebCore::serializePreservingVisualAppearance):
(WebCore::createMarkup): Deleted.

  • editing/markup.h:
  • editing/wpe/EditorWPE.cpp:

(WebCore::Editor::writeSelectionToPasteboard):

  • loader/archive/cf/LegacyWebArchive.cpp:

(WebCore::LegacyWebArchive::create):
(WebCore::LegacyWebArchive::createFromSelection):

  • platform/win/PasteboardWin.cpp:

(WebCore::Pasteboard::writeRangeToDataObject):

Source/WebKit:

  • WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:

(WebKit::WebEditorClient::updateGlobalSelection):

Source/WebKitLegacy/mac:

  • DOM/WebDOMOperations.mm:

(-[DOMRange markupString]):

Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r236611 r236612  
     12018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Rename createMarkup to serializePreservingVisualAppearance
     4        https://bugs.webkit.org/show_bug.cgi?id=190086
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Renamed the function to clarify what it does. Also removed the unused Range::toHTML.
     9
     10        * dom/Range.cpp:
     11        (WebCore::Range::toHTML const): Deleted.
     12        * dom/Range.h:
     13        * editing/CompositeEditCommand.cpp:
     14        (WebCore::CompositeEditCommand::moveParagraphs):
     15        * editing/cocoa/EditorCocoa.mm:
     16        (WebCore::Editor::selectionInHTMLFormat):
     17        * editing/gtk/EditorGtk.cpp:
     18        (WebCore::Editor::writeSelectionToPasteboard):
     19        * editing/markup.cpp:
     20        (WebCore::serializePreservingVisualAppearance):
     21        (WebCore::createMarkup): Deleted.
     22        * editing/markup.h:
     23        * editing/wpe/EditorWPE.cpp:
     24        (WebCore::Editor::writeSelectionToPasteboard):
     25        * loader/archive/cf/LegacyWebArchive.cpp:
     26        (WebCore::LegacyWebArchive::create):
     27        (WebCore::LegacyWebArchive::createFromSelection):
     28        * platform/win/PasteboardWin.cpp:
     29        (WebCore::Pasteboard::writeRangeToDataObject):
     30
    1312018-09-28  Simon Fraser  <simon.fraser@apple.com>
    232
  • trunk/Source/WebCore/dom/Range.cpp

    r236607 r236612  
    951951
    952952    return builder.toString();
    953 }
    954 
    955 String Range::toHTML() const
    956 {
    957     return createMarkup(*this);
    958953}
    959954
  • trunk/Source/WebCore/dom/Range.h

    r220503 r236612  
    8585    WEBCORE_EXPORT String toString() const;
    8686
    87     String toHTML() const;
    8887    WEBCORE_EXPORT String text() const;
    8988
  • trunk/Source/WebCore/editing/CompositeEditCommand.cpp

    r236583 r236612  
    14451445    // This used to use a ternary for initialization, but that confused some versions of GCC, see bug 37912
    14461446    if (startOfParagraphToMove != endOfParagraphToMove)
    1447         fragment = createFragmentFromMarkup(document(), createMarkup(*range, nullptr, AnnotateForInterchange::No, ConvertBlocksToInlines::Yes), emptyString());
     1447        fragment = createFragmentFromMarkup(document(), serializePreservingVisualAppearance(*range, nullptr, AnnotateForInterchange::No, ConvertBlocksToInlines::Yes), emptyString());
    14481448
    14491449    // A non-empty paragraph's style is moved when we copy and move it.  We don't move
  • trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm

    r236583 r236612  
    7777{
    7878    if (auto range = selectedRange())
    79         return createMarkup(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     79        return serializePreservingVisualAppearance(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
    8080    return { };
    8181}
  • trunk/Source/WebCore/editing/gtk/EditorGtk.cpp

    r236583 r236612  
    147147    pasteboardContent.canSmartCopyOrDelete = canSmartCopyOrDelete();
    148148    pasteboardContent.text = selectedTextForDataTransfer();
    149     pasteboardContent.markup = createMarkup(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     149    pasteboardContent.markup = serializePreservingVisualAppearance(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
    150150    pasteboard.write(pasteboardContent);
    151151}
  • trunk/Source/WebCore/editing/markup.cpp

    r236609 r236612  
    845845}
    846846
    847 String createMarkup(const Range& range, Vector<Node*>* nodes, AnnotateForInterchange annotate, ConvertBlocksToInlines convertBlocksToInlines, ResolveURLs urlsToReslve)
     847String serializePreservingVisualAppearance(const Range& range, Vector<Node*>* nodes, AnnotateForInterchange annotate, ConvertBlocksToInlines convertBlocksToInlines, ResolveURLs urlsToReslve)
    848848{
    849849    return createMarkupInternal(range.ownerDocument(), range, nodes, annotate, convertBlocksToInlines, urlsToReslve, MSOListMode::DoNotPreserve);
  • trunk/Source/WebCore/editing/markup.h

    r236583 r236612  
    7070enum class ResolveURLs : uint8_t { No, Yes, YesExcludingLocalFileURLsForPrivacy };
    7171enum class ConvertBlocksToInlines : uint8_t { No, Yes };
    72 WEBCORE_EXPORT String createMarkup(const Range&, Vector<Node*>* = nullptr, AnnotateForInterchange = AnnotateForInterchange::No, ConvertBlocksToInlines = ConvertBlocksToInlines::No, ResolveURLs = ResolveURLs::No);
     72WEBCORE_EXPORT String serializePreservingVisualAppearance(const Range&, Vector<Node*>* = nullptr, AnnotateForInterchange = AnnotateForInterchange::No, ConvertBlocksToInlines = ConvertBlocksToInlines::No, ResolveURLs = ResolveURLs::No);
    7373
    7474enum class SerializedNodes : uint8_t { SubtreeIncludingNode, SubtreesOfChildren };
    7575enum class SerializationSyntax : uint8_t { HTML, XML };
    7676WEBCORE_EXPORT String serializeFragment(const Node&, SerializedNodes, Vector<Node*>* = nullptr, ResolveURLs = ResolveURLs::No, Vector<QualifiedName>* tagNamesToSkip = nullptr, SerializationSyntax = SerializationSyntax::HTML);
    77 WEBCORE_EXPORT String serializeFragmentWithDocType(const Node&);
    7877
    7978String urlToMarkup(const URL&, const String& title);
  • trunk/Source/WebCore/editing/wpe/EditorWPE.cpp

    r236583 r236612  
    6565    PasteboardWebContent pasteboardContent;
    6666    pasteboardContent.text = selectedTextForDataTransfer();
    67     pasteboardContent.markup = createMarkup(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     67    pasteboardContent.markup = serializePreservingVisualAppearance(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
    6868    pasteboard.write(pasteboardContent);
    6969}
  • trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp

    r236583 r236612  
    461461    // FIXME: This is always "for interchange". Is that right?
    462462    Vector<Node*> nodeList;
    463     String markupString = documentTypeString(document) + createMarkup(*range, &nodeList, AnnotateForInterchange::Yes);
     463    String markupString = documentTypeString(document) + serializePreservingVisualAppearance(*range, &nodeList, AnnotateForInterchange::Yes);
    464464    return create(markupString, *frame, nodeList, nullptr);
    465465}
     
    556556    Vector<Node*> nodeList;
    557557    if (auto selectionRange = frame->selection().toNormalizedRange())
    558         builder.append(createMarkup(*selectionRange, &nodeList, AnnotateForInterchange::Yes));
     558        builder.append(serializePreservingVisualAppearance(*selectionRange, &nodeList, AnnotateForInterchange::Yes));
    559559
    560560    auto archive = create(builder.toString(), *frame, nodeList, nullptr);
  • trunk/Source/WebCore/platform/win/PasteboardWin.cpp

    r236583 r236612  
    445445
    446446    Vector<char> data;
    447     markupToCFHTML(createMarkup(selectedRange, nullptr, AnnotateForInterchange::Yes),
     447    markupToCFHTML(serializePreservingVisualAppearance(selectedRange, nullptr, AnnotateForInterchange::Yes),
    448448        selectedRange.startContainer().document().url().string(), data);
    449449    medium.hGlobal = createGlobalData(data);
  • trunk/Source/WebKit/ChangeLog

    r236610 r236612  
     12018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Rename createMarkup to serializePreservingVisualAppearance
     4        https://bugs.webkit.org/show_bug.cgi?id=190086
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
     9        (WebKit::WebEditorClient::updateGlobalSelection):
     10
    1112018-09-28  Commit Queue  <commit-queue@webkit.org>
    212
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp

    r236583 r236612  
    127127    pasteboardContent.canSmartCopyOrDelete = false;
    128128    pasteboardContent.text = range->text();
    129     pasteboardContent.markup = createMarkup(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     129    pasteboardContent.markup = serializePreservingVisualAppearance(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
    130130    Pasteboard::createForGlobalSelection()->write(pasteboardContent);
    131131}
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r236610 r236612  
     12018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Rename createMarkup to serializePreservingVisualAppearance
     4        https://bugs.webkit.org/show_bug.cgi?id=190086
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * DOM/WebDOMOperations.mm:
     9        (-[DOMRange markupString]):
     10
    1112018-09-28  Commit Queue  <commit-queue@webkit.org>
    212
  • trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm

    r236583 r236612  
    196196{
    197197    auto& range = *core(self);
    198     return String { documentTypeString(range.startContainer().document()) + createMarkup(range, nullptr, AnnotateForInterchange::Yes) };
     198    return String { documentTypeString(range.startContainer().document()) + serializePreservingVisualAppearance(range, nullptr, AnnotateForInterchange::Yes) };
    199199}
    200200
Note: See TracChangeset for help on using the changeset viewer.