Bug 384458 - part 1: make the background color of the SELECTION_ATTENTION range fully transparent when modal highlighting is on. r=masayuki
authorMike de Boer <mdeboer@mozilla.com>
Thu, 09 Jun 2016 13:30:44 +0200
changeset 343356 0d05e6a1bdc206eddb08d4dc6e24a8e30801064f
parent 343355 c03e4314339f812e3a2aca39607f483e59b875ef
child 343357 de5d300e468729ae3dede732849298a6fe84b0dc
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs384458
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 384458 - part 1: make the background color of the SELECTION_ATTENTION range fully transparent when modal highlighting is on. r=masayuki
widget/nsXPLookAndFeel.cpp
widget/nsXPLookAndFeel.h
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -242,16 +242,17 @@ const char nsXPLookAndFeel::sColorPrefs[
 };
 
 int32_t nsXPLookAndFeel::sCachedColors[LookAndFeel::eColorID_LAST_COLOR] = {0};
 int32_t nsXPLookAndFeel::sCachedColorBits[COLOR_CACHE_SIZE] = {0};
 
 bool nsXPLookAndFeel::sInitialized = false;
 bool nsXPLookAndFeel::sUseNativeColors = true;
 bool nsXPLookAndFeel::sUseStandinsForNativeColors = false;
+bool nsXPLookAndFeel::sFindbarModalHighlight = false;
 
 nsLookAndFeel* nsXPLookAndFeel::sInstance = nullptr;
 bool nsXPLookAndFeel::sShutdown = false;
 
 // static
 nsLookAndFeel*
 nsXPLookAndFeel::GetInstance()
 {
@@ -460,16 +461,19 @@ nsXPLookAndFeel::Init()
   }
 
   Preferences::AddBoolVarCache(&sUseNativeColors,
                                "ui.use_native_colors",
                                sUseNativeColors);
   Preferences::AddBoolVarCache(&sUseStandinsForNativeColors,
                                "ui.use_standins_for_native_colors",
                                sUseStandinsForNativeColors);
+  Preferences::AddBoolVarCache(&sFindbarModalHighlight,
+                               "findbar.modalHighlight",
+                               sFindbarModalHighlight);
 
   if (XRE_IsContentProcess()) {
     mozilla::dom::ContentChild* cc =
       mozilla::dom::ContentChild::GetSingleton();
 
     nsTArray<LookAndFeelInt> lookAndFeelIntCache;
     cc->SendGetLookAndFeelCache(&lookAndFeelIntCache);
     LookAndFeel::SetIntCache(lookAndFeelIntCache);
@@ -768,16 +772,21 @@ nsXPLookAndFeel::GetColorImpl(ColorID aI
   if (aID == eColorID_TextSelectBackgroundDisabled) {
     // This is used to gray out the selection when it's not focused
     // Used with nsISelectionController::SELECTION_DISABLED
     aResult = NS_RGB(0xb0, 0xb0, 0xb0);
     return NS_OK;
   }
 
   if (aID == eColorID_TextSelectBackgroundAttention) {
+    if (sFindbarModalHighlight) {
+      aResult = NS_RGBA(0, 0, 0, 0);
+      return NS_OK;
+    }
+
     // This makes the selection stand out when typeaheadfind is on
     // Used with nsISelectionController::SELECTION_ATTENTION
     aResult = NS_RGB(0x38, 0xd8, 0x78);
     return NS_OK;
   }
 
   if (aID == eColorID_TextHighlightBackground) {
     // This makes the matched text stand out when findbar highlighting is on
--- a/widget/nsXPLookAndFeel.h
+++ b/widget/nsXPLookAndFeel.h
@@ -106,14 +106,15 @@ protected:
   /* this length must not be shorter than the length of the longest string in the array
    * see nsXPLookAndFeel.cpp
    */
   static const char sColorPrefs[][38];
   static int32_t sCachedColors[LookAndFeel::eColorID_LAST_COLOR];
   static int32_t sCachedColorBits[COLOR_CACHE_SIZE];
   static bool sUseNativeColors;
   static bool sUseStandinsForNativeColors;
+  static bool sFindbarModalHighlight;
 
   static nsLookAndFeel* sInstance;
   static bool sShutdown;
 };
 
 #endif