Граф коммитов

115 Коммитов

Автор SHA1 Сообщение Дата
Nathan Froyd e7b3b3140d Bug 1415980 - make hash keys movable and not copyable; r=erahm
Everything that goes in a PLDHashtable (and its derivatives, like
nsTHashtable) needs to inherit from PLDHashEntryHdr. But through a lack
of enforcement, copy constructors for these derived classes didn't
explicitly invoke the copy constructor for PLDHashEntryHdr (and the
compiler didn't invoke the copy constructor for us). Instead,
PLDHashTable explicitly copied around the bits that the copy constructor
would have.

The current setup has two problems:

1) Derived classes should be using move construction, not copy
   construction, since anything that's shuffling hash table keys/entries
   around will be using move construction.

2) Derived classes should take responsibility for transferring bits of
   superclass state around, and not rely on something else to handle that.

The second point is not a huge problem for PLDHashTable (PLDHashTable
only has to copy PLDHashEntryHdr's bits in a single place), but future
hash table implementations that might move entries around more
aggressively would have to insert compensation code all over the
place. Additionally, if moving entries is implemented via memcpy (which
is quite common), PLDHashTable copying around bits *again* is
inefficient.

Let's fix all these problems in one go, by:

1) Explicitly declaring the set of constructors that PLDHashEntryHdr
   implements (and does not implement). In particular, the copy
   constructor is deleted, so any derived classes that attempt to make
   themselves copyable will be detected at compile time: the compiler
   will complain that the superclass type is not copyable.

This change on its own will result in many compiler errors, so...

2) Change any derived classes to implement move constructors instead of
   copy constructors. Note that some of these move constructors are,
   strictly speaking, unnecessary, since the relevant classes are moved
   via memcpy in nsTHashtable and its derivatives.
2018-09-20 11:20:36 -04:00
Thomas Nguyen a6c1be6216 Bug 1330487 - Part 2 : Refactor, new constructor of URIPrincipalReferrerPolicyAndCorsModeHashKey from SheetLoadData r=heycam
MozReview-Commit-ID: LC3jzw8mli7

Differential Revision: https://phabricator.services.mozilla.com/D2290

--HG--
extra : moz-landing-system : lando
2018-09-17 05:35:10 +00:00
Thomas Nguyen 12582ae1aa Bug 1330487 - Part 1: Parse referrer policy from header and propagate to stylesheet r=heycam
This also fixes loading child stylesheet case, using correct referrer policy stored
in parent sheet.

MozReview-Commit-ID: ARXQyleD9Wq

Differential Revision: https://phabricator.services.mozilla.com/D1921

--HG--
extra : moz-landing-system : lando
2018-09-17 05:35:26 +00:00
Emilio Cobos Álvarez 638c015ba9 Bug 1477198: Remove Document.obsoleteSheet. r=bz
Not used anywhere, not even comm-central or bluegriffon.

Differential Revision: https://phabricator.services.mozilla.com/D2263

MozReview-Commit-ID: LGefiaYSZjT
2018-07-29 00:34:33 +02:00
Emilio Cobos Álvarez 9caf38a872 Bug 1470420: Change an nsAutoPtr to UniquePtr in the Loader. r=xidorn
MozReview-Commit-ID: 4KnjxHOybmG
2018-06-22 17:23:01 +02:00
Emilio Cobos Álvarez da6e9b176a Bug 1470420: Cleanup ParseSheet. r=xidorn
MozReview-Commit-ID: 3RtTHSo9Z1G
2018-06-22 17:23:00 +02:00
Emilio Cobos Álvarez 79401ad550 Bug 1470420: Make Stop() infallible. r=xidorn
MozReview-Commit-ID: KScKUyUSkjj
2018-06-22 17:22:59 +02:00
Emilio Cobos Álvarez c3f12726ac Bug 1470420: Make InsertChildSheet infallible. r=xidorn
MozReview-Commit-ID: 4bkwzSZ2ByZ
2018-06-22 17:22:58 +02:00
Emilio Cobos Álvarez ee59da45b2 Bug 1470358: Deduplicate sheet insertion code between document and shadow root. r=heycam
Summary: Sort of straight-forward cleanup.

Test Plan: Covered by existing tests.

Reviewers: heycam

Reviewed By: heycam

Bug #: 1470358

Differential Revision: https://phabricator.services.mozilla.com/D1763
2018-06-22 12:57:37 +02:00
Emilio Cobos Álvarez 9509853a38 Bug 1459498: Rename nsIStyleSheetLinkingElement::StyleSheetInfo to SheetInfo. r=heycam
MozReview-Commit-ID: FeOmISAxWBk
2018-05-08 10:07:46 +02:00
Emilio Cobos Álvarez 786abfd0cc Bug 1459498: Remove a useless QI. r=heycam
MozReview-Commit-ID: FD74BpQvMih
2018-05-08 10:07:45 +02:00
Emilio Cobos Álvarez c8b98b398b Bug 1459498: Remove useless CreateSheet arguments. r=heycam
This is one of the most important steps for bug 1459498. After this I can use
StyleSheetInfo to compute IsAlternate. Still all the preferred stylesheet stuff
is crazy...

MozReview-Commit-ID: 9ZHW9AYGoBe
2018-05-08 10:07:44 +02:00
Emilio Cobos Álvarez 91b6cb40dc Bug 1459498: Use StyleSheetInfo more. r=heycam
Not as much as I'd like, because we have all the internal loads and child
sheets, but...

MozReview-Commit-ID: 7402w8vxCel
2018-05-08 10:07:43 +02:00
Emilio Cobos Álvarez d6f7b1d2f5 Bug 1459497: Refactor the preferred style set stuff in order to move the state away from the loader. r=heycam
The main thing to have into account is that the styleset to use is either
mLastStyleSheetSet, or mPreferredStyleSheetSet.

This last one gets set from Loader::IsAlternateSheet, which is quite nasty and
what I'm trying to remove.

MozReview-Commit-ID: BI4P1Chqtli
2018-05-07 03:55:36 +02:00
Emilio Cobos Álvarez 9b13f54912 Bug 1457920: Loader::ParseSheet is not really fallible. r=xidorn
MozReview-Commit-ID: IexX1RRCuF4
2018-05-02 04:13:34 +02:00
Emilio Cobos Álvarez a62beaa09b Bug 1457920: Cleanup a useless argument in Loader. r=xidorn
MozReview-Commit-ID: HajaHl6JEV8
2018-05-02 04:13:32 +02:00
Emilio Cobos Álvarez c556ec7ad0 Bug 1457920: Remove ServoStyleSheet usage. r=xidorn
MozReview-Commit-ID: LIBkovuQ6MB
2018-05-02 04:13:26 +02:00
Emilio Cobos Álvarez 8239c1300e Bug 1386840: Defer loading and don't block rendering for non-matching stylesheets. r=bz,heycam
MozReview-Commit-ID: 24UJZDooGmn
2018-04-26 16:44:03 +02:00
Emilio Cobos Álvarez 31aff796a0 Bug 1456435: Make the loader a bit less outparam-happy. r=heycam
Returning the same type and UpdateStyleSheet.

This hopefully helps seeing how the data flows between the methods, instead of
the messy bits we had before.

MozReview-Commit-ID: C6THNRi8bbg
2018-04-26 16:43:58 +02:00
Emilio Cobos Álvarez 5618bcfb59 Bug 1456435: Less bool outparam in Loader too. r=heycam
MozReview-Commit-ID: D5A2BxwHGjn
2018-04-26 16:43:54 +02:00
Bobby Holley 9cff749db5 Bug 1454460 - Pass a bonafide nsACString to Servo. r=bz
This will allow the Rust code hold a copy-free strong reference to the string
past callstack unwind.

MozReview-Commit-ID: HCop9h2abZU
2018-04-17 16:27:08 -07:00
Xidorn Quan 3b8cc6c6ef Bug 1447828 part 4 - Remove StyleBackendType uses from Loader. r=emilio
MozReview-Commit-ID: 8DbjibZE3Dw

--HG--
extra : rebase_source : aa664ee40199b5358e304e076c8d6853e496d7a8
extra : source : 06be08613cf88b6963033929ff5ac0d82a6327b1
2018-03-29 02:33:01 +11:00
Jonathan Watt 4570211dcc Bug 1449565 - Remove the aGeckoParentRule parameter from css::Loader's InsertChildSheet and LoadChildSheet. r=emilio
--HG--
extra : source : c31de7e26809522daca72a6050cd3ab665e8f6ff
2018-03-23 17:02:35 +00:00
Emilio Cobos Álvarez f7522ae728 Bug 1447358: Unifdef the old style system code. r=jwatt
Summary:
This has been automatically generated using:

  http://dotat.at/prog/unifdef/

And:

find $OBJDIR -type f -name '*.h' |
while read FILE; do
  echo "$FILE"
  unifdef -m -DMOZ_STYLO -UMOZ_OLD_STYLE "$FILE";
done

find $OBJDIR -type f -name '*.cpp' |
while read FILE; do
  echo "$FILE"
  unifdef -m -DMOZ_STYLO -UMOZ_OLD_STYLE "$FILE";
done

MozReview-Commit-ID: I4NdKqbMXzJ

Reviewers: jwatt

Bug #: 1447358

Differential Revision: https://phabricator.services.mozilla.com/D779
2018-03-21 10:20:34 +01:00
Emilio Cobos Álvarez de099db7bd Bug 1444905: Remove scoped style support from the old style system. r=xidorn,smaug
Summary: It uses two node bits that can be better suited for something else.

Reviewers: xidorn, smaug

Bug #: 1444905

Differential Revision: https://phabricator.services.mozilla.com/D709

MozReview-Commit-ID: HIPDtHm6xpM
2018-03-13 10:26:13 +01:00
Boris Zbarsky ccac7d9846 Bug 1442126. Make sure to consistently fail a sheet load if any of its imports fail. r=bholley
This fixes a race where we would fail if and only if our last-to-complete import failed.

MozReview-Commit-ID: L33bIxlkj08
2018-03-06 14:45:27 -05:00
Bobby Holley 1c48af9d6d Bug 1438974 - Dispatch to the appropriate event target. r=smaug
MozReview-Commit-ID: 6mCk1PjStND
2018-02-28 10:43:13 -08:00
Bobby Holley 8eda59462e Bug 1438974 - Make Servo stylesheet parsing completion async by default. r=bz
MozReview-Commit-ID: GXLT5NakIop
2018-02-28 10:43:13 -08:00
Bobby Holley a584615963 Bug 1438974 - Separate synchronous stylesheet parsing into a separate path. r=bz
This will allow us to make the regular path fully asynchronous.

MozReview-Commit-ID: 6ZurtiNQPZK
2018-02-28 10:43:12 -08:00
Bobby Holley e328272882 Bug 1438974 - Separate the Gecko and Servo parsing paths in the Loader. r=bz
This will allow us to avoid touching the old style system when making
the Servo parses asynchronous, and make it easier to drop the old code
when the time comes.

MozReview-Commit-ID: 5em0PMnb5Nw
2018-02-28 10:43:11 -08:00
Bobby Holley 096338d19b Bug 1438974 - Add an explicit "being parsed" flag to SheetLoadData and remove mParsingDatas. r=bz
MozReview-Commit-ID: 69fK5VAWrbj
2018-02-28 10:43:11 -08:00
Bobby Holley 2ba333893c Bug 1441896 - Pass an explicit parent SheetLoadData for child stylesheet loads. r=bz CLOSED TREE
MozReview-Commit-ID: 7XNu42NtITm
2018-02-28 10:09:00 +02:00
Kris Maglione 1653b08073 Bug 1415352: Part 4c - Use subject principal as the triggering principal for inline <style> nodes. r=bz
This change captures the subject principal when a scripted caller sets the
textContent or innerHTML property of a <style> node, and uses it as the
triggering principal for the resulting stylesheet.

If the node contents are modified in any way other than through textContent or
innerHTML, the triggering principal is forgotten (which is an intentional
design feature).

MozReview-Commit-ID: GacZFIB5BzS

--HG--
extra : rebase_source : 04926f30b8e2831d18d3fb64b850f670f006eb85
2017-11-07 14:25:45 -08:00
Daniel Holbert 680815cd6e Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK

--HG--
extra : rebase_source : 3356d4b80ff6213935192e87cdbc9103fec6084c
2017-10-27 10:33:53 -07:00
Kris Maglione 5fdcb5a5d2 Bug 1407056: Part 1 - Provide more consistent principal/origin URL to content policies. r=bz,ckerschb
We're currently fairly vague and inconsistent about the values we provide to
content policy implementations for requestOrigin and requestPrincipal. In some
cases they're the triggering principal, sometimes the loading principal,
sometimes the channel principal.

Our existing content policy implementations which require or expect a loading
principal currently retrieve it from the context node. Since no current
callers require the principal to be the loading principal, and some already
expect it to be the triggering principal (which there's currently no other way
to retrieve), I chose to pass the triggering principal whenever possible, but
use the loading principal to determine the origin URL.

As a follow-up, I'd like to change the nsIContentPolicy interface to
explicitly receive loading and triggering principals, or possibly just
LoadInfo instances, rather than poorly-defined request
origin/principal/context args. But since that may cause trouble for
comm-central, I'd rather not do it as part of this bug.

MozReview-Commit-ID: LqD9GxdzMte

--HG--
extra : rebase_source : 41ce439912ae7b895e0a3b0e660fa6ba571eb50f
2017-10-12 15:43:55 -07:00
Kris Maglione 9c145b38f6 Bug 1406278: Part 8b - Use subject principal as triggering principal in style <link> "href" attribute. r=bz
MozReview-Commit-ID: LWMkBcB4WIg

--HG--
extra : rebase_source : fa2daf25c58190cee7e55798347d4eaffa0d5250
extra : histedit_source : f2887c9e53c572aa5e675600cd1aeb6c5a72becc%2Ce7a84ac505319ca24e65c73a4df13014a0a0cdc0
2017-10-05 19:40:48 -07:00
Henri Sivonen 3c8567b60d Bug 1354989 - Avoid pivoting via UTF-16 when loading CSS in the Stylo mode. r=jdm,SimonSapin
MozReview-Commit-ID: Llt29dvB4Io

--HG--
extra : rebase_source : 3ae51dc8beff3fb19e9318a6c7c30c9ab08a5b57
2017-08-29 16:01:42 +03:00
Thomas Nguyen 33fb4a1505 Bug 1384493 - LoadStyleLink and LoadInlineStyle should use correct referrer policy. r=heycam
If the link element has referrerpolicy attribute, we should use policy in the
attribute with higher priority

MozReview-Commit-ID: GZZeRaoxPUw
2017-08-15 00:05:00 -04:00
Emilio Cobos Álvarez f16a67fdd4 Bug 1372041: Refactor a bunch of stuff so link rel="media" is honored. r=heycam
This still leaves one annoying refactoring of @import so we also fix it for
them.

MozReview-Commit-ID: 4s0WExDEH75
2017-07-02 17:19:07 +02:00
KuoE0 1ef85c4cf5 Bug 1367984 - Refactor LoaderReusableStyleSheets to accept StyleSheet to support both of CSSStyleSheet and ServoStyleSheet. r=heycam
MozReview-Commit-ID: 8scCs4avrCf

--HG--
extra : rebase_source : 19e928838c48211ed9deff7c2d8870dc770e4459
2017-05-15 15:55:08 +08:00
Emilio Cobos Álvarez c0d9b6a9d7 Bug 1325878: Use dom::MediaList in the CSS Loader. r=xidorn
MozReview-Commit-ID: 8KcKYrkk3jI
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-13 00:30:05 +08:00
Xidorn Quan e0f34c4221 Bug 1352763 part 2 - Pass borrowed child stylesheet to Gecko for loading rather than the import rule. r=emilio
This is necessary because if we pass in the import rule, we would need
to invoke Servo_ImportRule_GetSheet to get the child sheet. However,
Servo_ImportRule_GetSheet tries to lock the global rwlock with read
access, while Servo_CssRules_InsertRule has already locked the same
rwlock with write access for the CSSOM case.

Since the import rule itself is never needed in the code path, it is
easier to just pass in the child stylesheet.

MozReview-Commit-ID: 4njNyGniPIm

