Changeset 244467 in webkit


Ignore:
Timestamp:
Apr 19, 2019 2:19:57 PM (5 years ago)
Author:
timothy@apple.com
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.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244462 r244467  
     12019-04-19  Timothy Hatcher  <timothy@apple.com>
     2
     3        Standardize the `<meta name="color-scheme">` separator.
     4        https://bugs.webkit.org/show_bug.cgi?id=193931
     5        rdar://problem/49995929
     6
     7        Reviewed by Darin Adler.
     8
     9        * css-dark-mode/color-scheme-meta-expected.txt:
     10        * css-dark-mode/color-scheme-meta.html: Test other types of spaces like tab, newline and vertical tab.
     11
    1122019-04-19  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/LayoutTests/css-dark-mode/color-scheme-meta-expected.txt

    r244413 r244467  
    1919PASS Color schemes changed to light,dark
    2020PASS Element colors are in light color scheme since comma is not an allowed seperator
     21PASS Color schemes changed to foo\vdark
     22PASS Element colors are in light color scheme since vertical tab is not an allowed seperator
    2123PASS Color schemes changed to a bogus value and dark
    2224PASS Element colors are correct in dark color scheme with dark color scheme
  • trunk/LayoutTests/css-dark-mode/color-scheme-meta.html

    r244413 r244467  
    9393
    9494test(function() {
    95     document.getElementById("meta").content = "light  foo ";
     95    document.getElementById("meta").content = "\tlight  foo ";
    9696}, "Color schemes changed to light and a bogus value");
    9797
     
    120120
    121121test(function() {
    122     document.getElementById("meta").content = "  foo dark";
     122    document.getElementById("meta").content = "foo\vdark ";
     123}, "Color schemes changed to foo\\vdark");
     124
     125test(function() {
     126    // The semantic text color should be black still.
     127    test_color_is_black("test1");
     128}, "Element colors are in light color scheme since vertical tab is not an allowed seperator");
     129
     130test(function() {
     131    document.getElementById("meta").content = "  foo\ndark";
    123132}, "Color schemes changed to a bogus value and dark");
    124133
  • trunk/Source/WebCore/ChangeLog

    r244457 r244467  
     12019-04-19  Timothy Hatcher  <timothy@apple.com>
     2
     3        Standardize the <meta name="color-scheme"> separator.
     4        https://bugs.webkit.org/show_bug.cgi?id=193931
     5        rdar://problem/49995929
     6
     7        Reviewed by Darin Adler.
     8
     9        Tests: css-dark-mode/color-scheme-meta.html
     10
     11        * dom/Document.cpp:
     12        (WebCore::processColorSchemeString): Use isHTMLSpace insead of isColorSchemeSeparator and isASCIISpace.
     13        (WebCore::isColorSchemeSeparator): Deleted.
     14
    1152019-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
    216
  • trunk/Source/WebCore/dom/Document.cpp

    r244440 r244467  
    36043604
    36053605#if ENABLE(DARK_MODE_CSS)
    3606 static inline bool isColorSchemeSeparator(UChar character)
    3607 {
    3608     return isASCIISpace(character);
    3609 }
    3610 
    36113606static void processColorSchemeString(StringView colorScheme, const WTF::Function<void(StringView key)>& callback)
    36123607{
     
    36143609    for (unsigned i = 0; i < length; ) {
    36153610        // Skip to first non-separator.
    3616         while (i < length && isColorSchemeSeparator(colorScheme[i]))
     3611        while (i < length && isHTMLSpace(colorScheme[i]))
    36173612            ++i;
    36183613        unsigned keyBegin = i;
    36193614
    36203615        // Skip to first separator.
    3621         while (i < length && !isColorSchemeSeparator(colorScheme[i]))
     3616        while (i < length && !isHTMLSpace(colorScheme[i]))
    36223617            ++i;
    36233618        unsigned keyEnd = i;
Note: See TracChangeset for help on using the changeset viewer.