Skip to content

Commit

Permalink
#659: tuneups and edgecases
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Apr 20, 2023
1 parent 2f7da4e commit 17b2369
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions layout/style/nsCSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,22 +1592,29 @@ CSSParserImpl::InitScanner(nsCSSScanner& aScanner,
mSheetPrincipal = aSheetPrincipal;
mHavePushBack = false;

// TenFourFox issue 659
mHostCSSGridOK = false;
if (MOZ_LIKELY(mBaseURI)) {
nsCString host;

nsresult rv = mBaseURI->GetHost(host);
if (NS_SUCCEEDED(rv)) {
nsCString pref;

pref.AssignLiteral("layout.css.grid.host.");
pref.SetCapacity(pref.Length() + host.Length());
pref += host;
mHostCSSGridOK = Preferences::GetBool(pref.get(), false);
bool isChrome;

// Never turn on grid for browser chrome.
nsresult rv = mBaseURI->SchemeIs("chrome", &isChrome);
if (NS_SUCCEEDED(rv) && !isChrome) {
// Get host and check pref.
rv = mBaseURI->GetHost(host);
if (NS_SUCCEEDED(rv) && !host.IsEmpty()) {
nsCString pref;

pref.AssignLiteral("layout.css.grid.host.");
pref.SetCapacity(pref.Length() + host.Length());
pref += host;
mHostCSSGridOK = Preferences::GetBool(pref.get(), false);
#if DEBUG
if (mHostCSSGridOK)
fprintf(stderr, "CSS grid enabled for %s\n", pref.get());
if (mHostCSSGridOK)
fprintf(stderr, "CSS grid enabled for %s\n", pref.get());
#endif
}
}
}
}
Expand Down

0 comments on commit 17b2369

Please sign in to comment.