Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2018 01:59:52 +0000 (01:59 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2018 01:59:52 +0000 (01:59 +0000)
commit9e884f5d4751d2f23f5723bfa7f6a199b60a6b41
tree067221231c3853753e580ba5c34fb9d5b2e05e8a
parentd41d5ac52204dd80393c79e5d5c45dc68751ce2b
Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
https://bugs.webkit.org/show_bug.cgi?id=190108

Reviewed by Wenson Hsieh.

Source/WebCore:

Added a version of serializePreservingVisualAppearance which takes VisibleSelection so that we can avoid creating
a range simply to get the first node and the end node of the selection later. This simple change also fixes a bug
demonstrated in editing/pasteboard/paste-table-003.html.

Test: editing/pasteboard/paste-table-003.html

* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::selectionInHTMLFormat): Adopt the new variant.
* editing/gtk/EditorGtk.cpp:
(WebCore::Editor::writeSelectionToPasteboard): Ditto.
* editing/markup.cpp:
(WebCore::serializePreservingVisualAppearance): Added.
* editing/markup.h:
* editing/wpe/EditorWPE.cpp:
(WebCore::Editor::writeSelectionToPasteboard): Ditto.
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createFromSelection): Ditto.
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeSelection): Ditto.

Source/WebKit:

Adopt the new variant which directly takes VisibleSelection.

* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::updateGlobalSelection):

LayoutTests:

Rebaselined the test since the bug that interchange new lines are inserted in the last table cell is fixed.
Also updated the description in the test to reflect this change.

* editing/pasteboard/paste-table-003-expected.txt:
* editing/pasteboard/paste-table-003.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/paste-table-003-expected.txt
LayoutTests/editing/pasteboard/paste-table-003.html
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/EditorCocoa.mm
Source/WebCore/editing/gtk/EditorGtk.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/editing/markup.h
Source/WebCore/editing/wpe/EditorWPE.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/platform/win/PasteboardWin.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp