Title: [244467] trunk
Revision
244467
Author
[email protected]
Date
2019-04-19 14:19:57 -0700 (Fri, 19 Apr 2019)

Log Message

Source/WebCore:
Standardize the <meta name="color-scheme"> separator.
https://bugs.webkit.org/show_bug.cgi?id=193931
rdar://problem/49995929

Reviewed by Darin Adler.

Tests: css-dark-mode/color-scheme-meta.html

* dom/Document.cpp:
(WebCore::processColorSchemeString): Use isHTMLSpace insead of isColorSchemeSeparator and isASCIISpace.
(WebCore::isColorSchemeSeparator): Deleted.

LayoutTests:
Standardize the `<meta name="color-scheme">` separator.
https://bugs.webkit.org/show_bug.cgi?id=193931
rdar://problem/49995929

Reviewed by Darin Adler.

* css-dark-mode/color-scheme-meta-expected.txt:
* css-dark-mode/color-scheme-meta.html: Test other types of spaces like tab, newline and vertical tab.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244466 => 244467)


--- trunk/LayoutTests/ChangeLog	2019-04-19 21:07:30 UTC (rev 244466)
+++ trunk/LayoutTests/ChangeLog	2019-04-19 21:19:57 UTC (rev 244467)
@@ -1,3 +1,14 @@
+2019-04-19  Timothy Hatcher  <[email protected]>
+
+        Standardize the `<meta name="color-scheme">` separator.
+        https://bugs.webkit.org/show_bug.cgi?id=193931
+        rdar://problem/49995929
+
+        Reviewed by Darin Adler.
+
+        * css-dark-mode/color-scheme-meta-expected.txt:
+        * css-dark-mode/color-scheme-meta.html: Test other types of spaces like tab, newline and vertical tab.
+
 2019-04-19  Ryosuke Niwa  <[email protected]>
 
         [Mac WK2] REGRESSION (r244182) editing/execCommand/change-list-type.html is a flaky failure

Modified: trunk/LayoutTests/css-dark-mode/color-scheme-meta-expected.txt (244466 => 244467)


--- trunk/LayoutTests/css-dark-mode/color-scheme-meta-expected.txt	2019-04-19 21:07:30 UTC (rev 244466)
+++ trunk/LayoutTests/css-dark-mode/color-scheme-meta-expected.txt	2019-04-19 21:19:57 UTC (rev 244467)
@@ -18,6 +18,8 @@
 PASS Element colors are correct in dark color scheme with implicit light color scheme 
 PASS Color schemes changed to light,dark 
 PASS Element colors are in light color scheme since comma is not an allowed seperator 
+PASS Color schemes changed to foo\vdark 
+PASS Element colors are in light color scheme since vertical tab is not an allowed seperator 
 PASS Color schemes changed to a bogus value and dark 
 PASS Element colors are correct in dark color scheme with dark color scheme 
 

Modified: trunk/LayoutTests/css-dark-mode/color-scheme-meta.html (244466 => 244467)


--- trunk/LayoutTests/css-dark-mode/color-scheme-meta.html	2019-04-19 21:07:30 UTC (rev 244466)
+++ trunk/LayoutTests/css-dark-mode/color-scheme-meta.html	2019-04-19 21:19:57 UTC (rev 244467)
@@ -92,7 +92,7 @@
 }, "Element colors are correct in dark color scheme with only dark color scheme");
 
 test(function() {
-    document.getElementById("meta").content = "light  foo ";
+    document.getElementById("meta").content = "\tlight  foo ";
 }, "Color schemes changed to light and a bogus value");
 
 test(function() {
@@ -119,7 +119,16 @@
 }, "Element colors are in light color scheme since comma is not an allowed seperator");
 
 test(function() {
-    document.getElementById("meta").content = "  foo dark";
+    document.getElementById("meta").content = "foo\vdark ";
+}, "Color schemes changed to foo\\vdark");
+
+test(function() {
+    // The semantic text color should be black still.
+    test_color_is_black("test1");
+}, "Element colors are in light color scheme since vertical tab is not an allowed seperator");
+
+test(function() {
+    document.getElementById("meta").content = "  foo\ndark";
 }, "Color schemes changed to a bogus value and dark");
 
 test(function() {

Modified: trunk/Source/WebCore/ChangeLog (244466 => 244467)


--- trunk/Source/WebCore/ChangeLog	2019-04-19 21:07:30 UTC (rev 244466)
+++ trunk/Source/WebCore/ChangeLog	2019-04-19 21:19:57 UTC (rev 244467)
@@ -1,3 +1,17 @@
+2019-04-19  Timothy Hatcher  <[email protected]>
+
+        Standardize the <meta name="color-scheme"> separator.
+        https://bugs.webkit.org/show_bug.cgi?id=193931
+        rdar://problem/49995929
+
+        Reviewed by Darin Adler.
+
+        Tests: css-dark-mode/color-scheme-meta.html
+
+        * dom/Document.cpp:
+        (WebCore::processColorSchemeString): Use isHTMLSpace insead of isColorSchemeSeparator and isASCIISpace.
+        (WebCore::isColorSchemeSeparator): Deleted.
+
 2019-04-19  Wenson Hsieh  <[email protected]>
 
         [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites

Modified: trunk/Source/WebCore/dom/Document.cpp (244466 => 244467)


--- trunk/Source/WebCore/dom/Document.cpp	2019-04-19 21:07:30 UTC (rev 244466)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-04-19 21:19:57 UTC (rev 244467)
@@ -3603,22 +3603,17 @@
 }
 
 #if ENABLE(DARK_MODE_CSS)
-static inline bool isColorSchemeSeparator(UChar character)
-{
-    return isASCIISpace(character);
-}
-
 static void processColorSchemeString(StringView colorScheme, const WTF::Function<void(StringView key)>& callback)
 {
     unsigned length = colorScheme.length();
     for (unsigned i = 0; i < length; ) {
         // Skip to first non-separator.
-        while (i < length && isColorSchemeSeparator(colorScheme[i]))
+        while (i < length && isHTMLSpace(colorScheme[i]))
             ++i;
         unsigned keyBegin = i;
 
         // Skip to first separator.
-        while (i < length && !isColorSchemeSeparator(colorScheme[i]))
+        while (i < length && !isHTMLSpace(colorScheme[i]))
             ++i;
         unsigned keyEnd = i;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to