[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00

aroben at apple.com aroben at apple.com
Wed Mar 17 18:36:52 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 133e2175dad36f48dc93df32116c88c289d4abae
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 12 19:06:01 2010 +0000

    Teach prepare-ChangeLog to find modified selectors in CSS files
    
    Reviewed by Tim Hatcher.
    
    Fixes <http://webkit.org/b/36064> prepare-ChangeLog should extract
    modified selectors from CSS files
    
    * Scripts/prepare-ChangeLog:
    (get_function_line_ranges): Call get_selector_line_ranges_for_css for
    .css files.
    (get_selector_line_ranges_for_css): Added. Finds selectors and their
    line ranges and returns them.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6417aec..d2eb61b 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-12  Adam Roben  <aroben at apple.com>
+
+        Teach prepare-ChangeLog to find modified selectors in CSS files
+
+        Reviewed by Tim Hatcher.
+
+        Fixes <http://webkit.org/b/36064> prepare-ChangeLog should extract
+        modified selectors from CSS files
+
+        * Scripts/prepare-ChangeLog:
+        (get_function_line_ranges): Call get_selector_line_ranges_for_css for
+        .css files.
+        (get_selector_line_ranges_for_css): Added. Finds selectors and their
+        line ranges and returns them.
+
 2010-03-12  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Build fix (for EWS). Make sure the new code builds on older soup.
diff --git a/WebKitTools/Scripts/prepare-ChangeLog b/WebKitTools/Scripts/prepare-ChangeLog
index 3350aa3..870c4b7 100755
--- a/WebKitTools/Scripts/prepare-ChangeLog
+++ b/WebKitTools/Scripts/prepare-ChangeLog
@@ -89,6 +89,7 @@ sub get_function_line_ranges($$);
 sub get_function_line_ranges_for_c($$);
 sub get_function_line_ranges_for_java($$);
 sub get_function_line_ranges_for_javascript($$);
+sub get_selector_line_ranges_for_css($$);
 sub method_decl_to_selector($);
 sub processPaths(\@);
 sub reviewerAndDescriptionForGitCommit($);
@@ -474,6 +475,8 @@ sub get_function_line_ranges($$)
         return get_function_line_ranges_for_java ($file_handle, $file_name);
     } elsif ($file_name =~ /\.js$/) {
         return get_function_line_ranges_for_javascript ($file_handle, $file_name);
+    } elsif ($file_name =~ /\.css$/) {
+        return get_selector_line_ranges_for_css ($file_handle, $file_name);
     }
     return ();
 }
@@ -1173,6 +1176,41 @@ sub get_function_line_ranges_for_javascript($$)
     return @ranges;
 }
 
+# Read a file and get all the line ranges of the things that look like CSS selectors.  A selector is
+# anything before an opening brace on a line. A selector starts at the line containing the opening
+# brace and ends at the closing brace.
+# FIXME: Comments are parsed just like uncommented text.
+#
+# Result is a list of triples: [ start_line, end_line, selector ].
+
+sub get_selector_line_ranges_for_css($$)
+{
+    my ($fileHandle, $fileName) = @_;
+
+    my @ranges;
+
+    my $currentSelector = "";
+    my $start = 0;
+
+    while (<$fileHandle>) {
+        if (/^[ \t]*(.*[^ \t])[ \t]*{/) {
+            $currentSelector = $1;
+            $start = $.;
+        }
+        if (index($_, "}") >= 0) {
+            unless ($start) {
+                warn "mismatched braces in $fileName\n";
+                next;
+            }
+            push(@ranges, [$start, $., $currentSelector]);
+            $currentSelector = "";
+            $start = 0;
+            next;
+        }
+    }
+
+    return @ranges;
+}
 
 sub processPaths(\@)
 {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list