Bug 1290209 - Part 5: Change nsMediaList's style sheet pointer from a CSSStyleSheet to a StyleSheet. r?xidorn
MozReview-Commit-ID: LdtTfnNCewU
--- a/layout/style/nsMediaList.cpp
+++ b/layout/style/nsMediaList.cpp
@@ -6,18 +6,18 @@
/*
* representation of media lists used when linking to style sheets or by
* @media rules
*/
#include "nsMediaList.h"
#include "mozAutoDocUpdate.h"
-#include "mozilla/CSSStyleSheet.h"
#include "mozilla/dom/MediaListBinding.h"
+#include "mozilla/StyleSheet.h"
#include "nsCSSParser.h"
template <class Numeric>
int32_t DoCompare(Numeric a, Numeric b)
{
if (a == b)
return 0;
if (a < b)
@@ -551,17 +551,17 @@ nsMediaList::Matches(nsPresContext* aPre
if (mArray[i]->Matches(aPresContext, aKey)) {
return true;
}
}
return mArray.IsEmpty();
}
void
-nsMediaList::SetStyleSheet(CSSStyleSheet* aSheet)
+nsMediaList::SetStyleSheet(StyleSheet* aSheet)
{
NS_ASSERTION(aSheet == mStyleSheet || !aSheet || !mStyleSheet,
"multiple style sheets competing for one media list");
mStyleSheet = aSheet;
}
already_AddRefed<nsMediaList>
nsMediaList::Clone()
@@ -577,17 +577,17 @@ nsMediaList::Clone()
NS_IMETHODIMP
nsMediaList::GetMediaText(nsAString& aMediaText)
{
GetText(aMediaText);
return NS_OK;
}
-// "sheet" should be a CSSStyleSheet and "doc" should be an
+// "sheet" should be a StyleSheet and "doc" should be an
// nsCOMPtr<nsIDocument>
#define BEGIN_MEDIA_CHANGE(sheet, doc) \
if (sheet) { \
doc = sheet->GetOwningDocument(); \
} \
mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true); \
if (sheet) { \
sheet->WillDirty(); \
--- a/layout/style/nsMediaList.h
+++ b/layout/style/nsMediaList.h
@@ -21,17 +21,17 @@
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
class nsPresContext;
class nsAString;
struct nsMediaFeature;
namespace mozilla {
-class CSSStyleSheet;
+class StyleSheet;
namespace css {
class DocumentRule;
} // namespace css
} // namespace mozilla
struct nsMediaExpression {
enum Range { eMin, eMax, eEqual };
@@ -273,17 +273,17 @@ public:
void GetText(nsAString& aMediaText);
void SetText(const nsAString& aMediaText);
// Does this query apply to the presentation?
// If |aKey| is non-null, add cache information to it.
bool Matches(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey* aKey);
- void SetStyleSheet(mozilla::CSSStyleSheet* aSheet);
+ void SetStyleSheet(mozilla::StyleSheet* aSheet);
void AppendQuery(nsAutoPtr<nsMediaQuery>& aQuery) {
// Takes ownership of aQuery
mArray.AppendElement(aQuery.forget());
}
already_AddRefed<nsMediaList> Clone();
nsMediaQuery* MediumAt(int32_t aIndex) { return mArray[aIndex]; }
@@ -308,11 +308,11 @@ protected:
nsresult Delete(const nsAString & aOldMedium);
nsresult Append(const nsAString & aOldMedium);
InfallibleTArray<nsAutoPtr<nsMediaQuery> > mArray;
// not refcounted; sheet will let us know when it goes away
// mStyleSheet is the sheet that needs to be dirtied when this medialist
// changes
- mozilla::CSSStyleSheet* mStyleSheet;
+ mozilla::StyleSheet* mStyleSheet;
};
#endif /* !defined(nsMediaList_h_) */