Title: [219795] trunk/Source
- Revision
- 219795
- Author
- [email protected]
- Date
- 2017-07-23 23:05:17 -0700 (Sun, 23 Jul 2017)
Log Message
[iOS WK2] 5 DataInteractionTests are failing: observed selection rects after dropping don't match expected values
https://bugs.webkit.org/show_bug.cgi?id=174769
<rdar://problem/33478864>
Reviewed by Tim Horton.
Source/WebCore:
These tests began failing after r219541, due to a change in behavior of whether or not we call
setIgnoreSelectionChanges(false, RevealSelection::No) or setIgnoreSelectionChanges(false, RevealSelection::Yes)
when performing a text editing drop.
Before r219541, we would not reveal the selection when performing an edit drag operation. This is because in
WebPage::performDragControllerAction, we would begin ignoring selection changes by calling
setIgnoreSelectionChanges(true). However, while taking a text indicator snapshot, we would stop ignoring
selection in TextIndicator::createWithRange due to us calling setIgnoreSelectionChanges(false,
RevealSelection::No) at the end of the function. Then, when we return to the scope of
WebPage::performDragControllerAction and try to setIgnoreSelectionChanges(false), this is a no-op because we've
already stopped ignoring selection changes.
After r219541, switching to using TemporarySelectionChange means that TextIndicator::createWithRange now means
we respect whether or not we were already ignoring selection before taking the snapshot, so we won't always
setIgnoreSelectionChanges(false) at the end. This means that selection changes will now be correctly ignored
when performing a drag operation, but this also means that we'll try to reveal the selection, since
WebPage::performDragControllerAction calls setIgnoreSelectionChanges(false), for which RevealSelection::Yes
is used by default.
Revealing the selection in WebPage::performDragControllerAction was unintended in the first place, so we should
revert to calling setIgnoreSelectionChanges(false, RevealSelection::No). To ensure this, we adopt
TemporarySelectionChange here and pass only TemporarySelectionOptionIgnoreSelectionChanges, so that we won't
additionally try to reveal selection after the drop. This is consistent with behavior prior to macOS 10.13 and
iOS 11. Additionally, this patch also moves the call to ignore selection change from WebKit into WebCore, so
that whether we ignore selection is consistent across both WebKit1 and WebKit2.
* page/DragController.cpp:
(WebCore::DragController::performDragOperation):
Source/WebKit:
Fixes several API tests in the DataInteractionTests suite. See Source/WebCore/ChangeLog for more details.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performDragControllerAction):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (219794 => 219795)
--- trunk/Source/WebCore/ChangeLog 2017-07-24 05:58:46 UTC (rev 219794)
+++ trunk/Source/WebCore/ChangeLog 2017-07-24 06:05:17 UTC (rev 219795)
@@ -1,3 +1,40 @@
+2017-07-23 Wenson Hsieh <[email protected]>
+
+ [iOS WK2] 5 DataInteractionTests are failing: observed selection rects after dropping don't match expected values
+ https://bugs.webkit.org/show_bug.cgi?id=174769
+ <rdar://problem/33478864>
+
+ Reviewed by Tim Horton.
+
+ These tests began failing after r219541, due to a change in behavior of whether or not we call
+ setIgnoreSelectionChanges(false, RevealSelection::No) or setIgnoreSelectionChanges(false, RevealSelection::Yes)
+ when performing a text editing drop.
+
+ Before r219541, we would not reveal the selection when performing an edit drag operation. This is because in
+ WebPage::performDragControllerAction, we would begin ignoring selection changes by calling
+ setIgnoreSelectionChanges(true). However, while taking a text indicator snapshot, we would stop ignoring
+ selection in TextIndicator::createWithRange due to us calling setIgnoreSelectionChanges(false,
+ RevealSelection::No) at the end of the function. Then, when we return to the scope of
+ WebPage::performDragControllerAction and try to setIgnoreSelectionChanges(false), this is a no-op because we've
+ already stopped ignoring selection changes.
+
+ After r219541, switching to using TemporarySelectionChange means that TextIndicator::createWithRange now means
+ we respect whether or not we were already ignoring selection before taking the snapshot, so we won't always
+ setIgnoreSelectionChanges(false) at the end. This means that selection changes will now be correctly ignored
+ when performing a drag operation, but this also means that we'll try to reveal the selection, since
+ WebPage::performDragControllerAction calls setIgnoreSelectionChanges(false), for which RevealSelection::Yes
+ is used by default.
+
+ Revealing the selection in WebPage::performDragControllerAction was unintended in the first place, so we should
+ revert to calling setIgnoreSelectionChanges(false, RevealSelection::No). To ensure this, we adopt
+ TemporarySelectionChange here and pass only TemporarySelectionOptionIgnoreSelectionChanges, so that we won't
+ additionally try to reveal selection after the drop. This is consistent with behavior prior to macOS 10.13 and
+ iOS 11. Additionally, this patch also moves the call to ignore selection change from WebKit into WebCore, so
+ that whether we ignore selection is consistent across both WebKit1 and WebKit2.
+
+ * page/DragController.cpp:
+ (WebCore::DragController::performDragOperation):
+
2017-07-23 Chris Dumez <[email protected]>
Drop ExceptionCodeDescription class
Modified: trunk/Source/WebCore/page/DragController.cpp (219794 => 219795)
--- trunk/Source/WebCore/page/DragController.cpp 2017-07-24 05:58:46 UTC (rev 219794)
+++ trunk/Source/WebCore/page/DragController.cpp 2017-07-24 06:05:17 UTC (rev 219795)
@@ -46,6 +46,7 @@
#include "ElementAncestorIterator.h"
#include "EventHandler.h"
#include "FloatRect.h"
+#include "FocusController.h"
#include "FrameLoadRequest.h"
#include "FrameLoader.h"
#include "FrameSelection.h"
@@ -258,6 +259,7 @@
bool DragController::performDragOperation(const DragData& dragData)
{
SetForScope<bool> isPerformingDrop(m_isPerformingDrop, true);
+ TemporarySelectionChange ignoreSelectionChanges(m_page.focusController().focusedOrMainFrame(), std::nullopt, TemporarySelectionOptionIgnoreSelectionChanges);
m_documentUnderMouse = m_page.mainFrame().documentAtPoint(dragData.clientPosition());
Modified: trunk/Source/WebKit/ChangeLog (219794 => 219795)
--- trunk/Source/WebKit/ChangeLog 2017-07-24 05:58:46 UTC (rev 219794)
+++ trunk/Source/WebKit/ChangeLog 2017-07-24 06:05:17 UTC (rev 219795)
@@ -1,3 +1,16 @@
+2017-07-23 Wenson Hsieh <[email protected]>
+
+ [iOS WK2] 5 DataInteractionTests are failing: observed selection rects after dropping don't match expected values
+ https://bugs.webkit.org/show_bug.cgi?id=174769
+ <rdar://problem/33478864>
+
+ Reviewed by Tim Horton.
+
+ Fixes several API tests in the DataInteractionTests suite. See Source/WebCore/ChangeLog for more details.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::performDragControllerAction):
+
2017-07-20 Carlos Garcia Campos <[email protected]>
WebDriver: implement page load timeout
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (219794 => 219795)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-07-24 05:58:46 UTC (rev 219794)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-07-24 06:05:17 UTC (rev 219795)
@@ -3616,10 +3616,7 @@
m_pendingDropExtensionsForFileUpload.append(extension);
}
- auto& frame = m_page->focusController().focusedOrMainFrame();
- frame.editor().setIgnoreSelectionChanges(true);
bool handled = m_page->dragController().performDragOperation(dragData);
- frame.editor().setIgnoreSelectionChanges(false);
// If we started loading a local file, the sandbox extension tracker would have adopted this
// pending drop sandbox extension. If not, we'll play it safe and clear it.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes