Title: [268966] trunk
Revision
268966
Author
[email protected]
Date
2020-10-26 04:00:26 -0700 (Mon, 26 Oct 2020)

Log Message

Drop sorting and deduplication of media queries.
https://bugs.webkit.org/show_bug.cgi?id=217751

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/cssom/mediaquery-sort-dedup-expected.txt: annotate progression

Source/WebCore:

This matches what Gecko has shipped for ages.

The spec used to contain the sorting but not the de-duplication.

Both the spec and Chromium have been updated to match Gecko, see
https://github.com/w3c/csswg-drafts/issues/5627

* css/MediaQuery.cpp:
(WebCore::MediaQuery::MediaQuery): Don't sort / dedup

Tests: imported/w3c/web-platform-tests/css/cssom/mediaquery-sort-dedup.html

LayoutTests:

* fast/media/media-query-serialization.html: Adjust to match spec.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268965 => 268966)


--- trunk/LayoutTests/ChangeLog	2020-10-26 09:35:09 UTC (rev 268965)
+++ trunk/LayoutTests/ChangeLog	2020-10-26 11:00:26 UTC (rev 268966)
@@ -1,3 +1,12 @@
+2020-10-26  Emilio Cobos Álvarez  <[email protected]>
+
+        Drop sorting and deduplication of media queries.
+        https://bugs.webkit.org/show_bug.cgi?id=217751
+
+        Reviewed by Simon Fraser.
+
+        * fast/media/media-query-serialization.html: Adjust to match spec.
+
 2020-10-26  Diego Pino Garcia  <[email protected]>
 
         [GTK][WPE] Unreviewed test gardening. Update baselines of a few more tests remaining after r268958. 

Modified: trunk/LayoutTests/fast/media/media-query-serialization.html (268965 => 268966)


--- trunk/LayoutTests/fast/media/media-query-serialization.html	2020-10-26 09:35:09 UTC (rev 268965)
+++ trunk/LayoutTests/fast/media/media-query-serialization.html	2020-10-26 11:00:26 UTC (rev 268966)
@@ -16,7 +16,7 @@
 );
 
 
-var expected = "not braille, tv and (max-width: 200px) and (min-width: 100px) and (orientation: landscape), (color)";
+var expected = "not braille, tv and (orientation: landscape) and (min-width: 100px) and (max-width: 200px), (color) and (color)";
 shouldBe("document.styleSheets[0].media.mediaText", "expected");
 
 </script>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (268965 => 268966)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-26 09:35:09 UTC (rev 268965)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-26 11:00:26 UTC (rev 268966)
@@ -1,3 +1,12 @@
+2020-10-26  Emilio Cobos Álvarez  <[email protected]>
+
+        Drop sorting and deduplication of media queries.
+        https://bugs.webkit.org/show_bug.cgi?id=217751
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/cssom/mediaquery-sort-dedup-expected.txt: annotate progression
+
 2020-10-25  Emilio Cobos Álvarez  <[email protected]>
 
         Update CSSOM WPT tests.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/mediaquery-sort-dedup-expected.txt (268965 => 268966)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/mediaquery-sort-dedup-expected.txt	2020-10-26 09:35:09 UTC (rev 268965)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/mediaquery-sort-dedup-expected.txt	2020-10-26 11:00:26 UTC (rev 268966)
@@ -1,4 +1,4 @@
 
-FAIL Media queries are not sorted lexicographically assert_equals: expected "(min-width: 10px) and (min-height: 10px)" but got "(min-height: 10px) and (min-width: 10px)"
-FAIL Media queries are not deduplicated assert_equals: expected "(color) and (color)" but got "(color)"
+PASS Media queries are not sorted lexicographically
+PASS Media queries are not deduplicated
 

Modified: trunk/Source/WebCore/ChangeLog (268965 => 268966)


--- trunk/Source/WebCore/ChangeLog	2020-10-26 09:35:09 UTC (rev 268965)
+++ trunk/Source/WebCore/ChangeLog	2020-10-26 11:00:26 UTC (rev 268966)
@@ -1,3 +1,22 @@
+2020-10-26  Emilio Cobos Álvarez  <[email protected]>
+
+        Drop sorting and deduplication of media queries.
+        https://bugs.webkit.org/show_bug.cgi?id=217751
+
+        Reviewed by Simon Fraser.
+
+        This matches what Gecko has shipped for ages.
+
+        The spec used to contain the sorting but not the de-duplication.
+
+        Both the spec and Chromium have been updated to match Gecko, see
+        https://github.com/w3c/csswg-drafts/issues/5627
+
+        * css/MediaQuery.cpp:
+        (WebCore::MediaQuery::MediaQuery): Don't sort / dedup
+
+        Tests: imported/w3c/web-platform-tests/css/cssom/mediaquery-sort-dedup.html
+
 2020-10-25  Sam Weinig  <[email protected]>
 
         Remove non-standard 'css'/'Css' prefixed properties on CSSStyleDeclaration

Modified: trunk/Source/WebCore/css/MediaQuery.cpp (268965 => 268966)


--- trunk/Source/WebCore/css/MediaQuery.cpp	2020-10-26 09:35:09 UTC (rev 268965)
+++ trunk/Source/WebCore/css/MediaQuery.cpp	2020-10-26 11:00:26 UTC (rev 268966)
@@ -74,23 +74,6 @@
     , m_expressions(WTFMove(expressions))
     , m_restrictor(restrictor)
 {
-    std::sort(m_expressions.begin(), m_expressions.end(), [](auto& a, auto& b) {
-        return codePointCompare(a.serialize(), b.serialize()) < 0;
-    });
-
-    // Remove all duplicated expressions.
-    String key;
-    for (int i = m_expressions.size() - 1; i >= 0; --i) {
-
-        // If any _expression_ is invalid the media query must be ignored.
-        if (!m_ignored)
-            m_ignored = !m_expressions[i].isValid();
-
-        if (m_expressions[i].serialize() == key)
-            m_expressions.remove(i);
-        else
-            key = m_expressions[i].serialize();
-    }
 }
 
 // http://dev.w3.org/csswg/cssom/#compare-media-queries
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to