This should help out quite a bit with uBO, which has lots of very
general attribute selectors. We invalidate per attribute name rather
than using a SelectorMap, which prevents matching for attribute
selectors that can't have changed.
The idea is that this should be generally cheaper, though there are
cases where this would be a slight pesimization. For example, if there's
an attribute selector like:
my-specific-element[my-attribute] { /* ... */ }
And you change `my-attribute` in an element that isn't a
`my-specific-element`, before that the SelectorMap would've prevented us
from selector-matching completely. Now we'd still run selector-matching
for that (though the matching would be pretty cheap).
However I think this should speed up things generally, let's see what
the perf tests think before landing this though.
Differential Revision: https://phabricator.services.mozilla.com/D76825
Make it show the contents of style sheets (as it used to before Stylo)
and make it work in --disable-debug --enable-layout-debugger builds.
Differential Revision: https://phabricator.services.mozilla.com/D76640
In the common case of using case sensitive matching, improvements come from:
* for attributes backed by nsStringBuffers, not needing to AddRef/Release the
string buffer
* for attributes backed by atoms, not needing to run the destructor of an
nsDependentAtomString
* for prefix and suffix attribute selectors, using memcmp instead of the
slower StringBeginsWith/StringEndsWith (which read a character at a
time and call a virtual function on the comparator object)
* for the substring attribute selector, using std::search(), which also
avoids virtual function calls on a comparator object
Attribute selector performance is important on pages with many links
with ad blocker extensions that use such selectors installed.
On my machine, this drops total time spent loading the single page HTML
spec
* under Gecko_AttrHasPrefix from 2.69 s to 1.25 s
* under Gecko_AttrHasSubstring from 1.06 s to 0.30 s
Differential Revision: https://phabricator.services.mozilla.com/D76643
Forgot to add test to the first commit.
Moved bug reference link to seperate link tag in scroll-target-margin-004.html and changed comment on modified css line.
Differential Revision: https://phabricator.services.mozilla.com/D76685
This one I went all-in with :is(). Because even if we have to do some more
selector-matching for each element, we need to check the more expensive
selectors and the combinators less often, so I don't think we end up worse than
before, and the difference is massive.
Differential Revision: https://phabricator.services.mozilla.com/D76266
There's some lists code that I could technically clean up a bit more, but I
erred in the side of making the selectors as fast as possible with our current
infrastructure.
For example, this selector list:
:is(ul, ol, dir, menu, dl) ul,
:is(ul, ol, dir, menu, dl) ol,
:is(ul, ol, dir, menu, dl) dir,
:is(ul, ol, dir, menu, dl) menu,
:is(ul, ol, dir, menu, dl) dl
Could be reduced to:
:is(ul, ol, dir, menu, dl) :is(ul, ol, dir, menu, dl)
But that means that for `dl` elements we'll selector-match all the selectors
inside the :is() instead of just `dl`. Maybe it doesn't matter compared with
the work of going up all the parent chain, but I erred in the side of caution
for most of these.
Differential Revision: https://phabricator.services.mozilla.com/D76265
I also removed some unneeded specific selectors for ::placeholder /
::-moz-text-control-editing-root / etc. We only query them for textarea
/ input elements, so it is more of a pesimization than an optimization.
Differential Revision: https://phabricator.services.mozilla.com/D76263
The only caller that passes that principal is the only caller that calls
into LoadSheet with a loader that has a document anyway.
And the principal we're passing is Document::NodePrincipal(), which is
what we'd end up using anyway, so the new code is exactly equivalent, as
far as I can tell.
Differential Revision: https://phabricator.services.mozilla.com/D76469
I don't think all this complexity is worth it for having a
marginally-more-realistic testing story. Using the pref just works and we should
do that, I think.
Differential Revision: https://phabricator.services.mozilla.com/D59980
In order to test its parsing and serialization, we expose it but protect
it behind a pref.
Besides, I would like to drop layout.css.aspect-ratio-number.enabled in
the next patch because the spec has been updated. It seems we don't have
to keep this pref and we should always use Number.
Differential Revision: https://phabricator.services.mozilla.com/D74955
Which is the spec term. nsIStyleSheetLinkingElement is even more
confusing since it may not be an element at all (see: processing
instructions).
Differential Revision: https://phabricator.services.mozilla.com/D76071
When the loader finds an already-complete stylesheet, it will call
PostLoadEvent to fire the load event of the relevant <link> element,
etc.
For that, it'll mint a SheetLoadData, with various fields hard-coded.
That causes us to eventually insert the sheet in mCompleteSheets, but
with a different key, which means we'll end up with two copies of the
same stylesheet in the cache, than when reporting memory we'll report
twice.
Fix it by constructing the right load data a bit sooner, and add an
assertion to ensure this doesn't happen anymore.
Differential Revision: https://phabricator.services.mozilla.com/D76000
After bug 1632647, we can have pseudo-classes inside :not / :is /
:where, which the invalidation and matching code weren't handling.
Add a few tests for this stuff working as expected.
Differential Revision: https://phabricator.services.mozilla.com/D76160
This patch is generated by using my editor's rename functionality.
In the next patch, `nsIFrame::` prefix is going to be removed manually
from all the ChildLists() calls.
Differential Revision: https://phabricator.services.mozilla.com/D75893
See https://bugzilla.mozilla.org/show_bug.cgi?id=932410#c2 for the
context for which this pseudo-element was added.
In the previous patch, I had to special-case range appearance because of
this pseudo-class, but that patch makes this pseudo-class completely
redundant, as now all form controls, themed and unthemed, display
outlines, unless the native theme displays a focus indicator on its own.
Remove the special case, and make ranges use outlines like everything
else rather than this bespoke pseudo-element.
Differential Revision: https://phabricator.services.mozilla.com/D74734
See https://bugzilla.mozilla.org/show_bug.cgi?id=932410#c2 for the
context for which this pseudo-element was added.
In the previous patch, I had to special-case range appearance because of
this pseudo-class, but that patch makes this pseudo-class completely
redundant, as now all form controls, themed and unthemed, display
outlines, unless the native theme displays a focus indicator on its own.
Remove the special case, and make ranges use outlines like everything
else rather than this bespoke pseudo-element.
Differential Revision: https://phabricator.services.mozilla.com/D74734
This also requires changing the EffectCompositor to allow animations in print
and print preview, and setting up a document timeline for the cloned document
Differential Revision: https://phabricator.services.mozilla.com/D69069
Turns out we did have a hook for this already! But it is used to draw or
not inner button styles, so not quite equivalent.
I had to expand the amount of things it applies to because buttons and
such do paint focus indicators in all widgets. This patch could cause
some undesired outlines in some widgets. I hope not (I tried to audit to
the best of my knowledge), but in that case they'd be just more values
to add to the list.
Differential Revision: https://phabricator.services.mozilla.com/D74733
Turns out we did have a hook for this already! But it is used to draw or
not inner button styles, so not quite equivalent.
I had to expand the amount of things it applies to because buttons and
such do paint focus indicators in all widgets. This patch could cause
some undesired outlines in some widgets. I hope not (I tried to audit to
the best of my knowledge), but in that case they'd be just more values
to add to the list.
Differential Revision: https://phabricator.services.mozilla.com/D74733