Title: [271021] trunk
Revision
271021
Author
[email protected]
Date
2020-12-21 08:10:45 -0800 (Mon, 21 Dec 2020)

Log Message

REGRESSION (r262729): Poor contrast for specific color/background combinations on disabled input fields
https://bugs.webkit.org/show_bug.cgi?id=219991
<rdar://problem/70522921>

Reviewed by Sam Weinig.

Source/WebCore:

The text color for disabled input fields is adjusted based on any
specified color and background-color rules.

r262729 modified the adjustment logic to use the contrastRatio
utility function to determine illegibility issues due to contrast,
rather than a differenceSquared computation. In both cases if the
computed value is less than a minimum constrast value, the original
text color is preserved. As a part of the change, the minimum
contrast value was set to 1.1, a value chosen in order to maintain
the appearance of fast/forms/input-disabled-color.html.

However, the constrast value 1.1 results in combination of
"color #acacac" and "background-color: #f2f2f2" producing white
text on a light gray background, which is illegible. Previously,
this color combination did not result in any change to the text color.

In order to fix, increase the minimum color constrast to 1.195,
which accounts for the failing combination. Note that this increase to
the minimum value prevents some existing text color adjustments
from being performed. This is evidenced by the need to rebaseline
fast/forms/input-disabled-color.html after increasing the constrast.
However, the new text colors are subjectively more legible, which
is the reason why we have a minimum color constrast value.

* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::disabledTextColor const):

LayoutTests:

Updated an existing test to account for the failing color/background
combination and rebaselined expectations to match the new minimum
constrast ratio.

* fast/forms/input-disabled-color.html:
* platform/ios/fast/forms/input-disabled-color-expected.txt:
* platform/mac-catalina/fast/forms/input-disabled-color-expected.txt:
* platform/mac-mojave/fast/forms/input-disabled-color-expected.txt:
* platform/mac/fast/forms/input-disabled-color-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271020 => 271021)


--- trunk/LayoutTests/ChangeLog	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/LayoutTests/ChangeLog	2020-12-21 16:10:45 UTC (rev 271021)
@@ -1,3 +1,21 @@
+2020-12-21  Aditya Keerthi  <[email protected]>
+
+        REGRESSION (r262729): Poor contrast for specific color/background combinations on disabled input fields
+        https://bugs.webkit.org/show_bug.cgi?id=219991
+        <rdar://problem/70522921>
+
+        Reviewed by Sam Weinig.
+
+        Updated an existing test to account for the failing color/background
+        combination and rebaselined expectations to match the new minimum
+        constrast ratio.
+
+        * fast/forms/input-disabled-color.html:
+        * platform/ios/fast/forms/input-disabled-color-expected.txt:
+        * platform/mac-catalina/fast/forms/input-disabled-color-expected.txt:
+        * platform/mac-mojave/fast/forms/input-disabled-color-expected.txt:
+        * platform/mac/fast/forms/input-disabled-color-expected.txt:
+
 2020-12-21  Alicia Boya GarcĂ­a  <[email protected]>
 
         media-source-webm.html: Handle frame size in HAVE_METADATA

Modified: trunk/LayoutTests/fast/forms/input-disabled-color.html (271020 => 271021)


--- trunk/LayoutTests/fast/forms/input-disabled-color.html	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/LayoutTests/fast/forms/input-disabled-color.html	2020-12-21 16:10:45 UTC (rev 271021)
@@ -27,6 +27,8 @@
 <input type=text style="color:red; background-color:white" value="This text field is not disabled" ><br>
 <input type=text style="color:red; background-color:transparent" disabled value="The text in this disabled field should displayed as dimmed or grey" >
 <input type=text style="color:red; background-color:transparent" value="This text field is not disabled" ><br>
+<input type=text style="color:#acacac; background-color:#f2f2f2" disabled value="The text in this disabled field should displayed as dimmed or grey" >
+<input type=text style="color:#acacac; background-color:#f2f2f2" value="This text field is not disabled" ><br>
  </body>
 </html>
 

Modified: trunk/LayoutTests/platform/ios/fast/forms/input-disabled-color-expected.txt (271020 => 271021)


