[tbb-commits] [tor-browser] 45/73: Bug 1783415 - Don't use custom styling of select in chrome pages. r=mconley, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Sep 21 20:17:38 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch geckoview-102.3.0esr-12.0-1
in repository tor-browser.

commit 0bd42cb43a8dff6f9e17ca73a27bc62fe5309144
Author: Emilio Cobos Álvarez <emilio at crisal.io>
AuthorDate: Fri Sep 2 08:56:12 2022 -0400

    Bug 1783415 - Don't use custom styling of select in chrome pages. r=mconley, a=RyanVM
    
    Assume default styles fit well enough. This prevents confusing colors from
    applying, since in the described case we pick the hovered select background,
    but then override the options to use the unhovered background...
    
    With short selects (like the ones that have only two options), that may cause
    the wrong impression. A bit tricky!
    
    This repros for me on win10, for what is worth.
---
 toolkit/actors/SelectChild.jsm  |  2 ++
 toolkit/actors/SelectParent.jsm | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/toolkit/actors/SelectChild.jsm b/toolkit/actors/SelectChild.jsm
index c209ae30903e6..f133b0eb29a02 100644
--- a/toolkit/actors/SelectChild.jsm
+++ b/toolkit/actors/SelectChild.jsm
@@ -129,6 +129,7 @@ SelectContentHelper.prototype = {
       isOpenedViaTouch: this.isOpenedViaTouch,
       options,
       rect,
+      custom: !this.element.nodePrincipal.isSystemPrincipal,
       selectedIndex: this.element.selectedIndex,
       style: supportedStyles(computedStyles, SUPPORTED_SELECT_PROPERTIES),
       defaultStyle: supportedStyles(defaultStyles, SUPPORTED_SELECT_PROPERTIES),
@@ -198,6 +199,7 @@ SelectContentHelper.prototype = {
     );
     this.actor.sendAsyncMessage("Forms:UpdateDropDown", {
       options: this._buildOptionList(),
+      custom: !this.element.nodePrincipal.isSystemPrincipal,
       selectedIndex: this.element.selectedIndex,
       style: supportedStyles(computedStyles, SUPPORTED_SELECT_PROPERTIES),
       defaultStyle: supportedStyles(defaultStyles, SUPPORTED_SELECT_PROPERTIES),
diff --git a/toolkit/actors/SelectParent.jsm b/toolkit/actors/SelectParent.jsm
index f7c954ca828b1..353b17300aa3a 100644
--- a/toolkit/actors/SelectParent.jsm
+++ b/toolkit/actors/SelectParent.jsm
@@ -82,6 +82,7 @@ var SelectParentHelper = {
    * @param {Array<Object>}  uniqueItemStyles
    * @param {Number}         selectedIndex
    * @param {Number}         zoom
+   * @param {Boolean}        custom
    * @param {Object}         uaStyle
    * @param {Object}         selectStyle
    */
@@ -91,6 +92,7 @@ var SelectParentHelper = {
     uniqueItemStyles,
     selectedIndex,
     zoom,
+    custom,
     uaStyle,
     selectStyle
   ) {
@@ -110,7 +112,7 @@ var SelectParentHelper = {
 
     let sheet = stylesheet.sheet;
 
-    if (!CUSTOM_STYLING_ENABLED) {
+    if (!custom) {
       selectStyle = uaStyle;
     }
 
@@ -128,7 +130,7 @@ var SelectParentHelper = {
       selectStyle["background-color"] != uaStyle["background-color"] ||
       selectStyle.color != uaStyle.color;
 
-    if (CUSTOM_STYLING_ENABLED) {
+    if (custom) {
       if (selectStyle["text-shadow"] != "none") {
         sheet.insertRule(
           `#ContentSelectDropdown > menupopup > :is(menuitem, menucaption)[_moz-menuactive="true"] {
@@ -212,7 +214,7 @@ var SelectParentHelper = {
       rule.direction = style.direction;
       rule.fontSize = zoom * parseFloat(style["font-size"], 10) + "px";
 
-      if (CUSTOM_STYLING_ENABLED) {
+      if (custom) {
         let optionBackgroundIsTransparent =
           style["background-color"] == "rgba(0, 0, 0, 0)";
         let optionBackgroundSet =
@@ -265,7 +267,7 @@ var SelectParentHelper = {
     // We only set the `customoptionstyling` if the background has been
     // manually set. This prevents the overlap between moz-appearance and
     // background-color. `color` and `text-shadow` do not interfere with it.
-    if (CUSTOM_STYLING_ENABLED && selectBackgroundSet) {
+    if (custom && selectBackgroundSet) {
       menulist.menupopup.setAttribute("customoptionstyling", "true");
     } else {
       menulist.menupopup.removeAttribute("customoptionstyling");
@@ -434,6 +436,7 @@ var SelectParentHelper = {
         options.uniqueStyles,
         selectedIndex,
         this._currentZoom,
+        msg.data.custom && CUSTOM_STYLING_ENABLED,
         msg.data.defaultStyle,
         msg.data.style
       );
@@ -783,6 +786,7 @@ class SelectParent extends JSWindowActorParent {
           // We only want to apply the full zoom. The text zoom is already
           // applied in the font-size.
           this.manager.browsingContext.fullZoom,
+          data.custom && CUSTOM_STYLING_ENABLED,
           data.defaultStyle,
           data.style
         );

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list