Closed Bug 1225192 Opened 9 years ago Closed 9 years ago

prettifying CSS preserves leading whitespace

Categories

(DevTools :: Style Editor, defect)

defect
Not set
normal

Tracking

(firefox45 fixed)

RESOLVED FIXED
Firefox 45
Tracking Status
firefox45 --- fixed

People

(Reporter: tromey, Assigned: tromey)

References

Details

Attachments

(2 files, 4 obsolete files)

When prettifying CSS, the code in css-logic preserves leading whitespace.
This can yield strange results like:

   div {
}

body {
}
Cleaning up css-logic.js while I was in the area.
Remove leading whitespace before prettifying.
Comment on attachment 8687991 [details] [diff] [review]
fix eslint complaints about css-logic.js

This fixes all the eslint nits I could fix.
(It still complains about domUtils and CSS not being defined,
but that's some other problem)
Attachment #8687991 - Flags: review?(pbrosset)
Attachment #8687992 - Flags: review?(pbrosset)
Comment on attachment 8687991 [details] [diff] [review]
fix eslint complaints about css-logic.js

Review of attachment 8687991 [details] [diff] [review]:
-----------------------------------------------------------------

I'm going to be totally honest here, I did not review those 2000 lines in details :)
The changes seemed mechanical enough that I quickly glanced over at them.

What I did think about while reviewing though was that we probably are not using all of the code in this module anymore. Taking a quick look, I couldn't find a usage of findMatchedSelectors for example (which means that it could be removed along with compareTo and specificity). There might be some others too.
Also, the actors in styles.js are the only one to actually instantiate the CssLogic class, but I have a feeling that this class isn't nearly as useful as it used to. For instance, we keep on calling .reset() on the instance, which, I think, defeats the original purpose which was to cache a bunch of properties.

Anyway, I digress. So I filed bug 1225254.
Attachment #8687991 - Flags: review?(pbrosset) → review+
Comment on attachment 8687992 [details] [diff] [review]
remove leading whitespace before prettifying css

Review of attachment 8687992 [details] [diff] [review]:
-----------------------------------------------------------------

:) that was an easy one.
Attachment #8687992 - Flags: review?(pbrosset) → review+
Rebased and added r= to commit.
Attachment #8687991 - Attachment is obsolete: true
Attachment #8687992 - Attachment is obsolete: true
try pointed out that some test cases would have to spuriously change,
because we're unconditionally rewriting the input.  This update
changes prettifyCSS to return the un-trimmed text for all "early"
exits.
Attachment #8688614 - Flags: review+
Comment on attachment 8688615 [details] [diff] [review]
remove leading whitespace before prettifying css

Maybe it's silly to re-request review for this one.
Attachment #8688615 - Flags: review?(pbrosset)
Attachment #8688615 - Flags: review?(pbrosset) → review+
Keywords: checkin-needed
this failed to apply:

renamed 1225192 -> Bug-1225192---fix-eslint-complaints-about-css-logi.patch
applying Bug-1225192---fix-eslint-complaints-about-css-logi.patch
patching file devtools/shared/styleinspector/css-logic.js
Hunk #2 FAILED at 75
1 out of 23 hunks FAILED -- saving rejects to file devtools/shared/styleinspector/css-logic.js.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working directory
errors during apply, please fix and refresh Bug-1225192---fix-eslint-complaints-about-css-logi.patch
Flags: needinfo?(ttromey)
Keywords: checkin-needed
I've rebased this but I think it's better to wait for bug 1216234 at this point,
as that one patches css-logic.js, which this patch massively changes.
Depends on: 1216234
Flags: needinfo?(ttromey)
Rebased.
Attachment #8688614 - Attachment is obsolete: true
Attachment #8688615 - Attachment is obsolete: true
Attachment #8694748 - Flags: review+
Attachment #8694749 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/5c706bfd11cc
https://hg.mozilla.org/mozilla-central/rev/872043399490
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: