Title: [253478] trunk/Tools
Revision
253478
Author
[email protected]
Date
2019-12-13 08:42:57 -0800 (Fri, 13 Dec 2019)

Log Message

Prefix CSS selectors with all applicable CSS groupings when generating a ChangeLog
https://bugs.webkit.org/show_bug.cgi?id=205196

Reviewed by Jonathan Bedard.

* Scripts/prepare-ChangeLog:
(get_selector_line_ranges_for_css):
* Scripts/webkitperl/prepare-ChangeLog_unittest/resources/css_unittests-expected.txt:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (253477 => 253478)


--- trunk/Tools/ChangeLog	2019-12-13 16:29:31 UTC (rev 253477)
+++ trunk/Tools/ChangeLog	2019-12-13 16:42:57 UTC (rev 253478)
@@ -1,3 +1,14 @@
+2019-12-13  Devin Rousso  <[email protected]>
+
+        Prefix CSS selectors with all applicable CSS groupings when generating a ChangeLog
+        https://bugs.webkit.org/show_bug.cgi?id=205196
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/prepare-ChangeLog:
+        (get_selector_line_ranges_for_css):
+        * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/css_unittests-expected.txt:
+
 2019-12-13  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Several tests crashing after r247898 "Reorganize UIScriptController into platform-specific subclasses"

Modified: trunk/Tools/Scripts/prepare-ChangeLog (253477 => 253478)


--- trunk/Tools/Scripts/prepare-ChangeLog	2019-12-13 16:29:31 UTC (rev 253477)
+++ trunk/Tools/Scripts/prepare-ChangeLog	2019-12-13 16:42:57 UTC (rev 253478)
@@ -1876,6 +1876,7 @@
     my @stack;
     my $context;
     my @currentParseMode = ("global");
+    my @groupingStack;
     my $selectorBraces = 0;
 
     while (<$fileHandle>) {
@@ -1895,11 +1896,20 @@
 
                     $inBrace -= 1;
 
-                    pop(@currentParseMode);
-                    my $name = pop(@stack);
-                    my $startLine = pop(@stack);
-                    my $endLine = $.;
-                    push(@ranges, [$startLine, $endLine, $name]);
+                    my $parseMode = pop(@currentParseMode);
+                    if ($parseMode eq "selector") {
+                        my $name = pop(@stack);
+                        my $startLine = pop(@stack);
+                        my $endLine = $.;
+                        my $groupingPrefix = join(" ", @groupingStack);
+                        if (length $groupingPrefix) {
+                            $groupingPrefix .= " "
+                        }
+                        push(@ranges, [$startLine, $endLine, $groupingPrefix . $name]);
+                    } elsif ($parseMode eq "media") {
+                        pop(@groupingStack);
+                    }
+
                     $selectorBraces = 0;
                 }
             } elsif ($token eq "/*") {
@@ -1913,7 +1923,7 @@
                     my $startLine = $.;
                     if ($token =~ /^\@media/) {
                         push(@currentParseMode, "media");
-                        push(@stack, ($startLine, $token));
+                        push(@groupingStack, $token);
                     } else {
                         push(@currentParseMode, "selector");
                         push(@stack, ($startLine, $token));

Modified: trunk/Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/css_unittests-expected.txt (253477 => 253478)


--- trunk/Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/css_unittests-expected.txt	2019-12-13 16:29:31 UTC (rev 253477)
+++ trunk/Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/resources/css_unittests-expected.txt	2019-12-13 16:42:57 UTC (rev 253478)
@@ -98,34 +98,24 @@
       '.media-query::before'
     ],
     [
-      '89',
-      '96',
-      '@media only screen and (max-width: 980px)'
-    ],
-    [
       '90',
       '90',
-      '.media-query a'
+      '@media only screen and (max-width: 980px) .media-query a'
     ],
     [
-      '91',
-      '94',
-      '@media (-webkit-min-device-pixel-ratio: 2)'
-    ],
-    [
       '92',
       '92',
-      '.both a'
+      '@media only screen and (max-width: 980px) @media (-webkit-min-device-pixel-ratio: 2) .both a'
     ],
     [
       '93',
       '93',
-      '.both b'
+      '@media only screen and (max-width: 980px) @media (-webkit-min-device-pixel-ratio: 2) .both b'
     ],
     [
       '95',
       '95',
-      '.media-query b'
+      '@media only screen and (max-width: 980px) .media-query b'
     ],
     [
       '98',
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to