diff options
Diffstat (limited to 'layout/style')
-rw-r--r-- | layout/style/nsCSSParser.cpp | 7 | ||||
-rw-r--r-- | layout/style/nsLayoutStylesheetCache.cpp | 293 | ||||
-rw-r--r-- | layout/style/nsMediaFeatures.cpp | 2 | ||||
-rw-r--r-- | layout/style/nsRuleNode.cpp | 3 | ||||
-rw-r--r-- | layout/style/test/chrome/bug418986-2.js | 2 | ||||
-rw-r--r-- | layout/style/test/property_database.js | 14 | ||||
-rw-r--r-- | layout/style/test/test_media_queries.html | 2 |
7 files changed, 18 insertions, 305 deletions
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 1108ce5b5..b361cf0c2 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -8918,6 +8918,10 @@ CSSParserImpl::ParseGridTrackSize(nsCSSValue& aValue, return CSSParseResult::NotFound; } if (mToken.mIdent.LowerCaseEqualsLiteral("fit-content")) { + if (requireFixedSize) { + UngetToken(); + return CSSParseResult::Error; + } nsCSSValue::Array* func = aValue.InitFunction(eCSSKeyword_fit_content, 1); if (ParseGridTrackBreadth(func->Item(1)) == CSSParseResult::Ok && func->Item(1).IsLengthPercentCalcUnit() && @@ -10400,7 +10404,8 @@ CSSParserImpl::ParseLinearGradient(nsCSSValue& aValue, UngetToken(); // <angle> , - if (ParseSingleTokenVariant(cssGradient->mAngle, VARIANT_ANGLE, nullptr) && + if (ParseSingleTokenVariant(cssGradient->mAngle, + VARIANT_ANGLE_OR_ZERO, nullptr) && !ExpectSymbol(',', true)) { SkipUntil(')'); return false; diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index f8aea5541..e8c6d09d7 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -23,19 +23,6 @@ #include "nsPrintfCString.h" #include "nsXULAppAPI.h" -// Includes for the crash report annotation in ErrorLoadingSheet. -#ifdef MOZ_CRASHREPORTER -#include "mozilla/Omnijar.h" -#include "nsDirectoryService.h" -#include "nsDirectoryServiceDefs.h" -#include "nsExceptionHandler.h" -#include "nsIChromeRegistry.h" -#include "nsISimpleEnumerator.h" -#include "nsISubstitutingProtocolHandler.h" -#include "zlib.h" -#include "nsZipArchive.h" -#endif - using namespace mozilla; using namespace mozilla::css; @@ -463,280 +450,6 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, LoadSheet(uri, aSheet, aParsingMode, aFailureAction); } -#ifdef MOZ_CRASHREPORTER -static inline nsresult -ComputeCRC32(nsIFile* aFile, uint32_t* aResult) -{ - PRFileDesc* fd; - nsresult rv = aFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd); - NS_ENSURE_SUCCESS(rv, rv); - - uint32_t crc = crc32(0, nullptr, 0); - - unsigned char buf[512]; - int32_t n; - while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) { - crc = crc32(crc, buf, n); - } - PR_Close(fd); - - if (n < 0) { - return NS_ERROR_FAILURE; - } - - *aResult = crc; - return NS_OK; -} - -static void -ListInterestingFiles(nsString& aAnnotation, nsIFile* aFile, - const nsTArray<nsString>& aInterestingFilenames) -{ - nsString filename; - aFile->GetLeafName(filename); - for (const nsString& interestingFilename : aInterestingFilenames) { - if (interestingFilename == filename) { - nsString path; - aFile->GetPath(path); - aAnnotation.AppendLiteral(" "); - aAnnotation.Append(path); - aAnnotation.AppendLiteral(" ("); - int64_t size; - if (NS_SUCCEEDED(aFile->GetFileSize(&size))) { - aAnnotation.AppendPrintf("%ld", size); - } else { - aAnnotation.AppendLiteral("???"); - } - aAnnotation.AppendLiteral(" bytes, crc32 = "); - uint32_t crc; - nsresult rv = ComputeCRC32(aFile, &crc); - if (NS_SUCCEEDED(rv)) { - aAnnotation.AppendPrintf("0x%08x)\n", crc); - } else { - aAnnotation.AppendPrintf("error 0x%08x)\n", uint32_t(rv)); - } - return; - } - } - - bool isDir = false; - aFile->IsDirectory(&isDir); - - if (!isDir) { - return; - } - - nsCOMPtr<nsISimpleEnumerator> entries; - if (NS_FAILED(aFile->GetDirectoryEntries(getter_AddRefs(entries)))) { - aAnnotation.AppendLiteral(" (failed to enumerated directory)\n"); - return; - } - - for (;;) { - bool hasMore = false; - if (NS_FAILED(entries->HasMoreElements(&hasMore))) { - aAnnotation.AppendLiteral(" (failed during directory enumeration)\n"); - return; - } - if (!hasMore) { - break; - } - - nsCOMPtr<nsISupports> entry; - if (NS_FAILED(entries->GetNext(getter_AddRefs(entry)))) { - aAnnotation.AppendLiteral(" (failed during directory enumeration)\n"); - return; - } - - nsCOMPtr<nsIFile> file = do_QueryInterface(entry); - if (file) { - ListInterestingFiles(aAnnotation, file, aInterestingFilenames); - } - } -} - -// Generate a crash report annotation to help debug issues with style -// sheets failing to load (bug 1194856). -static void -AnnotateCrashReport(nsIURI* aURI) -{ - nsAutoCString spec; - nsAutoCString scheme; - nsDependentCSubstring filename; - if (aURI) { - spec = aURI->GetSpecOrDefault(); - aURI->GetScheme(scheme); - int32_t i = spec.RFindChar('/'); - if (i != -1) { - filename.Rebind(spec, i + 1); - } - } - - nsString annotation; - - // The URL of the sheet that failed to load. - annotation.AppendLiteral("Error loading sheet: "); - annotation.Append(NS_ConvertUTF8toUTF16(spec).get()); - annotation.Append('\n'); - - annotation.AppendLiteral("NS_ERROR_FILE_CORRUPTION reason: "); - if (nsZipArchive::sFileCorruptedReason) { - annotation.Append(NS_ConvertUTF8toUTF16(nsZipArchive::sFileCorruptedReason).get()); - annotation.Append('\n'); - } else { - annotation.AppendLiteral("(none)\n"); - } - - // The jar: or file: URL that the sheet's resource: or chrome: URL - // resolves to. - if (scheme.EqualsLiteral("resource")) { - annotation.AppendLiteral("Real location: "); - nsCOMPtr<nsISubstitutingProtocolHandler> handler; - nsCOMPtr<nsIIOService> io(do_GetIOService()); - if (io) { - nsCOMPtr<nsIProtocolHandler> ph; - io->GetProtocolHandler(scheme.get(), getter_AddRefs(ph)); - if (ph) { - handler = do_QueryInterface(ph); - } - } - if (!handler) { - annotation.AppendLiteral("(ResolveURI failed)\n"); - } else { - nsAutoCString resolvedSpec; - handler->ResolveURI(aURI, resolvedSpec); - annotation.Append(NS_ConvertUTF8toUTF16(resolvedSpec)); - annotation.Append('\n'); - } - } else if (scheme.EqualsLiteral("chrome")) { - annotation.AppendLiteral("Real location: "); - nsCOMPtr<nsIChromeRegistry> reg = - mozilla::services::GetChromeRegistryService(); - if (!reg) { - annotation.AppendLiteral("(no chrome registry)\n"); - } else { - nsCOMPtr<nsIURI> resolvedURI; - reg->ConvertChromeURL(aURI, getter_AddRefs(resolvedURI)); - if (!resolvedURI) { - annotation.AppendLiteral("(ConvertChromeURL failed)\n"); - } else { - annotation.Append( - NS_ConvertUTF8toUTF16(resolvedURI->GetSpecOrDefault())); - annotation.Append('\n'); - } - } - } - - nsTArray<nsString> interestingFiles; - interestingFiles.AppendElement(NS_LITERAL_STRING("chrome.manifest")); - interestingFiles.AppendElement(NS_LITERAL_STRING("omni.ja")); - interestingFiles.AppendElement(NS_ConvertUTF8toUTF16(filename)); - - annotation.AppendLiteral("GRE directory: "); - nsCOMPtr<nsIFile> file; - nsDirectoryService::gService->Get(NS_GRE_DIR, NS_GET_IID(nsIFile), - getter_AddRefs(file)); - if (file) { - // The Firefox installation directory. - nsString path; - file->GetPath(path); - annotation.Append(path); - annotation.Append('\n'); - - // List interesting files -- any chrome.manifest or omni.ja file or any file - // whose name is the sheet's filename -- under the Firefox installation - // directory. - annotation.AppendLiteral("Interesting files in the GRE directory:\n"); - ListInterestingFiles(annotation, file, interestingFiles); - - // If the Firefox installation directory has a chrome.manifest file, let's - // see what's in it. - file->Append(NS_LITERAL_STRING("chrome.manifest")); - bool exists = false; - file->Exists(&exists); - if (exists) { - annotation.AppendLiteral("Contents of chrome.manifest:\n[[[\n"); - PRFileDesc* fd; - if (NS_SUCCEEDED(file->OpenNSPRFileDesc(PR_RDONLY, 0, &fd))) { - nsCString contents; - char buf[512]; - int32_t n; - while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) { - contents.Append(buf, n); - } - if (n < 0) { - annotation.AppendLiteral(" (error while reading)\n"); - } else { - annotation.Append(NS_ConvertUTF8toUTF16(contents)); - } - PR_Close(fd); - } - annotation.AppendLiteral("]]]\n"); - } - } else { - annotation.AppendLiteral("(none)\n"); - } - - // The jar: or file: URL prefix that chrome: and resource: URLs get translated - // to. - annotation.AppendLiteral("GRE omnijar URI string: "); - nsCString uri; - nsresult rv = Omnijar::GetURIString(Omnijar::GRE, uri); - if (NS_FAILED(rv)) { - annotation.AppendLiteral("(failed)\n"); - } else { - annotation.Append(NS_ConvertUTF8toUTF16(uri)); - annotation.Append('\n'); - } - - RefPtr<nsZipArchive> zip = Omnijar::GetReader(Omnijar::GRE); - if (zip) { - // List interesting files in the GRE omnijar. - annotation.AppendLiteral("Interesting files in the GRE omnijar:\n"); - nsZipFind* find; - rv = zip->FindInit(nullptr, &find); - if (NS_FAILED(rv)) { - annotation.AppendPrintf(" (FindInit failed with 0x%08x)\n", rv); - } else if (!find) { - annotation.AppendLiteral(" (FindInit returned null)\n"); - } else { - const char* result; - uint16_t len; - while (NS_SUCCEEDED(find->FindNext(&result, &len))) { - nsCString itemPathname; - nsString itemFilename; - itemPathname.Append(result, len); - int32_t i = itemPathname.RFindChar('/'); - if (i != -1) { - itemFilename = NS_ConvertUTF8toUTF16(Substring(itemPathname, i + 1)); - } - for (const nsString& interestingFile : interestingFiles) { - if (interestingFile == itemFilename) { - annotation.AppendLiteral(" "); - annotation.Append(NS_ConvertUTF8toUTF16(itemPathname)); - nsZipItem* item = zip->GetItem(itemPathname.get()); - if (!item) { - annotation.AppendLiteral(" (GetItem failed)\n"); - } else { - annotation.AppendPrintf(" (%d bytes, crc32 = 0x%08x)\n", - item->RealSize(), - item->CRC32()); - } - break; - } - } - } - delete find; - } - } else { - annotation.AppendLiteral("No GRE omnijar\n"); - } - - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SheetLoadFailure"), - NS_ConvertUTF16toUTF8(annotation)); -} -#endif - static void ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction) { @@ -751,9 +464,6 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction) } } -#ifdef MOZ_CRASHREPORTER - AnnotateCrashReport(aURI); -#endif NS_RUNTIMEABORT(errorMessage.get()); } @@ -780,9 +490,6 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, } } -#ifdef MOZ_CRASHREPORTER - nsZipArchive::sFileCorruptedReason = nullptr; -#endif nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet); if (NS_FAILED(rv)) { ErrorLoadingSheet(aURI, diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 052ce58e8..5a54d5455 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -70,8 +70,6 @@ struct OperatingSystemVersionInfo { // Os version identities used in the -moz-os-version media query. const OperatingSystemVersionInfo osVersionStrings[] = { - { LookAndFeel::eOperatingSystemVersion_WindowsXP, L"windows-xp" }, - { LookAndFeel::eOperatingSystemVersion_WindowsVista, L"windows-vista" }, { LookAndFeel::eOperatingSystemVersion_Windows7, L"windows-win7" }, { LookAndFeel::eOperatingSystemVersion_Windows8, L"windows-win8" }, { LookAndFeel::eOperatingSystemVersion_Windows10, L"windows-win10" } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index b22002d87..fa29fe0f1 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -4686,7 +4686,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct, if (font->mSize != 0) { lh = nscoord(float(lh) * float(font->mFont.size) / float(font->mSize)); } else { - lh = minimumFontSize; + // Never shrink line heights as a result of minFontSize + lh = std::max(lh, minimumFontSize); } } text->mLineHeight.SetCoordValue(lh); diff --git a/layout/style/test/chrome/bug418986-2.js b/layout/style/test/chrome/bug418986-2.js index 4336f4abd..b083f48ee 100644 --- a/layout/style/test/chrome/bug418986-2.js +++ b/layout/style/test/chrome/bug418986-2.js @@ -53,8 +53,6 @@ var suppressed_toggles = [ // Possible values for '-moz-os-version' var windows_versions = [ - "windows-xp", - "windows-vista", "windows-win7", "windows-win8", "windows-win10", diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 9c69e7d10..62d413d98 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -132,6 +132,9 @@ var validGradientAndElementValues = [ "linear-gradient(to right bottom, red, 50%, green 50%, 50%, blue)", "linear-gradient(to right bottom, red, 0%, green 50%, 100%, blue)", + /* Unitless 0 is valid as an <angle> */ + "linear-gradient(0, red, blue)", + "-moz-linear-gradient(red, blue)", "-moz-linear-gradient(red, yellow, blue)", "-moz-linear-gradient(red 1px, yellow 20%, blue 24em, green)", @@ -388,10 +391,8 @@ var invalidGradientAndElementValues = [ "-moz-linear-gradient(10 10px -45deg, red, blue) repeat", "-moz-linear-gradient(10px 10 -45deg, red, blue) repeat", "linear-gradient(red -99, yellow, green, blue 120%)", - /* Unitless 0 is invalid as an <angle> */ - "-moz-linear-gradient(top left 0, red, blue)", - "-moz-linear-gradient(5px 5px 0, red, blue)", - "linear-gradient(0, red, blue)", + /* Unitless nonzero numbers are valid as an <angle> */ + "linear-gradient(30, red, blue)", /* Invalid color, calc() or -moz-image-rect() function */ "linear-gradient(red, rgb(0, rubbish, 0) 50%, red)", "linear-gradient(red, red calc(50% + rubbish), red)", @@ -6270,6 +6271,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.grid.enabled")) { "repeat(auto-fill,minmax(1%,auto))", "repeat(auto-fill,minmax(1em,min-content)) minmax(min-content,0)", "repeat(auto-fill,minmax(max-content,1mm))", + "repeat(2, fit-content(1px))", "fit-content(1px) 1fr", "[a] fit-content(calc(1px - 99%)) [b]", "[a] fit-content(10%) [b c] fit-content(1em)", @@ -6314,6 +6316,8 @@ if (IsCSSPropertyPrefEnabled("layout.css.grid.enabled")) { "repeat(1, repeat(1, 20px))", "repeat(auto-fill, auto)", "repeat(auto-fit,auto)", + "repeat(auto-fill, fit-content(1px))", + "repeat(auto-fit, fit-content(1px))", "repeat(auto-fit,[])", "repeat(auto-fill, 0) repeat(auto-fit, 0) ", "repeat(auto-fit, 0) repeat(auto-fill, 0) ", @@ -6335,6 +6339,8 @@ if (IsCSSPropertyPrefEnabled("layout.css.grid.enabled")) { "fit-content(-1px)", "fit-content(auto)", "fit-content(min-content)", + "fit-content(1px) repeat(auto-fit, 1px)", + "fit-content(1px) repeat(auto-fill, 1px)", ], unbalanced_values: [ "(foo] 40px", diff --git a/layout/style/test/test_media_queries.html b/layout/style/test/test_media_queries.html index 479306a55..d503fad0b 100644 --- a/layout/style/test/test_media_queries.html +++ b/layout/style/test/test_media_queries.html @@ -713,8 +713,6 @@ function run() { expression_should_not_be_parseable("-moz-windows-theme: "); // os version media queries (currently windows only) - expression_should_be_parseable("-moz-os-version: windows-xp"); - expression_should_be_parseable("-moz-os-version: windows-vista"); expression_should_be_parseable("-moz-os-version: windows-win7"); expression_should_be_parseable("-moz-os-version: windows-win8"); expression_should_be_parseable("-moz-os-version: windows-win10"); |