--HG--
extra : rebase_source : ad88929713fdc5a581addc044094fa8130125121
2017-04-03 16:18:49 +10:00
Kris Maglione dabd327027 Bug 1348442: Part 1 - Allow loading preloaded stylesheets asynchronously. r=heycam
These changes allow us to asynchronously load pre-loaded stylesheets, in a way
that's similar to ChromeUtils.compileScript. The new method returns a Promise
which resolves to the preloaded sheet once it's finished loading.

This will allow us to remove the last remaining use of synchronous channels in
moz-extension: URLs.

MozReview-Commit-ID: 7J52ff93YKT

--HG--
extra : rebase_source : 20fa013cdc7f5fbedb5ce671ede17765a2abbac2
2017-03-19 19:33:49 -07:00
Ting-Yu Lin f087300185 Bug 1338446 Part 3 - Label SheetLoadData in Loader::PostLoadEvent. r=heycam
When constructing a Loader without passing a document, we added a DocGroup
parameter so that we could still use it to dispatch events to the DocGroup.

Delete NS_ENSURE_TRUE because new() is infallable.

Use another runnable pointer for calling dispatching because forget() will
nuke the pointer and we need to use evt afterwards.

MozReview-Commit-ID: Ce2K6j4pUhA

--HG--
extra : rebase_source : 2bacf1f856e0700f36b2fefe4d2424719cad77a7
2017-03-13 17:00:57 +08:00
Cameron McCormack e1710ec7c9 Bug 1290209 - Part 7: Rename an argument. r=xidorn
MozReview-Commit-ID: DQ3gTkgnDR2
2017-01-06 15:05:24 +08:00
Thomas Nguyen 0aaea58b69 Bug 1304623 - Create a pref to control the default referrer policy - part 3. r=bkelly
MozReview-Commit-ID: 1A6IHPeNYBQ
2017-01-05 11:29:56 +08:00
Emilio Cobos Álvarez f5651bd75d Bug 1304792: Use borrowed types for ServoImportRule. r=Manishearth r=heycam
MozReview-Commit-ID: HKjsOaE2qAp
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2016-12-30 16:30:42 +01:00
Emilio Cobos Álvarez a25a3083ce Bug 1304792: stylo: Implement @import. r=heycam
MozReview-Commit-ID: Hw1V66JxIBD
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2016-12-30 16:30:41 +01:00
Xidorn Quan 2f49a48a09 Bug 1304302 part 10 - Replace all uses of StyleSheetHandle. r=heycam
This commit is generated by the following commands with some minor
manual adjustment:

find . \( -name '*.h' -or -name '*.cpp' \) -not -path './layout/style/StyleSheet*' -exec sed -i -b \
  -e '/^\(#include\|using\)/s/StyleSheetHandle/StyleSheet/g' \
  -e 's/\(mozilla::\)\?StyleSheetHandle::RefPtr/RefPtr<\1StyleSheet>/g' \
  -e 's/StyleSheetHandle()/nullptr/g' \
  -e 's/->AsStyleSheet()//g' \
  -e 's/StyleSheetHandle/StyleSheet*/g' {} +
sed -i -b 's/sheet->AsVoidPtr()/sheet.get()/' layout/style/Loader.cpp
sed -i -b 's/AsHandle()/this/' layout/style/StyleSheet.cpp

MozReview-Commit-ID: 7abdvlKHukd

--HG--
extra : source : e5682242db07203b5a91810fe1e243c955310588
2016-09-26 22:03:25 +10:00
Xidorn Quan 1dc2955ab8 Bug 1304302 part 8 - Change include of {CSS,Servo}StyleSheet.h to StyleSheetInlines.h. r=heycam
It is a preparation for later patch which moves functions from those
classes into StyleSheet. Some of the functions are better defined in
StyleSheetInlines.h.

This commit is generated by the following command:

find . \( -name '*.h' -or -name '*.cpp' \) -not -name '*StyleSheet*' -exec sed -i -b \
  -e '/^#include/ s_/\(CSS\|Servo\)StyleSheet\.h_/StyleSheetInlines.h_' \
  -e '1,\_^#include "mozilla/StyleSheetInlines.h"_ ! { \_^#include "mozilla/StyleSheetInlines.h"_d }' {} +

MozReview-Commit-ID: 54H5x27Pmso

--HG--
extra : source : e4fe253a8f82c3c58e5191d6af66fb0e85f2df19
2016-09-26 22:03:25 +10:00