Changeset 174615 in webkit


Ignore:
Timestamp:
Oct 10, 2014, 3:38:37 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: CSS minification should not strip whitespace around calc +/- binary operators
https://bugs.webkit.org/show_bug.cgi?id=137624

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2014-10-10
Reviewed by Timothy Hatcher.

Be careful when stripping whitespace around "+". We want to strip for
selectors "a + b" but not for calc expressions "calc(1px + 2px)".

This is not a perfect solution, but it does a good job. It may still break
with more complex calc expressions, like "calc(1px + calc())" but this
handles the basics.

  • Scripts/copy-user-interface-resources-dryrun.rb: Added.
  • Scripts/cssmin.py:

(cssminify):

Location:
trunk/Source/WebInspectorUI
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r174510 r174615  
     12014-10-10  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: CSS minification should not strip whitespace around calc +/- binary operators
     4        https://bugs.webkit.org/show_bug.cgi?id=137624
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Be careful when stripping whitespace around "+". We want to strip for
     9        selectors "a + b" but not for calc expressions "calc(1px + 2px)".
     10
     11        This is not a perfect solution, but it does a good job. It may still break
     12        with more complex calc expressions, like "calc(1px + calc())" but this
     13        handles the basics.
     14
     15        * Scripts/copy-user-interface-resources-dryrun.rb: Added.
     16        * Scripts/cssmin.py:
     17        (cssminify):
     18
    1192014-10-09  Joseph Pecoraro  <pecoraro@apple.com>
    220
  • trunk/Source/WebInspectorUI/Scripts/cssmin.py

    • Property svn:executable set to *
    r151453 r174615  
    3131        (r"\n", ""),                   # delete new lines
    3232        (r"\s+", " "),                 # change multiple spaces to one space
    33         (r"\s?([;:{},+>])\s?", r"\1"), # delete space where it is not needed
     33        (r"\s?([;:{},~>])\s?", r"\1"), # delete space where it is not needed
     34        (r"\s?([-+])(?:\s(?![0-9(]))", r"\1"), # delete whitespace around + and - when not followed by a number or paren. E.g. strip for selector "a + b" but not "calc(a + b)" which requires spaces.
    3435        (r";}", "}")                   # change ';}' to '}' because the semicolon is not needed
    3536    )
Note: See TracChangeset for help on using the changeset viewer.