mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1029867: Remove useless nsCSSParser::mHTMLMediaMode. r=heycam
MozReview-Commit-ID: AFtd0G4oP3R
This commit is contained in:
parent
ab0ead8b92
commit
d791eef979
@ -242,7 +242,7 @@ ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString & aSizes)
|
||||
nsCSSParser cssParser;
|
||||
|
||||
return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
|
||||
mSizeQueries, mSizeValues, true);
|
||||
mSizeQueries, mSizeValues);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -77,7 +77,7 @@ HTMLSourceElement::WouldMatchMediaForDocument(const nsAString& aMedia,
|
||||
|
||||
nsCSSParser cssParser;
|
||||
RefPtr<nsMediaList> mediaList = new nsMediaList();
|
||||
cssParser.ParseMediaList(aMedia, nullptr, 0, mediaList, false);
|
||||
cssParser.ParseMediaList(aMedia, nullptr, 0, mediaList);
|
||||
|
||||
return pctx && mediaList->Matches(pctx, nullptr);
|
||||
}
|
||||
@ -93,7 +93,7 @@ HTMLSourceElement::UpdateMediaList(const nsAttrValue* aValue)
|
||||
|
||||
nsCSSParser cssParser;
|
||||
mMediaList = new nsMediaList();
|
||||
cssParser.ParseMediaList(mediaStr, nullptr, 0, mMediaList, false);
|
||||
cssParser.ParseMediaList(mediaStr, nullptr, 0, mMediaList);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -646,10 +646,7 @@ void
|
||||
nsMediaList::SetText(const nsAString& aMediaText)
|
||||
{
|
||||
nsCSSParser parser;
|
||||
|
||||
bool htmlMode = mStyleSheet && mStyleSheet->GetOwnerNode();
|
||||
|
||||
parser.ParseMediaList(aMediaText, nullptr, 0, this, htmlMode);
|
||||
parser.ParseMediaList(aMediaText, nullptr, 0, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1300,7 +1300,7 @@ Loader::PrepareSheet(StyleSheet* aSheet,
|
||||
|
||||
// We have aMediaString only when linked from link elements, style
|
||||
// elements, or PIs, so pass true.
|
||||
mediumParser.ParseMediaList(aMediaString, nullptr, 0, mediaList, true);
|
||||
mediumParser.ParseMediaList(aMediaString, nullptr, 0, mediaList);
|
||||
}
|
||||
|
||||
sheet->SetMedia(mediaList);
|
||||
|
@ -24,7 +24,7 @@ MediaQueryList::MediaQueryList(nsIDocument *aDocument,
|
||||
PR_INIT_CLIST(this);
|
||||
|
||||
nsCSSParser parser;
|
||||
parser.ParseMediaList(aMediaQueryList, nullptr, 0, mMediaList, false);
|
||||
parser.ParseMediaList(aMediaQueryList, nullptr, 0, mMediaList);
|
||||
}
|
||||
|
||||
MediaQueryList::~MediaQueryList()
|
||||
|
@ -202,15 +202,13 @@ public:
|
||||
void ParseMediaList(const nsSubstring& aBuffer,
|
||||
nsIURI* aURL, // for error reporting
|
||||
uint32_t aLineNumber, // for error reporting
|
||||
nsMediaList* aMediaList,
|
||||
bool aHTMLMode);
|
||||
nsMediaList* aMediaList);
|
||||
|
||||
bool ParseSourceSizeList(const nsAString& aBuffer,
|
||||
nsIURI* aURI, // for error reporting
|
||||
uint32_t aLineNumber, // for error reporting
|
||||
InfallibleTArray< nsAutoPtr<nsMediaQuery> >& aQueries,
|
||||
InfallibleTArray<nsCSSValue>& aValues,
|
||||
bool aHTMLMode);
|
||||
InfallibleTArray<nsCSSValue>& aValues);
|
||||
|
||||
void ParseVariable(const nsAString& aVariableName,
|
||||
const nsAString& aPropValue,
|
||||
@ -1488,10 +1486,6 @@ protected:
|
||||
// True if viewport units should be allowed.
|
||||
bool mViewportUnitsEnabled : 1;
|
||||
|
||||
// True for parsing media lists for HTML attributes, where we have to
|
||||
// ignore CSS comments.
|
||||
bool mHTMLMediaMode : 1;
|
||||
|
||||
// This flag is set when parsing a non-box shorthand; it's used to not apply
|
||||
// some quirks during shorthand parsing
|
||||
bool mParsingCompoundProperty : 1;
|
||||
@ -1613,7 +1607,6 @@ CSSParserImpl::CSSParserImpl()
|
||||
mParsingMode(css::eAuthorSheetFeatures),
|
||||
mIsChrome(false),
|
||||
mViewportUnitsEnabled(true),
|
||||
mHTMLMediaMode(false),
|
||||
mParsingCompoundProperty(false),
|
||||
mInSupportsCondition(false),
|
||||
mInFailingSupportsRule(false),
|
||||
@ -1687,7 +1680,6 @@ CSSParserImpl::InitScanner(nsCSSScanner& aScanner,
|
||||
nsIURI* aSheetURI, nsIURI* aBaseURI,
|
||||
nsIPrincipal* aSheetPrincipal)
|
||||
{
|
||||
NS_PRECONDITION(!mHTMLMediaMode, "Bad initial state");
|
||||
NS_PRECONDITION(!mParsingCompoundProperty, "Bad initial state");
|
||||
NS_PRECONDITION(!mScanner, "already have scanner");
|
||||
|
||||
@ -2132,8 +2124,7 @@ void
|
||||
CSSParserImpl::ParseMediaList(const nsSubstring& aBuffer,
|
||||
nsIURI* aURI, // for error reporting
|
||||
uint32_t aLineNumber, // for error reporting
|
||||
nsMediaList* aMediaList,
|
||||
bool aHTMLMode)
|
||||
nsMediaList* aMediaList)
|
||||
{
|
||||
// XXX Are there cases where the caller wants to keep what it already
|
||||
// has in case of parser error? If GatherMedia ever changes to return
|
||||
@ -2145,27 +2136,12 @@ CSSParserImpl::ParseMediaList(const nsSubstring& aBuffer,
|
||||
css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aURI);
|
||||
InitScanner(scanner, reporter, aURI, aURI, nullptr);
|
||||
|
||||
mHTMLMediaMode = aHTMLMode;
|
||||
|
||||
// XXXldb We need to make the scanner not skip CSS comments! (Or
|
||||
// should we?)
|
||||
|
||||
// For aHTMLMode, we used to follow the parsing rules in
|
||||
// http://www.w3.org/TR/1999/REC-html401-19991224/types.html#type-media-descriptors
|
||||
// which wouldn't work for media queries since they remove all but the
|
||||
// first word. However, they're changed in
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/section-document.html#media2
|
||||
// (as of 2008-05-29) which says that the media attribute just points
|
||||
// to a media query. (The main substative difference is the relative
|
||||
// precedence of commas and paretheses.)
|
||||
|
||||
DebugOnly<bool> parsedOK = GatherMedia(aMediaList, false);
|
||||
NS_ASSERTION(parsedOK, "GatherMedia returned false; we probably want to avoid "
|
||||
"trashing aMediaList");
|
||||
|
||||
CLEAR_ERROR();
|
||||
ReleaseScanner();
|
||||
mHTMLMediaMode = false;
|
||||
}
|
||||
|
||||
// <source-size-list> = <source-size>#?
|
||||
@ -2175,8 +2151,7 @@ CSSParserImpl::ParseSourceSizeList(const nsAString& aBuffer,
|
||||
nsIURI* aURI, // for error reporting
|
||||
uint32_t aLineNumber, // for error reporting
|
||||
InfallibleTArray< nsAutoPtr<nsMediaQuery> >& aQueries,
|
||||
InfallibleTArray<nsCSSValue>& aValues,
|
||||
bool aHTMLMode)
|
||||
InfallibleTArray<nsCSSValue>& aValues)
|
||||
{
|
||||
aQueries.Clear();
|
||||
aValues.Clear();
|
||||
@ -2186,9 +2161,6 @@ CSSParserImpl::ParseSourceSizeList(const nsAString& aBuffer,
|
||||
css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aURI);
|
||||
InitScanner(scanner, reporter, aURI, aURI, nullptr);
|
||||
|
||||
// See ParseMediaList comment about HTML mode
|
||||
mHTMLMediaMode = aHTMLMode;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-attribute
|
||||
bool hitEnd = false;
|
||||
do {
|
||||
@ -2257,7 +2229,6 @@ CSSParserImpl::ParseSourceSizeList(const nsAString& aBuffer,
|
||||
|
||||
CLEAR_ERROR();
|
||||
ReleaseScanner();
|
||||
mHTMLMediaMode = false;
|
||||
|
||||
return !aQueries.IsEmpty();
|
||||
}
|
||||
@ -18225,11 +18196,10 @@ void
|
||||
nsCSSParser::ParseMediaList(const nsSubstring& aBuffer,
|
||||
nsIURI* aURI,
|
||||
uint32_t aLineNumber,
|
||||
nsMediaList* aMediaList,
|
||||
bool aHTMLMode)
|
||||
nsMediaList* aMediaList)
|
||||
{
|
||||
static_cast<CSSParserImpl*>(mImpl)->
|
||||
ParseMediaList(aBuffer, aURI, aLineNumber, aMediaList, aHTMLMode);
|
||||
ParseMediaList(aBuffer, aURI, aLineNumber, aMediaList);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -18237,12 +18207,10 @@ nsCSSParser::ParseSourceSizeList(const nsAString& aBuffer,
|
||||
nsIURI* aURI,
|
||||
uint32_t aLineNumber,
|
||||
InfallibleTArray< nsAutoPtr<nsMediaQuery> >& aQueries,
|
||||
InfallibleTArray<nsCSSValue>& aValues,
|
||||
bool aHTMLMode)
|
||||
InfallibleTArray<nsCSSValue>& aValues)
|
||||
{
|
||||
return static_cast<CSSParserImpl*>(mImpl)->
|
||||
ParseSourceSizeList(aBuffer, aURI, aLineNumber, aQueries, aValues,
|
||||
aHTMLMode);
|
||||
ParseSourceSizeList(aBuffer, aURI, aLineNumber, aQueries, aValues);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -152,18 +152,14 @@ public:
|
||||
bool* aChanged,
|
||||
bool aIsImportant);
|
||||
/**
|
||||
* Parse aBuffer into a media list |aMediaList|, which must be
|
||||
* non-null, replacing its current contents. If aHTMLMode is true,
|
||||
* parse according to HTML rules, with commas as the most important
|
||||
* delimiter. Otherwise, parse according to CSS rules, with
|
||||
* parentheses and strings more important than commas. |aURL| and
|
||||
* |aLineNumber| are used for error reporting.
|
||||
* Parse aBuffer into a media list |aMediaList|, which must be non-null,
|
||||
* replacing its current contents. |aURL| and |aLineNumber| are used for error
|
||||
* reporting.
|
||||
*/
|
||||
void ParseMediaList(const nsSubstring& aBuffer,
|
||||
nsIURI* aURL,
|
||||
uint32_t aLineNumber,
|
||||
nsMediaList* aMediaList,
|
||||
bool aHTMLMode);
|
||||
nsMediaList* aMediaList);
|
||||
|
||||
/*
|
||||
* Parse aBuffer into a list of media queries and their associated values,
|
||||
@ -181,8 +177,7 @@ public:
|
||||
nsIURI* aURI, // for error reporting
|
||||
uint32_t aLineNumber, // for error reporting
|
||||
InfallibleTArray< nsAutoPtr<nsMediaQuery> >& aQueries,
|
||||
InfallibleTArray<nsCSSValue>& aValues,
|
||||
bool aHTMLMode);
|
||||
InfallibleTArray<nsCSSValue>& aValues);
|
||||
|
||||
/**
|
||||
* Parse aBuffer into a nsCSSValue |aValue|. Will return false
|
||||
|
Loading…
Reference in New Issue
Block a user