Correctness improvements:
* UTF errors are handled safely per spec instead of dangerously truncating
strings.
* There are fewer converter implementations.
Performance improvements:
* The old code did exact buffer length math, which meant doing UTF math twice
on each input string (once for length calculation and another time for
conversion). Exact length math is more complicated when handling errors
properly, which the old code didn't do. The new code does UTF math on the
string content only once (when converting) but risks allocating more than
once. There are heuristics in place to lower the probability of
reallocation in cases where the double math avoidance isn't enough of a
saving to absorb an allocation and memcpy.
* Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
but a single non-ASCII code point pessimized the rest of the string. The
new code tries to get back on the fast ASCII path.
* UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
input to eliminate an operation from the inner loop on x86/x86_64.
* When assigning to a pre-existing string, the new code tries to reuse the
old buffer instead of first releasing the old buffer and then allocating a
new one.
* When reallocating from the new code, the memcpy covers only the data that
is part of the logical length of the old string instead of memcpying the
whole capacity. (For old callers old excess memcpy behavior is preserved
due to bogus callers. See bug 1472113.)
* UTF-8 strings in XPConnect that are in the Latin1 range are passed to
SpiderMonkey as Latin1.
New features:
* Conversion between UTF-8 and Latin1 is added in order to enable faster
future interop between Rust code (or otherwise UTF-8-using code) and text
node and SpiderMonkey code that uses Latin1.
MozReview-Commit-ID: JaJuExfILM9
Always assume allowed-for-all-content. There are a couple callers which weren't
doing that:
* A unit test -> removed.
* ComputeAnimationDistance: Used for testing (in transitions_per_property), and
for the animation inspector. The animation inspector shouldn't show
non-enabled properties. The transitions_per_property test already relies on
getComputedStyle stuff which only uses eForAllContent.
* GetCSSImageURLs: I added this API for the context menu page and such. It
doesn't rely on non-enabled-everywhere properties, it was only using
eInChrome because it was a ChromeOnly API, but it doesn't really need this.
Differential Revision: https://phabricator.services.mozilla.com/D2514
MozReview-Commit-ID: 4VOi5Su3Bos
The setup is that AnimationValue only contains physical properties, and
we physicalize when building keyframes and transitions.
MozReview-Commit-ID: 9dI20N0LFrk
Summary:
This should make it easier to report errors, and also reduce codesize.
The reason this was so generic is that error reporting was unconditionally
enabled and was super-hot, but now that's no longer the case after bug 1452143,
so we can afford the virtual call in the "error reporting enabled" case.
This opens the possibility of simplifying a lot the error setup as well, though
this patch doesn't do it.
Test Plan: No behavior change, so no new tests.
Reviewers: xidorn
Bug #: 1469957
Differential Revision: https://phabricator.services.mozilla.com/D1734
MozReview-Commit-ID: F3wTdhX9MB5
And move the parsing from a free function to MediaList::parse.
MozReview-Commit-ID: 75ES6I2EEOE
--HG--
extra : rebase_source : acd2be1381409371bf4f151e5b21df713e5d9660
This patch:
* Makes StyleStructID an enum class, and moves it to the mozilla namespaces.
* Introduces StyleStructConstants with some constants scattered through the
codebase.
* Makes the computed style bits an enum class, and splits mPseudoType and mBits
into their own members, since we were using a uint64_t when we have only a
couple flags and CSSPseudoElementType is a byte. We statically assert that
the number of style structs is less or equal to 32.
* Makes mPseudoTag, mPseudoType and mBits const, since we don't want them to be
mutated from C++, and we still need a few more refactorings (mostly getting
rid of FinishStyle) to avoid mutating ComputedStyle instead.
MozReview-Commit-ID: 7qsTtASGcYB
There were a check in CssUrl::parse_from_string for extra data, which
was removed as part of servo/servo#16241, so it never fails now.
CssUrl::from_url_value_data doesn't seem to need Result from the very
beginning. It is unclear why it was made that way.
MozReview-Commit-ID: LXzKlZ6wPYW
--HG--
extra : rebase_source : baa4eb68b7c6b0042bd01108d3e6631c3cdf01a8
This is the basic structure of the stuff. Following patches will fill
the gap between Gecko and Servo on value generating, and finally hook
it into InspectorUtils.
MozReview-Commit-ID: KNLAfFBiY6e
--HG--
extra : source : e9e5d72857746710ead3cd42481b805efc771389
The only difference in the final result is "all" shorthand, for which
the original result is wrong because "all" shorthand doesn't accept any
value other than the CSS-wide keywords.
MozReview-Commit-ID: BmT7kGwC0ZQ
--HG--
extra : rebase_source : 094d764007359cb928f4c31a3818448f254a4043
extra : source : 10d25cf7b4ff2b5615a638031f98dc6163708545
This patch is meant to be squashed with the following two. This is an initial
strawman implementation that I wrote to unblock jwatt, cleanups and fixes
follow.
Note that this is style pretty much untested until jwatt's patches are ready,
since Gecko doesn't understand the angle at all, but I expect the fixes to be
minor.
MozReview-Commit-ID: 1Nq5DyCjaZe