Diff
Modified: branches/safari-602-branch/LayoutTests/ChangeLog (205239 => 205240)
--- branches/safari-602-branch/LayoutTests/ChangeLog 2016-08-31 07:39:09 UTC (rev 205239)
+++ branches/safari-602-branch/LayoutTests/ChangeLog 2016-08-31 07:39:13 UTC (rev 205240)
@@ -1,3 +1,27 @@
+2016-08-31 Babak Shafiei <[email protected]>
+
+ Merge r205044. rdar://problem/27933564
+
+ 2016-08-26 Beth Dakin <[email protected]>
+
+ charactersAroundPosition can be wrong because it crosses editing boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=161215
+ -and corresponding-
+ rdar://problem/27933564
+
+ Reviewed by Ryosuke Niwa.
+
+ New test.
+ * editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt: Added.
+ * editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html: Added.
+
+ This test is going back to its pre-https://trac.webkit.org/changeset/195078 state.
+ That change caused this test to have a different layout because it caused more
+ layouts to happen. Now that we don’t allow the call to charactersAroundPosition()
+ to cross editing boundaries, those layouts don’t happen, and we have the old
+ behavior back.
+ * platform/mac/fast/dom/focus-contenteditable-expected.txt:
+
2016-08-30 Babak Shafiei <[email protected]>
Merge r204983. rdar://problem/27952772
Added: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt (0 => 205240)
--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt 2016-08-31 07:39:13 UTC (rev 205240)
@@ -0,0 +1,28 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertText:happy replacingDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldInsertText: replacingDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This test verifies that accepted candidates replace the text before the caret.
+
+happy
+
+
Added: branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html (0 => 205240)
--- branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html (rev 0)
+++ branches/safari-602-branch/LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html 2016-08-31 07:39:13 UTC (rev 205240)
@@ -0,0 +1,38 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function editingTest() {
+ edit = document.getElementById('edit');
+ edit.focus();
+ typeCharacterCommand('h');
+ typeCharacterCommand('a');
+ if (window.internals)
+ internals.handleAcceptedCandidate("happy");
+
+ if (window.testRunner)
+ testRunner.dumpAsText(true);
+}
+
+</script>
+</head>
+<body>
+<p>This test verifies that accepted candidates replace the text before the caret.</p>
+<div style="border:1px solid black;">
+ <div contenteditable="true" id="edit"></div>
+</div>
+
+<div style="visibility:hidden;">
+ <br>
+</div>
+
+<div style="width: 1px; height: 1px;"></div>
+
+<script>
+runEditingTest();
+</script>
+<script src=""
+</body>
+</html>
Modified: branches/safari-602-branch/LayoutTests/platform/mac/fast/dom/focus-contenteditable-expected.txt (205239 => 205240)
--- branches/safari-602-branch/LayoutTests/platform/mac/fast/dom/focus-contenteditable-expected.txt 2016-08-31 07:39:09 UTC (rev 205239)
+++ branches/safari-602-branch/LayoutTests/platform/mac/fast/dom/focus-contenteditable-expected.txt 2016-08-31 07:39:13 UTC (rev 205240)
@@ -6,7 +6,7 @@
RenderBlock (anonymous) at (0,0) size 769x36
RenderText {#text} at (0,0) size 509x18
text run at (0,0) width 509: "This test will try to call focus() on a contenteditable div, and then a normal div. "
- RenderBR {BR} at (0,0) size 0x0
+ RenderBR {BR} at (508,14) size 1x0
RenderText {#text} at (0,18) size 379x18
text run at (0,18) width 379: "The window should scroll to reveal the contenteditable div."
RenderBlock {DIV} at (0,36) size 500x800
Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (205239 => 205240)
--- branches/safari-602-branch/Source/WebCore/ChangeLog 2016-08-31 07:39:09 UTC (rev 205239)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog 2016-08-31 07:39:13 UTC (rev 205240)
@@ -1,5 +1,28 @@
2016-08-31 Babak Shafiei <[email protected]>
+ Merge r205044. rdar://problem/27933564
+
+ 2016-08-26 Beth Dakin <[email protected]>
+
+ charactersAroundPosition can be wrong because it crosses editing boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=161215
+ -and corresponding-
+ rdar://problem/27933564
+
+ Reviewed by Ryosuke Niwa.
+
+ charactersAroundPosition() should not cross editing boundaries. This patch fixes
+ that by making nextCharacterBoundaryInDirection() take an
+ EditingBoundaryCrossingRule parameter to pass onto VisiblePosition::next() and
+ VisiblePosition::previous().
+
+ * editing/VisibleUnits.cpp:
+ (WebCore::nextCharacterBoundaryInDirection):
+ (WebCore::positionOfNextBoundaryOfGranularity):
+ (WebCore::charactersAroundPosition):
+
+2016-08-31 Babak Shafiei <[email protected]>
+
Merge r204989. rdar://problem/28015116
2016-08-25 Wenson Hsieh <[email protected]>
Modified: branches/safari-602-branch/Source/WebCore/editing/VisibleUnits.cpp (205239 => 205240)
--- branches/safari-602-branch/Source/WebCore/editing/VisibleUnits.cpp 2016-08-31 07:39:09 UTC (rev 205239)
+++ branches/safari-602-branch/Source/WebCore/editing/VisibleUnits.cpp 2016-08-31 07:39:13 UTC (rev 205240)
@@ -1637,9 +1637,9 @@
return (prevBoundary < vp && vp < nextBoundary);
}
-static VisiblePosition nextCharacterBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
+static VisiblePosition nextCharacterBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction, EditingBoundaryCrossingRule rule)
{
- return directionIsDownstream(direction) ? vp.next() : vp.previous();
+ return directionIsDownstream(direction) ? vp.next(rule) : vp.previous(rule);
}
static VisiblePosition nextWordBoundaryInDirection(const VisiblePosition& vp, SelectionDirection direction)
@@ -1779,7 +1779,7 @@
{
switch (granularity) {
case CharacterGranularity:
- return nextCharacterBoundaryInDirection(vp, direction);
+ return nextCharacterBoundaryInDirection(vp, direction, CanCrossEditingBoundary);
case WordGranularity:
return nextWordBoundaryInDirection(vp, direction);
case SentenceGranularity:
@@ -1891,14 +1891,14 @@
VisiblePosition startPosition = position;
VisiblePosition endPosition = position;
- VisiblePosition nextPosition = nextCharacterBoundaryInDirection(position, DirectionForward);
+ VisiblePosition nextPosition = nextCharacterBoundaryInDirection(position, DirectionForward, CannotCrossEditingBoundary);
if (nextPosition.isNotNull())
endPosition = nextPosition;
- VisiblePosition previousPosition = nextCharacterBoundaryInDirection(position, DirectionBackward);
+ VisiblePosition previousPosition = nextCharacterBoundaryInDirection(position, DirectionBackward, CannotCrossEditingBoundary);
if (previousPosition.isNotNull()) {
startPosition = previousPosition;
- previousPosition = nextCharacterBoundaryInDirection(previousPosition, DirectionBackward);
+ previousPosition = nextCharacterBoundaryInDirection(previousPosition, DirectionBackward, CannotCrossEditingBoundary);
if (previousPosition.isNotNull())
startPosition = previousPosition;
}