--- trunk/LayoutTests/platform/ios/fast/forms/input-disabled-color-expected.txt	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/LayoutTests/platform/ios/fast/forms/input-disabled-color-expected.txt	2020-12-21 16:10:45 UTC (rev 271021)
@@ -58,6 +58,10 @@
         text run at (139,321) width 5: " "
       RenderTextControl {INPUT} at (145,322) size 138x22 [color=#FF0000] [border: (1px solid #4C4C4C)]
       RenderBR {BR} at (284,321) size 1x19
+      RenderText {#text} at (139,346) size 5x19
+        text run at (139,346) width 5: " "
+      RenderTextControl {INPUT} at (145,347) size 138x22 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (1px solid #4C4C4C)]
+      RenderBR {BR} at (284,346) size 1x19
 layer at (160,33) size 124x14 scrollWidth 140
   RenderBlock {DIV} at (6,3) size 125x15
     RenderText {#text} at (0,0) size 139x14
@@ -110,6 +114,10 @@
   RenderBlock {DIV} at (6,3) size 125x15
     RenderText {#text} at (0,0) size 139x14
       text run at (0,0) width 139: "This text field is not disabled"
+layer at (160,358) size 124x14 scrollWidth 140
+  RenderBlock {DIV} at (6,3) size 125x15
+    RenderText {#text} at (0,0) size 139x14
+      text run at (0,0) width 139: "This text field is not disabled"
 layer at (10,30) size 135x21
   RenderTextControl {INPUT} at (2,22) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)]
 layer at (17,33) size 122x14 scrollWidth 318
@@ -125,13 +133,13 @@
 layer at (10,80) size 135x21
   RenderTextControl {INPUT} at (2,72) size 136x22 [bgcolor=#0000FF] [border: (1px solid #4C4C4C)]
 layer at (17,83) size 122x14 scrollWidth 318
-  RenderBlock {DIV} at (6,3) size 123x15 [color=#545454]
+  RenderBlock {DIV} at (6,3) size 123x15
     RenderText {#text} at (0,0) size 318x14
       text run at (0,0) width 318: "The text in this disabled field should displayed as dimmed or grey"
 layer at (10,105) size 135x21
   RenderTextControl {INPUT} at (2,97) size 136x22 [color=#FF0000] [bgcolor=#0000FF] [border: (1px solid #4C4C4C)]
 layer at (17,108) size 122x14 scrollWidth 318
-  RenderBlock {DIV} at (6,3) size 123x15 [color=#AB0000]
+  RenderBlock {DIV} at (6,3) size 123x15
     RenderText {#text} at (0,0) size 318x14
       text run at (0,0) width 318: "The text in this disabled field should displayed as dimmed or grey"
 layer at (10,130) size 135x21
@@ -188,3 +196,9 @@
   RenderBlock {DIV} at (6,3) size 123x15
     RenderText {#text} at (0,0) size 318x14
       text run at (0,0) width 318: "The text in this disabled field should displayed as dimmed or grey"
+layer at (10,355) size 135x21
+  RenderTextControl {INPUT} at (2,347) size 136x22 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (1px solid #4C4C4C)]
+layer at (17,358) size 122x14 scrollWidth 318
+  RenderBlock {DIV} at (6,3) size 123x15
+    RenderText {#text} at (0,0) size 318x14
+      text run at (0,0) width 318: "The text in this disabled field should displayed as dimmed or grey"

Modified: trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt (271020 => 271021)


--- trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt	2020-12-21 16:10:45 UTC (rev 271021)
@@ -71,6 +71,11 @@
         text run at (149,296) width 5: " "
       RenderTextControl {INPUT} at (155,296) size 148x19 [color=#FF0000] [border: (2px inset #FF0000)]
       RenderBR {BR} at (304,296) size 1x18
+      RenderTextControl {INPUT} at (2,319) size 146x19 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (2px inset #ACACAC)]
+      RenderText {#text} at (149,319) size 5x18
+        text run at (149,319) width 5: " "
+      RenderTextControl {INPUT} at (155,319) size 148x19 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (2px inset #ACACAC)]
+      RenderBR {BR} at (304,319) size 1x18
 layer at (13,31) size 140x13 scrollWidth 343
   RenderBlock {DIV} at (3,3) size 140x13 [color=#545454]
     RenderText {#text} at (0,0) size 344x13
@@ -88,7 +93,7 @@
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
 layer at (13,77) size 140x13 scrollWidth 343
-  RenderBlock {DIV} at (3,3) size 140x13 [color=#545454]
+  RenderBlock {DIV} at (3,3) size 140x13
     RenderText {#text} at (0,0) size 344x13
       text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
 layer at (167,77) size 141x13 scrollWidth 152
@@ -96,7 +101,7 @@
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
 layer at (13,100) size 140x13 scrollWidth 343
-  RenderBlock {DIV} at (3,3) size 140x13 [color=#AB0000]
+  RenderBlock {DIV} at (3,3) size 140x13
     RenderText {#text} at (0,0) size 344x13
       text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
 layer at (167,100) size 141x13 scrollWidth 152
@@ -175,3 +180,11 @@
   RenderBlock {DIV} at (3,3) size 141x13
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
+layer at (13,330) size 140x13 scrollWidth 343
+  RenderBlock {DIV} at (3,3) size 140x13
+    RenderText {#text} at (0,0) size 344x13
+      text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
+layer at (167,330) size 141x13 scrollWidth 152
+  RenderBlock {DIV} at (3,3) size 141x13
+    RenderText {#text} at (0,0) size 151x13
+      text run at (0,0) width 151: "This text field is not disabled"

Modified: trunk/LayoutTests/platform/mac-catalina/fast/forms/input-disabled-color-expected.txt (271020 => 271021)


--- trunk/LayoutTests/platform/mac-catalina/fast/forms/input-disabled-color-expected.txt	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/LayoutTests/platform/mac-catalina/fast/forms/input-disabled-color-expected.txt	2020-12-21 16:10:45 UTC (rev 271021)
@@ -71,6 +71,11 @@
         text run at (149,296) width 5: " "
       RenderTextControl {INPUT} at (155,296) size 148x19 [color=#FF0000] [border: (2px inset #FF0000)]
       RenderBR {BR} at (304,296) size 1x18
+      RenderTextControl {INPUT} at (2,319) size 146x19 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (2px inset #ACACAC)]
+      RenderText {#text} at (149,319) size 5x18
+        text run at (149,319) width 5: " "
+      RenderTextControl {INPUT} at (155,319) size 148x19 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (2px inset #ACACAC)]
+      RenderBR {BR} at (304,319) size 1x18
 layer at (13,31) size 140x13 scrollWidth 344
   RenderBlock {DIV} at (3,3) size 140x13 [color=#545454]
     RenderText {#text} at (0,0) size 344x13
@@ -88,7 +93,7 @@
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
 layer at (13,77) size 140x13 scrollWidth 344
-  RenderBlock {DIV} at (3,3) size 140x13 [color=#545454]
+  RenderBlock {DIV} at (3,3) size 140x13
     RenderText {#text} at (0,0) size 344x13
       text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
 layer at (167,77) size 141x13 scrollWidth 152
@@ -96,7 +101,7 @@
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
 layer at (13,100) size 140x13 scrollWidth 344
-  RenderBlock {DIV} at (3,3) size 140x13 [color=#AB0000]
+  RenderBlock {DIV} at (3,3) size 140x13
     RenderText {#text} at (0,0) size 344x13
       text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
 layer at (167,100) size 141x13 scrollWidth 152
@@ -175,3 +180,11 @@
   RenderBlock {DIV} at (3,3) size 141x13
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
+layer at (13,330) size 140x13 scrollWidth 344
+  RenderBlock {DIV} at (3,3) size 140x13
+    RenderText {#text} at (0,0) size 344x13
+      text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
+layer at (167,330) size 141x13 scrollWidth 152
+  RenderBlock {DIV} at (3,3) size 141x13
+    RenderText {#text} at (0,0) size 151x13
+      text run at (0,0) width 151: "This text field is not disabled"

Modified: trunk/LayoutTests/platform/mac-mojave/fast/forms/input-disabled-color-expected.txt (271020 => 271021)


--- trunk/LayoutTests/platform/mac-mojave/fast/forms/input-disabled-color-expected.txt	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/LayoutTests/platform/mac-mojave/fast/forms/input-disabled-color-expected.txt	2020-12-21 16:10:45 UTC (rev 271021)
@@ -71,6 +71,11 @@
         text run at (149,296) width 5: " "
       RenderTextControl {INPUT} at (155,296) size 148x19 [color=#FF0000] [border: (2px inset #FF0000)]
       RenderBR {BR} at (304,296) size 1x18
+      RenderTextControl {INPUT} at (2,319) size 146x19 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (2px inset #ACACAC)]
+      RenderText {#text} at (149,319) size 5x18
+        text run at (149,319) width 5: " "
+      RenderTextControl {INPUT} at (155,319) size 148x19 [color=#ACACAC] [bgcolor=#F2F2F2] [border: (2px inset #ACACAC)]
+      RenderBR {BR} at (304,319) size 1x18
 layer at (13,31) size 140x13 scrollWidth 344
   RenderBlock {DIV} at (3,3) size 140x13 [color=#545454]
     RenderText {#text} at (0,0) size 344x13
@@ -88,7 +93,7 @@
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
 layer at (13,77) size 140x13 scrollWidth 344
-  RenderBlock {DIV} at (3,3) size 140x13 [color=#545454]
+  RenderBlock {DIV} at (3,3) size 140x13
     RenderText {#text} at (0,0) size 344x13
       text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
 layer at (167,77) size 141x13 scrollWidth 152
@@ -96,7 +101,7 @@
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
 layer at (13,100) size 140x13 scrollWidth 344
-  RenderBlock {DIV} at (3,3) size 140x13 [color=#AB0000]
+  RenderBlock {DIV} at (3,3) size 140x13
     RenderText {#text} at (0,0) size 344x13
       text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
 layer at (167,100) size 141x13 scrollWidth 152
@@ -175,3 +180,11 @@
   RenderBlock {DIV} at (3,3) size 141x13
     RenderText {#text} at (0,0) size 151x13
       text run at (0,0) width 151: "This text field is not disabled"
+layer at (13,330) size 140x13 scrollWidth 344
+  RenderBlock {DIV} at (3,3) size 140x13
+    RenderText {#text} at (0,0) size 344x13
+      text run at (0,0) width 344: "The text in this disabled field should displayed as dimmed or grey"
+layer at (167,330) size 141x13 scrollWidth 152
+  RenderBlock {DIV} at (3,3) size 141x13
+    RenderText {#text} at (0,0) size 151x13
+      text run at (0,0) width 151: "This text field is not disabled"

Modified: trunk/Source/WebCore/ChangeLog (271020 => 271021)


--- trunk/Source/WebCore/ChangeLog	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/Source/WebCore/ChangeLog	2020-12-21 16:10:45 UTC (rev 271021)
@@ -1,3 +1,38 @@
+2020-12-21  Aditya Keerthi  <[email protected]>
+
+        REGRESSION (r262729): Poor contrast for specific color/background combinations on disabled input fields
+        https://bugs.webkit.org/show_bug.cgi?id=219991
+        <rdar://problem/70522921>
+
+        Reviewed by Sam Weinig.
+
+        The text color for disabled input fields is adjusted based on any
+        specified color and background-color rules.
+
+        r262729 modified the adjustment logic to use the contrastRatio
+        utility function to determine illegibility issues due to contrast,
+        rather than a differenceSquared computation. In both cases if the
+        computed value is less than a minimum constrast value, the original
+        text color is preserved. As a part of the change, the minimum
+        contrast value was set to 1.1, a value chosen in order to maintain
+        the appearance of fast/forms/input-disabled-color.html.
+
+        However, the constrast value 1.1 results in combination of
+        "color #acacac" and "background-color: #f2f2f2" producing white
+        text on a light gray background, which is illegible. Previously,
+        this color combination did not result in any change to the text color.
+
+        In order to fix, increase the minimum color constrast to 1.195,
+        which accounts for the failing combination. Note that this increase to
+        the minimum value prevents some existing text color adjustments
+        from being performed. This is evidenced by the need to rebaseline
+        fast/forms/input-disabled-color.html after increasing the constrast.
+        However, the new text colors are subjectively more legible, which
+        is the reason why we have a minimum color constrast value.
+
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::disabledTextColor const):
+
 2020-12-20  Simon Fraser  <[email protected]>
 
         Rename FrameView::sendResizeEventIfNeeded() to scheduleResizeEventIfNeeded()

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (271020 => 271021)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2020-12-21 12:15:20 UTC (rev 271020)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2020-12-21 16:10:45 UTC (rev 271021)
@@ -1404,7 +1404,7 @@
 #endif
 
 // Value chosen by observation. This can be tweaked.
-constexpr float minColorContrastValue = 1.1f;
+constexpr float minColorContrastValue = 1.195f;
 
 // For transparent or translucent background color, use lightening.
 constexpr float minDisabledColorAlphaValue = 0.5f;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to