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
This commit is contained in:
KuoE0 2017-05-15 15:55:08 +08:00
Родитель 3399c6ee09
Коммит 1ef85c4cf5
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -498,7 +498,7 @@ SheetLoadData::ScheduleLoadEventIfNeeded(nsresult aStatus)
bool
LoaderReusableStyleSheets::FindReusableStyleSheet(nsIURI* aURL,
RefPtr<CSSStyleSheet>& aResult)
RefPtr<StyleSheet>& aResult)
{
MOZ_ASSERT(aURL);
for (size_t i = mReusableSheets.Length(); i > 0; --i) {
@ -2270,11 +2270,11 @@ Loader::LoadChildSheet(StyleSheet* aParentSheet,
// Now that we know it's safe to load this (passes security check and not a
// loop) do so.
RefPtr<StyleSheet> sheet;
RefPtr<CSSStyleSheet> reusableSheet;
StyleSheetState state;
if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, reusableSheet)) {
sheet = reusableSheet;
aGeckoParentRule->SetSheet(reusableSheet);
if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, sheet)) {
if (aParentSheet->IsGecko()) {
aGeckoParentRule->SetSheet(sheet->AsGecko());
}
state = eSheetComplete;
} else {
bool isAlternate;

Просмотреть файл

@ -155,7 +155,7 @@ public:
* @param aURL the url to match
* @param aResult [out] the style sheet which can be reused
*/
bool FindReusableStyleSheet(nsIURI* aURL, RefPtr<CSSStyleSheet>& aResult);
bool FindReusableStyleSheet(nsIURI* aURL, RefPtr<StyleSheet>& aResult);
/**
* Indicate that a certain style sheet is available for reuse if its
@ -164,7 +164,7 @@ public:
*
* @param aSheet the sheet which can be reused
*/
void AddReusableSheet(CSSStyleSheet* aSheet) {
void AddReusableSheet(StyleSheet* aSheet) {
mReusableSheets.AppendElement(aSheet);
}
@ -173,7 +173,7 @@ private:
LoaderReusableStyleSheets& operator=(const LoaderReusableStyleSheets&) = delete;
// The sheets that can be reused.
nsTArray<RefPtr<CSSStyleSheet>> mReusableSheets;
nsTArray<RefPtr<StyleSheet>> mReusableSheets;
};
/***********************************************************************