Add WKPreference for SelectionPaintingWithoutSelectionGaps
authorgyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2016 08:39:07 +0000 (08:39 +0000)
committergyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2016 08:39:07 +0000 (08:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156900

Reviewed by Michael Catanzaro.

Unlike other browsers WebKit has been drawing selection gaps
between render blocks during the text selection. This often
cause text selection screen looks messy.

This patch adds a setting method to disable the functionality,
and EFL port disables it by default.

Source/WebCore:

* page/Settings.in:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::shouldPaintSelectionGaps):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetSelectionPaintingWithoutSelectionGapsEnabled):
(WKPreferencesGetSelectionPaintingWithoutSelectionGapsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200412 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/Settings.in
Source/WebCore/rendering/RenderBlock.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 1b17dad..06a88ee 100644 (file)
@@ -1,3 +1,21 @@
+2016-05-04  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Add WKPreference for SelectionPaintingWithoutSelectionGaps
+        https://bugs.webkit.org/show_bug.cgi?id=156900
+
+        Reviewed by Michael Catanzaro.
+
+        Unlike other browsers WebKit has been drawing selection gaps
+        between render blocks during the text selection. This often
+        cause text selection screen looks messy.
+
+        This patch adds a setting method to disable the functionality,
+        and EFL port disables it by default.
+
+        * page/Settings.in:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::shouldPaintSelectionGaps):
+
 2016-05-04  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Rename JSKeyValueIterator as JSDOMIterator
index 1650c30..09bfcc2 100644 (file)
@@ -256,3 +256,6 @@ userInterfaceDirectionPolicy type=UserInterfaceDirectionPolicy, initial=UserInte
 systemLayoutDirection type=TextDirection, initial=LTR
 
 allowContentSecurityPolicySourceStarToMatchAnyProtocol initial=false
+
+selectionPaintingWithoutSelectionGapsEnabled initial=false
+
index eb85cf2..163cdd4 100644 (file)
@@ -1714,6 +1714,9 @@ void RenderBlock::paintContinuationOutlines(PaintInfo& info, const LayoutPoint&
 
 bool RenderBlock::shouldPaintSelectionGaps() const
 {
+    if (frame().settings().selectionPaintingWithoutSelectionGapsEnabled())
+        return false;
+
     return selectionState() != SelectionNone && style().visibility() == VISIBLE && isSelectionRoot();
 }
 
index 873456e..e86558d 100644 (file)
@@ -1,3 +1,25 @@
+2016-05-04  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Add WKPreference for SelectionPaintingWithoutSelectionGaps
+        https://bugs.webkit.org/show_bug.cgi?id=156900
+
+        Reviewed by Michael Catanzaro.
+
+        Unlike other browsers WebKit has been drawing selection gaps
+        between render blocks during the text selection. This often
+        cause text selection screen looks messy.
+
+        This patch adds a setting method to disable the functionality,
+        and EFL port disables it by default.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetSelectionPaintingWithoutSelectionGapsEnabled):
+        (WKPreferencesGetSelectionPaintingWithoutSelectionGapsEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-05-04  Zan Dobersek  <zdobersek@igalia.com>
 
         [CoordGraphics] CompositingCoordinator should hande root compositing and view overlay layers separately
index 8cba565..4e54b86 100644 (file)
 #define DEFAULT_WEBKIT_TABSTOLINKS_ENABLED false
 #endif
 
+#if PLATFORM(EFL)
+#define DEFAULT_SELECTION_PAINTING_WITHOUT_SELECTION_GAPS_ENABLED true
+#else
+#define DEFAULT_SELECTION_PAINTING_WITHOUT_SELECTION_GAPS_ENABLED false
+#endif
+
 #if ENABLE(SMOOTH_SCROLLING)
 #define DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED true
 #else
     macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, false, "", "") \
     macro(WebGL2Enabled, webGL2Enabled, Bool, bool, false, "", "") \
     macro(DownloadAttributeEnabled, downloadAttributeEnabled, Bool, bool, false, "", "") \
+    macro(SelectionPaintingWithoutSelectionGapsEnabled, selectionPaintingWithoutSelectionGapsEnabled, Bool, bool, DEFAULT_SELECTION_PAINTING_WITHOUT_SELECTION_GAPS_ENABLED, "", "") \
     FOR_EACH_ADDITIONAL_WEBKIT_BOOL_PREFERENCE(macro) \
     \
 
index e581935..61431ea 100644 (file)
@@ -1540,3 +1540,13 @@ bool WKPreferencesGetDownloadAttributeEnabled(WKPreferencesRef preferencesRef)
 {
     return toImpl(preferencesRef)->downloadAttributeEnabled();
 }
+
+void WKPreferencesSetSelectionPaintingWithoutSelectionGapsEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setSelectionPaintingWithoutSelectionGapsEnabled(flag);
+}
+
+bool WKPreferencesGetSelectionPaintingWithoutSelectionGapsEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->selectionPaintingWithoutSelectionGapsEnabled();
+}
index 9da3140..7d454a8 100644 (file)
@@ -431,6 +431,10 @@ WK_EXPORT bool WKPreferencesGetFetchAPIEnabled(WKPreferencesRef);
 WK_EXPORT void WKPreferencesSetDownloadAttributeEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetDownloadAttributeEnabled(WKPreferencesRef);
 
+// Defaults to false
+WK_EXPORT void WKPreferencesSetSelectionPaintingWithoutSelectionGapsEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetSelectionPaintingWithoutSelectionGapsEnabled(WKPreferencesRef);
+
 #ifdef __cplusplus
 }
 #endif
index 8a50367..c8c50ad 100644 (file)
@@ -2949,6 +2949,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
     settings.setHttpEquivEnabled(store.getBoolValueForKey(WebPreferencesKey::httpEquivEnabledKey()));
 
+    settings.setSelectionPaintingWithoutSelectionGapsEnabled(store.getBoolValueForKey(WebPreferencesKey::selectionPaintingWithoutSelectionGapsEnabledKey()));
+
     DatabaseManager::singleton().setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
 
 #if ENABLE(FULLSCREEN_API)