Add PreferCompositingToLCDText feature flag

Add a feature flag to prefer compositing over lcd text in preparation
for running an experiment on the impact to scroll latency.  Enabling
this feature has the same impact as using the --enable-prefer-
compositing-to-lcd-text command line switch.  Note that the following
command-line switches will override this feature:

  --enable-prefer-compositing-to-lcd-text
  --disable-prefer-compositing-to-lcd-text
  --enable-lcd-text
  --disable-lcd-text

It will also have no impact on android, chromeos, or any device that
uses >= 150% device scale factor.

Change-Id: Ib8ddff2f9a98c67b177d7a5b20a65243f4c5b93e
Bug: 984346
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1735775
Reviewed-by: Chris Harrelson <[email protected]>
Reviewed-by: David Bokan <[email protected]>
Reviewed-by: Stefan Zager <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Commit-Queue: Sam Fortiner <[email protected]>
Cr-Commit-Position: refs/heads/master@{#685598}
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
index 7c60236c..671258c 100644
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -360,6 +360,10 @@
 #endif
 };
 
+// Whether we should composite a PLSA even if it means losing lcd text.
+const base::Feature kPreferCompositingToLCDText = {
+    "PreferCompositingToLCDText", base::FEATURE_DISABLED_BY_DEFAULT};
+
 // Enables process sharing for sites that do not require a dedicated process
 // by using a default SiteInstance. Default SiteInstances will only be used
 // on platforms that do not use full site isolation.
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h
index 0d4e8e4..44205be56 100644
--- a/content/public/common/content_features.h
+++ b/content/public/common/content_features.h
@@ -84,6 +84,7 @@
 CONTENT_EXPORT extern const base::Feature kPeriodicBackgroundSync;
 CONTENT_EXPORT extern const base::Feature kPerNavigationMojoInterface;
 CONTENT_EXPORT extern const base::Feature kPepper3DImageChromium;
+CONTENT_EXPORT extern const base::Feature kPreferCompositingToLCDText;
 CONTENT_EXPORT extern const base::Feature kPrioritizeBootstrapTasks;
 CONTENT_EXPORT extern const base::Feature kProactivelySwapBrowsingInstance;
 CONTENT_EXPORT extern const base::Feature
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 5a5e4844..9142891 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -385,6 +385,8 @@
     return true;
   if (!compositor_deps->IsLcdTextEnabled())
     return true;
+  if (base::FeatureList::IsEnabled(features::kPreferCompositingToLCDText))
+    return true;
   return DeviceScaleEnsuresTextQuality(device_scale_factor);
 }