Title: [156158] trunk
Revision
156158
Author
[email protected]
Date
2013-09-20 06:17:07 -0700 (Fri, 20 Sep 2013)

Log Message

Source/WebCore: Make "autoscroll for drag'n drop" a setting
https://bugs.webkit.org/show_bug.cgi?id=121559

Reviewed by Ryosuke Niwa.
Patch by Antonio Gomes <[email protected]>

Currently, there is a ChromeClient hook to make the
feature opt'ed-in or out. That makes it harder to test the
feature on ports that do not enable it, e.g. Mac/WebKit2 port.
However, Mac/WebKit2 is the port that has the best drag'n drop
WTR implementation.

Patch changes the toggle on/off mechanism to be a setting,
and exposes it through InternalSetting interface for testing.

* page/AutoscrollController.cpp:
(WebCore::AutoscrollController::updateDragAndDrop):
* page/ChromeClient.h:
* page/Settings.in:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setAutoscrollForDragAndDropEnabled):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

LayoutTests: Make "autoscroll" for drag'n drop a setting
https://bugs.webkit.org/show_bug.cgi?id=121559

* fast/events/drag-and-drop-autoscroll.html:

Adapts the test so that is toggles the feature on
via InternalSettings interface.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156157 => 156158)


--- trunk/LayoutTests/ChangeLog	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/LayoutTests/ChangeLog	2013-09-20 13:17:07 UTC (rev 156158)
@@ -1,3 +1,15 @@
+2013-09-18  Antonio Gomes  <[email protected]>
+
+        Make "autoscroll" for drag'n drop a setting
+        https://bugs.webkit.org/show_bug.cgi?id=121559
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/events/drag-and-drop-autoscroll.html:
+
+        Adapts the test so that is toggles the feature on
+        via InternalSettings interface.
+
 2013-09-20  Gabor Abraham  <[email protected]>
 
         [Qt] Unreviewed gardening. Update tests after change to Qt 5.1.1

Modified: trunk/LayoutTests/fast/events/drag-and-drop-autoscroll.html (156157 => 156158)


--- trunk/LayoutTests/fast/events/drag-and-drop-autoscroll.html	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/LayoutTests/fast/events/drag-and-drop-autoscroll.html	2013-09-20 13:17:07 UTC (rev 156158)
@@ -103,6 +103,7 @@
         return;
     }
 
+    window.internals.settings.setAutoscrollForDragAndDropEnabled(true);
     window.jsTestIsAsync = true;
     window.setTimeout(testIt, 0);
 }

Modified: trunk/Source/WebCore/ChangeLog (156157 => 156158)


--- trunk/Source/WebCore/ChangeLog	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/ChangeLog	2013-09-20 13:17:07 UTC (rev 156158)
@@ -1,3 +1,30 @@
+2013-09-18  Antonio Gomes  <[email protected]>
+
+        Make "autoscroll for drag'n drop" a setting
+        https://bugs.webkit.org/show_bug.cgi?id=121559
+
+        Reviewed by Ryosuke Niwa.
+
+        Currently, there is a ChromeClient hook to make the
+        feature opt'ed-in or out. That makes it harder to test the
+        feature on ports that do not enable it, e.g. Mac/WebKit2 port.
+        However, Mac/WebKit2 is the port that has the best drag'n drop
+        WTR implementation.
+
+        Patch changes the toggle on/off mechanism to be a setting,
+        and exposes it through InternalSetting interface for testing.
+
+        * page/AutoscrollController.cpp:
+        (WebCore::AutoscrollController::updateDragAndDrop):
+        * page/ChromeClient.h:
+        * page/Settings.in:
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup):
+        (WebCore::InternalSettings::Backup::restoreTo):
+        (WebCore::InternalSettings::setAutoscrollForDragAndDropEnabled):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2013-09-16  Antonio Gomes  <[email protected]>
 
         StrictTypeChecking extended attribute fails for methods with sequence<T>

Modified: trunk/Source/WebCore/page/AutoscrollController.cpp (156157 => 156158)


--- trunk/Source/WebCore/page/AutoscrollController.cpp	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/page/AutoscrollController.cpp	2013-09-20 13:17:07 UTC (rev 156158)
@@ -28,8 +28,6 @@
 #include "config.h"
 #include "AutoscrollController.h"
 
-#include "Chrome.h"
-#include "ChromeClient.h"
 #include "EventHandler.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -38,6 +36,7 @@
 #include "RenderBox.h"
 #include "RenderView.h"
 #include "ScrollView.h"
+#include "Settings.h"
 #include <wtf/CurrentTime.h>
 
 namespace WebCore {
@@ -159,7 +158,7 @@
     Frame& frame = scrollable->frame();
 
     Page* page = frame.page();
-    if (!page || !page->chrome().client().shouldAutoscrollForDragAndDrop(scrollable)) {
+    if (!page || !page->settings().autoscrollForDragAndDropEnabled()) {
         stopAutoscrollTimer();
         return;
     }

Modified: trunk/Source/WebCore/page/ChromeClient.h (156157 => 156158)


--- trunk/Source/WebCore/page/ChromeClient.h	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/page/ChromeClient.h	2013-09-20 13:17:07 UTC (rev 156158)
@@ -359,9 +359,6 @@
     virtual String plugInExtraStyleSheet() const { return String(); }
     virtual String plugInExtraScript() const { return String(); }
 
-    // FIXME: Port should return true using heuristic based on scrollable(RenderBox).
-    virtual bool shouldAutoscrollForDragAndDrop(RenderBox*) const { return false; }
-
     virtual void didAssociateFormControls(const Vector<RefPtr<Element> >&) { };
     virtual bool shouldNotifyOnFormChanges() { return false; };
 

Modified: trunk/Source/WebCore/page/Settings.in (156157 => 156158)


--- trunk/Source/WebCore/page/Settings.in	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/page/Settings.in	2013-09-20 13:17:07 UTC (rev 156158)
@@ -187,6 +187,8 @@
 # enabled, the user can initiate drag using long press.
 touchDragDropEnabled initial=false
 
+autoscrollForDragAndDropEnabled initial=false
+
 unifiedTextCheckerEnabled initial=defaultUnifiedTextCheckerEnabled
 
 logsPageMessagesToSystemConsoleEnabled initial=false

Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (156157 => 156158)


--- trunk/Source/WebCore/testing/InternalSettings.cpp	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp	2013-09-20 13:17:07 UTC (rev 156158)
@@ -96,6 +96,7 @@
     , m_defaultVideoPosterURL(settings.defaultVideoPosterURL())
     , m_originalTimeWithoutMouseMovementBeforeHidingControls(settings.timeWithoutMouseMovementBeforeHidingControls())
     , m_useLegacyBackgroundSizeShorthandBehavior(settings.useLegacyBackgroundSizeShorthandBehavior())
+    , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled())
 {
 }
 
@@ -131,6 +132,7 @@
     settings.setDefaultVideoPosterURL(m_defaultVideoPosterURL);
     settings.setTimeWithoutMouseMovementBeforeHidingControls(m_originalTimeWithoutMouseMovementBeforeHidingControls);
     settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior);
+    settings.setAutoscrollForDragAndDropEnabled(m_autoscrollForDragAndDropEnabled);
 }
 
 // We can't use RefCountedSupplement because that would try to make InternalSettings RefCounted
@@ -480,4 +482,10 @@
     settings()->setUseLegacyBackgroundSizeShorthandBehavior(enabled);
 }
 
+void InternalSettings::setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode& ec)
+{
+    InternalSettingsGuardForSettings();
+    settings()->setAutoscrollForDragAndDropEnabled(enabled);
 }
+
+}

Modified: trunk/Source/WebCore/testing/InternalSettings.h (156157 => 156158)


--- trunk/Source/WebCore/testing/InternalSettings.h	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/testing/InternalSettings.h	2013-09-20 13:17:07 UTC (rev 156158)
@@ -81,6 +81,7 @@
         String m_defaultVideoPosterURL;
         bool m_originalTimeWithoutMouseMovementBeforeHidingControls;
         bool m_useLegacyBackgroundSizeShorthandBehavior;
+        bool m_autoscrollForDragAndDropEnabled;
     };
 
     static PassRefPtr<InternalSettings> create(Page* page)
@@ -125,6 +126,7 @@
     void setDefaultVideoPosterURL(const String& url, ExceptionCode&);
     void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&);
     void setUseLegacyBackgroundSizeShorthandBehavior(bool enabled, ExceptionCode&);
+    void setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode&);
 
 private:
     explicit InternalSettings(Page*);

Modified: trunk/Source/WebCore/testing/InternalSettings.idl (156157 => 156158)


--- trunk/Source/WebCore/testing/InternalSettings.idl	2013-09-20 13:16:28 UTC (rev 156157)
+++ trunk/Source/WebCore/testing/InternalSettings.idl	2013-09-20 13:17:07 UTC (rev 156158)
@@ -59,4 +59,5 @@
     [RaisesException] void setDefaultVideoPosterURL(DOMString poster);
     [RaisesException] void setTimeWithoutMouseMovementBeforeHidingControls(double time);
     [RaisesException] void setUseLegacyBackgroundSizeShorthandBehavior(boolean enabled);
+    [RaisesException] void setAutoscrollForDragAndDropEnabled(boolean enabled);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to