Closed Bug 1405311 Opened 7 years ago Closed 7 years ago

Remove :-moz-system-metric pseudo-class, replace with system metric media queries.

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox57 --- wontfix
firefox58 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(3 files)

After :-moz-system-metric is UA / chrome only, we can replace its current uses for system metric media queries, and remove this pseudo-class, which would be nicer to avoid duplication, and also would make them be evaluated just once.
Priority: -- → P3
Depends on: 1406631
Comment on attachment 8916237 [details] Bug 1405311: Remove uses of :-moz-system-metric. https://reviewboard.mozilla.org/r/187468/#review192972 Looks good to me, with one issue below. Also this touches lots of toolkit and browser code, so may be worth double-check by a browser peer. ::: layout/reftests/css-mediaqueries/reftest.list (Diff revision 1) > == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml > == mq_print_minheight_updown.xhtml mq_print-ref.xhtml > == mq_print_minwidth_updown.xhtml mq_print-ref.xhtml > > pref(layout.css.scoped-style.enabled,true) == scoped-mq-update.html scoped-mq-update-ref.html > -== system-metrics-1.html system-metrics-1-ref.html The removal of test which checking this feature should probably be moved to the next patch, but it probably doesn't matter too much. ::: toolkit/content/minimal-xul.css:124 (Diff revision 1) > -scrollbarbutton[sbattr="scrollbar-up-top"]:not(:-moz-system-metric(scrollbar-start-backward)), > -scrollbarbutton[sbattr="scrollbar-down-top"]:not(:-moz-system-metric(scrollbar-start-forward)), > -scrollbarbutton[sbattr="scrollbar-up-bottom"]:not(:-moz-system-metric(scrollbar-end-backward)), > -scrollbarbutton[sbattr="scrollbar-down-bottom"]:not(:-moz-system-metric(scrollbar-end-forward)) { > +@media not (-moz-scrollbar-start-backward) { > + scrollbarbutton[sbattr="scrollbar-up-top"], > + scrollbarbutton[sbattr="scrollbar-down-top"], > + scrollbarbutton[sbattr="scrollbar-up-bottom"], > + scrollbarbutton[sbattr="scrollbar-down-bottom"] { > - display: none; > + display: none; > -} > + } > +} Apparently this rewrite is incorrect. The four selectors uses different metrics. They are `scrollbar-{start,end}-{forward-backward}`. Unless you can prove that these four are always identical, this cannot be rewritten this way. (So, it isn't. Specifically, our GTK widget supports all kinds of combination [1]) [1] https://searchfox.org/mozilla-central/rev/b53e29293c9e9a2905f4849f4e3c415e2013f0cb/widget/gtk/nsLookAndFeel.cpp#427-441
Attachment #8916237 - Flags: review?(xidorn+moz) → review+
Attachment #8916237 - Flags: review?(jmathies)
Attachment #8916238 - Flags: review?(xidorn+moz) → review+
(In reply to Xidorn Quan [:xidorn] UTC+10 from comment #4) > Comment on attachment 8916237 [details] > Bug 1405311: Remove uses of :-moz-system-metric. > > https://reviewboard.mozilla.org/r/187468/#review192972 > > Looks good to me, with one issue below. > > Also this touches lots of toolkit and browser code, so may be worth > double-check by a browser peer. > > ::: layout/reftests/css-mediaqueries/reftest.list > (Diff revision 1) > > == mq_print_maxheight_updown.xhtml mq_print-ref.xhtml > > == mq_print_minheight_updown.xhtml mq_print-ref.xhtml > > == mq_print_minwidth_updown.xhtml mq_print-ref.xhtml > > > > pref(layout.css.scoped-style.enabled,true) == scoped-mq-update.html scoped-mq-update-ref.html > > -== system-metrics-1.html system-metrics-1-ref.html > > The removal of test which checking this feature should probably be moved to > the next patch, but it probably doesn't matter too much. > > ::: toolkit/content/minimal-xul.css:124 > (Diff revision 1) > > -scrollbarbutton[sbattr="scrollbar-up-top"]:not(:-moz-system-metric(scrollbar-start-backward)), > > -scrollbarbutton[sbattr="scrollbar-down-top"]:not(:-moz-system-metric(scrollbar-start-forward)), > > -scrollbarbutton[sbattr="scrollbar-up-bottom"]:not(:-moz-system-metric(scrollbar-end-backward)), > > -scrollbarbutton[sbattr="scrollbar-down-bottom"]:not(:-moz-system-metric(scrollbar-end-forward)) { > > +@media not (-moz-scrollbar-start-backward) { > > + scrollbarbutton[sbattr="scrollbar-up-top"], > > + scrollbarbutton[sbattr="scrollbar-down-top"], > > + scrollbarbutton[sbattr="scrollbar-up-bottom"], > > + scrollbarbutton[sbattr="scrollbar-down-bottom"] { > > - display: none; > > + display: none; > > -} > > + } > > +} > > Apparently this rewrite is incorrect. > > The four selectors uses different metrics. They are > `scrollbar-{start,end}-{forward-backward}`. > > Unless you can prove that these four are always identical, this cannot be > rewritten this way. > > (So, it isn't. Specifically, our GTK widget supports all kinds of > combination [1]) > > [1] > https://searchfox.org/mozilla-central/rev/ > b53e29293c9e9a2905f4849f4e3c415e2013f0cb/widget/gtk/nsLookAndFeel.cpp#427-441 Err, nice catch, will ammend.
Comment on attachment 8916237 [details] Bug 1405311: Remove uses of :-moz-system-metric. Moving to a browser theme owner. I'm not qualified to review css changes in toolkit.
Attachment #8916237 - Flags: review?(jmathies) → review?(dao+bmo)
Comment on attachment 8916239 [details] Bug 1405311: Not require a subtree restyle when system metrics change now that :-moz-system-metric no longer exists. https://reviewboard.mozilla.org/r/187472/#review193856
Attachment #8916239 - Flags: review?(cam) → review+
Comment on attachment 8916237 [details] Bug 1405311: Remove uses of :-moz-system-metric. https://reviewboard.mozilla.org/r/187468/#review193942 ::: toolkit/content/minimal-xul.css:124 (Diff revision 1) > .scale-slider { > -moz-binding: url(chrome://global/content/bindings/scale.xml#scaleslider); > -moz-user-focus: normal; > } > > -scrollbarbutton[sbattr="scrollbar-up-top"]:not(:-moz-system-metric(scrollbar-start-backward)), > +@media not (-moz-scrollbar-start-backward) { Apart from what Xidorn said, I don't think this syntax is correct. Media queries are weird. '@media not all and (-moz-scrollbar-start-backward)' would be the "right" way to use 'not' here, but '@media (-moz-scrollbar-start-backward: 0)' is preferable.
Attachment #8916237 - Flags: review?(dao+bmo) → review-
Comment on attachment 8916237 [details] Bug 1405311: Remove uses of :-moz-system-metric. https://reviewboard.mozilla.org/r/187468/#review193956 ::: toolkit/content/minimal-xul.css:124 (Diff revision 1) > .scale-slider { > -moz-binding: url(chrome://global/content/bindings/scale.xml#scaleslider); > -moz-user-focus: normal; > } > > -scrollbarbutton[sbattr="scrollbar-up-top"]:not(:-moz-system-metric(scrollbar-start-backward)), > +@media not (-moz-scrollbar-start-backward) { Yup, you're totally right. Ammended.
Attachment #8916237 - Flags: review?(dao+bmo) → review+
Pushed by ecoal95@gmail.com: https://hg.mozilla.org/integration/autoland/rev/f758ec788914 Remove uses of :-moz-system-metric. r=xidorn,dao
x(In reply to Pulsebot from comment #15) > Pushed by ecoal95@gmail.com: > https://hg.mozilla.org/integration/autoland/rev/f758ec788914 > Remove uses of :-moz-system-metric. r=xidorn,dao I'm landing this first so https://github.com/servo/servo/pull/18848 doesn't break the build, will land the rest after that.
Pushed by ecoal95@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e30f8c099e20 Remove :-moz-system-metric pseudo-class. r=xidorn https://hg.mozilla.org/integration/autoland/rev/049867300f7e Not require a subtree restyle when system metrics change now that :-moz-system-metric no longer exists. r=heycam
Depends on: 1409847
Depends on: 1408702
Blocks: 1483823
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: