Title: [236612] trunk/Source
Revision
236612
Author
[email protected]
Date
2018-09-28 14:08:54 -0700 (Fri, 28 Sep 2018)

Log 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]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236611 => 236612)


--- trunk/Source/WebCore/ChangeLog	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/ChangeLog	2018-09-28 21:08:54 UTC (rev 236612)
@@ -1,3 +1,33 @@
+2018-09-28  Ryosuke Niwa  <[email protected]>
+
+        Rename createMarkup to serializePreservingVisualAppearance
+        https://bugs.webkit.org/show_bug.cgi?id=190086
+
+        Reviewed by Wenson Hsieh.
+
+        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):
+
 2018-09-28  Simon Fraser  <[email protected]>
 
         Remove some unused RenderLayer code

Modified: trunk/Source/WebCore/dom/Range.cpp (236611 => 236612)


--- trunk/Source/WebCore/dom/Range.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/dom/Range.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -952,11 +952,6 @@
     return builder.toString();
 }
 
-String Range::toHTML() const
-{
-    return createMarkup(*this);
-}
-
 String Range::text() const
 {
     // We need to update layout, since plainText uses line boxes in the render tree.

Modified: trunk/Source/WebCore/dom/Range.h (236611 => 236612)


--- trunk/Source/WebCore/dom/Range.h	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/dom/Range.h	2018-09-28 21:08:54 UTC (rev 236612)
@@ -84,7 +84,6 @@
     WEBCORE_EXPORT ExceptionOr<void> insertNode(Ref<Node>&&);
     WEBCORE_EXPORT String toString() const;
 
-    String toHTML() const;
     WEBCORE_EXPORT String text() const;
 
     WEBCORE_EXPORT ExceptionOr<Ref<DocumentFragment>> createContextualFragment(const String& html);

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (236611 => 236612)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -1444,7 +1444,7 @@
     RefPtr<DocumentFragment> fragment;
     // This used to use a ternary for initialization, but that confused some versions of GCC, see bug 37912
     if (startOfParagraphToMove != endOfParagraphToMove)
-        fragment = createFragmentFromMarkup(document(), createMarkup(*range, nullptr, AnnotateForInterchange::No, ConvertBlocksToInlines::Yes), emptyString());
+        fragment = createFragmentFromMarkup(document(), serializePreservingVisualAppearance(*range, nullptr, AnnotateForInterchange::No, ConvertBlocksToInlines::Yes), emptyString());
 
     // A non-empty paragraph's style is moved when we copy and move it.  We don't move 
     // anything if we're given an empty paragraph, but an empty paragraph can have style

Modified: trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm (236611 => 236612)


--- trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm	2018-09-28 21:08:54 UTC (rev 236612)
@@ -76,7 +76,7 @@
 String Editor::selectionInHTMLFormat()
 {
     if (auto range = selectedRange())
-        return createMarkup(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
+        return serializePreservingVisualAppearance(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     return { };
 }
 

Modified: trunk/Source/WebCore/editing/gtk/EditorGtk.cpp (236611 => 236612)


--- trunk/Source/WebCore/editing/gtk/EditorGtk.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/editing/gtk/EditorGtk.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -146,7 +146,7 @@
     PasteboardWebContent pasteboardContent;
     pasteboardContent.canSmartCopyOrDelete = canSmartCopyOrDelete();
     pasteboardContent.text = selectedTextForDataTransfer();
-    pasteboardContent.markup = createMarkup(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
+    pasteboardContent.markup = serializePreservingVisualAppearance(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     pasteboard.write(pasteboardContent);
 }
 

Modified: trunk/Source/WebCore/editing/markup.cpp (236611 => 236612)


--- trunk/Source/WebCore/editing/markup.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/editing/markup.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -844,7 +844,7 @@
     return accumulator.takeResults();
 }
 
-String createMarkup(const Range& range, Vector<Node*>* nodes, AnnotateForInterchange annotate, ConvertBlocksToInlines convertBlocksToInlines, ResolveURLs urlsToReslve)
+String serializePreservingVisualAppearance(const Range& range, Vector<Node*>* nodes, AnnotateForInterchange annotate, ConvertBlocksToInlines convertBlocksToInlines, ResolveURLs urlsToReslve)
 {
     return createMarkupInternal(range.ownerDocument(), range, nodes, annotate, convertBlocksToInlines, urlsToReslve, MSOListMode::DoNotPreserve);
 }

Modified: trunk/Source/WebCore/editing/markup.h (236611 => 236612)


--- trunk/Source/WebCore/editing/markup.h	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/editing/markup.h	2018-09-28 21:08:54 UTC (rev 236612)
@@ -69,12 +69,11 @@
 
 enum class ResolveURLs : uint8_t { No, Yes, YesExcludingLocalFileURLsForPrivacy };
 enum class ConvertBlocksToInlines : uint8_t { No, Yes };
-WEBCORE_EXPORT String createMarkup(const Range&, Vector<Node*>* = nullptr, AnnotateForInterchange = AnnotateForInterchange::No, ConvertBlocksToInlines = ConvertBlocksToInlines::No, ResolveURLs = ResolveURLs::No);
+WEBCORE_EXPORT String serializePreservingVisualAppearance(const Range&, Vector<Node*>* = nullptr, AnnotateForInterchange = AnnotateForInterchange::No, ConvertBlocksToInlines = ConvertBlocksToInlines::No, ResolveURLs = ResolveURLs::No);
 
 enum class SerializedNodes : uint8_t { SubtreeIncludingNode, SubtreesOfChildren };
 enum class SerializationSyntax : uint8_t { HTML, XML };
 WEBCORE_EXPORT String serializeFragment(const Node&, SerializedNodes, Vector<Node*>* = nullptr, ResolveURLs = ResolveURLs::No, Vector<QualifiedName>* tagNamesToSkip = nullptr, SerializationSyntax = SerializationSyntax::HTML);
-WEBCORE_EXPORT String serializeFragmentWithDocType(const Node&);
 
 String urlToMarkup(const URL&, const String& title);
 

Modified: trunk/Source/WebCore/editing/wpe/EditorWPE.cpp (236611 => 236612)


--- trunk/Source/WebCore/editing/wpe/EditorWPE.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/editing/wpe/EditorWPE.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -64,7 +64,7 @@
 {
     PasteboardWebContent pasteboardContent;
     pasteboardContent.text = selectedTextForDataTransfer();
-    pasteboardContent.markup = createMarkup(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
+    pasteboardContent.markup = serializePreservingVisualAppearance(*selectedRange(), nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     pasteboard.write(pasteboardContent);
 }
 

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (236611 => 236612)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -460,7 +460,7 @@
 
     // FIXME: This is always "for interchange". Is that right?
     Vector<Node*> nodeList;
-    String markupString = documentTypeString(document) + createMarkup(*range, &nodeList, AnnotateForInterchange::Yes);
+    String markupString = documentTypeString(document) + serializePreservingVisualAppearance(*range, &nodeList, AnnotateForInterchange::Yes);
     return create(markupString, *frame, nodeList, nullptr);
 }
 
@@ -555,7 +555,7 @@
 
     Vector<Node*> nodeList;
     if (auto selectionRange = frame->selection().toNormalizedRange())
-        builder.append(createMarkup(*selectionRange, &nodeList, AnnotateForInterchange::Yes));
+        builder.append(serializePreservingVisualAppearance(*selectionRange, &nodeList, AnnotateForInterchange::Yes));
 
     auto archive = create(builder.toString(), *frame, nodeList, nullptr);
     

Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (236611 => 236612)


--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -444,7 +444,7 @@
     medium.tymed = TYMED_HGLOBAL;
 
     Vector<char> data;
-    markupToCFHTML(createMarkup(selectedRange, nullptr, AnnotateForInterchange::Yes),
+    markupToCFHTML(serializePreservingVisualAppearance(selectedRange, nullptr, AnnotateForInterchange::Yes),
         selectedRange.startContainer().document().url().string(), data);
     medium.hGlobal = createGlobalData(data);
     if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))

Modified: trunk/Source/WebKit/ChangeLog (236611 => 236612)


--- trunk/Source/WebKit/ChangeLog	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebKit/ChangeLog	2018-09-28 21:08:54 UTC (rev 236612)
@@ -1,3 +1,13 @@
+2018-09-28  Ryosuke Niwa  <[email protected]>
+
+        Rename createMarkup to serializePreservingVisualAppearance
+        https://bugs.webkit.org/show_bug.cgi?id=190086
+
+        Reviewed by Wenson Hsieh.
+
+        * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
+        (WebKit::WebEditorClient::updateGlobalSelection):
+
 2018-09-28  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r236605.

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp (236611 => 236612)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp	2018-09-28 21:08:54 UTC (rev 236612)
@@ -126,7 +126,7 @@
     PasteboardWebContent pasteboardContent;
     pasteboardContent.canSmartCopyOrDelete = false;
     pasteboardContent.text = range->text();
-    pasteboardContent.markup = createMarkup(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
+    pasteboardContent.markup = serializePreservingVisualAppearance(*range, nullptr, AnnotateForInterchange::Yes, ConvertBlocksToInlines::No, ResolveURLs::YesExcludingLocalFileURLsForPrivacy);
     Pasteboard::createForGlobalSelection()->write(pasteboardContent);
 }
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (236611 => 236612)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-09-28 21:08:54 UTC (rev 236612)
@@ -1,3 +1,13 @@
+2018-09-28  Ryosuke Niwa  <[email protected]>
+
+        Rename createMarkup to serializePreservingVisualAppearance
+        https://bugs.webkit.org/show_bug.cgi?id=190086
+
+        Reviewed by Wenson Hsieh.
+
+        * DOM/WebDOMOperations.mm:
+        (-[DOMRange markupString]):
+
 2018-09-28  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r236605.

Modified: trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm (236611 => 236612)


--- trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm	2018-09-28 21:03:23 UTC (rev 236611)
+++ trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm	2018-09-28 21:08:54 UTC (rev 236612)
@@ -195,7 +195,7 @@
 - (NSString *)markupString
 {
     auto& range = *core(self);
-    return String { documentTypeString(range.startContainer().document()) + createMarkup(range, nullptr, AnnotateForInterchange::Yes) };
+    return String { documentTypeString(range.startContainer().document()) + serializePreservingVisualAppearance(range, nullptr, AnnotateForInterchange::Yes) };
 }
 
 @end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to