This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.
These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.
- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>
- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
- Count() --> Length()
- ObjectAt() --> ElementAt()
- AppendObject() --> AppendElement()
- RemoveObjectAt() --> RemoveElementAt()
- ns*Hashtable<nsISupportsHashKey, ...> -->
ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>
- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
- This requires adding a Get() method to nsRefPtrHashtable that it lacks but
nsInterfaceHashtable has.
- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
- nsArrayBase::Create() --> nsTArray()
- GetLength() --> Length()
- do_QueryElementAt() --> operator[]
The patch also has some changes to Rust code that manipulates nsIAtom.
MozReview-Commit-ID: DykOl8aEnUJ
In addition to the sourceMappingURL comment, there is a second special
comment, "sourceURL", that can be used to set the "display name" of a
style sheet for developer tools. This name is also used as the base
URL for the source-map URL resolution algorithm. sourceURL is
described here:
https://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
This patch changes Firefox to record this URL, if specified, and to
expose it (chrome-only) vai StyleSheet.webidl.
MozReview-Commit-ID: 7NwXsOf7nbY
The variables (basicShapeSVGBoxValues, etc.) in property_database.js are
moved to the beginning of the file so that they're defined before usage.
MozReview-Commit-ID: 7L3obIY1alP
This changes the CSS lexer to extract sourceMappingURL directives from
comments and preserve them; then changes the parser to expose this value
as the style sheet's sourceMapURL.
MozReview-Commit-ID: LfMamJ1PsU0
This patch replaces four functions of the name AssignWithConversion which
are essentially wrappers around CopyASCIItoUTF16 and LossyCopyUTF16toASCII
with direct calls to the latter two functions. The replaced functions are:
void nsCString::AssignWithConversion( const nsAString& aData )
void nsString::AssignWithConversion( const nsACString& aData )
void nsTString_CharT::AssignWithConversion(
const incompatible_char_type* aData,
int32_t aLength = -1);
The last of the three exists inside the double-included nsTString* world and
so describes two functions, giving four in total.
This has two advantages:
* it removes code
* at the call points, it makes clear (from the replacement name) which
conversion is being carried out. The generic name "AssignWithConversion"
doesn't make that obvious -- one had to infer it from the types.
The patch also removes two commented out lines from
editor/composer/nsComposerCommands.cpp, that appear to be related. They are
at top level, where they would never have compiled. They look like
leftovers from some previous change.
layout/style/nsCSSParser.cpp:524:12 [-Wunused-member-function] unused member function 'DoNotRestore'
layout/style/nsCSSParser.cpp:563:7 [-Wunused-member-function] unused member function 'nsAutoScannerChanger'
layout/style/nsCSSParser.cpp:587:7 [-Wunused-member-function] unused member function '~nsAutoScannerChanger'
layout/style/nsCSSParser.cpp:1236:8 [-Wunused-member-function] unused member function 'ParseSingleTokenVariantWithRestrictions'
MozReview-Commit-ID: JRTBxrNcZzT
In the an+b syntax, this continues to allow comments and spaces like so:
` an + b `. It does not allow `a n+b`, or `- an+b` or `+ an+b` (and the
same for the `an-b` form). Similarly, it does not allow `- b` or `+ b`.
Additionally, it *does* allow `+/*comment*/n+b` or `-/*comment*/n+b`,
but not `+ n+b` or `-n+b`. This is specced; in this one case we
parse two tokens but do not allow whitespace in between.
MozReview-Commit-ID: INzFGeMPeK7
This matches how Servo handles this, which should be faster when the
value is valid, because we can skip checking lots of keyword tables
in many cases.
MozReview-Commit-ID: C1pGwbKTi0c
scrollbars.css is the only sheet which is parsed as author level, but later
added as agent level in [1]. Add a new enum value so that it can be parsed
as author level in gecko (nsCSSParser::AgentRulesEnabled() will exclude it),
but servo can recognize it as agent level sheet when the sheet is created.
Delete UserRulesEnabled() because no one uses it.
[1] http://searchfox.org/mozilla-central/rev/7419b368156a6efa24777b21b0e5706be89a9c2f/layout/base/nsDocumentViewer.cpp#2326
MozReview-Commit-ID: 2lrV4ogfnHM
The logic around here is a bit tricky, because -moz-linear-gradient() shares
this codepath. Here's how things were going wrong:
* The -moz-linear-gradient syntax allows an angle (e.g. "30deg") to be followed
by an optional box-position (e.g. "top right") before eventually requiring a
comma and then some color stops.
* In contrast, the -webkit-linear-gradient syntax does NOT allow a box-position
there (unless the box-position is by itself, without an angle).
* So, for -webkit-linear-gradient, we (correctly) skipped the box-position
parsing code, if we've seen an angle already.
* BUT: in skipping that code, we *also* inadvertantly skipped the code that
enforces that we eventually see a comma before we get to the color stops.
So, we incorrectly accept some -webkit-linear-gradient() expressions that are
missing a comma that really should be mandatory.
So, this patch adds a special case for -webkit-linear-gradient that
preemptively bails if we get an angle that's not followed by a comma. (With
that, we can also simplify the condition around the box position parsing, too.)
MozReview-Commit-ID: B7MQLxqe6D7
Note: Instead of exactly honoring the legacy -webkit-gradient(linear,...)
syntax, we aim to simply parse it into something that's approximately
equivalent for common use cases.
In the legacy -webkit-gradient(linear,...) syntax, authors provide *two
arbitrary points* to establish the direction of the gradient, whereas modern
linear-gradient() is simpler: it just takes a single "<side-or-corner>" point
and fills the box with a gradient in the direction of that side or corner.
Before this changeset, we parsed -webkit-gradient(linear,...) into a
slightly-less-legacy "-moz-linear-gradient" representation, so that we could
honor at least one of the author's specified points (since -moz-linear-gradient
accepts a single arbitrary point as the start of the gradient). But that
prevents us from deprecating -moz-linear-gradient, and it makes it impossible
to spec our emulation behavior in terms of modern standards.
So, this changeset is just changing our approximate representation so that it
can always be serializeable as a modern linear-gradient() expression.
In addition, I'm removing the reftest "webkit-gradient-approx-linear-1.html"
(whose behavior this patch is changing slightly) and I'm replacing it with a
new chunk in test_computed_style.html to more directly test this parsing
behaivor.
MozReview-Commit-ID: 6N1oKaGeOuE