WebKit Bugzilla
Attachment 360735 Details for
Bug 194070
: Don't insert spaces at the beginning of a newline when using smart-copy-paste
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194070-20190131093614.patch (text/plain), 9.69 KB, created by
Megan Gardner
on 2019-01-31 09:36:14 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2019-01-31 09:36:14 PST
Size:
9.69 KB
patch
obsolete
>Subversion Revision: 240631 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f43ca04879d1929a18de844674b21585d2b7153e..b3c6f761c06cb9848e7791dccbbb6250e185cddb 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-01-30 Megan Gardner <megan_gardner@apple.com> >+ >+ Don't insert spaces at the beginning of a newline when using smart-copy-paste >+ https://bugs.webkit.org/show_bug.cgi?id=194070 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ If our inserted content end is at the beginning of a paragraph, do not insert a space. >+ Also, if our inserted content beginning is at the end of a paragar, do not instert a space. >+ >+ Test: editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html >+ >+ * editing/ReplaceSelectionCommand.cpp: >+ (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace): >+ > 2019-01-28 Timothy Hatcher <timothy@apple.com> > > Make it easier for non-Apple ports to enable dark mode CSS support. >diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp >index f8239d2aa71ffc1f715176ea0f5366a260d97fcd..47d60dbbc22a3b38f2e76d945f467156b49aac41 100644 >--- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp >+++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp >@@ -1344,7 +1344,7 @@ void ReplaceSelectionCommand::addSpacesForSmartReplace() > endOffset = endUpstream.offsetInContainerNode(); > } > >- bool needsTrailingSpace = !isEndOfParagraph(endOfInsertedContent) && !isCharacterSmartReplaceExemptConsideringNonBreakingSpace(endOfInsertedContent.characterAfter(), false); >+ bool needsTrailingSpace = !isEndOfParagraph(endOfInsertedContent) && !isStartOfParagraph(endOfInsertedContent) && !isCharacterSmartReplaceExemptConsideringNonBreakingSpace(endOfInsertedContent.characterAfter(), false); > if (needsTrailingSpace && endNode) { > bool collapseWhiteSpace = !endNode->renderer() || endNode->renderer()->style().collapseWhiteSpace(); > if (is<Text>(*endNode)) { >@@ -1368,7 +1368,7 @@ void ReplaceSelectionCommand::addSpacesForSmartReplace() > startOffset = startDownstream.offsetInContainerNode(); > } > >- bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isCharacterSmartReplaceExemptConsideringNonBreakingSpace(startOfInsertedContent.previous().characterAfter(), true); >+ bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isEndOfParagraph(startOfInsertedContent) && !isCharacterSmartReplaceExemptConsideringNonBreakingSpace(startOfInsertedContent.previous().characterAfter(), true); > if (needsLeadingSpace && startNode) { > bool collapseWhiteSpace = !startNode->renderer() || startNode->renderer()->style().collapseWhiteSpace(); > if (is<Text>(*startNode)) { >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index b580a7d443ae6c4d8daf7ade4101c2f952b8e67c..940432fac4e15b44aaf8e3d7a552f1555e3be1ed 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-30 Megan Gardner <megan_gardner@apple.com> >+ >+ Don't insert spaces at the beginning of a newline when using smart-copy-paste >+ https://bugs.webkit.org/show_bug.cgi?id=194070 >+ >+ Add test for smart copy paste around newlines. >+ Rebaseline a test the is dependant on a console log that changes lines. >+ Add additional helper functions to ui-helper.js. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea-expected.txt: Added. >+ * editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html: Added. >+ * http/tests/security/anchor-download-block-crossorigin-expected.txt: >+ * platform/mac/TestExpectations: >+ * resources/ui-helper.js: >+ (window.UIHelper.doubleClickAt): >+ (window.UIHelper.doubleClickAtThenDragTo): >+ (window.UIHelper.async.selectWordByDoubleTapOrClick): >+ > 2019-01-28 Daniel Bates <dabates@apple.com> > > [iOS] Make Window virtual key code computation match Mac >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 4df547b03ac2ac9414364d722b24b4764b429c08..95275e489a7d5698b6e9e59af67abd2655e1e871 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -52,6 +52,7 @@ http/tests/cookies/same-site [ Skip ] > system-preview [ Skip ] > editing/images [ Skip ] > pointerevents/ios [ Skip ] >+editing/pasteboard/mac [ Skip ] > > # window.showModalDialog is only tested in DumpRenderTree on Mac. > editing/execCommand/show-modal-dialog-during-execCommand.html [ Skip ] >diff --git a/LayoutTests/editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea-expected.txt b/LayoutTests/editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a2936554114c69bb392f0426bf4707f2c1b0562e >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS selectFirstLineIncludingLineBreak(); copyPaste(); textarea.selectionEnd is offsetAfterLineBreak >+ >diff --git a/LayoutTests/editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html b/LayoutTests/editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7599f45248adb8279b554a4b4687ca1e80bbd278 >--- /dev/null >+++ b/LayoutTests/editing/pasteboard/mac/copy-smartpaste-first-line-in-textarea.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<textarea id="test" cols=50 rows=10>first >+second</textarea> >+<script src="../../../resources/js-test-pre.js"></script> >+<script src="../../editing.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<p id="console"></p> >+<script> >+ >+if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+var textarea = document.querySelector('textarea'); >+ >+function selectFirstLineIncludingLineBreak() { >+ var element = document.getElementById("test"); >+ const boundingRect = element.getBoundingClientRect(); >+ const x = boundingRect.x + 5; >+ const y = boundingRect.y + 5; >+ UIHelper.doubleClickAtThenDragTo(x, y, x + boundingRect.width/2, y); >+} >+ >+function copyPaste() { >+ document.execCommand('copy'); >+ document.execCommand('paste'); >+} >+ >+var offsetAfterLineBreak = 6; >+shouldBe("selectFirstLineIncludingLineBreak(); copyPaste(); textarea.selectionEnd", "offsetAfterLineBreak"); >+ >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt b/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt >index 06d6cf579627cdf0f85b663cdf238fd49c77435d..fc6d3705fadcf23e1149fb3a0ea8935a8b4b3395 100644 >--- a/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt >+++ b/LayoutTests/http/tests/security/anchor-download-block-crossorigin-expected.txt >@@ -1,4 +1,4 @@ >-CONSOLE MESSAGE: line 88: The download attribute on anchor was ignored because its href URL has a different security origin. >+CONSOLE MESSAGE: line 107: The download attribute on anchor was ignored because its href URL has a different security origin. > Tests that the download attribute is ignored if the link is cross origin. > > It should navigate the subframe instead of downloading the file. >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index a555df820e3633231d6b4a5cf5a3ada414314057..eb968eff3a6d075aeda0ea532906ade173db51b6 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -11,6 +11,7 @@ displaylists [ Pass ] > editing/mac [ Pass ] > fast/scrolling/latching [ Pass ] > media/mac [ Pass ] >+editing/pasteboard/mac [ Pass ] > > fast/forms/search/search-padding-cancel-results-buttons.html [ Pass ] > fast/forms/search/search-results-hidden-crash.html [ Pass ] >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 5b320bc4d4541d781eacca63bc8fe409def6078a..070b53fab042df074c447f010695a9183cdba358 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -10,6 +10,25 @@ window.UIHelper = class UIHelper { > return window.testRunner.isWebKit2; > } > >+ static doubleClickAt(x, y) >+ { >+ eventSender.mouseMoveTo(x, y); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ } >+ >+ static doubleClickAtThenDragTo(x1, y1, x2, y2) >+ { >+ eventSender.mouseMoveTo(x1, y1); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ eventSender.mouseDown(); >+ eventSender.mouseMoveTo(x2, y2); >+ eventSender.mouseUp(); >+ } >+ > static tapAt(x, y) > { > console.assert(this.isIOS()); >@@ -104,6 +123,22 @@ window.UIHelper = class UIHelper { > return UIHelper.activateAt(x, y); > } > >+ static async selectWordByDoubleTapOrClick(element, relativeX = 5, relativeY = 5) >+ { >+ const boundingRect = element.getBoundingClientRect(); >+ const x = boundingRect.x + relativeX; >+ const y = boundingRect.y + relativeY; >+ if (this.isIOS()) { >+ await UIHelper.tapAt(x, y); >+ await UIHelper.doubleTapAt(x, y); >+ // only here to deal with async/sync copy/paste calls. >+ // once <rdar://problem/16207002> is resolved, should be able to remove for faster tests. >+ await new Promise(resolve => testRunner.runUIScript("uiController.uiScriptComplete()", resolve)); >+ } else { >+ await UIHelper.doubleClickAt(x, y); >+ } >+ } >+ > static keyDown(key, modifiers=[]) > { > if (!this.isWebKit2() || !this.isIOS()) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194070
:
360663
|
360670
|
360678
|
360680
|
360682
|
360683
|
360692
|
360735
|
360799